import{o as e}from"./rolldown-runtime-Bhmf7a9N.js";import{KM as t,n}from"./lucide-7srpeIMw.js";var r=e(t(),1),i=`abort.canplay.canplaythrough.durationchange.emptied.encrypted.ended.error.loadeddata.loadedmetadata.loadstart.pause.play.playing.progress.ratechange.seeked.seeking.stalled.suspend.timeupdate.volumechange.waiting.waitingforkey.resize.enterpictureinpicture.leavepictureinpicture.webkitbeginfullscreen.webkitendfullscreen.webkitpresentationmodechanged`.split(`.`),a=globalThis.document?.createElement(`template`);a&&(a.innerHTML=`
    <style>
      :host {
        display: inline-block;
        line-height: 0;
      }

      video,
      audio {
        max-width: 100%;
        max-height: 100%;
        min-width: 100%;
        min-height: 100%;
      }
    </style>
    <slot></slot>
  `);var o=(e,{tag:t,is:n})=>{let r=globalThis.document?.createElement(t,{is:n}),o=r?s(r):[];return class l extends e{static Events=i;static template=a;static skipAttributes=[];static#e;static get observedAttributes(){return l.#t(),[...r?.constructor?.observedAttributes??[],`autopictureinpicture`,`disablepictureinpicture`,`disableremoteplayback`,`autoplay`,`controls`,`controlslist`,`crossorigin`,`loop`,`muted`,`playsinline`,`poster`,`preload`,`src`]}static#t(){if(this.#e)return;this.#e=!0;let e=new Set(this.observedAttributes);e.delete(`muted`);for(let t of o)if(!(t in this.prototype))if(typeof r[t]==`function`)this.prototype[t]=function(...e){this.#c();let n=()=>this.call?this.call(t,...e):this.nativeEl[t].apply(this.nativeEl,e);return this.loadComplete&&!this.isLoaded?this.loadComplete.then(n):n()};else{let n={get(){this.#c();let n=t.toLowerCase();if(e.has(n)){let e=this.getAttribute(n);return e===null?!1:e===``?!0:e}return this.get?.(t)??this.nativeEl?.[t]??this.#s[t]}};t!==t.toUpperCase()&&(n.set=async function(n){this.#c();let r=t.toLowerCase();if(e.has(r)){n===!0||n===!1||n==null?this.toggleAttribute(r,!!n):this.setAttribute(r,n);return}if(this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.set){this.set(t,n);return}this.nativeEl[t]=n}),Object.defineProperty(this.prototype,t,n)}}#n;#r;#i=!1;#a=!1;#o;#s;constructor(){super(),this.shadowRoot||(this.attachShadow({mode:`open`}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0))),this.load!==l.prototype.load&&(this.loadComplete=new c)}get loadComplete(){return this.#r}set loadComplete(e){this.#a=!1,this.#r=e,e?.then(()=>{this.#a=!0})}get isLoaded(){return this.#a}get nativeEl(){return this.#o??this.shadowRoot.querySelector(t)??this.querySelector(t)}set nativeEl(e){this.#o=e}get defaultMuted(){return this.hasAttribute(`muted`)}set defaultMuted(e){this.toggleAttribute(`muted`,!!e)}get src(){return this.getAttribute(`src`)}set src(e){this.setAttribute(`src`,`${e}`)}get preload(){return this.getAttribute(`preload`)??this.nativeEl?.preload}set preload(e){this.setAttribute(`preload`,`${e}`)}async#c(){if(this.#n)return;this.#n=!0,this.#u(),this.#d();for(let e of o)this.#l(e);let e=new Map,t=this.shadowRoot.querySelector(`slot:not([name])`);t?.addEventListener(`slotchange`,()=>{let n=new Map(e);t.assignedElements().filter(e=>[`track`,`source`].includes(e.localName)).forEach(async t=>{n.delete(t);let r=e.get(t);r||(r=t.cloneNode(),e.set(t,r)),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl.append?.(r)}),n.forEach(e=>e.remove())});for(let e of this.constructor.Events)this.shadowRoot.addEventListener?.(e,e=>{e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))},!0)}#l(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}}#u(){let e=document.createElement(t,{is:n});e.muted=this.hasAttribute(`muted`);for(let{name:t,value:n}of this.attributes)e.setAttribute(t,n);this.#s={};for(let t of s(e))this.#s[t]=e[t];e.removeAttribute(`src`),e.load()}async#d(){if(this.loadComplete&&!this.isLoaded&&await this.loadComplete,!this.nativeEl){let e=document.createElement(t,{is:n});e.part=t,this.shadowRoot.append(e)}this.nativeEl.muted=this.hasAttribute(`muted`)}attributeChangedCallback(e,t,n){this.#c(),e===`src`&&this.load!==l.prototype.load&&this.#f(),this.#p(e,t,n)}async#f(){this.#i&&(this.loadComplete=new c),this.#i=!0,await Promise.resolve(),await this.load(),this.loadComplete?.resolve(),await this.loadComplete}async#p(e,t,n){this.loadComplete&&!this.isLoaded&&await this.loadComplete,![`id`,`class`,...this.constructor.skipAttributes].includes(e)&&(n===null?this.nativeEl.removeAttribute?.(e):this.nativeEl.setAttribute?.(e,n))}connectedCallback(){this.#c()}}};function s(e){let t=[];for(let n=Object.getPrototypeOf(e);n&&n!==HTMLElement.prototype;n=Object.getPrototypeOf(n))t.push(...Object.getOwnPropertyNames(n));return t}var c=class extends Promise{constructor(e=()=>{}){let t,n;super((r,i)=>{e(r,i),t=r,n=i}),this.resolve=t,this.reject=n}},l=globalThis.document?o(HTMLElement,{tag:`video`}):class{};globalThis.document&&o(HTMLElement,{tag:`audio`});var u=globalThis.document?.createElement(`template`);u&&(u.innerHTML=`
  <div class="wistia_embed"></div>
  `);var d=globalThis.document?.createElement(`template`);d&&(d.innerHTML=`
  <style>
    :host {
      display: inline-block;
      min-width: 300px;
      min-height: 150px;
      position: relative;
    }
    ::slotted(.wistia_embed) {
      position: absolute;
      width: 100%;
      height: 100%;
    }
  </style>
  <slot></slot>
  `);var f=class extends l{static template=d;static skipAttributes=[`src`];get nativeEl(){return this.api?.elem()??this.querySelector(`video`)}async load(){var e;if((e=this.querySelector(`.wistia_embed`))==null||e.remove(),!this.src)return;await new Promise(e=>setTimeout(e,50));let t=this.src.match(/(?:wistia\.com|wi\.st)\/(?:medias|embed)\/(.*)$/i)[1],n={autoPlay:this.autoplay,preload:this.preload??`metadata`,playsinline:this.playsInline,endVideoBehavior:this.loop&&`loop`,chromeless:!this.controls,playButton:this.controls,muted:this.defaultMuted};this.append(u.content.cloneNode(!0));let r=this.querySelector(`.wistia_embed`);r.id||=g(t),r.classList.add(`wistia_async_${t}`),await m(`https://fast.wistia.com/assets/external/E-v1.js`,`Wistia`),this.api=await new Promise(e=>{globalThis._wq.push({id:r.id,onReady:e,options:n})})}async attributeChangedCallback(e,t,n){if(e===`controls`){switch(await this.loadComplete,e){case`controls`:this.api.bigPlayButtonEnabled(this.controls),this.controls?this.api.releaseChromeless():this.api.requestChromeless();break}return}super.attributeChangedCallback(e,t,n)}get duration(){return this.api?.duration()}async play(){return await this.loadComplete,this.api.play(),new Promise(e=>this.addEventListener(`playing`,e))}},p={};async function m(e,t){return t?p[e]?p[e]:self[t]?self[t]:p[e]=new Promise((n,r)=>{let i=document.createElement(`script`);i.defer=!0,i.src=e,i.onload=()=>n(self[t]),i.onerror=r,document.head.append(i)}):n(()=>import(e),[])}var h=0;function g(e){return`${e}${++h}`}globalThis.customElements&&!globalThis.customElements.get(`wistia-video`)&&globalThis.customElements.define(`wistia-video`,f);var _=f,v=new Set([`style`,`children`,`ref`,`key`,`suppressContentEditableWarning`,`suppressHydrationWarning`,`dangerouslySetInnerHTML`]),y={className:`class`,htmlFor:`for`};function b(e){return e.toLowerCase()}function x(e){if(typeof e==`boolean`)return e?``:void 0;if(typeof e!=`function`&&!(typeof e==`object`&&e))return e}function S({react:e,tagName:t,elementClass:n,events:r,displayName:i,defaultProps:a,toAttributeName:o=b,toAttributeValue:s=x}){let c=Number.parseInt(e.version)>=19,l=e.forwardRef((i,l)=>{let u=e.useRef(null),d=e.useRef(new Map),f={},p={},m={},h={};for(let[e,t]of Object.entries(i)){if(v.has(e)){m[e]=t;continue}let r=o(y[e]??e);if(n.prototype&&e in n.prototype&&!(e in(globalThis.HTMLElement?.prototype??{}))&&!n.observedAttributes?.some(e=>e===r)){h[e]=t;continue}if(e.startsWith(`on`)){f[e]=t;continue}let i=s(t);r&&i!=null&&(p[r]=String(i),c||(m[r]=i)),r&&c&&(i===x(t)?m[r]=t:m[r]=i)}if(typeof window<`u`){for(let t in f){let n=f[t],i=t.endsWith(`Capture`),a=(r?.[t]??t.slice(2).toLowerCase()).slice(0,i?-7:void 0);e.useLayoutEffect(()=>{let e=u?.current;if(!(!e||typeof n!=`function`))return e.addEventListener(a,n,i),()=>{e.removeEventListener(a,n,i)}},[u?.current,n])}e.useLayoutEffect(()=>{if(u.current===null)return;let e=new Map;for(let t in h)C(u.current,t,h[t]),d.current.delete(t),e.set(t,h[t]);for(let[e,t]of d.current)C(u.current,e,void 0);d.current=e})}if(typeof window>`u`&&n?.getTemplateHTML&&n?.shadowRootOptions){let{mode:t,delegatesFocus:r}=n.shadowRootOptions;m.children=[e.createElement(`template`,{shadowrootmode:t,shadowrootdelegatesfocus:r,dangerouslySetInnerHTML:{__html:n.getTemplateHTML(p,i)},key:`ce-la-react-ssr-template-shadow-root`}),m.children]}return e.createElement(t,{...a,...m,ref:e.useCallback(e=>{u.current=e,typeof l==`function`?l(e):l!==null&&(l.current=e)},[l])},m.children)});return l.displayName=i??n.name,l}function C(e,t,n){e[t]=n,n==null&&t in(globalThis.HTMLElement?.prototype??{})&&e.removeAttribute(t)}var w=S({react:r.default,tagName:`wistia-video`,elementClass:_,toAttributeName(e){return e===`muted`?``:e===`defaultMuted`?`muted`:b(e)}});export{w as default};