1import{a_ as S,b4 as p,bg as f,bP as W,be as k,aS as b,aT as n,bq as w,bb as x,b0 as t,bn as u,bl as m,b8 as B,aU as P,aW as E,bU as L,aX as M,bt as Y,bk as j,bL as N}from"./CR1X-UN3.js";import{_ as O}from"./B69ZD-5-.js";import{_ as F}from"./B57whtrx.js";import{_ as q}from"./DlT597Kf.js";import{u as D}from"./DjMmrhrd.js";import"./DlAUqK2U.js";import"./B4b-r04n.js";import"./CNs8aQjE.js";import"./TRIIVA1T.js";const H={class:"flex size-12 items-center justify-center rounded-full bg-(--ui-container-secondary) text-(--color-purple-grey-800)"},Q=564,X=317,G=S({__name:"MarketingVideoPlayer",props:{videoUrl:{},posterUrl:{},posterAlt:{},mode:{default:"inline"},loading:{type:Boolean,default:!1}},setup(o){const v=`${Q} / ${X}`,l=o,c=p(!1),a=p(!1),s=p(null),{source:y,onError:A}=D(()=>l.posterUrl?{src:l.posterUrl}:null),_=f(()=>y.value?W(y.value.src):"");function C(e){try{const{pathname:r}=new URL(e);return r.endsWith(".mp4")||r.endsWith(".m3u8")}catch{return e.endsWith(".mp4")||e.endsWith(".m3u8")}}function I(e){return e.match(/(?:youtube(?:-nocookie)?\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/)|youtu\.be\/)([\w-]{11})/)?.[1]??null}const i=f(()=>{const e=l.videoUrl?I(l.videoUrl):null;return e?`https://www.youtube.com/embed/${e}?autoplay=1&rel=0`:null});async function R(){if(l.videoUrl&&(l.mode==="modal"?a.value=!0:c.value=!0,!i.value)){if(C(l.videoUrl)){s.value=l.videoUrl;return}try{const e=await $fetch(`${l.videoUrl}?url_only=1`);e?.result?s.value=e.result:(c.value=!1,a.value=!1)}catch(e){console.error("[MarketingVideoPlayer] failed to load video",e),c.value=!1,a.value=!1}}}k(()=>l.videoUrl,()=>{c.value=!1,a.value=!1,s.value=null}),k(a,e=>{e||(s.value=null)});const d=f(()=>l.mode==="inline"&&c.value);return(e,r)=>{const V=N,$=L,g=O,h=F,T=Y,z=q;return n(),b("div",{class:x(["group relative w-full overflow-hidden rounded-xl border border-(--color-deep-purple-400) shadow",{"cursor-pointer":o.videoUrl&&!t(d)&&!o.loading}]),style:w(!t(d)||t(i)?{aspectRatio:v}:void 0)},[t(d)?t(i)?(n(),u(g,{key:1,src:t(i),title:o.posterAlt},null,8,["src","title"])):(n(),u(h,{key:2,"streaming-url":t(s),poster:o.posterUrl,autoplay:""},null,8,["streaming-url","poster"])):(n(),b(B,{key:0},[t(_)?(n(),u(V,{key:0,src:t(_),alt:o.posterAlt??"",class:x(["absolute inset-0 size-full object-cover",o.loading?"blur-xl":"transition-transform duration-(--duration-base) ease-out group-hover:scale-105"]),onError:t(A)},null,8,["src","alt","class","onError"])):m("",!0),o.videoUrl&&!o.loading?(n(),b("button",{key:1,type:"button","aria-label":"Play video",class:"absolute inset-0 flex cursor-pointer items-center justify-center",onClick:R},[P("span",H,[E($,{name:"material-symbols:play-arrow",class:"size-6"})])])):m("",!0)],64)),o.mode==="modal"?(n(),u(z,{key:3,open:t(a),"onUpdate:open":r[1]||(r[1]=U=>j(a)?a.value=U:null),ui:{content:"sm:max-w-3xl bg-transparent ring-0 shadow-none"}},{content:M(()=>[P("div",{class:"relative w-full overflow-hidden rounded-lg bg-black shadow-2xl",style:w({aspectRatio:v})},[t(i)?(n(),u(g,{key:0,src:t(i),title:o.posterAlt},null,8,["src","title"])):t(s)?(n(),u(h,{key:1,"streaming-url":t(s),autoplay:""},null,8,["streaming-url"])):m("",!0),E(T,{name:"material-symbols:close",class:"size-6 absolute top-4 right-4 cursor-pointer text-(--ui-primary)",onClick:r[0]||(r[0]=U=>a.value=!1)})],4)]),_:1},8,["open"])):m("",!0)],6)}}}),re=Object.assign(G,{__name:"MarketingVideoPlayer"});export{re as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.