"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1954],{81327:function(t,e,i){i.r(e),i.d(e,{default:function(){return g}});var n=i(2265);let s=/open\.spotify\.com\/(\w+)\/(\w+)/i;function o(t,e={}){let i={src:r(t,e),scrolling:"no",frameborder:0,width:"100%",height:"100%",allow:"accelerometer; fullscreen; autoplay; encrypted-media; gyroscope; picture-in-picture"};return`
    <style>
      :host {
        display: inline-block;
        min-width: 160px;
        min-height: 80px;
        position: relative;
      }
      iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
      }
      :host(:not([controls])) {
        display: none !important;
      }
    </style>
    <iframe${function(t){let e="";for(let i in t){let n=t[i];""===n?e+=` ${i}`:e+=` ${i}="${n}"`}return e}(i)}></iframe>
  `}function r(t,e){var i,n,o;if(!t.src)return;let r=t.src.match(s),a=r&&r[1],l=r&&r[2],u={t:null==(i=e.config)?void 0:i.startAt,theme:(null==(n=e.config)?void 0:n.theme)==="dark"?"0":null},d=(null==(o=e.config)?void 0:o.preferVideo)?"/video":"";return`https://open.spotify.com/embed/${a}/${l}${d}?${String(new URLSearchParams(function(t){let e={};for(let i in t){let n=t[i];!0===n||""===n?e[i]=1:!1===n?e[i]=0:null!=n&&(e[i]=n)}return e}(u)))}`}class a extends(globalThis.HTMLElement??class{}){static getTemplateHTML=o;static shadowRootOptions={mode:"open"};static observedAttributes=["controls","loop","src"];loadComplete=new h;#t;#e;#i;#n=!1;#s=!1;#o=!0;#r=0;#a=NaN;#l=!1;#u=null;constructor(){super(),this.#d("config")}async load(){var t,e,i;if(this.#t)return;this.#e&&(this.loadComplete=new h),this.#e=!0,await (this.#t=Promise.resolve()),this.#t=null,this.#n=!1,this.#s=!1,this.#r=0,this.#a=NaN,this.#l=!1,this.dispatchEvent(new Event("emptied"));let n=this.api;if(this.api=null,!this.src)return;this.dispatchEvent(new Event("loadstart"));let s={t:null==(t=this.config)?void 0:t.startAt,theme:(null==(e=this.config)?void 0:e.theme)==="dark"?"0":null,preferVideo:null==(i=this.config)?void 0:i.preferVideo};if(this.#i)this.api=n,this.api.iframeElement.src=r(l(this.attributes),this);else{this.#i=!0,this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=o(l(this.attributes),this));let t=this.shadowRoot.querySelector("iframe"),e=await d("https://open.spotify.com/embed-podcast/iframe-api/v1","SpotifyIframeApi","onSpotifyIframeApiReady");this.api=await new Promise(i=>e.createController(t,s,i)),this.api.iframeElement=t,this.api.addListener("ready",()=>{this.dispatchEvent(new Event("loadedmetadata")),this.dispatchEvent(new Event("durationchange")),this.dispatchEvent(new Event("volumechange"))}),this.api.addListener("playback_update",t=>{if(this.#s&&this.#o&&(t.data.isBuffering||!t.data.isPaused)){this.#s=!1,this.currentTime=1;return}if(t.data.duration/1e3!==this.#a&&(this.#s=!1,this.#a=t.data.duration/1e3,this.dispatchEvent(new Event("durationchange"))),t.data.position/1e3!==this.#r&&(this.#l=!1,this.#s=!1,this.#r=t.data.position/1e3,this.dispatchEvent(new Event("timeupdate"))),!this.#n&&!this.#o&&t.data.isPaused){this.#o=!0,this.dispatchEvent(new Event("pause"));return}if(this.#o&&(t.data.isBuffering||!t.data.isPaused)){this.#o=!1,this.dispatchEvent(new Event("play")),this.#n=t.data.isBuffering,this.#n?this.dispatchEvent(new Event("waiting")):this.dispatchEvent(new Event("playing"));return}if(this.#n&&!t.data.isPaused){this.#n=!1,this.dispatchEvent(new Event("playing"));return}if(!this.paused&&!this.seeking&&!this.#s&&Math.ceil(this.currentTime)>=this.duration){if(this.#s=!0,this.loop){this.currentTime=1;return}this.continuous||(this.pause(),this.dispatchEvent(new Event("ended")));return}})}this.loadComplete.resolve(),await this.loadComplete}async attributeChangedCallback(t,e,i){if(e!==i&&"src"===t){this.load();return}}async play(){var t;return this.#o=!1,this.#n=!0,this.dispatchEvent(new Event("play")),await this.loadComplete,null==(t=this.api)?void 0:t.resume()}async pause(){var t;return await this.loadComplete,null==(t=this.api)?void 0:t.pause()}get config(){return this.#u}set config(t){this.#u=t}get paused(){return this.#o??!0}get muted(){return!1}set muted(t){}get volume(){return 1}set volume(t){}get ended(){return Math.ceil(this.currentTime)>=this.duration}get seeking(){return this.#l}get loop(){return this.hasAttribute("loop")}set loop(t){this.loop!=t&&this.toggleAttribute("loop",!!t)}get currentTime(){return this.#r}set currentTime(t){if(this.currentTime==t)return;this.#l=!0;let e=this.#r;this.#r=t,this.dispatchEvent(new Event("timeupdate")),this.#r=e,this.loadComplete.then(()=>{var e;null==(e=this.api)||e.seek(t)})}get duration(){return this.#a}get src(){return this.getAttribute("src")}set src(t){this.setAttribute("src",`${t}`)}#d(t){if(Object.prototype.hasOwnProperty.call(this,t)){let e=this[t];delete this[t],this[t]=e}}}function l(t){let e={};for(let i of t)e[i.name]=i.value;return e}let u={};async function d(t,e,i){return u[t]?u[t]:e&&self[e]?Promise.resolve(self[e]):u[t]=new Promise(function(e,n){let s=document.createElement("script");s.src=t;let o=t=>e(t);i&&(self[i]=o),s.onload=()=>!i&&o(),s.onerror=n,document.head.append(s)})}class h extends Promise{constructor(t=()=>{}){let e,i;super((n,s)=>{t(n,s),e=n,i=s}),this.resolve=e,this.reject=i}}globalThis.customElements&&!globalThis.customElements.get("spotify-audio")&&globalThis.customElements.define("spotify-audio",a);var c=new Set(["style","children","ref","key","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML"]),p={className:"class",htmlFor:"for"};function f(t){return t.toLowerCase()}function m(t){return"boolean"==typeof t?t?"":void 0:"function"==typeof t?void 0:"object"!=typeof t||null===t?t:void 0}function v(t,e,i){var n,s;t[e]=i,null==i&&e in(null!==(s=null==(n=globalThis.HTMLElement)?void 0:n.prototype)&&void 0!==s?s:{})&&t.removeAttribute(e)}var g=function(t){let{react:e,tagName:i,elementClass:n,events:s,displayName:o,defaultProps:r,toAttributeName:a=f,toAttributeValue:l=m}=t,u=Number.parseInt(e.version)>=19,d=e.forwardRef((t,o)=>{var d,h,f,g,w;let E=e.useRef(null),y=e.useRef(new Map),T={},b={},L={},k={};for(let[e,i]of Object.entries(t)){if(c.has(e)){L[e]=i;continue}let t=a(null!==(f=p[e])&&void 0!==f?f:e);if(n.prototype&&e in n.prototype&&!(e in(null!==(g=null==(d=globalThis.HTMLElement)?void 0:d.prototype)&&void 0!==g?g:{}))&&!(null==(h=n.observedAttributes)?void 0:h.some(e=>e===t))){k[e]=i;continue}if(e.startsWith("on")){T[e]=i;continue}let s=l(i);t&&null!=s&&(b[t]=String(s),u||(L[t]=s)),t&&u&&(s!==m(i)?L[t]=s:L[t]=i)}if("undefined"!=typeof window){for(let t in T){let i=T[t],n=t.endsWith("Capture"),o=(null!==(w=null==s?void 0:s[t])&&void 0!==w?w:t.slice(2).toLowerCase()).slice(0,n?-7:void 0);e.useLayoutEffect(()=>{let t=null==E?void 0:E.current;if(t&&"function"==typeof i)return t.addEventListener(o,i,n),()=>{t.removeEventListener(o,i,n)}},[null==E?void 0:E.current,i])}e.useLayoutEffect(()=>{if(null===E.current)return;let t=new Map;for(let e in k)v(E.current,e,k[e]),y.current.delete(e),t.set(e,k[e]);for(let[t,e]of y.current)v(E.current,t,void 0);y.current=t})}if("undefined"==typeof window&&(null==n?void 0:n.getTemplateHTML)&&(null==n?void 0:n.shadowRootOptions)){let{mode:i,delegatesFocus:s}=n.shadowRootOptions,o=e.createElement("template",{shadowrootmode:i,shadowrootdelegatesfocus:s,dangerouslySetInnerHTML:{__html:n.getTemplateHTML(b,t)},key:"ce-la-react-ssr-template-shadow-root"});L.children=[o,L.children]}return e.createElement(i,{...r,...L,ref:e.useCallback(t=>{E.current=t,"function"==typeof o?o(t):null!==o&&(o.current=t)},[o])},L.children)});return d.displayName=null!=o?o:n.name,d}({react:n,tagName:"spotify-audio",elementClass:a,toAttributeName:t=>"muted"===t?"":"defaultMuted"===t?"muted":f(t)})}}]);