import{_}from"./BmQjTMGt.js";import{l as x,L as w,U as l,h as u,X as B,C as E,E as K,f as o,K as L,I as M}from"./BJxAvODp.js";import{u as P}from"./DzkfItoY.js";function U(){var f;return((f=x().public.core.streaming)==null?void 0:f.matchOffset)||45}const z=w({__name:"index",props:{asset:{},relationships:{},buttonSmall:{},startAt:{},finishAt:{},offset:{}},emits:["triggered"],setup(b,{emit:f}){var g,y,S,I,v;const{openPlayerModal:D}=P(),m=x(),r=m.public.club.features.streamline===!0,d=l.now(),k=u(()=>B(r?"StreamlineButton":"StreamAmgButton")),A=u(()=>{var a;const t="/videos/subscriptions",s=((a=m.public.video)==null?void 0:a.upgradeSlug)||t;return r?s:t}),e=b,c=((y=(g=m.public)==null?void 0:g.club.theme)==null?void 0:y[(e==null?void 0:e.theme)||"club"])||((v=(I=(S=m.public)==null?void 0:S.club)==null?void 0:I.theme)==null?void 0:v.club),O={backgroundColor:c.backgroundColor.color,backgroundShade:c.backgroundColor.shade,fontColor:c.color.color,fontShade:c.color.shade},j=u(()=>r?!(C(e.asset.assetID)!=="active"||!h.value):h.value),C=t=>{var s,a,n;if(r&&"relationships"in e){let i=(a=(s=e.relationships)==null?void 0:s.streamline)==null?void 0:a.find(p=>p.id===t);return i=i||((n=e.relationships.filter(p=>p.type==="streamline"&&p.id===t))==null?void 0:n[0]),i?i.attributes.assetData.status:void 0}},h=u(()=>{let t,s;return r?(s=l.fromISO(e.startAt).minus({minutes:U()}),t=l.fromISO(e.finishAt)):r||(s=l.fromISO(e.asset.offset||e.offset||e.startAt),t=l.fromISO(e.asset.finishAt||e.finishAt)),d>s&&d<t}),T=u(()=>{var t,s,a,n,i;return r&&"relationships"in e?(i=(n=(a=(s=(t=e.relationships)==null?void 0:t.streamline)==null?void 0:s[0])==null?void 0:a.attributes)==null?void 0:n.accessData)==null?void 0:i.entitlements:!r&&"streamamgData"in e?e.asset.streamamgData.assetData[0].authType:void 0});return(t,s)=>t.asset.assetID?(E(),K(o(k),{key:0,class:L(["flex items-center gap-4 px-4 pt-3 pb-2 text-gray-600 rounded-lg w-[225px] group shadow-sm bg-primary-500 border-2 border-primary-500",[("useStyleObject"in t?t.useStyleObject:o(_))(O),{"min-h-[20px] text-center justify-center":t.buttonSmall,"min-h-[75px] justify-start":!t.buttonSmall}]]),type:"primary-light",icon:"icon",mode:"dark","buy-link":o(A),url:`/live/${t.asset.assetID}`,"asset-id":t.asset.assetID,media:t.asset.mediaType,"is-live":o(j),"auth-type":o(T),"button-small":t.buttonSmall,onTriggered:s[0]||(s[0]=a=>o(D)({entryID:t.asset.assetID,currentTitle:""}))},null,8,["class","buy-link","url","asset-id","media","is-live","auth-type","button-small"])):M("",!0)}});export{z as _,U as g};