/** * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0. * Original file: /npm/media-chrome@4.14.0/dist/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ const e={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},t={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},i={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},n=Object.entries(i),a=n.reduce(((e,[t,i])=>(e[t]=i.toLowerCase(),e)),{}),s=n.reduce(((e,[t,i])=>(e[t]=i.toLowerCase(),e)),{USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"}),r=Object.entries(s).reduce(((e,[t,i])=>{const n=a[t];return n&&(e[i]=n),e}),{userinactivechange:"userinactive"}),o=Object.entries(a).reduce(((e,[t,i])=>{const n=s[t];return n&&(e[i]=n),e}),{userinactive:"userinactivechange"}),l={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},d={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},c={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},u={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},h={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},m={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};var p=Object.freeze({__proto__:null,AttributeToStateChangeEventMap:o,AvailabilityStates:u,MediaStateChangeEvents:s,MediaStateReceiverAttributes:t,MediaUIAttributes:a,MediaUIEvents:e,MediaUIProps:i,PointerTypes:c,ReadyStates:{HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},StateChangeEventToAttributeMap:r,StreamTypes:h,TextTrackKinds:l,TextTrackModes:d,VolumeLevels:{HIGH:"high",MEDIUM:"medium",LOW:"low",OFF:"off"},WebkitPresentationModes:m});function E(e){if(e){const{id:t,width:i,height:n}=e;return[t,i,n].filter((e=>null!=e)).join(":")}}function v(e){if(e){const{id:t,kind:i,language:n,label:a}=e;return[t,i,n,a].filter((e=>null!=e)).join(":")}}function b(e){return"number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)}const g=e=>new Promise((t=>setTimeout(t,e))),A=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],f=e=>{if(!b(e))return"";const t=Math.abs(e),i=t!==e,n=new Date(0,0,0,0,0,t,0);return`${[n.getHours(),n.getMinutes(),n.getSeconds()].map(((e,t)=>e&&((e,t)=>`${e} ${1===e?A[t].singular:A[t].plural}`)(e,t))).filter((e=>e)).join(", ")}${i?" remaining":""}`};function I(e,t){let i=!1;e<0&&(i=!0,e=0-e),e=e<0?0:e;let n=Math.floor(e%60),a=Math.floor(e/60%60),s=Math.floor(e/3600);const r=Math.floor(t/60%60),o=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(s=a=n="0"),s=s>0||o>0?s+":":"",a=((s||r>=10)&&a<10?"0"+a:a)+":",n=n<10?"0"+n:n,(i?"-":"")+s+a+n}const w=Object.freeze({length:0,start(e){const t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){const t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});var _=Object.freeze({__proto__:null,emptyTimeRanges:w,formatAsTimePhrase:f,formatTime:I,serializeTimeRanges:function(e=w){return Array.from(e).map(((t,i)=>[Number(e.start(i).toFixed(3)),Number(e.end(i).toFixed(3))].join(":"))).join(" ")}});var y;const T={en:{"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."}};let M=(null==(y=globalThis.navigator)?void 0:y.language)||"en";const k=(e,t={})=>(e=>{var t,i,n;const[a]=M.split("-");return(null==(t=T[M])?void 0:t[e])||(null==(i=T[a])?void 0:i[e])||(null==(n=T.en)?void 0:n[e])||e})(e).replace(/\{(\w+)\}/g,((e,i)=>i in t?String(t[i]):`{${i}}`));class S{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}}class L extends S{}class R extends L{constructor(){super(...arguments),this.role=null}}const D={createElement:function(){return new C.HTMLElement},createElementNS:function(){return new C.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent:e=>!1},C={ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},document:D,Node:L,Element:R,HTMLElement:class extends R{constructor(){super(...arguments),this.innerHTML=""}get content(){return new C.DocumentFragment}},DocumentFragment:class extends S{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem:e=>null,setItem(e,t){},removeItem(e){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia:e=>({matches:!1,media:e}),DOMParser:class{parseFromString(e,t){return{body:{textContent:e}}}}},x="undefined"==typeof window||void 0===window.customElements,N=Object.keys(C).every((e=>e in globalThis)),U=x&&!N?C:globalThis,P=x&&!N?D:globalThis.document,O=new WeakMap,H=e=>{let t=O.get(e);return t||O.set(e,t=new Set),t},V=new U.ResizeObserver((e=>{for(const t of e)for(const e of H(t.target))e(t)}));function W(e,t){H(e).add(t),V.observe(e)}function $(e,t){const i=H(e);i.delete(t),i.size||V.unobserve(e)}function B(e){const t={};for(const i of e)t[i.name]=i.value;return t}function G(e){var i;return null!=(i=function(e){var i;const{MEDIA_CONTROLLER:n}=t,a=e.getAttribute(n);if(a)return null==(i=function(e){var t;const i=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e);if(i instanceof ShadowRoot||i instanceof Document)return i;return null}(e))?void 0:i.getElementById(a)}(e))?i:K(e,"media-controller")}const F=(e,t,i=".value")=>{const n=e.querySelector(i);n&&(n.textContent=t)},q=(e,t)=>((e,t)=>{const i=`slot[name="${t}"]`,n=e.shadowRoot.querySelector(i);return n?n.children:[]})(e,t)[0],Q=(e,t)=>!(!e||!t)&&(!!(null==e?void 0:e.contains(t))||Q(e,t.getRootNode().host)),K=(e,t)=>{if(!e)return null;const i=e.closest(t);return i||K(e.getRootNode().host,t)};function j(e=document){var t;const i=null==e?void 0:e.activeElement;return i?null!=(t=j(i.shadowRoot))?t:i:null}function Y(e,{depth:t=3,checkOpacity:i=!0,checkVisibilityCSS:n=!0}={}){if(e.checkVisibility)return e.checkVisibility({checkOpacity:i,checkVisibilityCSS:n});let a=e;for(;a&&t>0;){const e=getComputedStyle(a);if(i&&"0"===e.opacity||n&&"hidden"===e.visibility||"none"===e.display)return!1;a=a.parentElement,t--}return!0}function Z(e,t){const i=function(e,t){var i,n;let a;for(a of null!=(i=e.querySelectorAll("style:not([media])"))?i:[]){let e;try{e=null==(n=a.sheet)?void 0:n.cssRules}catch{continue}for(const i of null!=e?e:[])if(t(i.selectorText))return i}}(e,(e=>e===t));return i||function(e,t){var i,n;const a=null!=(i=e.querySelectorAll("style:not([media])"))?i:[],s=null==a?void 0:a[a.length-1];if(!(null==s?void 0:s.sheet))return console.warn("Media Chrome: No style sheet found on style tag of",e),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}};return null==s||s.sheet.insertRule(`${t}{}`,s.sheet.cssRules.length),null==(n=s.sheet.cssRules)?void 0:n[s.sheet.cssRules.length-1]}(e,t)}function z(e,t,i=Number.NaN){const n=e.getAttribute(t);return null!=n?+n:i}function X(e,t,i){const n=+i;null==i||Number.isNaN(n)?e.hasAttribute(t)&&e.removeAttribute(t):z(e,t,void 0)!==n&&e.setAttribute(t,`${n}`)}function J(e,t){return e.hasAttribute(t)}function ee(e,t,i){null!=i?J(e,t)!=i&&e.toggleAttribute(t,i):e.hasAttribute(t)&&e.removeAttribute(t)}function te(e,t,i=null){var n;return null!=(n=e.getAttribute(t))?n:i}function ie(e,t,i){if(null==i)return void(e.hasAttribute(t)&&e.removeAttribute(t));const n=`${i}`;te(e,t,void 0)!==n&&e.setAttribute(t,n)}var ne,ae=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},se=(e,t,i)=>(ae(e,t,"read from private field"),i?i.call(e):t.get(e)),re=(e,t,i,n)=>(ae(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class oe extends U.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,ne,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[t.MEDIA_CONTROLLER,a.MEDIA_PAUSED]}attributeChangedCallback(e,i,n){var a,s,r,o,l;e===t.MEDIA_CONTROLLER&&(i&&(null==(s=null==(a=se(this,ne))?void 0:a.unassociateElement)||s.call(a,this),re(this,ne,null)),n&&this.isConnected&&(re(this,ne,null==(r=this.getRootNode())?void 0:r.getElementById(n)),null==(l=null==(o=se(this,ne))?void 0:o.associateElement)||l.call(o,this)))}connectedCallback(){var e,i,n,a;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),re(this,ne,function(e){var i;const n=e.getAttribute(t.MEDIA_CONTROLLER);if(n)return null==(i=e.getRootNode())?void 0:i.getElementById(n);return K(e,"media-controller")}(this)),this.getAttribute(t.MEDIA_CONTROLLER)&&(null==(i=null==(e=se(this,ne))?void 0:e.associateElement)||i.call(e,this)),null==(n=se(this,ne))||n.addEventListener("pointerdown",this),null==(a=se(this,ne))||a.addEventListener("click",this)}disconnectedCallback(){var e,i,n,a;this.getAttribute(t.MEDIA_CONTROLLER)&&(null==(i=null==(e=se(this,ne))?void 0:e.unassociateElement)||i.call(e,this)),null==(n=se(this,ne))||n.removeEventListener("pointerdown",this),null==(a=se(this,ne))||a.removeEventListener("click",this),re(this,ne,null)}handleEvent(e){var t;const i=null==(t=e.composedPath())?void 0:t[0];if(["video","media-controller"].includes(null==i?void 0:i.localName))if("pointerdown"===e.type)this._pointerType=e.pointerType;else if("click"===e.type){const{clientX:t,clientY:i}=e,{left:n,top:a,width:s,height:r}=this.getBoundingClientRect(),o=t-n,l=i-a;if(o<0||l<0||o>s||l>r||0===s&&0===r)return;const d=this._pointerType||"mouse";if(this._pointerType=void 0,d===c.TOUCH)return void this.handleTap(e);if(d===c.MOUSE)return void this.handleMouseClick(e)}}get mediaPaused(){return J(this,a.MEDIA_PAUSED)}set mediaPaused(e){ee(this,a.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(t){const i=this.mediaPaused?e.MEDIA_PLAY_REQUEST:e.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new U.CustomEvent(i,{composed:!0,bubbles:!0}))}}ne=new WeakMap,oe.shadowRootOptions={mode:"open"},oe.getTemplateHTML=function(e){return"\n \n "},U.customElements.get("media-gesture-receiver")||U.customElements.define("media-gesture-receiver",oe);var le,de,ce,ue,he,me,pe,Ee,ve,be,ge,Ae,fe,Ie,we,_e,ye,Te,Me,ke=oe,Se=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Le=(e,t,i)=>(Se(e,t,"read from private field"),i?i.call(e):t.get(e)),Re=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},De=(e,t,i,n)=>(Se(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),Ce=(e,t,i)=>(Se(e,t,"access private method"),i);const xe={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};const Ne=Object.values(a);function Ue(e,t){var i;if(!e.isConnected)return;const n=function(e){const t=e.split(/\s+/);return Object.fromEntries(t.map((e=>e.split(":"))))}(null!=(i=e.getAttribute(xe.BREAKPOINTS))?i:"sm:384 md:576 lg:768 xl:960"),a=function(e,t){return Object.keys(e).filter((i=>t>=parseInt(e[i])))}(n,t);let r=!1;if(Object.keys(n).forEach((t=>{a.includes(t)?e.hasAttribute(`breakpoint${t}`)||(e.setAttribute(`breakpoint${t}`,""),r=!0):e.hasAttribute(`breakpoint${t}`)&&(e.removeAttribute(`breakpoint${t}`),r=!0)})),r){const t=new CustomEvent(s.BREAKPOINTS_CHANGE,{detail:a});e.dispatchEvent(t)}e.breakpointsComputed||(e.breakpointsComputed=!0,e.dispatchEvent(new CustomEvent(s.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}class Pe extends U.HTMLElement{constructor(){if(super(),Re(this,me),Re(this,be),Re(this,Ae),Re(this,Ie),Re(this,_e),Re(this,Te),Re(this,le,0),Re(this,de,null),Re(this,ce,null),Re(this,ue,void 0),this.breakpointsComputed=!1,Re(this,he,new MutationObserver(Ce(this,me,pe).bind(this))),Re(this,Ee,!1),Re(this,ve,(e=>{Le(this,Ee)||(setTimeout((()=>{!function(e){Ue(e.target,e.contentRect.width)}(e),De(this,Ee,!1)}),0),De(this,Ee,!0))})),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}const e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",(()=>{e.assignedElements({flatten:!0}).length?this.handleMediaUpdated(this.media):Le(this,de)&&this.mediaUnsetCallback(Le(this,de))}))}static get observedAttributes(){return[xe.AUTOHIDE,xe.GESTURES_DISABLED].concat(Ne).filter((e=>![a.MEDIA_RENDITION_LIST,a.MEDIA_AUDIO_TRACK_LIST,a.MEDIA_CHAPTERS_CUES,a.MEDIA_WIDTH,a.MEDIA_HEIGHT,a.MEDIA_ERROR,a.MEDIA_ERROR_MESSAGE].includes(e)))}attributeChangedCallback(e,t,i){e.toLowerCase()==xe.AUTOHIDE&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return"SLOT"==(null==e?void 0:e.nodeName)&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(De(this,de,e),e.localName.includes("-")&&await U.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Le(this,he).observe(this,{childList:!0,subtree:!0}),W(this,Le(this,ve));const t=null!=this.getAttribute(xe.AUDIO),i=k(t?"audio player":"video player");this.setAttribute("role","region"),this.setAttribute("aria-label",i),this.handleMediaUpdated(this.media),this.setAttribute(xe.USER_INACTIVE,""),Ue(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),null==(e=U.window)||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Le(this,he).disconnect(),$(this,Le(this,ve)),this.media&&this.mediaUnsetCallback(this.media),null==(e=U.window)||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){De(this,de,null)}handleEvent(e){switch(e.type){case"pointerdown":De(this,le,e.timeStamp);break;case"pointermove":Ce(this,be,ge).call(this,e);break;case"pointerup":Ce(this,Ae,fe).call(this,e);break;case"mouseleave":Ce(this,Ie,we).call(this);break;case"mouseup":this.removeAttribute(xe.KEYBOARD_CONTROL);break;case"keyup":Ce(this,Te,Me).call(this),this.setAttribute(xe.KEYBOARD_CONTROL,"")}}set autohide(e){const t=Number(e);De(this,ue,isNaN(t)?0:t)}get autohide(){return(void 0===Le(this,ue)?2:Le(this,ue)).toString()}get breakpoints(){return te(this,xe.BREAKPOINTS)}set breakpoints(e){ie(this,xe.BREAKPOINTS,e)}get audio(){return J(this,xe.AUDIO)}set audio(e){ee(this,xe.AUDIO,e)}get gesturesDisabled(){return J(this,xe.GESTURES_DISABLED)}set gesturesDisabled(e){ee(this,xe.GESTURES_DISABLED,e)}get keyboardControl(){return J(this,xe.KEYBOARD_CONTROL)}set keyboardControl(e){ee(this,xe.KEYBOARD_CONTROL,e)}get noAutohide(){return J(this,xe.NO_AUTOHIDE)}set noAutohide(e){ee(this,xe.NO_AUTOHIDE,e)}get autohideOverControls(){return J(this,xe.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){ee(this,xe.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return J(this,xe.USER_INACTIVE)}set userInteractive(e){ee(this,xe.USER_INACTIVE,e)}}le=new WeakMap,de=new WeakMap,ce=new WeakMap,ue=new WeakMap,he=new WeakMap,me=new WeakSet,pe=function(e){const t=this.media;for(const i of e){if("childList"!==i.type)continue;const e=i.removedNodes;for(const n of e){if("media"!=n.slot||i.target!=this)continue;let e=i.previousSibling&&i.previousSibling.previousElementSibling;if(e&&t){let t="media"!==e.slot;for(;null!==(e=e.previousSibling);)"media"==e.slot&&(t=!1);t&&this.mediaUnsetCallback(n)}else this.mediaUnsetCallback(n)}if(t)for(const e of i.addedNodes)e===t&&this.handleMediaUpdated(t)}},Ee=new WeakMap,ve=new WeakMap,be=new WeakSet,ge=function(e){if("mouse"!==e.pointerType){const t=250;if(e.timeStamp-Le(this,le)["media-play-button","media-fullscreen-button"].includes(null==e?void 0:e.localName)))&&Ce(this,Te,Me).call(this)},Ie=new WeakSet,we=function(){if(Le(this,ue)<0)return;if(this.hasAttribute(xe.USER_INACTIVE))return;this.setAttribute(xe.USER_INACTIVE,"");const e=new U.CustomEvent(s.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(e)},_e=new WeakSet,ye=function(){if(!this.hasAttribute(xe.USER_INACTIVE))return;this.removeAttribute(xe.USER_INACTIVE);const e=new U.CustomEvent(s.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(e)},Te=new WeakSet,Me=function(){Ce(this,_e,ye).call(this),clearTimeout(Le(this,ce));const e=parseInt(this.autohide);e<0||De(this,ce,setTimeout((()=>{Ce(this,Ie,we).call(this)}),1e3*e))},Pe.shadowRootOptions={mode:"open"},Pe.getTemplateHTML=function(e){return`\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n `},U.customElements.get("media-container")||U.customElements.define("media-container",Pe);var Oe,He,Ve,We,$e,Be,Ge=Pe,Fe=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},qe=(e,t,i)=>(Fe(e,t,"read from private field"),i?i.call(e):t.get(e)),Qe=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Ke=(e,t,i,n)=>(Fe(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class je{constructor(e,t,{defaultValue:i}={defaultValue:void 0}){Qe(this,$e),Qe(this,Oe,void 0),Qe(this,He,void 0),Qe(this,Ve,void 0),Qe(this,We,new Set),Ke(this,Oe,e),Ke(this,He,t),Ke(this,Ve,new Set(i))}[Symbol.iterator](){return qe(this,$e,Be).values()}get length(){return qe(this,$e,Be).size}get value(){var e;return null!=(e=[...qe(this,$e,Be)].join(" "))?e:""}set value(e){var t;e!==this.value&&(Ke(this,We,new Set),this.add(...null!=(t=null==e?void 0:e.split(" "))?t:[]))}toString(){return this.value}item(e){return[...qe(this,$e,Be)][e]}values(){return qe(this,$e,Be).values()}forEach(e,t){qe(this,$e,Be).forEach(e,t)}add(...e){var t,i;e.forEach((e=>qe(this,We).add(e))),(""!==this.value||(null==(t=qe(this,Oe))?void 0:t.hasAttribute(`${qe(this,He)}`)))&&(null==(i=qe(this,Oe))||i.setAttribute(`${qe(this,He)}`,`${this.value}`))}remove(...e){var t;e.forEach((e=>qe(this,We).delete(e))),null==(t=qe(this,Oe))||t.setAttribute(`${qe(this,He)}`,`${this.value}`)}contains(e){return qe(this,$e,Be).has(e)}toggle(e,t){return void 0!==t?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}Oe=new WeakMap,He=new WeakMap,Ve=new WeakMap,We=new WeakMap,$e=new WeakSet,Be=function(){return qe(this,We).size?qe(this,We):qe(this,Ve)};const Ye=(e="")=>{const[t,i,n]=e.split(":"),a=n?decodeURIComponent(n):void 0;return{kind:"cc"===t?l.CAPTIONS:l.SUBTITLES,language:i,label:a}},Ze=(e="",t={})=>((e="")=>e.split(/\s+/))(e).map((e=>{const i=Ye(e);return{...t,...i}})),ze=e=>e?Array.isArray(e)?e.map((e=>"string"==typeof e?Ye(e):e)):"string"==typeof e?Ze(e):[e]:[],Xe=({kind:e,label:t,language:i}={kind:"subtitles"})=>t?`${"captions"===e?"cc":"sb"}:${i}:${encodeURIComponent(t)}`:i,Je=(e=[])=>Array.prototype.map.call(e,Xe).join(" "),et=e=>{const t=Object.entries(e).map((([e,t])=>((e,t)=>i=>i[e]===t)(e,t)));return e=>t.every((t=>t(e)))},tt=(e,t=[],i=[])=>{const n=ze(i).map(et);Array.from(t).filter((e=>n.some((t=>t(e))))).forEach((t=>{t.mode=e}))},it=(e,t=()=>!0)=>{if(!(null==e?void 0:e.textTracks))return[];const i="function"==typeof t?t:et(t);return Array.from(e.textTracks).filter(i)},nt="exitFullscreen"in P?"exitFullscreen":"webkitExitFullscreen"in P?"webkitExitFullscreen":"webkitCancelFullScreen"in P?"webkitCancelFullScreen":void 0,at="fullscreenElement"in P?"fullscreenElement":"webkitFullscreenElement"in P?"webkitFullscreenElement":void 0,st=e=>{var t;const{media:i,documentElement:n,fullscreenElement:a=i}=e;if(!i||!n)return!1;const s=(e=>{const{documentElement:t,media:i}=e,n=null==t?void 0:t[at];return!n&&"webkitDisplayingFullscreen"in i&&"webkitPresentationMode"in i&&i.webkitDisplayingFullscreen&&i.webkitPresentationMode===m.FULLSCREEN?i:n})(e);if(!s)return!1;if(s===a||s===i)return!0;if(s.localName.includes("-")){let e=s.shadowRoot;if(!(at in e))return Q(s,a);for(;null==e?void 0:e[at];){if(e[at]===a)return!0;e=null==(t=e[at])?void 0:t.shadowRoot}}return!1},rt="fullscreenEnabled"in P?"fullscreenEnabled":"webkitFullscreenEnabled"in P?"webkitFullscreenEnabled":void 0;let ot;const lt=()=>{var e,t;return ot||(ot=null==(t=null==(e=P)?void 0:e.createElement)?void 0:t.call(e,"video"),ot)},dt=(e,t)=>new Promise((i=>{e.addEventListener("volumechange",(()=>i(!0)),{signal:t})})),ct=async(e,t)=>{for(let i=0;i<10;i++){if(e.volume===t)return!1;await g(10)}return e.volume!==t},ut=/.*Version\/.*Safari\/.*/.test(U.navigator.userAgent),ht=(e=lt())=>(!U.matchMedia("(display-mode: standalone)").matches||!ut)&&"function"==typeof(null==e?void 0:e.requestPictureInPicture),mt=(e=lt())=>(e=>{const{documentElement:t,media:i}=e;return!!(null==t?void 0:t[rt])||i&&"webkitSupportsFullscreen"in i})({documentElement:P,media:e}),pt=mt(),Et=ht(),vt=!!U.WebKitPlaybackTargetAvailabilityEvent,bt=!!U.chrome,gt=e=>it(e.media,(e=>[l.SUBTITLES,l.CAPTIONS].includes(e.kind))).sort(((e,t)=>e.kind>=t.kind?1:-1)),At=e=>it(e.media,(e=>e.mode===d.SHOWING&&[l.SUBTITLES,l.CAPTIONS].includes(e.kind))),ft=(e,t)=>{const i=gt(e),n=At(e),a=!!n.length;if(i.length)if(!1===t||a&&!0!==t)tt(d.DISABLED,i,n);else if(!0===t||!a&&!1!==t){let t=i[0];const{options:a}=e;if(!(null==a?void 0:a.noSubtitlesLangPref)){const e=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),n=e?[e,...globalThis.navigator.languages]:globalThis.navigator.languages,a=i.filter((e=>n.some((t=>e.language.toLowerCase().startsWith(t.split("-")[0]))))).sort(((e,t)=>n.findIndex((t=>e.language.toLowerCase().startsWith(t.split("-")[0])))-n.findIndex((e=>t.language.toLowerCase().startsWith(e.split("-")[0])))));a[0]&&(t=a[0])}const{language:s,label:r,kind:o}=t;tt(d.DISABLED,i,n),tt(d.SHOWING,i,[{language:s,label:r,kind:o}])}},It=(e,t)=>e===t||null!=e&&null!=t&&(typeof e==typeof t&&(!("number"!=typeof e||!Number.isNaN(e)||!Number.isNaN(t))||"object"==typeof e&&(Array.isArray(e)?wt(e,t):Object.entries(e).every((([e,i])=>e in t&&It(i,t[e])))))),wt=(e,t)=>{const i=Array.isArray(e),n=Array.isArray(t);return i===n&&(!i&&!n||e.length===t.length&&e.every(((e,i)=>It(e,t[i]))))},_t=Object.values(h);let yt;const Tt=(async(e=lt())=>{if(!e)return!1;const t=e.volume;e.volume=t/2+.1;const i=new AbortController,n=await Promise.race([dt(e,i.signal),ct(e,t)]);return i.abort(),n})().then((e=>(yt=e,yt))),Mt=new U.DOMParser,kt=e=>e&&Mt.parseFromString(e,"text/html").body.textContent||e,St={mediaError:{get(e,t){const{media:i}=e;if("playing"!==(null==t?void 0:t.type))return null==i?void 0:i.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(e,t){var i;const{media:n}=e;if("playing"!==(null==t?void 0:t.type))return null==(i=null==n?void 0:n.error)?void 0:i.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(e,t){var i,n;const{media:a}=e;if("playing"!==(null==t?void 0:t.type))return null!=(n=null==(i=null==a?void 0:a.error)?void 0:i.message)?n:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(e){var t;const{media:i}=e;return null!=(t=null==i?void 0:i.videoWidth)?t:0},mediaEvents:["resize"]},mediaHeight:{get(e){var t;const{media:i}=e;return null!=(t=null==i?void 0:i.videoHeight)?t:0},mediaEvents:["resize"]},mediaPaused:{get(e){var t;const{media:i}=e;return null==(t=null==i?void 0:i.paused)||t},set(e,t){var i;const{media:n}=t;n&&(e?n.pause():null==(i=n.play())||i.catch((()=>{})))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(e,t){const{media:i}=e;return!!i&&(t?"playing"===t.type:!i.paused)},mediaEvents:["playing","emptied"]},mediaEnded:{get(e){var t;const{media:i}=e;return null!=(t=null==i?void 0:i.ended)&&t},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(e){var t;const{media:i}=e;return null!=(t=null==i?void 0:i.playbackRate)?t:1},set(e,t){const{media:i}=t;i&&Number.isFinite(+e)&&(i.playbackRate=+e)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(e){var t;const{media:i}=e;return null!=(t=null==i?void 0:i.muted)&&t},set(e,t){const{media:i,options:{noMutedPref:n}={}}=t;if(i){if(!i.hasAttribute("muted")&&!n)try{U.localStorage.setItem("media-chrome-pref-muted",e?"true":"false")}catch(e){console.debug("Error setting muted pref",e)}i.muted=e}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(e,t)=>{const{options:{noMutedPref:i}}=t,{media:n}=t;if(n&&!n.muted&&!i)try{const i="true"===U.localStorage.getItem("media-chrome-pref-muted");St.mediaMuted.set(i,t),e(i)}catch(e){console.debug("Error getting muted pref",e)}}]},mediaVolume:{get(e){var t;const{media:i}=e;return null!=(t=null==i?void 0:i.volume)?t:1},set(e,t){const{media:i,options:{noVolumePref:n}={}}=t;if(i){try{null==e?U.localStorage.removeItem("media-chrome-pref-volume"):i.hasAttribute("muted")||n||U.localStorage.setItem("media-chrome-pref-volume",e.toString())}catch(e){console.debug("Error setting volume pref",e)}Number.isFinite(+e)&&(i.volume=+e)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(e,t)=>{const{options:{noVolumePref:i}}=t;if(!i)try{const{media:i}=t;if(!i)return;const n=U.localStorage.getItem("media-chrome-pref-volume");if(null==n)return;St.mediaVolume.set(+n,t),e(+n)}catch(e){console.debug("Error getting volume pref",e)}}]},mediaVolumeLevel:{get(e){const{media:t}=e;return void 0===(null==t?void 0:t.volume)?"high":t.muted||0===t.volume?"off":t.volume<.5?"low":t.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(e){var t;const{media:i}=e;return null!=(t=null==i?void 0:i.currentTime)?t:0},set(e,t){const{media:i}=t;i&&b(e)&&(i.currentTime=e)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(e){const{media:t,options:{defaultDuration:i}={}}=e;return!i||t&&t.duration&&!Number.isNaN(t.duration)&&Number.isFinite(t.duration)?Number.isFinite(null==t?void 0:t.duration)?t.duration:Number.NaN:i},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(e){const{media:t}=e;return(null==t?void 0:t.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(e){var t;const{media:i}=e;if(!(null==(t=null==i?void 0:i.seekable)?void 0:t.length))return;const n=i.seekable.start(0),a=i.seekable.end(i.seekable.length-1);return n||a?[Number(n.toFixed(3)),Number(a.toFixed(3))]:void 0},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(e){var t;const{media:i}=e,n=null!=(t=null==i?void 0:i.buffered)?t:[];return Array.from(n).map(((e,t)=>[Number(n.start(t).toFixed(3)),Number(n.end(t).toFixed(3))]))},mediaEvents:["progress","emptied"]},mediaStreamType:{get(e){const{media:t,options:{defaultStreamType:i}={}}=e,n=[h.LIVE,h.ON_DEMAND].includes(i)?i:void 0;if(!t)return n;const{streamType:a}=t;if(_t.includes(a))return a===h.UNKNOWN?n:a;const s=t.duration;return s===1/0?h.LIVE:Number.isFinite(s)?h.ON_DEMAND:n},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(e){const{media:t}=e;if(!t)return Number.NaN;const{targetLiveWindow:i}=t,n=St.mediaStreamType.get(e);return null!=i&&!Number.isNaN(i)||n!==h.LIVE?i:0},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(e){const{media:t,options:{liveEdgeOffset:i=10}={}}=e;if(!t)return!1;if("number"==typeof t.liveEdgeStart)return!Number.isNaN(t.liveEdgeStart)&&t.currentTime>=t.liveEdgeStart;if(!(St.mediaStreamType.get(e)===h.LIVE))return!1;const n=t.seekable;if(!n)return!0;if(!n.length)return!1;const a=n.end(n.length-1)-i;return t.currentTime>=a},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get:e=>gt(e).map((({kind:e,label:t,language:i})=>({kind:e,label:t,language:i}))),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get:e=>At(e).map((({kind:e,label:t,language:i})=>({kind:e,label:t,language:i}))),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{var i,n;const{media:a,options:s}=t;if(!a)return;const r=e=>{var i;if(!s.defaultSubtitles)return;e&&![l.CAPTIONS,l.SUBTITLES].includes(null==(i=null==e?void 0:e.track)?void 0:i.kind)||ft(t,!0)};return a.addEventListener("loadstart",r),null==(i=a.textTracks)||i.addEventListener("addtrack",r),null==(n=a.textTracks)||n.addEventListener("removetrack",r),()=>{var e,t;a.removeEventListener("loadstart",r),null==(e=a.textTracks)||e.removeEventListener("addtrack",r),null==(t=a.textTracks)||t.removeEventListener("removetrack",r)}}]},mediaChaptersCues:{get(e){var t;const{media:i}=e;if(!i)return[];const[n]=it(i,{kind:l.CHAPTERS});return Array.from(null!=(t=null==n?void 0:n.cues)?t:[]).map((({text:e,startTime:t,endTime:i})=>({text:kt(e),startTime:t,endTime:i})))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{var i;const{media:n}=t;if(!n)return;const a=n.querySelector('track[kind="chapters"][default][src]'),s=null==(i=n.shadowRoot)?void 0:i.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return null==a||a.addEventListener("load",e),null==s||s.addEventListener("load",e),()=>{null==a||a.removeEventListener("load",e),null==s||s.removeEventListener("load",e)}}]},mediaIsPip:{get(e){var t,i;const{media:n,documentElement:a}=e;if(!n||!a)return!1;if(!a.pictureInPictureElement)return!1;if(a.pictureInPictureElement===n)return!0;if(a.pictureInPictureElement instanceof HTMLMediaElement)return!!(null==(t=n.localName)?void 0:t.includes("-"))&&Q(n,a.pictureInPictureElement);if(a.pictureInPictureElement.localName.includes("-")){let e=a.pictureInPictureElement.shadowRoot;for(;null==e?void 0:e.pictureInPictureElement;){if(e.pictureInPictureElement===n)return!0;e=null==(i=e.pictureInPictureElement)?void 0:i.shadowRoot}}return!1},set(e,t){const{media:i}=t;if(i)if(e){if(!P.pictureInPictureEnabled)return void console.warn("MediaChrome: Picture-in-picture is not enabled");if(!i.requestPictureInPicture)return void console.warn("MediaChrome: The current media does not support picture-in-picture");const e=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};i.requestPictureInPicture().catch((t=>{if(11!==t.code)throw t;if(i.src){if(0!==i.readyState||"none"!==i.preload)throw t;{const t=()=>{i.removeEventListener("loadedmetadata",n),i.preload="none"},n=()=>{i.requestPictureInPicture().catch(e),t()};i.addEventListener("loadedmetadata",n),i.preload="metadata",setTimeout((()=>{0===i.readyState&&e(),t()}),1e3)}}else console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.")}))}else P.pictureInPictureElement&&P.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(e){var t;const{media:i}=e;return[...null!=(t=null==i?void 0:i.videoRenditions)?t:[]].map((e=>({...e})))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(e){var t,i,n;const{media:a}=e;return null==(n=null==(i=null==a?void 0:a.videoRenditions)?void 0:i[null==(t=a.videoRenditions)?void 0:t.selectedIndex])?void 0:n.id},set(e,t){const{media:i}=t;if(!(null==i?void 0:i.videoRenditions))return void console.warn("MediaController: Rendition selection not supported by this media.");const n=e,a=Array.prototype.findIndex.call(i.videoRenditions,(e=>e.id==n));i.videoRenditions.selectedIndex!=a&&(i.videoRenditions.selectedIndex=a)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(e){var t;const{media:i}=e;return[...null!=(t=null==i?void 0:i.audioTracks)?t:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(e){var t,i;const{media:n}=e;return null==(i=[...null!=(t=null==n?void 0:n.audioTracks)?t:[]].find((e=>e.enabled)))?void 0:i.id},set(e,t){const{media:i}=t;if(!(null==i?void 0:i.audioTracks))return void console.warn("MediaChrome: Audio track selection not supported by this media.");const n=e;for(const e of i.audioTracks)e.enabled=n==e.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get:e=>st(e),set(e,t){e?(e=>{var t;const{media:i,fullscreenElement:n}=e;try{const e=n&&"requestFullscreen"in n?"requestFullscreen":n&&"webkitRequestFullScreen"in n?"webkitRequestFullScreen":void 0;if(e){const i=null==(t=n[e])?void 0:t.call(n);if(i instanceof Promise)return i.catch((()=>{}))}else(null==i?void 0:i.webkitEnterFullscreen)?i.webkitEnterFullscreen():(null==i?void 0:i.requestFullscreen)&&i.requestFullscreen()}catch(e){console.error(e)}})(t):(e=>{var t;const{documentElement:i}=e;if(nt){const e=null==(t=null==i?void 0:i[nt])?void 0:t.call(i);if(e instanceof Promise)e.catch((()=>{}))}})(t)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(e){var t;const{media:i}=e;return!(!(null==i?void 0:i.remote)||"disconnected"===(null==(t=i.remote)?void 0:t.state))&&!!i.remote.state},set(e,t){var i,n;const{media:a}=t;a&&(e&&"disconnected"!==(null==(i=a.remote)?void 0:i.state)||(e||"connected"===(null==(n=a.remote)?void 0:n.state))&&("function"==typeof a.remote.prompt?a.remote.prompt().catch((()=>{})):console.warn("MediaChrome: Casting is not supported in this environment")))},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get:()=>!1,set(e,t){const{media:i}=t;i&&(i.webkitShowPlaybackTargetPicker&&U.WebKitPlaybackTargetAvailabilityEvent?i.webkitShowPlaybackTargetPicker():console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment"))},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(e){const{media:t}=e;if(!pt||!mt(t))return u.UNSUPPORTED}},mediaPipUnavailable:{get(e){const{media:t}=e;return Et&&ht(t)?(null==t?void 0:t.disablePictureInPicture)?u.UNAVAILABLE:void 0:u.UNSUPPORTED}},mediaVolumeUnavailable:{get(e){const{media:t}=e;if(!1===yt||null==(null==t?void 0:t.volume))return u.UNSUPPORTED},stateOwnersUpdateHandlers:[e=>{null==yt&&Tt.then((t=>e(t?void 0:u.UNSUPPORTED)))}]},mediaCastUnavailable:{get(e,{availability:t="not-available"}={}){var i;const{media:n}=e;return bt&&(null==(i=null==n?void 0:n.remote)?void 0:i.state)?null!=t&&"available"!==t?u.UNAVAILABLE:void 0:u.UNSUPPORTED},stateOwnersUpdateHandlers:[(e,t)=>{var i;const{media:n}=t;if(!n)return;return n.disableRemotePlayback||n.hasAttribute("disableremoteplayback")||null==(i=null==n?void 0:n.remote)||i.watchAvailability((t=>{e({availability:t?"available":"not-available"})})).catch((t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})})),()=>{var e;null==(e=null==n?void 0:n.remote)||e.cancelWatchAvailability().catch((()=>{}))}}]},mediaAirplayUnavailable:{get:(e,t)=>vt?"not-available"===(null==t?void 0:t.availability)?u.UNAVAILABLE:void 0:u.UNSUPPORTED,mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(e,t)=>{var i;const{media:n}=t;if(!n)return;return n.disableRemotePlayback||n.hasAttribute("disableremoteplayback")||null==(i=null==n?void 0:n.remote)||i.watchAvailability((t=>{e({availability:t?"available":"not-available"})})).catch((t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})})),()=>{var e;null==(e=null==n?void 0:n.remote)||e.cancelWatchAvailability().catch((()=>{}))}}]},mediaRenditionUnavailable:{get(e){var t;const{media:i}=e;return(null==i?void 0:i.videoRenditions)?(null==(t=i.videoRenditions)?void 0:t.length)?void 0:u.UNAVAILABLE:u.UNSUPPORTED},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(e){var t,i;const{media:n}=e;return(null==n?void 0:n.audioTracks)?(null!=(i=null==(t=n.audioTracks)?void 0:t.length)?i:0)<=1?u.UNAVAILABLE:void 0:u.UNSUPPORTED},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(e){const{options:{mediaLang:t}={}}=e;return null!=t?t:"en"}}},Lt={[e.MEDIA_PREVIEW_REQUEST](e,t,{detail:i}){var n,a,s;const{media:r}=t,o=null!=i?i:void 0;let d,c;if(r&&null!=o){const[e]=it(r,{kind:l.METADATA,label:"thumbnails"}),t=Array.prototype.find.call(null!=(n=null==e?void 0:e.cues)?n:[],((e,t,i)=>0===t?e.endTime>o:t===i.length-1?e.startTime<=o:e.startTime<=o&&e.endTime>o));if(t){const e=/'^(?:[a-z]+:)?\/\//i.test(t.text)||null==(a=null==r?void 0:r.querySelector('track[label="thumbnails"]'))?void 0:a.src,i=new URL(t.text,e);c=new URLSearchParams(i.hash).get("#xywh").split(",").map((e=>+e)),d=i.href}}const u=e.mediaDuration.get(t);let h=null==(s=e.mediaChaptersCues.get(t).find(((e,t,i)=>t===i.length-1&&u===e.endTime?e.startTime<=o&&e.endTime>=o:e.startTime<=o&&e.endTime>o)))?void 0:s.text;return null!=i&&null==h&&(h=""),{mediaPreviewTime:o,mediaPreviewImage:d,mediaPreviewCoords:c,mediaPreviewChapter:h}},[e.MEDIA_PAUSE_REQUEST](e,t){e.mediaPaused.set(!0,t)},[e.MEDIA_PLAY_REQUEST](e,t){var i,n,a,s;const r=e.mediaStreamType.get(t)===h.LIVE,o=!(null==(i=t.options)?void 0:i.noAutoSeekToLive),l=e.mediaTargetLiveWindow.get(t)>0;if(r&&o&&!l){const i=null==(n=e.mediaSeekable.get(t))?void 0:n[1];if(i){const n=i-(null!=(s=null==(a=t.options)?void 0:a.seekToLiveOffset)?s:0);e.mediaCurrentTime.set(n,t)}}e.mediaPaused.set(!1,t)},[e.MEDIA_PLAYBACK_RATE_REQUEST](e,t,{detail:i}){const n=i;e.mediaPlaybackRate.set(n,t)},[e.MEDIA_MUTE_REQUEST](e,t){e.mediaMuted.set(!0,t)},[e.MEDIA_UNMUTE_REQUEST](e,t){e.mediaVolume.get(t)||e.mediaVolume.set(.25,t),e.mediaMuted.set(!1,t)},[e.MEDIA_VOLUME_REQUEST](e,t,{detail:i}){const n=i;n&&e.mediaMuted.get(t)&&e.mediaMuted.set(!1,t),e.mediaVolume.set(n,t)},[e.MEDIA_SEEK_REQUEST](e,t,{detail:i}){const n=i;e.mediaCurrentTime.set(n,t)},[e.MEDIA_SEEK_TO_LIVE_REQUEST](e,t){var i,n,a;const s=null==(i=e.mediaSeekable.get(t))?void 0:i[1];if(Number.isNaN(Number(s)))return;const r=s-(null!=(a=null==(n=t.options)?void 0:n.seekToLiveOffset)?a:0);e.mediaCurrentTime.set(r,t)},[e.MEDIA_SHOW_SUBTITLES_REQUEST](e,t,{detail:i}){var n;const{options:a}=t,s=gt(t),r=ze(i),o=null==(n=r[0])?void 0:n.language;o&&!a.noSubtitlesLangPref&&U.localStorage.setItem("media-chrome-pref-subtitles-lang",o),tt(d.SHOWING,s,r)},[e.MEDIA_DISABLE_SUBTITLES_REQUEST](e,t,{detail:i}){const n=gt(t);tt(d.DISABLED,n,null!=i?i:[])},[e.MEDIA_TOGGLE_SUBTITLES_REQUEST](e,t,{detail:i}){ft(t,i)},[e.MEDIA_RENDITION_REQUEST](e,t,{detail:i}){const n=i;e.mediaRenditionSelected.set(n,t)},[e.MEDIA_AUDIO_TRACK_REQUEST](e,t,{detail:i}){const n=i;e.mediaAudioTrackEnabled.set(n,t)},[e.MEDIA_ENTER_PIP_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsPip.set(!0,t)},[e.MEDIA_EXIT_PIP_REQUEST](e,t){e.mediaIsPip.set(!1,t)},[e.MEDIA_ENTER_FULLSCREEN_REQUEST](e,t){e.mediaIsPip.get(t)&&e.mediaIsPip.set(!1,t),e.mediaIsFullscreen.set(!0,t)},[e.MEDIA_EXIT_FULLSCREEN_REQUEST](e,t){e.mediaIsFullscreen.set(!1,t)},[e.MEDIA_ENTER_CAST_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsCasting.set(!0,t)},[e.MEDIA_EXIT_CAST_REQUEST](e,t){e.mediaIsCasting.set(!1,t)},[e.MEDIA_AIRPLAY_REQUEST](e,t){e.mediaIsAirplaying.set(!0,t)}},Rt=({media:e,fullscreenElement:t,documentElement:i,stateMediator:n=St,requestMap:a=Lt,options:s={},monitorStateOwnersOnlyWithSubscriptions:r=!0})=>{const o=[],l={options:{...s}};let d=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0});const c=e=>{null!=e&&(It(e,d)||(d=Object.freeze({...d,...e}),o.forEach((e=>e(d)))))},u=()=>{const e=Object.entries(n).reduce(((e,[t,{get:i}])=>(e[t]=i(l),e)),{});c(e)},h={};let m;const p=async(e,t)=>{var i,a,s,d,p,E,v,b,g,A,f,I,w,_,y,T;const M=!!m;if(m={...l,...null!=m?m:{},...e},M)return;await(async(...e)=>{await Promise.all(e.filter((e=>e)).map((async e=>{if(!("localName"in e&&e instanceof U.HTMLElement))return;const t=e.localName;if(!t.includes("-"))return;const i=U.customElements.get(t);i&&e instanceof i||(await U.customElements.whenDefined(t),U.customElements.upgrade(e))})))})(...Object.values(e));const k=o.length>0&&0===t&&r,S=l.media!==m.media,L=(null==(i=l.media)?void 0:i.textTracks)!==(null==(a=m.media)?void 0:a.textTracks),R=(null==(s=l.media)?void 0:s.videoRenditions)!==(null==(d=m.media)?void 0:d.videoRenditions),D=(null==(p=l.media)?void 0:p.audioTracks)!==(null==(E=m.media)?void 0:E.audioTracks),C=(null==(v=l.media)?void 0:v.remote)!==(null==(b=m.media)?void 0:b.remote),x=l.documentElement!==m.documentElement,N=!!l.media&&(S||k),P=!!(null==(g=l.media)?void 0:g.textTracks)&&(L||k),O=!!(null==(A=l.media)?void 0:A.videoRenditions)&&(R||k),H=!!(null==(f=l.media)?void 0:f.audioTracks)&&(D||k),V=!!(null==(I=l.media)?void 0:I.remote)&&(C||k),W=!!l.documentElement&&(x||k),$=N||P||O||H||V||W,B=0===o.length&&1===t&&r,G=!!m.media&&(S||B),F=!!(null==(w=m.media)?void 0:w.textTracks)&&(L||B),q=!!(null==(_=m.media)?void 0:_.videoRenditions)&&(R||B),Q=!!(null==(y=m.media)?void 0:y.audioTracks)&&(D||B),K=!!(null==(T=m.media)?void 0:T.remote)&&(C||B),j=!!m.documentElement&&(x||B),Y=G||F||q||Q||K||j;if(!($||Y))return Object.entries(m).forEach((([e,t])=>{l[e]=t})),u(),void(m=void 0);Object.entries(n).forEach((([e,{get:t,mediaEvents:i=[],textTracksEvents:n=[],videoRenditionsEvents:a=[],audioTracksEvents:s=[],remoteEvents:r=[],rootEvents:o=[],stateOwnersUpdateHandlers:d=[]}])=>{h[e]||(h[e]={});const u=i=>{const n=t(l,i);c({[e]:n})};let p;p=h[e].mediaEvents,i.forEach((t=>{p&&N&&(l.media.removeEventListener(t,p),h[e].mediaEvents=void 0),G&&(m.media.addEventListener(t,u),h[e].mediaEvents=u)})),p=h[e].textTracksEvents,n.forEach((t=>{var i,n;p&&P&&(null==(i=l.media.textTracks)||i.removeEventListener(t,p),h[e].textTracksEvents=void 0),F&&(null==(n=m.media.textTracks)||n.addEventListener(t,u),h[e].textTracksEvents=u)})),p=h[e].videoRenditionsEvents,a.forEach((t=>{var i,n;p&&O&&(null==(i=l.media.videoRenditions)||i.removeEventListener(t,p),h[e].videoRenditionsEvents=void 0),q&&(null==(n=m.media.videoRenditions)||n.addEventListener(t,u),h[e].videoRenditionsEvents=u)})),p=h[e].audioTracksEvents,s.forEach((t=>{var i,n;p&&H&&(null==(i=l.media.audioTracks)||i.removeEventListener(t,p),h[e].audioTracksEvents=void 0),Q&&(null==(n=m.media.audioTracks)||n.addEventListener(t,u),h[e].audioTracksEvents=u)})),p=h[e].remoteEvents,r.forEach((t=>{var i,n;p&&V&&(null==(i=l.media.remote)||i.removeEventListener(t,p),h[e].remoteEvents=void 0),K&&(null==(n=m.media.remote)||n.addEventListener(t,u),h[e].remoteEvents=u)})),p=h[e].rootEvents,o.forEach((t=>{p&&W&&(l.documentElement.removeEventListener(t,p),h[e].rootEvents=void 0),j&&(m.documentElement.addEventListener(t,u),h[e].rootEvents=u)}));const E=h[e].stateOwnersUpdateHandlers;d.forEach((t=>{E&&$&&E(),Y&&(h[e].stateOwnersUpdateHandlers=t(u,m))}))})),Object.entries(m).forEach((([e,t])=>{l[e]=t})),u(),m=void 0};return p({media:e,fullscreenElement:t,documentElement:i,options:s}),{dispatch(e){const{type:t,detail:i}=e;a[t]&&null==d.mediaErrorCode?c(a[t](n,l,e)):"mediaelementchangerequest"===t?p({media:i}):"fullscreenelementchangerequest"===t?p({fullscreenElement:i}):"documentelementchangerequest"===t?p({documentElement:i}):"optionschangerequest"===t&&(Object.entries(null!=i?i:{}).forEach((([e,t])=>{l.options[e]=t})),u())},getState:()=>d,subscribe:e=>(p({},o.length+1),o.push(e),e(d),()=>{const t=o.indexOf(e);t>=0&&(p({},o.length-1),o.splice(t,1))})}};var Dt,Ct,xt,Nt,Ut,Pt,Ot,Ht,Vt,Wt,$t,Bt,Gt=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ft=(e,t,i)=>(Gt(e,t,"read from private field"),i?i.call(e):t.get(e)),qt=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Qt=(e,t,i,n)=>(Gt(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),Kt=(e,t,i)=>(Gt(e,t,"access private method"),i);const jt=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],Yt="defaultsubtitles",Zt="defaultstreamtype",zt="defaultduration",Xt="fullscreenelement",Jt="hotkeys",ei="keysused",ti="liveedgeoffset",ii="seektoliveoffset",ni="noautoseektolive",ai="nohotkeys",si="novolumepref",ri="nomutedpref",oi="nosubtitleslangpref",li="nodefaultstore",di="keyboardforwardseekoffset",ci="keyboardbackwardseekoffset",ui="lang";class hi extends Pe{constructor(){super(),qt(this,Ot),qt(this,Vt),qt(this,$t),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,qt(this,Dt,new je(this,Jt)),qt(this,Ct,void 0),qt(this,xt,void 0),qt(this,Nt,void 0),qt(this,Ut,void 0),qt(this,Pt,(e=>{var t;null==(t=Ft(this,xt))||t.dispatch(e)})),this.associateElement(this);let e={};Qt(this,Nt,(t=>{Object.entries(t).forEach((([t,i])=>{if(t in e&&e[t]===i)return;this.propagateMediaState(t,i);const n=t.toLowerCase(),a=new U.CustomEvent(o[n],{composed:!0,detail:i});this.dispatchEvent(a)})),e=t})),this.hasAttribute(ai)?this.disableHotkeys():this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(ai,Jt,Zt,Yt,zt,ui)}get mediaStore(){return Ft(this,xt)}set mediaStore(e){var t,i;Ft(this,xt)&&(null==(t=Ft(this,Ut))||t.call(this),Qt(this,Ut,void 0)),Qt(this,xt,e),Ft(this,xt)||this.hasAttribute(li)?Qt(this,Ut,null==(i=Ft(this,xt))?void 0:i.subscribe(Ft(this,Nt))):Kt(this,Ot,Ht).call(this)}get fullscreenElement(){var e;return null!=(e=Ft(this,Ct))?e:this}set fullscreenElement(e){var t;this.hasAttribute(Xt)&&this.removeAttribute(Xt),Qt(this,Ct,e),null==(t=Ft(this,xt))||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return J(this,Yt)}set defaultSubtitles(e){ee(this,Yt,e)}get defaultStreamType(){return te(this,Zt)}set defaultStreamType(e){ie(this,Zt,e)}get defaultDuration(){return z(this,zt)}set defaultDuration(e){X(this,zt,e)}get noHotkeys(){return J(this,ai)}set noHotkeys(e){ee(this,ai,e)}get keysUsed(){return te(this,ei)}set keysUsed(e){ie(this,ei,e)}get liveEdgeOffset(){return z(this,ti)}set liveEdgeOffset(e){X(this,ti,e)}get noAutoSeekToLive(){return J(this,ni)}set noAutoSeekToLive(e){ee(this,ni,e)}get noVolumePref(){return J(this,si)}set noVolumePref(e){ee(this,si,e)}get noMutedPref(){return J(this,ri)}set noMutedPref(e){ee(this,ri,e)}get noSubtitlesLangPref(){return J(this,oi)}set noSubtitlesLangPref(e){ee(this,oi,e)}get noDefaultStore(){return J(this,li)}set noDefaultStore(e){ee(this,li,e)}attributeChangedCallback(e,t,i){var n,a,s,r,o,l,d,c,u;if(super.attributeChangedCallback(e,t,i),e===ai)i!==t&&""===i?(this.hasAttribute(Jt)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):i!==t&&null===i&&this.enableHotkeys();else if(e===Jt)Ft(this,Dt).value=i;else if(e===Yt&&i!==t)null==(n=Ft(this,xt))||n.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(Yt)}});else if(e===Zt)null==(s=Ft(this,xt))||s.dispatch({type:"optionschangerequest",detail:{defaultStreamType:null!=(a=this.getAttribute(Zt))?a:void 0}});else if(e===ti)null==(r=Ft(this,xt))||r.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(ti)?+this.getAttribute(ti):void 0,seekToLiveOffset:this.hasAttribute(ii)?void 0:+this.getAttribute(ti)}});else if(e===ii)null==(o=Ft(this,xt))||o.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(ii)?+this.getAttribute(ii):void 0}});else if(e===ni)null==(l=Ft(this,xt))||l.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(ni)}});else if(e===Xt){const e=i?null==(d=this.getRootNode())?void 0:d.getElementById(i):void 0;Qt(this,Ct,e),null==(c=Ft(this,xt))||c.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===ui&&i!==t&&(M=i,null==(u=Ft(this,xt))||u.dispatch({type:"optionschangerequest",detail:{mediaLang:i}}))}connectedCallback(){var e,t;Ft(this,xt)||this.hasAttribute(li)||Kt(this,Ot,Ht).call(this),null==(e=Ft(this,xt))||e.dispatch({type:"documentelementchangerequest",detail:P}),super.connectedCallback(),Ft(this,xt)&&!Ft(this,Ut)&&Qt(this,Ut,null==(t=Ft(this,xt))?void 0:t.subscribe(Ft(this,Nt))),this.hasAttribute(ai)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var t,i,n,a;null==(t=super.disconnectedCallback)||t.call(this),Ft(this,xt)&&(null==(i=Ft(this,xt))||i.dispatch({type:"documentelementchangerequest",detail:void 0}),null==(n=Ft(this,xt))||n.dispatch({type:e.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),Ft(this,Ut)&&(null==(a=Ft(this,Ut))||a.call(this),Qt(this,Ut,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),null==(t=Ft(this,xt))||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),null==(t=Ft(this,xt))||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){fi(this.mediaStateReceivers,e,t)}associateElement(t){if(!t)return;const{associatedElementSubscriptions:i}=this;if(i.has(t))return;const n=this.registerMediaStateReceiver.bind(this),a=this.unregisterMediaStateReceiver.bind(this),s=Ii(t,n,a);Object.values(e).forEach((e=>{t.addEventListener(e,Ft(this,Pt))})),i.set(t,s)}unassociateElement(t){if(!t)return;const{associatedElementSubscriptions:i}=this;if(!i.has(t))return;i.get(t)(),i.delete(t),Object.values(e).forEach((e=>{t.removeEventListener(e,Ft(this,Pt))}))}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),Ft(this,xt)&&Object.entries(Ft(this,xt).getState()).forEach((([t,i])=>{fi([e],t,i)})))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,i=t.indexOf(e);i<0||t.splice(i,1)}enableHotkeys(){this.addEventListener("keydown",Kt(this,$t,Bt))}disableHotkeys(){this.removeEventListener("keydown",Kt(this,$t,Bt)),this.removeEventListener("keyup",Kt(this,Vt,Wt))}get hotkeys(){return te(this,Jt)}set hotkeys(e){ie(this,Jt,e)}keyboardShortcutHandler(t){var i,n,a,s,r;const o=t.target;if((null!=(a=null!=(n=null==(i=o.getAttribute(ei))?void 0:i.split(" "))?n:null==o?void 0:o.keysUsed)?a:[]).map((e=>"Space"===e?" ":e)).filter(Boolean).includes(t.key))return;let l,d,c;if(!(Ft(this,Dt).contains(`no${t.key.toLowerCase()}`)||" "===t.key&&Ft(this,Dt).contains("nospace")))switch(t.key){case" ":case"k":l=Ft(this,xt).getState().mediaPaused?e.MEDIA_PLAY_REQUEST:e.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new U.CustomEvent(l,{composed:!0,bubbles:!0}));break;case"m":l="off"===this.mediaStore.getState().mediaVolumeLevel?e.MEDIA_UNMUTE_REQUEST:e.MEDIA_MUTE_REQUEST,this.dispatchEvent(new U.CustomEvent(l,{composed:!0,bubbles:!0}));break;case"f":l=this.mediaStore.getState().mediaIsFullscreen?e.MEDIA_EXIT_FULLSCREEN_REQUEST:e.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new U.CustomEvent(l,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new U.CustomEvent(e.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{const t=this.hasAttribute(ci)?+this.getAttribute(ci):10;d=Math.max((null!=(s=this.mediaStore.getState().mediaCurrentTime)?s:0)-t,0),c=new U.CustomEvent(e.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:d}),this.dispatchEvent(c);break}case"ArrowRight":{const t=this.hasAttribute(di)?+this.getAttribute(di):10;d=Math.max((null!=(r=this.mediaStore.getState().mediaCurrentTime)?r:0)+t,0),c=new U.CustomEvent(e.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:d}),this.dispatchEvent(c);break}}}}Dt=new WeakMap,Ct=new WeakMap,xt=new WeakMap,Nt=new WeakMap,Ut=new WeakMap,Pt=new WeakMap,Ot=new WeakSet,Ht=function(){var e;this.mediaStore=Rt({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(Yt),defaultDuration:this.hasAttribute(zt)?+this.getAttribute(zt):void 0,defaultStreamType:null!=(e=this.getAttribute(Zt))?e:void 0,liveEdgeOffset:this.hasAttribute(ti)?+this.getAttribute(ti):void 0,seekToLiveOffset:this.hasAttribute(ii)?+this.getAttribute(ii):this.hasAttribute(ti)?+this.getAttribute(ti):void 0,noAutoSeekToLive:this.hasAttribute(ni),noVolumePref:this.hasAttribute(si),noMutedPref:this.hasAttribute(ri),noSubtitlesLangPref:this.hasAttribute(oi)}})},Vt=new WeakSet,Wt=function(e){const{key:t}=e;jt.includes(t)?this.keyboardShortcutHandler(e):this.removeEventListener("keyup",Kt(this,Vt,Wt))},$t=new WeakSet,Bt=function(e){const{metaKey:t,altKey:i,key:n}=e;t||i||!jt.includes(n)?this.removeEventListener("keyup",Kt(this,Vt,Wt)):([" ","ArrowLeft","ArrowRight"].includes(n)&&!(Ft(this,Dt).contains(`no${n.toLowerCase()}`)||" "===n&&Ft(this,Dt).contains("nospace"))&&e.preventDefault(),this.addEventListener("keyup",Kt(this,Vt,Wt),{once:!0}))};const mi=Object.values(a),pi=Object.values(i),Ei=e=>{var i,n,a,s;let{observedAttributes:r}=e.constructor;!r&&(null==(i=e.nodeName)?void 0:i.includes("-"))&&(U.customElements.upgrade(e),({observedAttributes:r}=e.constructor));const o=null==(s=null==(a=null==(n=null==e?void 0:e.getAttribute)?void 0:n.call(e,t.MEDIA_CHROME_ATTRIBUTES))?void 0:a.split)?void 0:s.call(a,/\s+/);return Array.isArray(r||o)?(r||o).filter((e=>mi.includes(e))):[]},vi=e=>(e=>{var t,i;return!(null==(t=e.nodeName)?void 0:t.includes("-"))||!U.customElements.get(null==(i=e.nodeName)?void 0:i.toLowerCase())||e instanceof U.customElements.get(e.nodeName.toLowerCase())||U.customElements.upgrade(e),pi.some((t=>t in e))})(e)||!!Ei(e).length,bi=e=>{var t;return null==(t=null==e?void 0:e.join)?void 0:t.call(e,":")},gi={[a.MEDIA_SUBTITLES_LIST]:Je,[a.MEDIA_SUBTITLES_SHOWING]:Je,[a.MEDIA_SEEKABLE]:bi,[a.MEDIA_BUFFERED]:e=>null==e?void 0:e.map(bi).join(" "),[a.MEDIA_PREVIEW_COORDS]:e=>null==e?void 0:e.join(" "),[a.MEDIA_RENDITION_LIST]:function(e){return null==e?void 0:e.map(E).join(" ")},[a.MEDIA_AUDIO_TRACK_LIST]:function(e){return null==e?void 0:e.map(v).join(" ")}},Ai=(e,t)=>{if((e=>{var t;return!!(null==(t=e.closest)?void 0:t.call(e,'*[slot="media"]'))})(e))return;const i=(e,t)=>{var i,n;vi(e)&&t(e);const{children:a=[]}=null!=e?e:{};[...a,...null!=(n=null==(i=null==e?void 0:e.shadowRoot)?void 0:i.children)?n:[]].forEach((e=>Ai(e,t)))},n=null==e?void 0:e.nodeName.toLowerCase();!n.includes("-")||vi(e)?i(e,t):U.customElements.whenDefined(n).then((()=>{i(e,t)}))},fi=(e,t,i)=>{e.forEach((e=>{if(t in e)return void(e[t]=i);const n=Ei(e),a=t.toLowerCase();n.includes(a)&&(async(e,t,i)=>{var n,a;if(e.isConnected||await g(0),"boolean"==typeof i||null==i)return ee(e,t,i);if("number"==typeof i)return X(e,t,i);if("string"==typeof i)return ie(e,t,i);if(Array.isArray(i)&&!i.length)return e.removeAttribute(t);const s=null!=(a=null==(n=gi[t])?void 0:n.call(gi,i))?a:i;e.setAttribute(t,s)})(e,a,i)}))},Ii=(i,n,a)=>{Ai(i,n);const s=e=>{var t;const i=null!=(t=null==e?void 0:e.composedPath()[0])?t:e.target;n(i)},r=e=>{var t;const i=null!=(t=null==e?void 0:e.composedPath()[0])?t:e.target;a(i)};i.addEventListener(e.REGISTER_MEDIA_STATE_RECEIVER,s),i.addEventListener(e.UNREGISTER_MEDIA_STATE_RECEIVER,r);let o=[];const l=e=>{const t=e.target;"media"!==t.name&&(o.forEach((e=>Ai(e,a))),o=[...t.assignedElements({flatten:!0})],o.forEach((e=>Ai(e,n))))};i.addEventListener("slotchange",l);const d=new MutationObserver((e=>{e.forEach((e=>{const{addedNodes:i=[],removedNodes:s=[],type:r,target:o,attributeName:l}=e;"childList"===r?(Array.prototype.forEach.call(i,(e=>Ai(e,n))),Array.prototype.forEach.call(s,(e=>Ai(e,a)))):"attributes"===r&&l===t.MEDIA_CHROME_ATTRIBUTES&&(vi(o)?n(o):a(o))}))}));d.observe(i,{childList:!0,attributes:!0,subtree:!0});return()=>{Ai(i,a),i.removeEventListener("slotchange",l),d.disconnect(),i.removeEventListener(e.REGISTER_MEDIA_STATE_RECEIVER,s),i.removeEventListener(e.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};U.customElements.get("media-controller")||U.customElements.define("media-controller",hi);var wi=hi;const _i="placement",yi="bounds";class Ti extends U.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!Y(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;const t=this.placement;if("left"===t||"right"===t)return void this.style.removeProperty("--media-tooltip-offset-x");const i=getComputedStyle(this),n=null!=(e=K(this,"#"+this.bounds))?e:G(this);if(!n)return;const{x:a,width:s}=n.getBoundingClientRect(),{x:r,width:o}=this.getBoundingClientRect(),l=r+o,d=a+s,c=i.getPropertyValue("--media-tooltip-offset-x"),u=c?parseFloat(c.replace("px","")):0,h=i.getPropertyValue("--media-tooltip-container-margin"),m=h?parseFloat(h.replace("px","")):0,p=r-a+u-m,E=l-d+u+m;p<0?this.style.setProperty("--media-tooltip-offset-x",`${p}px`):E>0?this.style.setProperty("--media-tooltip-offset-x",`${E}px`):this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){const e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[_i,yi]}get placement(){return te(this,_i)}set placement(e){ie(this,_i,e)}get bounds(){return te(this,yi)}set bounds(e){ie(this,yi,e)}}Ti.shadowRootOptions={mode:"open"},Ti.getTemplateHTML=function(e){return'\n \n \n
\n '},U.customElements.get("media-tooltip")||U.customElements.define("media-tooltip",Ti);var Mi,ki,Si,Li,Ri,Di,Ci,xi=Ti,Ni=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ui=(e,t,i)=>(Ni(e,t,"read from private field"),i?i.call(e):t.get(e)),Pi=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Oi=(e,t,i,n)=>(Ni(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);const Hi="tooltipplacement",Vi="disabled",Wi="notooltip";class $i extends U.HTMLElement{constructor(){if(super(),Pi(this,Di),Pi(this,Mi,void 0),this.preventClick=!1,this.tooltipEl=null,Pi(this,ki,(e=>{this.preventClick||this.handleClick(e),setTimeout(Ui(this,Si),0)})),Pi(this,Si,(()=>{var e,t;null==(t=null==(e=this.tooltipEl)?void 0:e.updateXOffset)||t.call(e)})),Pi(this,Li,(e=>{const{key:t}=e;this.keysUsed.includes(t)?this.preventClick||this.handleClick(e):this.removeEventListener("keyup",Ui(this,Li))})),Pi(this,Ri,(e=>{const{metaKey:t,altKey:i,key:n}=e;t||i||!this.keysUsed.includes(n)?this.removeEventListener("keyup",Ui(this,Li)):this.addEventListener("keyup",Ui(this,Li),{once:!0})})),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",Hi,t.MEDIA_CONTROLLER,a.MEDIA_LANG]}enable(){this.addEventListener("click",Ui(this,ki)),this.addEventListener("keydown",Ui(this,Ri)),this.tabIndex=0}disable(){this.removeEventListener("click",Ui(this,ki)),this.removeEventListener("keydown",Ui(this,Ri)),this.removeEventListener("keyup",Ui(this,Li)),this.tabIndex=-1}attributeChangedCallback(e,i,n){var s,r,o,l,d;e===t.MEDIA_CONTROLLER?(i&&(null==(r=null==(s=Ui(this,Mi))?void 0:s.unassociateElement)||r.call(s,this),Oi(this,Mi,null)),n&&this.isConnected&&(Oi(this,Mi,null==(o=this.getRootNode())?void 0:o.getElementById(n)),null==(d=null==(l=Ui(this,Mi))?void 0:l.associateElement)||d.call(l,this))):"disabled"===e&&n!==i?null==n?this.enable():this.disable():e===Hi&&this.tooltipEl&&n!==i?this.tooltipEl.placement=n:e===a.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),Ui(this,Si).call(this)}connectedCallback(){var e,i,n;const{style:a}=Z(this.shadowRoot,":host");a.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");const s=this.getAttribute(t.MEDIA_CONTROLLER);s&&(Oi(this,Mi,null==(e=this.getRootNode())?void 0:e.getElementById(s)),null==(n=null==(i=Ui(this,Mi))?void 0:i.associateElement)||n.call(i,this)),U.customElements.whenDefined("media-tooltip").then((()=>{return(e=this,t=Di,i=Ci,Ni(e,t,"access private method"),i).call(this);var e,t,i}))}disconnectedCallback(){var e,t;this.disable(),null==(t=null==(e=Ui(this,Mi))?void 0:e.unassociateElement)||t.call(e,this),Oi(this,Mi,null),this.removeEventListener("mouseenter",Ui(this,Si)),this.removeEventListener("focus",Ui(this,Si)),this.removeEventListener("click",Ui(this,ki))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return te(this,Hi)}set tooltipPlacement(e){ie(this,Hi,e)}get mediaController(){return te(this,t.MEDIA_CONTROLLER)}set mediaController(e){ie(this,t.MEDIA_CONTROLLER,e)}get disabled(){return J(this,Vi)}set disabled(e){ee(this,Vi,e)}get noTooltip(){return J(this,Wi)}set noTooltip(e){ee(this,Wi,e)}handleClick(e){}}Mi=new WeakMap,ki=new WeakMap,Si=new WeakMap,Li=new WeakMap,Ri=new WeakMap,Di=new WeakSet,Ci=function(){this.addEventListener("mouseenter",Ui(this,Si)),this.addEventListener("focus",Ui(this,Si)),this.addEventListener("click",Ui(this,ki));const e=this.tooltipPlacement;e&&this.tooltipEl&&(this.tooltipEl.placement=e)},$i.shadowRootOptions={mode:"open"},$i.getTemplateHTML=function(e,t={}){return`\n \n\n ${this.getSlotTemplateHTML(e,t)}\n\n \n \n \n `},$i.getSlotTemplateHTML=function(e,t){return"\n \n "},$i.getTooltipContentHTML=function(){return""},U.customElements.get("media-chrome-button")||U.customElements.define("media-chrome-button",$i);var Bi=$i;const Gi='\n';const Fi=e=>{const t=e.mediaIsAirplaying?k("stop airplay"):k("start airplay");e.setAttribute("aria-label",t)};class qi extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_IS_AIRPLAYING,a.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Fi(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===a.MEDIA_IS_AIRPLAYING&&Fi(this)}get mediaIsAirplaying(){return J(this,a.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){ee(this,a.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return te(this,a.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){ie(this,a.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const t=new U.CustomEvent(e.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(t)}}qi.getSlotTemplateHTML=function(e){return`\n \n\n \n ${Gi}\n ${Gi}\n \n `},qi.getTooltipContentHTML=function(){return`\n ${k("start airplay")}\n ${k("stop airplay")}\n `},U.customElements.get("media-airplay-button")||U.customElements.define("media-airplay-button",qi);var Qi=qi;const Ki=e=>{e.setAttribute("aria-checked",(e=>{var t;return!!(null==(t=e.mediaSubtitlesShowing)?void 0:t.length)||e.hasAttribute(a.MEDIA_SUBTITLES_SHOWING)})(e).toString())};class ji extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_SUBTITLES_LIST,a.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",k("closed captions")),Ki(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===a.MEDIA_SUBTITLES_SHOWING&&Ki(this)}get mediaSubtitlesList(){return Yi(this,a.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){Zi(this,a.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return Yi(this,a.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){Zi(this,a.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new U.CustomEvent(e.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}ji.getSlotTemplateHTML=function(e){return'\n \n\n \n \n \n \n '},ji.getTooltipContentHTML=function(){return`\n ${k("Enable captions")}\n ${k("Disable captions")}\n `};const Yi=(e,t)=>{const i=e.getAttribute(t);return i?Ze(i):[]},Zi=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);const n=Je(i);e.getAttribute(t)!==n&&e.setAttribute(t,n)};U.customElements.get("media-captions-button")||U.customElements.define("media-captions-button",ji);var zi=ji;const Xi=e=>{const t=e.mediaIsCasting?k("stop casting"):k("start casting");e.setAttribute("aria-label",t)};class Ji extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_IS_CASTING,a.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Xi(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===a.MEDIA_IS_CASTING&&Xi(this)}get mediaIsCasting(){return J(this,a.MEDIA_IS_CASTING)}set mediaIsCasting(e){ee(this,a.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return te(this,a.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){ie(this,a.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const t=this.mediaIsCasting?e.MEDIA_EXIT_CAST_REQUEST:e.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new U.CustomEvent(t,{composed:!0,bubbles:!0}))}}Ji.getSlotTemplateHTML=function(e){return`\n \n\n \n \n \n \n `},Ji.getTooltipContentHTML=function(){return`\n ${k("Start casting")}\n ${k("Stop casting")}\n `},U.customElements.get("media-cast-button")||U.customElements.define("media-cast-button",Ji);var en,tn,nn,an,sn,rn,on,ln,dn,cn,un,hn,mn,pn,En,vn=Ji,bn=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gn=(e,t,i)=>(bn(e,t,"read from private field"),i?i.call(e):t.get(e)),An=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},fn=(e,t,i,n)=>(bn(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),In=(e,t,i)=>(bn(e,t,"access private method"),i);const wn="open",_n="anchor";class yn extends U.HTMLElement{constructor(){super(),An(this,an),An(this,rn),An(this,ln),An(this,cn),An(this,hn),An(this,pn),An(this,en,!1),An(this,tn,null),An(this,nn,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[wn,_n]}get open(){return J(this,wn)}set open(e){ee(this,wn,e)}handleEvent(e){switch(e.type){case"invoke":In(this,cn,un).call(this,e);break;case"focusout":In(this,hn,mn).call(this,e);break;case"keydown":In(this,pn,En).call(this,e)}}connectedCallback(){In(this,an,sn).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,i){In(this,an,sn).call(this),e===wn&&i!==t&&(this.open?In(this,rn,on).call(this):In(this,ln,dn).call(this))}focus(){fn(this,tn,j());const e=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),t=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(e||t)return;const i=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');null==i||i.focus()}get keysUsed(){return["Escape","Tab"]}}en=new WeakMap,tn=new WeakMap,nn=new WeakMap,an=new WeakSet,sn=function(){if(!gn(this,en)&&(fn(this,en,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e),queueMicrotask((()=>{const{style:e}=Z(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")}))}},rn=new WeakSet,on=function(){var e;null==(e=gn(this,nn))||e.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",(()=>this.focus()),{once:!0})},ln=new WeakSet,dn=function(){var e;null==(e=gn(this,nn))||e.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))},cn=new WeakSet,un=function(e){fn(this,nn,e.relatedTarget),Q(this,e.relatedTarget)||(this.open=!this.open)},hn=new WeakSet,mn=function(e){var t;Q(this,e.relatedTarget)||(null==(t=gn(this,tn))||t.focus(),gn(this,nn)&&gn(this,nn)!==e.relatedTarget&&this.open&&(this.open=!1))},pn=new WeakSet,En=function(e){var t,i,n,a,s;const{key:r,ctrlKey:o,altKey:l,metaKey:d}=e;o||l||d||this.keysUsed.includes(r)&&(e.preventDefault(),e.stopPropagation(),"Tab"===r?(e.shiftKey?null==(i=null==(t=this.previousElementSibling)?void 0:t.focus)||i.call(t):null==(a=null==(n=this.nextElementSibling)?void 0:n.focus)||a.call(n),this.blur()):"Escape"===r&&(null==(s=gn(this,tn))||s.focus(),this.open=!1))},yn.shadowRootOptions={mode:"open"},yn.getTemplateHTML=function(e){return`\n \n ${this.getSlotTemplateHTML(e)}\n `},yn.getSlotTemplateHTML=function(e){return'\n \n '},U.customElements.get("media-chrome-dialog")||U.customElements.define("media-chrome-dialog",yn);var Tn,Mn,kn,Sn,Ln,Rn,Dn,Cn,xn,Nn,Un,Pn,On,Hn,Vn,Wn,$n,Bn,Gn,Fn,qn,Qn,Kn,jn,Yn,Zn=yn,zn=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Xn=(e,t,i)=>(zn(e,t,"read from private field"),i?i.call(e):t.get(e)),Jn=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},ea=(e,t,i,n)=>(zn(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),ta=(e,t,i)=>(zn(e,t,"access private method"),i);class ia extends U.HTMLElement{constructor(){if(super(),Jn(this,Nn),Jn(this,Pn),Jn(this,Hn),Jn(this,Wn),Jn(this,Bn),Jn(this,Fn),Jn(this,Qn),Jn(this,jn),Jn(this,Tn,void 0),Jn(this,Mn,void 0),Jn(this,kn,void 0),Jn(this,Sn,void 0),Jn(this,Ln,{}),Jn(this,Rn,[]),Jn(this,Dn,(()=>{if(this.range.matches(":focus-visible")){const{style:e}=Z(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}})),Jn(this,Cn,(()=>{const{style:e}=Z(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")})),Jn(this,xn,(()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)})),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),ea(this,kn,this.shadowRoot.querySelector("#startpoint")),ea(this,Sn,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",t.MEDIA_CONTROLLER]}attributeChangedCallback(e,i,n){var a,s,r,o,l;e===t.MEDIA_CONTROLLER?(i&&(null==(s=null==(a=Xn(this,Tn))?void 0:a.unassociateElement)||s.call(a,this),ea(this,Tn,null)),n&&this.isConnected&&(ea(this,Tn,null==(r=this.getRootNode())?void 0:r.getElementById(n)),null==(l=null==(o=Xn(this,Tn))?void 0:o.associateElement)||l.call(o,this))):("disabled"===e||"aria-disabled"===e&&i!==n)&&(null==n?(this.range.removeAttribute(e),ta(this,Pn,On).call(this)):(this.range.setAttribute(e,n),ta(this,Hn,Vn).call(this)))}connectedCallback(){var e,i,n;const{style:a}=Z(this.shadowRoot,":host");a.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Xn(this,Ln).pointer=Z(this.shadowRoot,"#pointer"),Xn(this,Ln).progress=Z(this.shadowRoot,"#progress"),Xn(this,Ln).thumb=Z(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),Xn(this,Ln).activeSegment=Z(this.shadowRoot,"#segments-clipping rect:nth-child(0)");const s=this.getAttribute(t.MEDIA_CONTROLLER);s&&(ea(this,Tn,null==(e=this.getRootNode())?void 0:e.getElementById(s)),null==(n=null==(i=Xn(this,Tn))?void 0:i.associateElement)||n.call(i,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Xn(this,Dn)),this.shadowRoot.addEventListener("focusout",Xn(this,Cn)),ta(this,Pn,On).call(this),W(this.container,Xn(this,xn))}disconnectedCallback(){var e,t;ta(this,Hn,Vn).call(this),null==(t=null==(e=Xn(this,Tn))?void 0:e.unassociateElement)||t.call(e,this),ea(this,Tn,null),this.shadowRoot.removeEventListener("focusin",Xn(this,Dn)),this.shadowRoot.removeEventListener("focusout",Xn(this,Cn)),$(this.container,Xn(this,xn))}updatePointerBar(e){var t;null==(t=Xn(this,Ln).pointer)||t.style.setProperty("width",100*this.getPointerRatio(e)+"%")}updateBar(){var e,t;const i=100*this.range.valueAsNumber;null==(e=Xn(this,Ln).progress)||e.style.setProperty("width",`${i}%`),null==(t=Xn(this,Ln).thumb)||t.style.setProperty("left",`${i}%`)}updateSegments(e){const t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!(null==e?void 0:e.length)),!(null==e?void 0:e.length))return;const i=[...new Set([+this.range.min,...e.flatMap((e=>[e.start,e.end])),+this.range.max])];ea(this,Rn,[...i]);const n=i.pop();for(const[e,a]of i.entries()){const[s,r]=[0===e,e===i.length-1],o=s?"calc(var(--segments-gap) / -1)":100*a+"%",l=`calc(${100*((r?n:i[e+1])-a)}%${s||r?"":" - var(--segments-gap)"})`,d=P.createElementNS("http://www.w3.org/2000/svg","rect"),c=Z(this.shadowRoot,`#segments-clipping rect:nth-child(${e+1})`);c.style.setProperty("x",o),c.style.setProperty("width",l),t.append(d)}}getPointerRatio(e){return function(e,t,i,n){const a=n.x-i.x,s=n.y-i.y,r=a*a+s*s;if(0===r)return 0;const o=((e-i.x)*a+(t-i.y)*s)/r;return Math.max(0,Math.min(1,o))}(e.clientX,e.clientY,Xn(this,kn).getBoundingClientRect(),Xn(this,Sn).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":ta(this,jn,Yn).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":ta(this,Bn,Gn).call(this,e);break;case"pointerdown":ta(this,Wn,$n).call(this,e);break;case"pointerup":ta(this,Fn,qn).call(this);break;case"pointerleave":ta(this,Qn,Kn).call(this)}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}Tn=new WeakMap,Mn=new WeakMap,kn=new WeakMap,Sn=new WeakMap,Ln=new WeakMap,Rn=new WeakMap,Dn=new WeakMap,Cn=new WeakMap,xn=new WeakMap,Nn=new WeakSet,Un=function(e){const t=Xn(this,Ln).activeSegment;if(!t)return;const i=this.getPointerRatio(e),n=`#segments-clipping rect:nth-child(${Xn(this,Rn).findIndex(((e,t,n)=>{const a=n[t+1];return null!=a&&i>=e&&i<=a}))+1})`;t.selectorText==n&&t.style.transform||(t.selectorText=n,t.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))},Pn=new WeakSet,On=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))},Hn=new WeakSet,Vn=function(){var e,t;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),null==(e=U.window)||e.removeEventListener("pointerup",this),null==(t=U.window)||t.removeEventListener("pointermove",this)},Wn=new WeakSet,$n=function(e){var t;ea(this,Mn,e.composedPath().includes(this.range)),null==(t=U.window)||t.addEventListener("pointerup",this)},Bn=new WeakSet,Gn=function(e){var t;"mouse"!==e.pointerType&&ta(this,Wn,$n).call(this,e),this.addEventListener("pointerleave",this),null==(t=U.window)||t.addEventListener("pointermove",this)},Fn=new WeakSet,qn=function(){var e;null==(e=U.window)||e.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")},Qn=new WeakSet,Kn=function(){var e,t;this.removeEventListener("pointerleave",this),null==(e=U.window)||e.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),null==(t=Xn(this,Ln).activeSegment)||t.style.removeProperty("transform")},jn=new WeakSet,Yn=function(e){this.toggleAttribute("dragging",1===e.buttons||"mouse"!==e.pointerType),this.updatePointerBar(e),ta(this,Nn,Un).call(this,e),!this.dragging||"mouse"===e.pointerType&&Xn(this,Mn)||(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(e),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))},ia.shadowRootOptions={mode:"open"},ia.getTemplateHTML=function(e){return'\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n \n
\n
\n '},U.customElements.get("media-chrome-range")||U.customElements.define("media-chrome-range",ia);var na,aa=ia,sa=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},ra=(e,t,i)=>(sa(e,t,"read from private field"),i?i.call(e):t.get(e)),oa=(e,t,i,n)=>(sa(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class la extends U.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,na,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[t.MEDIA_CONTROLLER]}attributeChangedCallback(e,i,n){var a,s,r,o,l;e===t.MEDIA_CONTROLLER&&(i&&(null==(s=null==(a=ra(this,na))?void 0:a.unassociateElement)||s.call(a,this),oa(this,na,null)),n&&this.isConnected&&(oa(this,na,null==(r=this.getRootNode())?void 0:r.getElementById(n)),null==(l=null==(o=ra(this,na))?void 0:o.associateElement)||l.call(o,this)))}connectedCallback(){var e,i,n;const a=this.getAttribute(t.MEDIA_CONTROLLER);a&&(oa(this,na,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(n=null==(i=ra(this,na))?void 0:i.associateElement)||n.call(i,this))}disconnectedCallback(){var e,t;null==(t=null==(e=ra(this,na))?void 0:e.unassociateElement)||t.call(e,this),oa(this,na,null)}}na=new WeakMap,la.shadowRootOptions={mode:"open"},la.getTemplateHTML=function(e){return'\n \n\n \n '},U.customElements.get("media-control-bar")||U.customElements.define("media-control-bar",la);var da,ca=la,ua=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},ha=(e,t,i)=>(ua(e,t,"read from private field"),i?i.call(e):t.get(e)),ma=(e,t,i,n)=>(ua(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class pa extends U.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,da,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[t.MEDIA_CONTROLLER]}attributeChangedCallback(e,i,n){var a,s,r,o,l;e===t.MEDIA_CONTROLLER&&(i&&(null==(s=null==(a=ha(this,da))?void 0:a.unassociateElement)||s.call(a,this),ma(this,da,null)),n&&this.isConnected&&(ma(this,da,null==(r=this.getRootNode())?void 0:r.getElementById(n)),null==(l=null==(o=ha(this,da))?void 0:o.associateElement)||l.call(o,this)))}connectedCallback(){var e,i,n;const{style:a}=Z(this.shadowRoot,":host");a.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const s=this.getAttribute(t.MEDIA_CONTROLLER);s&&(ma(this,da,null==(e=this.getRootNode())?void 0:e.getElementById(s)),null==(n=null==(i=ha(this,da))?void 0:i.associateElement)||n.call(i,this))}disconnectedCallback(){var e,t;null==(t=null==(e=ha(this,da))?void 0:e.unassociateElement)||t.call(e,this),ma(this,da,null)}}da=new WeakMap,pa.shadowRootOptions={mode:"open"},pa.getTemplateHTML=function(e,t={}){return`\n \n\n ${this.getSlotTemplateHTML(e,t)}\n `},pa.getSlotTemplateHTML=function(e,t){return"\n \n "},U.customElements.get("media-text-display")||U.customElements.define("media-text-display",pa);var Ea,va=pa,ba=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},ga=(e,t,i)=>(ba(e,t,"read from private field"),i?i.call(e):t.get(e));class Aa extends pa{constructor(){var e,t,i,n,a;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,Ea,void 0),t=this,i=Ea,n=this.shadowRoot.querySelector("slot"),ba(t,i,"write to private field"),a?a.call(t,n):i.set(t,n),ga(this,Ea).textContent=I(null!=(e=this.mediaDuration)?e:0)}static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_DURATION]}attributeChangedCallback(e,t,i){e===a.MEDIA_DURATION&&(ga(this,Ea).textContent=I(+i)),super.attributeChangedCallback(e,t,i)}get mediaDuration(){return z(this,a.MEDIA_DURATION)}set mediaDuration(e){X(this,a.MEDIA_DURATION,e)}}Ea=new WeakMap,Aa.getSlotTemplateHTML=function(e,t){return`\n ${I(t.mediaDuration)}\n `},U.customElements.get("media-duration-display")||U.customElements.define("media-duration-display",Aa);var fa=Aa;const Ia={2:k("Network Error"),3:k("Decode Error"),4:k("Source Not Supported"),5:k("Encryption Error")},wa={2:k("A network error caused the media download to fail."),3:k("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:k("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:k("The media is encrypted and there are no keys to decrypt it.")},_a=e=>{var t,i;return 1===e.code?null:{title:null!=(t=Ia[e.code])?t:`Error ${e.code}`,message:null!=(i=wa[e.code])?i:e.message}};var ya,Ta=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};function Ma(e){var t;const{title:i,message:n}=null!=(t=_a(e))?t:{};let a="";return i&&(a+=`

${i}

`),n&&(a+=`

${n}

`),a}const ka=[a.MEDIA_ERROR_CODE,a.MEDIA_ERROR_MESSAGE];class Sa extends yn{constructor(){super(...arguments),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,ya,null)}static get observedAttributes(){return[...super.observedAttributes,...ka]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,i){var n;if(super.attributeChangedCallback(e,t,i),!ka.includes(e))return;const a=null!=(n=this.mediaError)?n:{code:this.mediaErrorCode,message:this.mediaErrorMessage};var s;this.open=(s=a).code&&null!==_a(s),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(a))}get mediaError(){return Ta(e=this,t=ya,"read from private field"),i?i.call(e):t.get(e);var e,t,i}set mediaError(e){((e,t,i,n)=>{Ta(e,t,"write to private field"),n?n.call(e,i):t.set(e,i)})(this,ya,e)}get mediaErrorCode(){return z(this,"mediaerrorcode")}set mediaErrorCode(e){X(this,"mediaerrorcode",e)}get mediaErrorMessage(){return te(this,"mediaerrormessage")}set mediaErrorMessage(e){ie(this,"mediaerrormessage",e)}}ya=new WeakMap,Sa.getSlotTemplateHTML=function(e){return`\n \n \n ${Ma({code:+e.mediaerrorcode,message:e.mediaerrormessage})}\n \n `},Sa.formatErrorMessage=Ma,U.customElements.get("media-error-dialog")||U.customElements.define("media-error-dialog",Sa);var La=Sa;const Ra=e=>{const t=e.mediaIsFullscreen?k("exit fullscreen mode"):k("enter fullscreen mode");e.setAttribute("aria-label",t)};class Da extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_IS_FULLSCREEN,a.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Ra(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===a.MEDIA_IS_FULLSCREEN&&Ra(this)}get mediaFullscreenUnavailable(){return te(this,a.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){ie(this,a.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return J(this,a.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){ee(this,a.MEDIA_IS_FULLSCREEN,e)}handleClick(){const t=this.mediaIsFullscreen?e.MEDIA_EXIT_FULLSCREEN_REQUEST:e.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new U.CustomEvent(t,{composed:!0,bubbles:!0}))}}Da.getSlotTemplateHTML=function(e){return`\n \n\n \n \n \n \n `},Da.getTooltipContentHTML=function(){return`\n ${k("Enter fullscreen mode")}\n ${k("Exit fullscreen mode")}\n `},U.customElements.get("media-fullscreen-button")||U.customElements.define("media-fullscreen-button",Da);var Ca=Da;const{MEDIA_TIME_IS_LIVE:xa,MEDIA_PAUSED:Na}=a,{MEDIA_SEEK_TO_LIVE_REQUEST:Ua,MEDIA_PLAY_REQUEST:Pa}=e;const Oa=e=>{var t;const i=e.mediaPaused||!e.mediaTimeIsLive,n=k(i?"seek to live":"playing live");e.setAttribute("aria-label",n);const a=null==(t=e.shadowRoot)?void 0:t.querySelector('slot[name="text"]');a&&(a.textContent=k("live")),i?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true")};class Ha extends $i{static get observedAttributes(){return[...super.observedAttributes,xa,Na]}connectedCallback(){super.connectedCallback(),Oa(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),Oa(this)}get mediaPaused(){return J(this,a.MEDIA_PAUSED)}set mediaPaused(e){ee(this,a.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return J(this,a.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){ee(this,a.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new U.CustomEvent(Ua,{composed:!0,bubbles:!0})),this.hasAttribute(Na)&&this.dispatchEvent(new U.CustomEvent(Pa,{composed:!0,bubbles:!0})))}}Ha.getSlotTemplateHTML=function(e){return`\n \n\n \n \n  ${k("live")}\n `},U.customElements.get("media-live-button")||U.customElements.define("media-live-button",Ha);var Va,Wa,$a=Ha,Ba=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ga=(e,t,i)=>(Ba(e,t,"read from private field"),i?i.call(e):t.get(e)),Fa=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},qa=(e,t,i,n)=>(Ba(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);const Qa="loadingdelay",Ka="noautohide";class ja extends U.HTMLElement{constructor(){if(super(),Fa(this,Va,void 0),Fa(this,Wa,500),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[t.MEDIA_CONTROLLER,a.MEDIA_PAUSED,a.MEDIA_LOADING,Qa]}attributeChangedCallback(e,i,n){var a,s,r,o,l;e===Qa&&i!==n?this.loadingDelay=Number(n):e===t.MEDIA_CONTROLLER&&(i&&(null==(s=null==(a=Ga(this,Va))?void 0:a.unassociateElement)||s.call(a,this),qa(this,Va,null)),n&&this.isConnected&&(qa(this,Va,null==(r=this.getRootNode())?void 0:r.getElementById(n)),null==(l=null==(o=Ga(this,Va))?void 0:o.associateElement)||l.call(o,this)))}connectedCallback(){var e,i,n;const a=this.getAttribute(t.MEDIA_CONTROLLER);a&&(qa(this,Va,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(n=null==(i=Ga(this,Va))?void 0:i.associateElement)||n.call(i,this))}disconnectedCallback(){var e,t;null==(t=null==(e=Ga(this,Va))?void 0:e.unassociateElement)||t.call(e,this),qa(this,Va,null)}get loadingDelay(){return Ga(this,Wa)}set loadingDelay(e){qa(this,Wa,e);const{style:t}=Z(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return J(this,a.MEDIA_PAUSED)}set mediaPaused(e){ee(this,a.MEDIA_PAUSED,e)}get mediaLoading(){return J(this,a.MEDIA_LOADING)}set mediaLoading(e){ee(this,a.MEDIA_LOADING,e)}get mediaController(){return te(this,t.MEDIA_CONTROLLER)}set mediaController(e){ie(this,t.MEDIA_CONTROLLER,e)}get noAutohide(){return J(this,Ka)}set noAutohide(e){ee(this,Ka,e)}}Va=new WeakMap,Wa=new WeakMap,ja.shadowRootOptions={mode:"open"},ja.getTemplateHTML=function(e){return`\n \n\n \n\n\n
${k("media loading")}
\n `},U.customElements.get("media-loading-indicator")||U.customElements.define("media-loading-indicator",ja);var Ya=ja;const Za='';const za=e=>{const t="off"===e.mediaVolumeLevel,i=k(t?"unmute":"mute");e.setAttribute("aria-label",i)};class Xa extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),za(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===a.MEDIA_VOLUME_LEVEL&&za(this)}get mediaVolumeLevel(){return te(this,a.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){ie(this,a.MEDIA_VOLUME_LEVEL,e)}handleClick(){const t="off"===this.mediaVolumeLevel?e.MEDIA_UNMUTE_REQUEST:e.MEDIA_MUTE_REQUEST;this.dispatchEvent(new U.CustomEvent(t,{composed:!0,bubbles:!0}))}}Xa.getSlotTemplateHTML=function(e){return`\n \n\n \n \n ${Za}\n ${Za}\n \n \n `},Xa.getTooltipContentHTML=function(){return`\n ${k("Mute")}\n ${k("Unmute")}\n `},U.customElements.get("media-mute-button")||U.customElements.define("media-mute-button",Xa);var Ja=Xa;const es='';const ts=e=>{const t=e.mediaIsPip?k("exit picture in picture mode"):k("enter picture in picture mode");e.setAttribute("aria-label",t)};class is extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_IS_PIP,a.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),ts(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===a.MEDIA_IS_PIP&&ts(this)}get mediaPipUnavailable(){return te(this,a.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){ie(this,a.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return J(this,a.MEDIA_IS_PIP)}set mediaIsPip(e){ee(this,a.MEDIA_IS_PIP,e)}handleClick(){const t=this.mediaIsPip?e.MEDIA_EXIT_PIP_REQUEST:e.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new U.CustomEvent(t,{composed:!0,bubbles:!0}))}}is.getSlotTemplateHTML=function(e){return`\n \n\n \n ${es}\n ${es}\n \n `},is.getTooltipContentHTML=function(){return`\n ${k("Enter picture in picture mode")}\n ${k("Exit picture in picture mode")}\n `},U.customElements.get("media-pip-button")||U.customElements.define("media-pip-button",is);var ns,as=is,ss=(e,t,i)=>(((e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)})(e,t,"read from private field"),i?i.call(e):t.get(e));const rs="rates",os=[1,1.2,1.5,1.7,2];class ls extends $i{constructor(){var e;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,ns,new je(this,rs,{defaultValue:os})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${null!=(e=this.mediaPlaybackRate)?e:1}x`}static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_PLAYBACK_RATE,rs]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===rs&&(ss(this,ns).value=i),e===a.MEDIA_PLAYBACK_RATE){const e=i?+i:Number.NaN,t=Number.isNaN(e)?1:e;this.container.innerHTML=`${t}x`,this.setAttribute("aria-label",k("Playback rate {playbackRate}",{playbackRate:t}))}}get rates(){return ss(this,ns)}set rates(e){e?Array.isArray(e)?ss(this,ns).value=e.join(" "):"string"==typeof e&&(ss(this,ns).value=e):ss(this,ns).value=""}get mediaPlaybackRate(){return z(this,a.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){X(this,a.MEDIA_PLAYBACK_RATE,e)}handleClick(){var t,i;const n=Array.from(ss(this,ns).values(),(e=>+e)).sort(((e,t)=>e-t)),a=null!=(i=null!=(t=n.find((e=>e>this.mediaPlaybackRate)))?t:n[0])?i:1,s=new U.CustomEvent(e.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:a});this.dispatchEvent(s)}}ns=new WeakMap,ls.getSlotTemplateHTML=function(e){return`\n \n ${e.mediaplaybackrate||1}x\n `},ls.getTooltipContentHTML=function(){return k("Playback rate")},U.customElements.get("media-playback-rate-button")||U.customElements.define("media-playback-rate-button",ls);var ds=ls;const cs=e=>{const t=e.mediaPaused?k("play"):k("pause");e.setAttribute("aria-label",t)};class us extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_PAUSED,a.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),cs(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e!==a.MEDIA_PAUSED&&e!==a.MEDIA_LANG||cs(this)}get mediaPaused(){return J(this,a.MEDIA_PAUSED)}set mediaPaused(e){ee(this,a.MEDIA_PAUSED,e)}handleClick(){const t=this.mediaPaused?e.MEDIA_PLAY_REQUEST:e.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new U.CustomEvent(t,{composed:!0,bubbles:!0}))}}us.getSlotTemplateHTML=function(e){return`\n \n\n \n \n \n \n `},us.getTooltipContentHTML=function(){return`\n ${k("Play")}\n ${k("Pause")}\n `},U.customElements.get("media-play-button")||U.customElements.define("media-play-button",us);var hs=us;const ms="placeholdersrc",ps="src";class Es extends U.HTMLElement{static get observedAttributes(){return[ms,ps]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,i){e===ps&&(null==i?this.image.removeAttribute(ps):this.image.setAttribute(ps,i)),e===ms&&(null==i?this.image.style.removeProperty("background-image"):((e,t)=>{e.style["background-image"]=`url('${t}')`})(this.image,i))}get placeholderSrc(){return te(this,ms)}set placeholderSrc(e){ie(this,ps,e)}get src(){return te(this,ps)}set src(e){ie(this,ps,e)}}Es.shadowRootOptions={mode:"open"},Es.getTemplateHTML=function(e){return'\n \n\n \n '},U.customElements.get("media-poster-image")||U.customElements.define("media-poster-image",Es);var vs,bs=Es,gs=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};class As extends pa{constructor(){var e,t,i,n;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,vs,void 0),e=this,t=vs,i=this.shadowRoot.querySelector("slot"),gs(e,t,"write to private field"),n?n.call(e,i):t.set(e,i)}static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_PREVIEW_CHAPTER,a.MEDIA_LANG]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),(e===a.MEDIA_PREVIEW_CHAPTER||e===a.MEDIA_LANG)&&i!==t&&null!=i)if((n=this,s=vs,gs(n,s,"read from private field"),r?r.call(n):s.get(n)).textContent=i,""!==i){const e=k("chapter: {chapterName}",{chapterName:i});this.setAttribute("aria-valuetext",e)}else this.removeAttribute("aria-valuetext");var n,s,r}get mediaPreviewChapter(){return te(this,a.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){ie(this,a.MEDIA_PREVIEW_CHAPTER,e)}}vs=new WeakMap,U.customElements.get("media-preview-chapter-display")||U.customElements.define("media-preview-chapter-display",As);var fs,Is=As,ws=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},_s=(e,t,i)=>(ws(e,t,"read from private field"),i?i.call(e):t.get(e)),ys=(e,t,i,n)=>(ws(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class Ts extends U.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,fs,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=B(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[t.MEDIA_CONTROLLER,a.MEDIA_PREVIEW_IMAGE,a.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,i,n;const a=this.getAttribute(t.MEDIA_CONTROLLER);a&&(ys(this,fs,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(n=null==(i=_s(this,fs))?void 0:i.associateElement)||n.call(i,this))}disconnectedCallback(){var e,t;null==(t=null==(e=_s(this,fs))?void 0:e.unassociateElement)||t.call(e,this),ys(this,fs,null)}attributeChangedCallback(e,i,n){var s,r,o,l,d;[a.MEDIA_PREVIEW_IMAGE,a.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===t.MEDIA_CONTROLLER&&(i&&(null==(r=null==(s=_s(this,fs))?void 0:s.unassociateElement)||r.call(s,this),ys(this,fs,null)),n&&this.isConnected&&(ys(this,fs,null==(o=this.getRootNode())?void 0:o.getElementById(n)),null==(d=null==(l=_s(this,fs))?void 0:l.associateElement)||d.call(l,this)))}get mediaPreviewImage(){return te(this,a.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){ie(this,a.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(a.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map((e=>+e))}set mediaPreviewCoords(e){e?this.setAttribute(a.MEDIA_PREVIEW_COORDS,e.join(" ")):this.removeAttribute(a.MEDIA_PREVIEW_COORDS)}update(){const e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!e||!t)return;const[i,n,a,s]=e,r=t.split("#")[0],o=getComputedStyle(this),{maxWidth:l,maxHeight:d,minWidth:c,minHeight:u}=o,h=Math.min(parseInt(l)/a,parseInt(d)/s),m=Math.max(parseInt(c)/a,parseInt(u)/s),p=h<1,E=p?h:m>1?m:1,{style:v}=Z(this.shadowRoot,":host"),b=Z(this.shadowRoot,"img").style,g=this.shadowRoot.querySelector("img"),A=p?"min":"max";v.setProperty(`${A}-width`,"initial","important"),v.setProperty(`${A}-height`,"initial","important"),v.width=a*E+"px",v.height=s*E+"px";const f=()=>{b.width=this.imgWidth*E+"px",b.height=this.imgHeight*E+"px",b.display="block"};g.src!==r&&(g.onload=()=>{this.imgWidth=g.naturalWidth,this.imgHeight=g.naturalHeight,f()},g.src=r,f()),f(),b.transform=`translate(-${i*E}px, -${n*E}px)`}}fs=new WeakMap,Ts.shadowRootOptions={mode:"open"},Ts.getTemplateHTML=function(e){return'\n \n \n '},U.customElements.get("media-preview-thumbnail")||U.customElements.define("media-preview-thumbnail",Ts);var Ms,ks=Ts,Ss=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ls=(e,t,i)=>(Ss(e,t,"read from private field"),i?i.call(e):t.get(e));class Rs extends pa{constructor(){var e,t,i,n;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,Ms,void 0),e=this,t=Ms,i=this.shadowRoot.querySelector("slot"),Ss(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),Ls(this,Ms).textContent=I(0)}static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===a.MEDIA_PREVIEW_TIME&&null!=i&&(Ls(this,Ms).textContent=I(parseFloat(i)))}get mediaPreviewTime(){return z(this,a.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){X(this,a.MEDIA_PREVIEW_TIME,e)}}Ms=new WeakMap,U.customElements.get("media-preview-time-display")||U.customElements.define("media-preview-time-display",Rs);var Ds=Rs;const Cs="seekoffset";class xs extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_CURRENT_TIME,Cs]}connectedCallback(){super.connectedCallback(),this.seekOffset=z(this,Cs,30)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===Cs&&(this.seekOffset=z(this,Cs,30))}get seekOffset(){return z(this,Cs,30)}set seekOffset(e){X(this,Cs,e),this.setAttribute("aria-label",k("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),F(q(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return z(this,a.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){X(this,a.MEDIA_CURRENT_TIME,e)}handleClick(){const t=Math.max(this.mediaCurrentTime-this.seekOffset,0),i=new U.CustomEvent(e.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(i)}}xs.getSlotTemplateHTML=function(e,t){return`\n ${i=t.seekOffset,`\n `}\n `;var i},xs.getTooltipContentHTML=function(){return k("Seek backward")},U.customElements.get("media-seek-backward-button")||U.customElements.define("media-seek-backward-button",xs);var Ns=xs;const Us="seekoffset";class Ps extends $i{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_CURRENT_TIME,Us]}connectedCallback(){super.connectedCallback(),this.seekOffset=z(this,Us,30)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===Us&&(this.seekOffset=z(this,Us,30))}get seekOffset(){return z(this,Us,30)}set seekOffset(e){X(this,Us,e),this.setAttribute("aria-label",k("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),F(q(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return z(this,a.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){X(this,a.MEDIA_CURRENT_TIME,e)}handleClick(){const t=this.mediaCurrentTime+this.seekOffset,i=new U.CustomEvent(e.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(i)}}Ps.getSlotTemplateHTML=function(e,t){return`\n ${i=t.seekOffset,`\n `}\n `;var i},Ps.getTooltipContentHTML=function(){return k("Seek forward")},U.customElements.get("media-seek-forward-button")||U.customElements.define("media-seek-forward-button",Ps);var Os,Hs=Ps,Vs=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ws=(e,t,i)=>(Vs(e,t,"read from private field"),i?i.call(e):t.get(e));const $s={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},Bs=[...Object.values($s),a.MEDIA_CURRENT_TIME,a.MEDIA_DURATION,a.MEDIA_SEEKABLE],Gs=["Enter"," "],Fs=(e,{timesSep:t=" / "}={})=>{var i,n;const a=null!=(i=e.mediaCurrentTime)?i:0,[,s]=null!=(n=e.mediaSeekable)?n:[];let r=0;Number.isFinite(e.mediaDuration)?r=e.mediaDuration:Number.isFinite(s)&&(r=s);const o=e.remaining?I(0-(r-a)):I(a);return e.showDuration?`${o}${t}${I(r)}`:o};class qs extends pa{constructor(){var e,t,i,n;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,Os,void 0),e=this,t=Os,i=this.shadowRoot.querySelector("slot"),Vs(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),Ws(this,Os).innerHTML=`${Fs(this)}`}static get observedAttributes(){return[...super.observedAttributes,...Bs,"disabled"]}connectedCallback(){const{style:e}=Z(this.shadowRoot,":host(:hover:not([notoggle]))");e.setProperty("cursor","var(--media-cursor, pointer)"),e.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))"),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",k("playback time"));const t=e=>{const{key:i}=e;Gs.includes(i)?this.toggleTimeDisplay():this.removeEventListener("keyup",t)};this.addEventListener("keydown",(e=>{const{metaKey:i,altKey:n,key:a}=e;i||n||!Gs.includes(a)?this.removeEventListener("keyup",t):this.addEventListener("keyup",t)})),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(e,t,i){Bs.includes(e)?this.update():"disabled"===e&&i!==t&&(null==i?this.enable():this.disable()),super.attributeChangedCallback(e,t,i)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return J(this,$s.REMAINING)}set remaining(e){ee(this,$s.REMAINING,e)}get showDuration(){return J(this,$s.SHOW_DURATION)}set showDuration(e){ee(this,$s.SHOW_DURATION,e)}get noToggle(){return J(this,$s.NO_TOGGLE)}set noToggle(e){ee(this,$s.NO_TOGGLE,e)}get mediaDuration(){return z(this,a.MEDIA_DURATION)}set mediaDuration(e){X(this,a.MEDIA_DURATION,e)}get mediaCurrentTime(){return z(this,a.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){X(this,a.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(a.MEDIA_SEEKABLE);if(e)return e.split(":").map((e=>+e))}set mediaSeekable(e){null!=e?this.setAttribute(a.MEDIA_SEEKABLE,e.join(":")):this.removeAttribute(a.MEDIA_SEEKABLE)}update(){const e=Fs(this);(e=>{var t;const i=e.mediaCurrentTime,[,n]=null!=(t=e.mediaSeekable)?t:[];let a=null;if(Number.isFinite(e.mediaDuration)?a=e.mediaDuration:Number.isFinite(n)&&(a=n),null==i||null===a)return void e.setAttribute("aria-valuetext","video not loaded, unknown time.");const s=e.remaining?f(0-(a-i)):f(i);if(!e.showDuration)return void e.setAttribute("aria-valuetext",s);const r=`${s} of ${f(a)}`;e.setAttribute("aria-valuetext",r)})(this),e!==Ws(this,Os).innerHTML&&(Ws(this,Os).innerHTML=e)}}Os=new WeakMap,qs.getSlotTemplateHTML=function(e,t){return`\n ${Fs(t)}\n `},U.customElements.get("media-time-display")||U.customElements.define("media-time-display",qs);var Qs,Ks,js,Ys,Zs,zs,Xs,Js,er,tr,ir=qs,nr=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},ar=(e,t,i)=>(nr(e,t,"read from private field"),i?i.call(e):t.get(e)),sr=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},rr=(e,t,i,n)=>(nr(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class or{constructor(e,t,i){sr(this,Qs,void 0),sr(this,Ks,void 0),sr(this,js,void 0),sr(this,Ys,void 0),sr(this,Zs,void 0),sr(this,zs,void 0),sr(this,Xs,void 0),sr(this,Js,void 0),sr(this,er,0),sr(this,tr,((e=performance.now())=>{rr(this,er,requestAnimationFrame(ar(this,tr))),rr(this,Ys,performance.now()-ar(this,js));const t=1e3/this.fps;if(ar(this,Ys)>t){rr(this,js,e-ar(this,Ys)%t);const r=1e3/((e-ar(this,Ks))/++(i=this,n=Zs,{set _(e){rr(i,n,e,a)},get _(){return ar(i,n,s)}})._),o=(e-ar(this,zs))/1e3/this.duration;let l=ar(this,Xs)+o*this.playbackRate;l-ar(this,Qs).valueAsNumber>0?rr(this,Js,this.playbackRate/this.duration/r):(rr(this,Js,.995*ar(this,Js)),l=ar(this,Qs).valueAsNumber+ar(this,Js)),this.callback(l)}var i,n,a,s})),rr(this,Qs,e),this.callback=t,this.fps=i}start(){0===ar(this,er)&&(rr(this,js,performance.now()),rr(this,Ks,ar(this,js)),rr(this,Zs,0),ar(this,tr).call(this))}stop(){0!==ar(this,er)&&(cancelAnimationFrame(ar(this,er)),rr(this,er,0))}update({start:e,duration:t,playbackRate:i}){const n=e-ar(this,Qs).valueAsNumber,a=Math.abs(t-this.duration);(n>0||n<-.03||a>=.5)&&this.callback(e),rr(this,Xs,e),rr(this,zs,performance.now()),this.duration=t,this.playbackRate=i}}Qs=new WeakMap,Ks=new WeakMap,js=new WeakMap,Ys=new WeakMap,Zs=new WeakMap,zs=new WeakMap,Xs=new WeakMap,Js=new WeakMap,er=new WeakMap,tr=new WeakMap;var lr,dr,cr,ur,hr,mr,pr,Er,vr,br,gr,Ar,fr,Ir,wr,_r,yr,Tr,Mr,kr,Sr,Lr,Rr,Dr,Cr,xr,Nr,Ur=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Pr=(e,t,i)=>(Ur(e,t,"read from private field"),i?i.call(e):t.get(e)),Or=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Hr=(e,t,i,n)=>(Ur(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),Vr=(e,t,i)=>(Ur(e,t,"access private method"),i);const Wr=(e,t=e.mediaCurrentTime)=>{const i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,n=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;if(Number.isNaN(n))return 0;const a=(t-i)/(n-i);return Math.max(0,Math.min(a,1))},$r=(e,t=e.range.valueAsNumber)=>{const i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,n=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;return Number.isNaN(n)?0:t*(n-i)+i};class Br extends ia{constructor(){super(),Or(this,gr),Or(this,fr),Or(this,_r),Or(this,Tr),Or(this,kr),Or(this,Lr),Or(this,Dr),Or(this,xr),Or(this,lr,void 0),Or(this,dr,void 0),Or(this,cr,void 0),Or(this,ur,void 0),Or(this,hr,void 0),Or(this,mr,void 0),Or(this,pr,void 0),Or(this,Er,void 0),Or(this,vr,void 0),Or(this,br,void 0),Or(this,wr,(e=>{this.dragging||(b(e)&&(this.range.valueAsNumber=e),Pr(this,br)||this.updateBar())}));this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'
'),Hr(this,cr,this.shadowRoot.querySelectorAll('[part~="box"]')),Hr(this,hr,this.shadowRoot.querySelector('[part~="preview-box"]')),Hr(this,mr,this.shadowRoot.querySelector('[part~="current-box"]'));const e=getComputedStyle(this);Hr(this,pr,parseInt(e.getPropertyValue("--media-box-padding-left"))),Hr(this,Er,parseInt(e.getPropertyValue("--media-box-padding-right"))),Hr(this,dr,new or(this.range,Pr(this,wr),60))}static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_PAUSED,a.MEDIA_DURATION,a.MEDIA_SEEKABLE,a.MEDIA_CURRENT_TIME,a.MEDIA_PREVIEW_IMAGE,a.MEDIA_PREVIEW_TIME,a.MEDIA_PREVIEW_CHAPTER,a.MEDIA_BUFFERED,a.MEDIA_PLAYBACK_RATE,a.MEDIA_LOADING,a.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",k("seek")),Vr(this,gr,Ar).call(this),Hr(this,lr,this.getRootNode()),null==(e=Pr(this,lr))||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),Vr(this,gr,Ar).call(this),null==(e=Pr(this,lr))||e.removeEventListener("transitionstart",this),Hr(this,lr,null)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),t!=i&&(e===a.MEDIA_CURRENT_TIME||e===a.MEDIA_PAUSED||e===a.MEDIA_ENDED||e===a.MEDIA_LOADING||e===a.MEDIA_DURATION||e===a.MEDIA_SEEKABLE?(Pr(this,dr).update({start:Wr(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),Vr(this,gr,Ar).call(this),(e=>{const t=e.range,i=f(+$r(e)),n=f(+e.mediaSeekableEnd),a=i&&n?`${i} of ${n}`:"video not loaded, unknown time.";t.setAttribute("aria-valuetext",a)})(this)):e===a.MEDIA_BUFFERED&&this.updateBufferedBar(),e!==a.MEDIA_DURATION&&e!==a.MEDIA_SEEKABLE||(this.mediaChaptersCues=Pr(this,vr),this.updateBar()))}get mediaChaptersCues(){return Pr(this,vr)}set mediaChaptersCues(e){var t;Hr(this,vr,e),this.updateSegments(null==(t=Pr(this,vr))?void 0:t.map((e=>({start:Wr(this,e.startTime),end:Wr(this,e.endTime)}))))}get mediaPaused(){return J(this,a.MEDIA_PAUSED)}set mediaPaused(e){ee(this,a.MEDIA_PAUSED,e)}get mediaLoading(){return J(this,a.MEDIA_LOADING)}set mediaLoading(e){ee(this,a.MEDIA_LOADING,e)}get mediaDuration(){return z(this,a.MEDIA_DURATION)}set mediaDuration(e){X(this,a.MEDIA_DURATION,e)}get mediaCurrentTime(){return z(this,a.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){X(this,a.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return z(this,a.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){X(this,a.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(a.MEDIA_BUFFERED);return e?e.split(" ").map((e=>e.split(":").map((e=>+e)))):[]}set mediaBuffered(e){if(!e)return void this.removeAttribute(a.MEDIA_BUFFERED);const t=e.map((e=>e.join(":"))).join(" ");this.setAttribute(a.MEDIA_BUFFERED,t)}get mediaSeekable(){const e=this.getAttribute(a.MEDIA_SEEKABLE);if(e)return e.split(":").map((e=>+e))}set mediaSeekable(e){null!=e?this.setAttribute(a.MEDIA_SEEKABLE,e.join(":")):this.removeAttribute(a.MEDIA_SEEKABLE)}get mediaSeekableEnd(){var e;const[,t=this.mediaDuration]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaSeekableStart(){var e;const[t=0]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaPreviewImage(){return te(this,a.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){ie(this,a.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return z(this,a.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){X(this,a.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return J(this,a.MEDIA_ENDED)}set mediaEnded(e){ee(this,a.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;const t=this.mediaBuffered;if(!t.length)return;let i;if(this.mediaEnded)i=1;else{const n=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=null!=(e=t.find((([e,t])=>e<=n&&n<=t)))?e:[];i=Wr(this,a)}const{style:n}=Z(this.shadowRoot,"#buffered");n.setProperty("width",100*i+"%")}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;const e=Z(this.shadowRoot,"#current-rail"),t=Z(this.shadowRoot,'[part~="current-box"]'),i=Vr(this,_r,yr).call(this,Pr(this,mr)),n=Vr(this,Tr,Mr).call(this,i,this.range.valueAsNumber),a=Vr(this,kr,Sr).call(this,i,this.range.valueAsNumber);e.style.transform=`translateX(${n})`,e.style.setProperty("--_range-width",`${i.range.width}`),t.style.setProperty("--_box-shift",`${a}`),t.style.setProperty("--_box-width",`${i.box.width}px`),t.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":Vr(this,xr,Nr).call(this);break;case"pointermove":Vr(this,Lr,Rr).call(this,e);break;case"pointerup":Pr(this,br)&&Hr(this,br,!1);break;case"pointerdown":Hr(this,br,!0);break;case"pointerleave":Vr(this,Dr,Cr).call(this,null);break;case"transitionstart":Q(e.target,this)&&setTimeout((()=>Vr(this,gr,Ar).call(this)),0)}}}lr=new WeakMap,dr=new WeakMap,cr=new WeakMap,ur=new WeakMap,hr=new WeakMap,mr=new WeakMap,pr=new WeakMap,Er=new WeakMap,vr=new WeakMap,br=new WeakMap,gr=new WeakSet,Ar=function(){Vr(this,fr,Ir).call(this)?Pr(this,dr).start():Pr(this,dr).stop()},fr=new WeakSet,Ir=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&Y(this)},wr=new WeakMap,_r=new WeakSet,yr=function(e){var t;const i=(null!=(t=this.getAttribute("bounds")?K(this,`#${this.getAttribute("bounds")}`):this.parentElement)?t:this).getBoundingClientRect(),n=this.range.getBoundingClientRect(),a=e.offsetWidth;return{box:{width:a,min:-(n.left-i.left-a/2),max:i.right-n.left-a/2},bounds:i,range:n}},Tr=new WeakSet,Mr=function(e,t){let i=100*t+"%";const{width:n,min:a,max:s}=e.box;if(!n)return i;if(!Number.isNaN(a)){i=`max(${`calc(1 / var(--_range-width) * 100 * ${a}% + ${"var(--media-box-padding-left)"})`}, ${i})`}if(!Number.isNaN(s)){i=`min(${i}, ${`calc(1 / var(--_range-width) * 100 * ${s}% - ${"var(--media-box-padding-right)"})`})`}return i},kr=new WeakSet,Sr=function(e,t){const{width:i,min:n,max:a}=e.box,s=t*e.range.width;if(sa-Pr(this,Er)){return s+i/2-(e.bounds.right-e.range.right-Pr(this,Er))-e.range.width+"px"}return 0},Lr=new WeakSet,Rr=function(e){const t=[...Pr(this,cr)].some((t=>e.composedPath().includes(t)));if(!this.dragging&&(t||!e.composedPath().includes(this)))return void Vr(this,Dr,Cr).call(this,null);const i=this.mediaSeekableEnd;if(!i)return;const n=Z(this.shadowRoot,"#preview-rail"),a=Z(this.shadowRoot,'[part~="preview-box"]'),s=Vr(this,_r,yr).call(this,Pr(this,hr));let r=(e.clientX-s.range.left)/s.range.width;r=Math.max(0,Math.min(1,r));const o=Vr(this,Tr,Mr).call(this,s,r),l=Vr(this,kr,Sr).call(this,s,r);n.style.transform=`translateX(${o})`,n.style.setProperty("--_range-width",`${s.range.width}`),a.style.setProperty("--_box-shift",`${l}`),a.style.setProperty("--_box-width",`${s.box.width}px`);const d=Math.round(Pr(this,ur))-Math.round(r*i);Math.abs(d)<1&&r>.01&&r<.99||(Hr(this,ur,r*i),Vr(this,Dr,Cr).call(this,Pr(this,ur)))},Dr=new WeakSet,Cr=function(t){this.dispatchEvent(new U.CustomEvent(e.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:t}))},xr=new WeakSet,Nr=function(){Pr(this,dr).stop();const t=$r(this);this.dispatchEvent(new U.CustomEvent(e.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t}))},Br.shadowRootOptions={mode:"open"},Br.getTemplateHTML=function(e){return`\n ${ia.getTemplateHTML(e)}\n \n
\n \n \n \n \n \n \n
\n
\n
\n
\n \n \n \n
\n `},U.customElements.get("media-time-range")||U.customElements.define("media-time-range",Br);var Gr=Br;class Fr extends ia{static get observedAttributes(){return[...super.observedAttributes,a.MEDIA_VOLUME,a.MEDIA_MUTED,a.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",(()=>{const t=this.range.value,i=new U.CustomEvent(e.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(i)}))}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",k("volume"))}attributeChangedCallback(e,t,i){var n,s;super.attributeChangedCallback(e,t,i),e!==a.MEDIA_VOLUME&&e!==a.MEDIA_MUTED||(this.range.valueAsNumber=(s=this).mediaMuted?0:s.mediaVolume,this.range.setAttribute("aria-valuetext",(n=this.range.valueAsNumber,`${Math.round(100*n)}%`)),this.updateBar())}get mediaVolume(){return z(this,a.MEDIA_VOLUME,1)}set mediaVolume(e){X(this,a.MEDIA_VOLUME,e)}get mediaMuted(){return J(this,a.MEDIA_MUTED)}set mediaMuted(e){ee(this,a.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return te(this,a.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){ie(this,a.MEDIA_VOLUME_UNAVAILABLE,e)}}U.customElements.get("media-volume-range")||U.customElements.define("media-volume-range",Fr);var qr=Fr;export{Qi as MediaAirplayButton,zi as MediaCaptionsButton,vn as MediaCastButton,Bi as MediaChromeButton,Zn as MediaChromeDialog,aa as MediaChromeRange,Ge as MediaContainer,ca as MediaControlBar,wi as MediaController,fa as MediaDurationDisplay,La as MediaErrorDialog,Ca as MediaFullscreenButton,ke as MediaGestureReceiver,$a as MediaLiveButton,Ya as MediaLoadingIndicator,Ja as MediaMuteButton,as as MediaPipButton,hs as MediaPlayButton,ds as MediaPlaybackRateButton,bs as MediaPosterImage,Is as MediaPreviewChapterDisplay,ks as MediaPreviewThumbnail,Ds as MediaPreviewTimeDisplay,Ns as MediaSeekBackwardButton,Hs as MediaSeekForwardButton,va as MediaTextDisplay,ir as MediaTimeDisplay,Gr as MediaTimeRange,xi as MediaTooltip,qr as MediaVolumeRange,p as constants,k as t,_ as timeUtils};export default null; //# sourceMappingURL=/sm/c604ff476e16c093c4070049c66b56d4dc4d43f309a19771073c843717dd184a.map