import{_ as r}from"./index.44599e36.js";import{_ as d,aE as a,o as c,s as u,n as t,N as n,m as h,Q as p,R as _,l as f}from"./entry.4a1e3e7a.js";import{l as w}from"./loadExternalScript.60adedb2.js";const m={mixins:[w],props:{wistiaId:{type:String,default:void 0},popover:{type:Boolean,default:!1},noAspectRatio:{type:Boolean,default:!1},width:{type:String,default:"large",validator:e=>["small","large"].includes(e)}},data:function(){return{video:null,isPlaying:!1,isLoading:!1,isBuilt:!1,observer:null,embedInitConfig:null}},mounted(){var e,s;((s=(e=this.$route)==null?void 0:e.query)==null?void 0:s.wvideo)===void 0&&"IntersectionObserver"in window?(this.observer=new IntersectionObserver(this.handleIntersection,{root:null,rootMargin:"120px",threshold:.5}),this.observer.observe(this.$refs.wistia_embed)):this.buildPlayer()},beforeUnmount(){this.observer&&this.observer.disconnect(),window._wq&&window._wq.push({revoke:this.embedInitConfig})},methods:{async handleIntersection(e){e[0].isIntersecting&&!this.isBuilt&&await this.buildPlayer()},buildPlayer(){return new Promise((e,s)=>{this.loadExternalScript("https://fast.wistia.com/assets/external/E-v1.js",{defer:!0}),this.$refs.wistia_embed.classList.add(`wistia_async_${this.wistiaId}`),this.isLoading=!0,this.embedInitConfig={id:this.wistiaId,onReady:i=>{this.video=i,this.video&&(this.video.bind("play",()=>{this.isPlaying=!0}),this.video.bind("end",()=>{this.isPlaying=!1}),this.video.bind("pause",()=>{this.isPlaying=!1})),e()},options:{autoPlay:!1,playsinline:!1,playButton:!1,fitStrategy:"cover",controlsVisibleOnLoad:!1,settingsControl:!0,playerColor:"00bfb3",plugin:{}}},window._wq=window._wq||[],window._wq&&window._wq.push(this.embedInitConfig),fetch(`https://fast.wistia.com/embed/medias/${this.wistiaId}.jsonp`).catch(i=>s(i)).finally(()=>{this.isLoading=!1,this.isBuilt=!0})})},playButtonPush(){if(this.video){const e=a(this.video);this.isPlaying?e.pause():e.play()}else this.buildPlayer().then(()=>{a(this.video).play()})}}},y=["src"];function v(e,s,i,b,g,o){const l=r;return c(),u("div",null,[t("div",{class:n(["wrap",!i.noAspectRatio&&"wistia-aspect-ratio"])},[t("div",{ref:"wistia_embed",class:n(["thumb wistia_embed",i.popover&&"popover=true popoverAnimateThumbnail=true"])},[t("img",{loading:"lazy",class:"thumb_image",src:`https://fast.wistia.com/embed/medias/${i.wistiaId}/swatch`,alt:""},null,8,y)],2),h(),p(f(l,{"is-playing":e.isPlaying,size:"small",class:"wistia-play",onClick:o.playButtonPush},null,8,["is-playing","onClick"]),[[_,!e.isLoading&&!e.isPlaying]])],2)])}const x=d(m,[["render",v],["__scopeId","data-v-c9baac90"]]);export{x as _};