var X=Object.defineProperty;var Z=(e,i,t)=>i in e?X(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var k=(e,i,t)=>(Z(e,typeof i!="symbol"?i+"":i,t),t),B=(e,i,t)=>{if(!i.has(e))throw TypeError("Cannot "+t)};var a=(e,i,t)=>(B(e,i,"read from private field"),t?t.call(e):i.get(e)),d=(e,i,t)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,t)},n=(e,i,t,s)=>(B(e,i,"write to private field"),s?s.call(e,t):i.set(e,t),t);var U=(e,i,t)=>(B(e,i,"access private method"),t);import{c as tt}from"./vendor-react-ece1c85f.js";const et="https://open.spotify.com",it=/open\.spotify\.com\/(\w+)\/(\w+)/i,st="https://open.spotify.com/embed-podcast/iframe-api/v1",nt="SpotifyIframeApi",ot="onSpotifyIframeApiReady";function q(e,i={}){const t={src:J(e,i),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${rt(t)}></iframe>
  `}function J(e,i){var t,s,u;if(!e.src)return;const c=e.src.match(it),g=c&&c[1],w=c&&c[2],A={t:(t=i.config)==null?void 0:t.startAt,theme:((s=i.config)==null?void 0:s.theme)==="dark"?"0":null},l=(u=i.config)!=null&&u.preferVideo?"/video":"";return`${et}/embed/${g}/${w}${l}?${at(A)}`}var L,S,C,f,p,m,v,_,P,H,N,K;class R extends(globalThis.HTMLElement??class{}){constructor(){super();d(this,N);k(this,"loadComplete",new F);d(this,L,void 0);d(this,S,void 0);d(this,C,void 0);d(this,f,!1);d(this,p,!1);d(this,m,!0);d(this,v,0);d(this,_,NaN);d(this,P,!1);d(this,H,null);U(this,N,K).call(this,"config")}async load(){var t,s,u;if(a(this,L))return;a(this,S)&&(this.loadComplete=new F),n(this,S,!0),await n(this,L,Promise.resolve()),n(this,L,null),n(this,f,!1),n(this,p,!1),n(this,v,0),n(this,_,NaN),n(this,P,!1),this.dispatchEvent(new Event("emptied"));let c=this.api;if(this.api=null,!this.src)return;this.dispatchEvent(new Event("loadstart"));const g={t:(t=this.config)==null?void 0:t.startAt,theme:((s=this.config)==null?void 0:s.theme)==="dark"?"0":null,preferVideo:(u=this.config)==null?void 0:u.preferVideo};if(a(this,C))this.api=c,this.api.iframeElement.src=J(G(this.attributes),this);else{n(this,C,!0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=q(G(this.attributes),this));let w=this.shadowRoot.querySelector("iframe");const A=await ut(st,nt,ot);this.api=await new Promise(l=>A.createController(w,g,l)),this.api.iframeElement=w,this.api.addListener("ready",()=>{this.dispatchEvent(new Event("loadedmetadata")),this.dispatchEvent(new Event("durationchange")),this.dispatchEvent(new Event("volumechange"))}),this.api.addListener("playback_update",l=>{if(a(this,p)&&a(this,m)&&(l.data.isBuffering||!l.data.isPaused)){n(this,p,!1),this.currentTime=1;return}if(l.data.duration/1e3!==a(this,_)&&(n(this,p,!1),n(this,_,l.data.duration/1e3),this.dispatchEvent(new Event("durationchange"))),l.data.position/1e3!==a(this,v)&&(n(this,P,!1),n(this,p,!1),n(this,v,l.data.position/1e3),this.dispatchEvent(new Event("timeupdate"))),!a(this,f)&&!a(this,m)&&l.data.isPaused){n(this,m,!0),this.dispatchEvent(new Event("pause"));return}if(a(this,m)&&(l.data.isBuffering||!l.data.isPaused)){n(this,m,!1),this.dispatchEvent(new Event("play")),n(this,f,l.data.isBuffering),a(this,f)?this.dispatchEvent(new Event("waiting")):this.dispatchEvent(new Event("playing"));return}if(a(this,f)&&!l.data.isPaused){n(this,f,!1),this.dispatchEvent(new Event("playing"));return}if(!this.paused&&!this.seeking&&!a(this,p)&&Math.ceil(this.currentTime)>=this.duration){if(n(this,p,!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,s,u){if(s!==u)switch(t){case"src":{this.load();return}}}async play(){var t;return n(this,m,!1),n(this,f,!0),this.dispatchEvent(new Event("play")),await this.loadComplete,(t=this.api)==null?void 0:t.resume()}async pause(){var t;return await this.loadComplete,(t=this.api)==null?void 0:t.pause()}get config(){return a(this,H)}set config(t){n(this,H,t)}get paused(){return a(this,m)??!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 a(this,P)}get loop(){return this.hasAttribute("loop")}set loop(t){this.loop!=t&&this.toggleAttribute("loop",!!t)}get currentTime(){return a(this,v)}set currentTime(t){if(this.currentTime==t)return;n(this,P,!0);let s=a(this,v);n(this,v,t),this.dispatchEvent(new Event("timeupdate")),n(this,v,s),this.loadComplete.then(()=>{var u;(u=this.api)==null||u.seek(t)})}get duration(){return a(this,_)}get src(){return this.getAttribute("src")}set src(t){this.setAttribute("src",`${t}`)}}L=new WeakMap,S=new WeakMap,C=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,v=new WeakMap,_=new WeakMap,P=new WeakMap,H=new WeakMap,N=new WeakSet,K=function(t){if(Object.prototype.hasOwnProperty.call(this,t)){const s=this[t];delete this[t],this[t]=s}},k(R,"getTemplateHTML",q),k(R,"shadowRootOptions",{mode:"open"}),k(R,"observedAttributes",["controls","loop","src"]);function rt(e){let i="";for(const t in e){const s=e[t];s===""?i+=` ${t}`:i+=` ${t}="${s}"`}return i}function at(e){return String(new URLSearchParams(lt(e)))}function lt(e){let i={};for(let t in e){let s=e[t];s===!0||s===""?i[t]=1:s===!1?i[t]=0:s!=null&&(i[t]=s)}return i}function G(e){let i={};for(let t of e)i[t.name]=t.value;return i}const j={};async function ut(e,i,t){return j[e]?j[e]:i&&self[i]?Promise.resolve(self[i]):j[e]=new Promise(function(s,u){const c=document.createElement("script");c.src=e;const g=w=>s(w);t&&(self[t]=g),c.onload=()=>!t&&g(),c.onerror=u,document.head.append(c)})}class F extends Promise{constructor(i=()=>{}){let t,s;super((u,c)=>{i(u,c),t=u,s=c}),this.resolve=t,this.reject=s}}globalThis.customElements&&!globalThis.customElements.get("spotify-audio")&&globalThis.customElements.define("spotify-audio",R);var ct=R,ht=new Set(["style","children","ref","key","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML"]),dt={className:"class",htmlFor:"for"};function Q(e){return e.toLowerCase()}function V(e){if(typeof e=="boolean")return e?"":void 0;if(typeof e!="function"&&!(typeof e=="object"&&e!==null))return e}function ft({react:e,tagName:i,elementClass:t,events:s,displayName:u,defaultProps:c,toAttributeName:g=Q,toAttributeValue:w=V}){const A=Number.parseInt(e.version)>=19,l=e.forwardRef((W,M)=>{var x,z;const y=e.useRef(null),O=e.useRef(new Map),$={},D={},E={},I={};for(const[o,r]of Object.entries(W)){if(ht.has(o)){E[o]=r;continue}const h=g(dt[o]??o);if(t.prototype&&o in t.prototype&&!(o in(((x=globalThis.HTMLElement)==null?void 0:x.prototype)??{}))&&!((z=t.observedAttributes)!=null&&z.some(T=>T===h))){I[o]=r;continue}if(o.startsWith("on")){$[o]=r;continue}const b=w(r);if(h&&b!=null&&(D[h]=String(b),A||(E[h]=b)),h&&A){const T=V(r);b!==T?E[h]=b:E[h]=r}}if(typeof window<"u"){for(const o in $){const r=$[o],h=o.endsWith("Capture"),b=((s==null?void 0:s[o])??o.slice(2).toLowerCase()).slice(0,h?-7:void 0);e.useLayoutEffect(()=>{const T=y==null?void 0:y.current;if(!(!T||typeof r!="function"))return T.addEventListener(b,r,h),()=>{T.removeEventListener(b,r,h)}},[y==null?void 0:y.current,r])}e.useLayoutEffect(()=>{if(y.current===null)return;const o=new Map;for(const r in I)Y(y.current,r,I[r]),O.current.delete(r),o.set(r,I[r]);for(const[r,h]of O.current)Y(y.current,r,void 0);O.current=o})}if(typeof window>"u"&&(t!=null&&t.getTemplateHTML)&&(t!=null&&t.shadowRootOptions)){const{mode:o,delegatesFocus:r}=t.shadowRootOptions,h=e.createElement("template",{shadowrootmode:o,shadowrootdelegatesfocus:r,dangerouslySetInnerHTML:{__html:t.getTemplateHTML(D,W)},key:"ce-la-react-ssr-template-shadow-root"});E.children=[h,E.children]}return e.createElement(i,{...c,...E,ref:e.useCallback(o=>{y.current=o,typeof M=="function"?M(o):M!==null&&(M.current=o)},[M])},E.children)});return l.displayName=u??t.name,l}function Y(e,i,t){var s;e[i]=t,t==null&&i in(((s=globalThis.HTMLElement)==null?void 0:s.prototype)??{})&&e.removeAttribute(i)}var vt=ft({react:tt,tagName:"spotify-audio",elementClass:ct,toAttributeName(e){return e==="muted"?"":e==="defaultMuted"?"muted":Q(e)}});/*! Bundled license information:

ce-la-react/dist/ce-la-react.js:
  (**
   * @license
   * Copyright 2018 Google LLC
   * SPDX-License-Identifier: BSD-3-Clause
   *
   * Modified version of `@lit/react` for vanilla custom elements with support for SSR.
   *)
*/export{vt as default};
