"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4491],{44940:function(e,t,o){o.r(t),o.d(t,{default:function(){return g}});var i=o(2265);let s=/tiktok\.com\/(?:player\/v1\/|share\/video\/|@[^/]+\/video\/)([0-9]+)/,n={INIT:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3},r={[n.INIT]:"emptied",[n.PAUSED]:"pause",[n.ENDED]:"ended",[n.PLAYING]:"play",[n.BUFFERING]:"waiting"};function a(e,t={}){let o={src:l(e,t),frameborder:0,width:"100%",height:"100%",allow:"accelerometer; autoplay; fullscreen; encrypted-media; gyroscope; picture-in-picture"};return t.config&&(o["data-config"]=JSON.stringify(t.config)),`
    <style>
      :host {
        display:inline-block;
        min-width: 300px;
        min-height: 150px;
        position: relative;
      }
      iframe {
        position:absolute;
        top:0;
        left:0;
        width:100%;
        height:100%;
        border:0;
      }
    </style>
    <iframe ${function(e){let t="";for(let o in e){let i=e[o];""===i?t+=` ${c(o)}`:t+=` ${c(o)}="${c(`${i}`)}"`}return t}(o)} title="TikTok video"></iframe>
  `}function l(e,t={}){if(!e.src)return;let o=e.src.match(s),i=o&&o[1],n={controls:""===e.controls?null:0,autoplay:e.autoplay,muted:e.muted,loop:e.loop,rel:0,...t.config};return`https://www.tiktok.com/player/v1/${i}?${String(new URLSearchParams(function(e){let t={};for(let o in e){let i=e[o];!0===i||""===i?t[o]=1:!1===i?t[o]=0:null!=i&&(t[o]=i)}return t}(n)))}`}class u extends(globalThis.HTMLElement??class{}){static getTemplateHTML=a;static shadowRootOptions={mode:"open"};static get observedAttributes(){return["src","controls","loop","autoplay","muted"]}loadComplete=new d;#e;#t;#o=!1;#i=0;#s=!0;#n=null;#r=100;#a=0;#l;constructor(){super(),this.#u("config")}async load(){if(this.#e)return;this.shadowRoot||this.attachShadow(u.shadowRootOptions);let e=!this.#t;if(this.#t&&(this.loadComplete=new d),this.#t=!0,await (this.#e=Promise.resolve()),this.#e=null,this.#i=0,this.#o=!1,this.#s=!0,!this.src){this.shadowRoot.innerHTML="",globalThis.removeEventListener("message",this.#d);return}let t=this.shadowRoot.querySelector("iframe"),o=function(e){let t={};for(let o of e)t[o.name]=o.value;return t}(this.attributes);e&&t&&(this.#n=JSON.parse(t.getAttribute("data-config")||"{}")),(null==t?void 0:t.src)&&t.src===l(o,this)||(this.shadowRoot.innerHTML=a(o,this),t=this.shadowRoot.querySelector("iframe")),this.#l=t,globalThis.addEventListener("message",this.#d)}async attributeChangedCallback(e,t,o){if(t!==o)switch(e){case"muted":await this.loadComplete,this.muted=null!=o;break;case"autoplay":case"controls":case"loop":case"src":this.load();return}}get config(){return this.#n}set config(e){this.#n=e}#d=e=>{var t;if(e.source!==(null==(t=this.#l)?void 0:t.contentWindow))return;let o=e.data;if(null==o?void 0:o["x-tiktok-player"])switch(o.type){case"onPlayerReady":this.loadComplete.resolve();break;case"onStateChange":{this.#s=[n.INIT,n.PAUSED,n.ENDED].includes(o.value);let e=r[o.value];e&&this.dispatchEvent(new Event(e));break}case"onCurrentTime":this.#i=o.value.currentTime,this.#a=o.value.duration,this.dispatchEvent(new Event("durationchange")),this.dispatchEvent(new Event("timeupdate"));break;case"onVolumeChange":this.#r=o.value,this.dispatchEvent(new Event("volumechange"));break;case"onMute":this.#o=!!o.value,this.#r=o.value?0:this.#r,this.dispatchEvent(new Event("volumechange"));break;case"onError":this.dispatchEvent(new Event("error"));break;default:console.warn("Unhandled TikTok player message:",o)}};#c(e,t){var o;if(!(null==(o=this.#l)?void 0:o.contentWindow))return;let i={"x-tiktok-player":!0,type:e,...void 0!==t?{value:t}:{}};this.#l.contentWindow.postMessage(i,"*")}async play(){await this.loadComplete,this.#c("play")}async pause(){await this.loadComplete,this.#c("pause")}async #h(e){await this.loadComplete,this.#c("seekTo",Number(e))}async #p(){await this.loadComplete,this.#c("mute")}async #m(){await this.loadComplete,this.#c("unMute")}get volume(){return this.#r/100}set volume(e){console.warn("Volume control is not supported for TikTok videos.")}get currentTime(){return this.#i}set currentTime(e){this.#h(e)}get muted(){return this.#o}set muted(e){this.#o=e,e?this.#p():this.#m()}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(e){this.toggleAttribute("muted",!!e)}get paused(){return this.#s}get duration(){return this.#a}get src(){return this.getAttribute("src")}set src(e){this.setAttribute("src",e??"")}#u(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}}}class d extends Promise{constructor(e=()=>{}){let t,o;super((i,s)=>{e(i,s),t=i,o=s}),this.resolve=t,this.reject=o}}function c(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/`/g,"&#x60;")}globalThis.customElements&&!globalThis.customElements.get("tiktok-video")&&globalThis.customElements.define("tiktok-video",u);var h=new Set(["style","children","ref","key","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML"]),p={className:"class",htmlFor:"for"};function m(e){return e.toLowerCase()}function f(e){return"boolean"==typeof e?e?"":void 0:"function"==typeof e?void 0:"object"!=typeof e||null===e?e:void 0}function v(e,t,o){var i,s;e[t]=o,null==o&&t in(null!==(s=null==(i=globalThis.HTMLElement)?void 0:i.prototype)&&void 0!==s?s:{})&&e.removeAttribute(t)}var g=function(e){let{react:t,tagName:o,elementClass:i,events:s,displayName:n,defaultProps:r,toAttributeName:a=m,toAttributeValue:l=f}=e,u=Number.parseInt(t.version)>=19,d=t.forwardRef((e,n)=>{var d,c,m,g,w;let y=t.useRef(null),b=t.useRef(new Map),E={},T={},k={},L={};for(let[t,o]of Object.entries(e)){if(h.has(t)){k[t]=o;continue}let e=a(null!==(m=p[t])&&void 0!==m?m:t);if(i.prototype&&t in i.prototype&&!(t in(null!==(g=null==(d=globalThis.HTMLElement)?void 0:d.prototype)&&void 0!==g?g:{}))&&!(null==(c=i.observedAttributes)?void 0:c.some(t=>t===e))){L[t]=o;continue}if(t.startsWith("on")){E[t]=o;continue}let s=l(o);e&&null!=s&&(T[e]=String(s),u||(k[e]=s)),e&&u&&(s!==f(o)?k[e]=s:k[e]=o)}if("undefined"!=typeof window){for(let e in E){let o=E[e],i=e.endsWith("Capture"),n=(null!==(w=null==s?void 0:s[e])&&void 0!==w?w:e.slice(2).toLowerCase()).slice(0,i?-7:void 0);t.useLayoutEffect(()=>{let e=null==y?void 0:y.current;if(e&&"function"==typeof o)return e.addEventListener(n,o,i),()=>{e.removeEventListener(n,o,i)}},[null==y?void 0:y.current,o])}t.useLayoutEffect(()=>{if(null===y.current)return;let e=new Map;for(let t in L)v(y.current,t,L[t]),b.current.delete(t),e.set(t,L[t]);for(let[e,t]of b.current)v(y.current,e,void 0);b.current=e})}if("undefined"==typeof window&&(null==i?void 0:i.getTemplateHTML)&&(null==i?void 0:i.shadowRootOptions)){let{mode:o,delegatesFocus:s}=i.shadowRootOptions,n=t.createElement("template",{shadowrootmode:o,shadowrootdelegatesfocus:s,dangerouslySetInnerHTML:{__html:i.getTemplateHTML(T,e)},key:"ce-la-react-ssr-template-shadow-root"});k.children=[n,k.children]}return t.createElement(o,{...r,...k,ref:t.useCallback(e=>{y.current=e,"function"==typeof n?n(e):null!==n&&(n.current=e)},[n])},k.children)});return d.displayName=null!=n?n:i.name,d}({react:i,tagName:"tiktok-video",elementClass:u,toAttributeName:e=>"muted"===e?"":"defaultMuted"===e?"muted":m(e)})}}]);