"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./chunk-FSLSW5KG.cjs.js"),n=require("react"),h=require("react/jsx-runtime");var L=l=>{const s={};return Object.entries(l).forEach(([d,a])=>{typeof a=="boolean"?s[d]=String(a):s[d]=a}),s},q=n.forwardRef((l,s)=>{const{aspect:d,children:a,className:w,embedHost:u,id:o,mediaId:c,roundedPlayer:E,swatch:p,style:P}=l,S=t.getMergedEmbedOption(c,"embedHost",u!=null?u:void 0),f=t.isString(S)?S:"fast.wistia.com",b=n.useRef(null),[m,v]=n.useState(d),[j,W]=n.useState(!1);n.useEffect(()=>{p!==!1&&m===void 0&&t.isString(f)&&t.getSwatchAspectRatio(c,f).then(e=>{v(e)}),Promise.resolve().then(()=>require("./wistia-player-PKAEVX5L.cjs.js")),customElements.whenDefined("wistia-player").then(()=>{W(!0)})},[]);const g={},y={};Object.entries(l).forEach(([e,i])=>{if(e.startsWith("on")&&e[2]===e[2].toUpperCase()){const r=t.camelCaseToKebabCase(e).slice(3);t.isFunction(i)&&(g[r]=i)}else t.isValidEmbedOption(i)&&(y[t.camelCaseToKebabCase(e)]=i)}),Object.entries(g).forEach(([e,i])=>{n.useEffect(()=>{const r=b.current;return r==null||r.addEventListener(e,i),()=>{r==null||r.removeEventListener(e,i)}},[i,j])});const O=m!==void 0,C=t.wistiaPlayerStyleBlock({mediaId:c,embedHost:f,aspect:m,shouldLoadSwatch:p,roundedPlayer:E});return h.jsxs(n.Fragment,{children:[O&&h.jsx("style",{dangerouslySetInnerHTML:{__html:C}}),h.jsx("wistia-player",{ref:(e=>{b.current=e,typeof s=="function"?s(e):s!==null&&(s.current=e)}),id:o!=null?o:void 0,"media-id":c,class:w,style:P,react:String(!0),...L(y),children:a},o!=null?o:c)]})});exports.WistiaPlayerWrapper=q;
