/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/jwplayer-video-element@1.3.5/dist/jwplayer-video-element.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var _a,_b;import{SuperVideoElement}from"super-media-element";const templateLightDOM=null==(_a=globalThis.document)?void 0:_a.createElement("template");templateLightDOM&&(templateLightDOM.innerHTML='\n  <style class="jw-style">\n    .jw-no-controls [class*="jw-controls"],\n    .jw-no-controls .jw-title {\n      display: none !important;\n    }\n  </style>\n  <div class="jwplayer"></div>\n  ');const templateShadowDOM=null==(_b=globalThis.document)?void 0:_b.createElement("template");templateShadowDOM&&(templateShadowDOM.innerHTML="\n  <style>\n    :host {\n      display: inline-block;\n      min-width: 300px;\n      min-height: 150px;\n      position: relative;\n    }\n    ::slotted(.jwplayer) {\n      position: absolute !important;\n      width: 100%;\n      height: 100%;\n    }\n  </style>\n  <slot></slot>\n  ");class JWPlayerVideoElement extends SuperVideoElement{static template=templateShadowDOM;static skipAttributes=["src"];get nativeEl(){return this.querySelector(".jw-video")}async load(){var e,t;if(null==(e=this.querySelector(".jw-style"))||e.remove(),null==(t=this.querySelector(".jwplayer"))||t.remove(),!this.src)return;this.loadComplete.then((()=>{this.volume=1}));const[,l,a]=this.src.match(/jwplayer\.com\/players\/(\w+)(?:-(\w+))?/i),i=`https://cdn.jwplayer.com/v2/media/${l}`,o=await(await fetch(i)).json(),n=`https://content.jwplatform.com/libraries/${a}.js`,s=await loadScript(n,"jwplayer");this.append(templateLightDOM.content.cloneNode(!0)),this.api=s(this.querySelector(".jwplayer")).setup({width:"100%",height:"100%",preload:this.getAttribute("preload")??"metadata",...o}),await promisify(this.api.on,this.api)("ready"),this.api.getContainer().classList.toggle("jw-no-controls",!this.controls)}async attributeChangedCallback(e,t,l){if(["controls","muted"].includes(e))switch(await this.loadComplete,e){case"controls":this.api.getContainer().classList.toggle("jw-no-controls",!this.controls);break;case"muted":this.muted=this.hasAttribute("muted")}else super.attributeChangedCallback(e,t,l)}get paused(){var e;return(null==(e=this.nativeEl)?void 0:e.paused)??!0}}const loadScriptCache={};async function loadScript(e,t){return t?loadScriptCache[e]?loadScriptCache[e]:self[t]?self[t]:loadScriptCache[e]=new Promise(((l,a)=>{const i=document.createElement("script");i.defer=!0,i.src=e,i.onload=()=>l(self[t]),i.onerror=a,document.head.append(i)})):import(e)}function promisify(e){return(...t)=>new Promise((l=>{e(...t,((...e)=>{e.length>1?l(e):l(e[0])}))}))}globalThis.customElements&&!globalThis.customElements.get("jwplayer-video")&&globalThis.customElements.define("jwplayer-video",JWPlayerVideoElement);var jwplayer_video_element_default=JWPlayerVideoElement;export{jwplayer_video_element_default as default,promisify};
//# sourceMappingURL=/sm/a4fac65fc8a597b97034625108cccfe5d2f728f685da6866dd270c5f09707b58.map