(function(lt,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],b):(lt=typeof globalThis<"u"?globalThis:lt||self,b(lt["hoski-business-ui"]={},lt.Vue))})(this,function(lt,b){"use strict";var vN=Object.defineProperty;var TN=(lt,b,cs)=>b in lt?vN(lt,b,{enumerable:!0,configurable:!0,writable:!0,value:cs}):lt[b]=cs;var Ux=(lt,b,cs)=>(TN(lt,typeof b!="symbol"?b+"":b,cs),cs);function cs(i,e=500,t,n){let s=null,r=!1;const a=function(...o){return new Promise((l,u)=>{if(s&&clearTimeout(s),t&&!r){try{const c=i.apply(this,o);n&&n(c),l(c)}catch(c){u(c)}r=!0}else s=setTimeout(()=>{try{const c=i.apply(this,o);n&&n(c),l(c)}catch(c){u(c)}r=!1,s=null},e)})};return a.cancel=function(){s&&clearTimeout(s),r=!1,s=null},a}function $x(i,e,t={leading:!1,trailing:!0}){let n=null,s=0;const{leading:r,trailing:a}=t,o=function(...l){const u=Date.now();!s&&!r&&(s=u);const c=e-(u-s);c<=0&&(n&&(clearTimeout(n),n=null),s=u,i.apply(this,l)),a&&!n&&(n=setTimeout(()=>{s=r?Date.now():0,n=null,i.apply(this,l)},c))};return o.cancel=function(){n&&clearTimeout(n),n=null,s=0},o}function Vx(i,e=2,t=",",n=".",s="",r=""){if(Number(i)===0)return Number(i).toFixed(e);if(!i)return"";i=Number(i).toFixed(e),i+="";const a=i.split(".");let o=a[0];const l=a.length>1?n+a[1]:"",u=/(\d+)(\d{3})/;function c(d){return Object.prototype.toString.call(d)==="[object Number]"}if(t&&!c(t))for(;u.test(o);)o=o.replace(u,"$1"+t+"$2");return s+o+l+r}/*! Element Plus Icons Vue v2.3.1 */var jx=b.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(e,t)=>(b.openBlock(),b.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[b.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"})]))}}),zx=jx,qx=b.defineComponent({name:"CaretBottom",__name:"caret-bottom",setup(i){return(e,t)=>(b.openBlock(),b.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[b.createElementVNode("path",{fill:"currentColor",d:"m192 384 320 384 320-384z"})]))}}),Gx=qx,Hx=b.defineComponent({name:"CircleCloseFilled",__name:"circle-close-filled",setup(i){return(e,t)=>(b.openBlock(),b.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[b.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}}),lg=Hx,Wx=b.defineComponent({name:"Close",__name:"close",setup(i){return(e,t)=>(b.openBlock(),b.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[b.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),Xx=Wx,Kx=b.defineComponent({name:"InfoFilled",__name:"info-filled",setup(i){return(e,t)=>(b.openBlock(),b.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[b.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}}),ug=Kx,Yx=b.defineComponent({name:"SuccessFilled",__name:"success-filled",setup(i){return(e,t)=>(b.openBlock(),b.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[b.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}}),cg=Yx,Zx=b.defineComponent({name:"WarningFilled",__name:"warning-filled",setup(i){return(e,t)=>(b.openBlock(),b.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[b.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))}}),hg=Zx;/** * @vue/shared v3.4.33 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **//*! #__NO_SIDE_EFFECTS__ */function Qx(i,e){const t=new Set(i.split(","));return e?n=>t.has(n.toLowerCase()):n=>t.has(n)}process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const dg=Object.assign,Jx=Object.prototype.hasOwnProperty,Qs=(i,e)=>Jx.call(i,e),hs=Array.isArray,Ca=i=>fg(i)==="[object Map]",ml=i=>typeof i=="function",Js=i=>typeof i=="string",wa=i=>typeof i=="symbol",er=i=>i!==null&&typeof i=="object",eb=Object.prototype.toString,fg=i=>eb.call(i),pg=i=>fg(i).slice(8,-1),th=i=>Js(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,tb=(i=>{const e=Object.create(null);return t=>e[t]||(e[t]=i(t))})(i=>i.charAt(0).toUpperCase()+i.slice(1)),tr=(i,e)=>!Object.is(i,e);/** * @vue/reactivity v3.4.33 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function ir(i,...e){console.warn(`[Vue warn] ${i}`,...e)}let ib;function nb(i,e=ib){e&&e.active&&e.effects.push(i)}let ds;class sb{constructor(e,t,n,s){this.fn=e,this.trigger=t,this.scheduler=n,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,nb(this,s)}get dirty(){if(this._dirtyLevel===2||this._dirtyLevel===3){this._dirtyLevel=1,vg();for(let e=0;e=4))break}this._dirtyLevel===1&&(this._dirtyLevel=0),Tg()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=Mn,t=ds;try{return Mn=!0,ds=this,this._runnings++,gg(this),this.fn()}finally{mg(this),this._runnings--,ds=t,Mn=e}}stop(){this.active&&(gg(this),mg(this),this.onStop&&this.onStop(),this.active=!1)}}function rb(i){return i.value}function gg(i){i._trackId++,i._depsLength=0}function mg(i){if(i.deps.length>i._depsLength){for(let e=i._depsLength;e{const t=new Map;return t.cleanup=i,t.computed=e,t},ah=new WeakMap,fs=Symbol(process.env.NODE_ENV!=="production"?"iterate":""),oh=Symbol(process.env.NODE_ENV!=="production"?"Map key iterate":"");function ci(i,e,t){if(Mn&&ds){let n=ah.get(i);n||ah.set(i,n=new Map);let s=n.get(t);s||n.set(t,s=Eg(()=>n.delete(t))),xg(ds,s,process.env.NODE_ENV!=="production"?{target:i,type:e,key:t}:void 0)}}function Nn(i,e,t,n,s,r){const a=ah.get(i);if(!a)return;let o=[];if(e==="clear")o=[...a.values()];else if(t==="length"&&hs(i)){const l=Number(n);a.forEach((u,c)=>{(c==="length"||!wa(c)&&c>=l)&&o.push(u)})}else switch(t!==void 0&&o.push(a.get(t)),e){case"add":hs(i)?th(t)&&o.push(a.get("length")):(o.push(a.get(fs)),Ca(i)&&o.push(a.get(oh)));break;case"delete":hs(i)||(o.push(a.get(fs)),Ca(i)&&o.push(a.get(oh)));break;case"set":Ca(i)&&o.push(a.get(fs));break}nh();for(const l of o)l&&bg(l,4,process.env.NODE_ENV!=="production"?{target:i,type:e,key:t,newValue:n,oldValue:s,oldTarget:r}:void 0);sh()}const ab=Qx("__proto__,__v_isRef,__isVue"),Sg=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(wa)),Cg=ob();function ob(){const i={};return["includes","indexOf","lastIndexOf"].forEach(e=>{i[e]=function(...t){const n=we(this);for(let r=0,a=this.length;r{i[e]=function(...t){vg(),nh();const n=we(this)[e].apply(this,t);return sh(),Tg(),n}}),i}function lb(i){wa(i)||(i=String(i));const e=we(this);return ci(e,"has",i),e.hasOwnProperty(i)}class wg{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){const s=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!s;if(t==="__v_isReadonly")return s;if(t==="__v_isShallow")return r;if(t==="__v_raw")return n===(s?r?xb:Og:r?Tb:Lg).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const a=hs(e);if(!s){if(a&&Qs(Cg,t))return Reflect.get(Cg,t,n);if(t==="hasOwnProperty")return lb}const o=Reflect.get(e,t,n);return(wa(t)?Sg.has(t):ab(t))||(s||ci(e,"get",t),r)?o:Cl(o)?a&&th(t)?o:o.value:er(o)?s?Ng(o):Mg(o):o}}class ub extends wg{constructor(e=!1){super(!1,e)}set(e,t,n,s){let r=e[t];if(!this._isShallow){const l=nr(r);if(!El(n)&&!nr(n)&&(r=we(r),n=we(n)),!hs(e)&&Cl(r)&&!Cl(n))return l?!1:(r.value=n,!0)}const a=hs(e)&&th(t)?Number(t)i,_l=i=>Reflect.getPrototypeOf(i);function yl(i,e,t=!1,n=!1){i=i.__v_raw;const s=we(i),r=we(e);t||(tr(e,r)&&ci(s,"get",e),ci(s,"get",r));const{has:a}=_l(s),o=n?lh:t?uh:Aa;if(a.call(s,e))return o(i.get(e));if(a.call(s,r))return o(i.get(r));i!==s&&i.get(e)}function vl(i,e=!1){const t=this.__v_raw,n=we(t),s=we(i);return e||(tr(i,s)&&ci(n,"has",i),ci(n,"has",s)),i===s?t.has(i):t.has(i)||t.has(s)}function Tl(i,e=!1){return i=i.__v_raw,!e&&ci(we(i),"iterate",fs),Reflect.get(i,"size",i)}function Ag(i,e=!1){!e&&!El(i)&&!nr(i)&&(i=we(i));const t=we(this);return _l(t).has.call(t,i)||(t.add(i),Nn(t,"add",i,i)),this}function Ig(i,e,t=!1){!t&&!El(e)&&!nr(e)&&(e=we(e));const n=we(this),{has:s,get:r}=_l(n);let a=s.call(n,i);a?process.env.NODE_ENV!=="production"&&Pg(n,s,i):(i=we(i),a=s.call(n,i));const o=r.call(n,i);return n.set(i,e),a?tr(e,o)&&Nn(n,"set",i,e,o):Nn(n,"add",i,e),this}function Dg(i){const e=we(this),{has:t,get:n}=_l(e);let s=t.call(e,i);s?process.env.NODE_ENV!=="production"&&Pg(e,t,i):(i=we(i),s=t.call(e,i));const r=n?n.call(e,i):void 0,a=e.delete(i);return s&&Nn(e,"delete",i,void 0,r),a}function kg(){const i=we(this),e=i.size!==0,t=process.env.NODE_ENV!=="production"?Ca(i)?new Map(i):new Set(i):void 0,n=i.clear();return e&&Nn(i,"clear",void 0,void 0,t),n}function xl(i,e){return function(n,s){const r=this,a=r.__v_raw,o=we(a),l=e?lh:i?uh:Aa;return!i&&ci(o,"iterate",fs),a.forEach((u,c)=>n.call(s,l(u),l(c),r))}}function bl(i,e,t){return function(...n){const s=this.__v_raw,r=we(s),a=Ca(r),o=i==="entries"||i===Symbol.iterator&&a,l=i==="keys"&&a,u=s[i](...n),c=t?lh:e?uh:Aa;return!e&&ci(r,"iterate",l?oh:fs),{next(){const{value:d,done:p}=u.next();return p?{value:d,done:p}:{value:o?[c(d[0]),c(d[1])]:c(d),done:p}},[Symbol.iterator](){return this}}}}function Fn(i){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";ir(`${tb(i)} operation ${t}failed: target is readonly.`,we(this))}return i==="delete"?!1:i==="clear"?void 0:this}}function fb(){const i={get(r){return yl(this,r)},get size(){return Tl(this)},has:vl,add:Ag,set:Ig,delete:Dg,clear:kg,forEach:xl(!1,!1)},e={get(r){return yl(this,r,!1,!0)},get size(){return Tl(this)},has:vl,add(r){return Ag.call(this,r,!0)},set(r,a){return Ig.call(this,r,a,!0)},delete:Dg,clear:kg,forEach:xl(!1,!0)},t={get(r){return yl(this,r,!0)},get size(){return Tl(this,!0)},has(r){return vl.call(this,r,!0)},add:Fn("add"),set:Fn("set"),delete:Fn("delete"),clear:Fn("clear"),forEach:xl(!0,!1)},n={get(r){return yl(this,r,!0,!0)},get size(){return Tl(this,!0)},has(r){return vl.call(this,r,!0)},add:Fn("add"),set:Fn("set"),delete:Fn("delete"),clear:Fn("clear"),forEach:xl(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{i[r]=bl(r,!1,!1),t[r]=bl(r,!0,!1),e[r]=bl(r,!1,!0),n[r]=bl(r,!0,!0)}),[i,t,e,n]}const[pb,gb,mb,_b]=fb();function Rg(i,e){const t=e?i?_b:mb:i?gb:pb;return(n,s,r)=>s==="__v_isReactive"?!i:s==="__v_isReadonly"?i:s==="__v_raw"?n:Reflect.get(Qs(t,s)&&s in n?t:n,s,r)}const yb={get:Rg(!1,!1)},vb={get:Rg(!0,!1)};function Pg(i,e,t){const n=we(t);if(n!==t&&e.call(i,n)){const s=pg(i);ir(`Reactive ${s} contains both the raw and reactive versions of the same object${s==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Lg=new WeakMap,Tb=new WeakMap,Og=new WeakMap,xb=new WeakMap;function bb(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Eb(i){return i.__v_skip||!Object.isExtensible(i)?0:bb(pg(i))}function Mg(i){return nr(i)?i:Fg(i,!1,hb,yb,Lg)}function Ng(i){return Fg(i,!0,db,vb,Og)}function Fg(i,e,t,n,s){if(!er(i))return process.env.NODE_ENV!=="production"&&ir(`value cannot be made ${e?"readonly":"reactive"}: ${String(i)}`),i;if(i.__v_raw&&!(e&&i.__v_isReactive))return i;const r=s.get(i);if(r)return r;const a=Eb(i);if(a===0)return i;const o=new Proxy(i,a===2?n:t);return s.set(i,o),o}function nr(i){return!!(i&&i.__v_isReadonly)}function El(i){return!!(i&&i.__v_isShallow)}function we(i){const e=i&&i.__v_raw;return e?we(e):i}const Aa=i=>er(i)?Mg(i):i,uh=i=>er(i)?Ng(i):i,Sb="Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free";class Cb{constructor(e,t,n,s){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new sb(()=>e(this._value),()=>Sl(this,this.effect._dirtyLevel===2?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const e=we(this);return(!e._cacheable||e.effect.dirty)&&tr(e._value,e._value=e.effect.run())&&Sl(e,4),Bg(e),e.effect._dirtyLevel>=2&&(process.env.NODE_ENV!=="production"&&this._warnRecursive&&ir(Sb,` getter: `,this.getter),Sl(e,2)),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function Bg(i){var e;Mn&&ds&&(i=we(i),xg(ds,(e=i.dep)!=null?e:i.dep=Eg(()=>i.dep=void 0,i instanceof Cb?i:void 0),process.env.NODE_ENV!=="production"?{target:i,type:"get",key:"value"}:void 0))}function Sl(i,e=4,t,n){i=we(i);const s=i.dep;s&&bg(s,e,process.env.NODE_ENV!=="production"?{target:i,type:"set",key:"value",newValue:t,oldValue:n}:void 0)}function Cl(i){return!!(i&&i.__v_isRef===!0)}function Ug(i){return wb(i,!0)}function wb(i,e){return Cl(i)?i:new Ab(i,e)}class Ab{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:we(e),this._value=t?e:Aa(e)}get value(){return Bg(this),this._value}set value(e){const t=this.__v_isShallow||El(e)||nr(e);if(e=t?e:we(e),tr(e,this._rawValue)){const n=this._rawValue;this._rawValue=e,this._value=t?e:Aa(e),Sl(this,4,e,n)}}}var Ia=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $g(i){var e=i.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(n){var s=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return i[n]}})}),t}var Vg={exports:{}};(function(i,e){(function(t,n){i.exports=n()})(Ia,function(){function t(d){var p=[];return d.AMapUI&&p.push(n(d.AMapUI)),d.Loca&&p.push(s(d.Loca)),Promise.all(p)}function n(d){return new Promise(function(p,y){var _=[];if(d.plugins)for(var T=0;T{e.value=new n.Map("amap",{viewMode:"3D",zoom:5,center:[105.602725,37.076636]}),e.value.on("zoomchange",()=>{const r=e.value.getZoom();console.log("\u7F29\u653E",r)}),e.value.on("zoomend",()=>{});const s=new n.Marker({position:new n.LngLat(116.39,39.9),offset:new n.Pixel(-10,-10),icon:"//vdata.amap.com/icons/b18/1/2.png",title:"\u5317\u4EAC"});e.value.add(s)}).catch(n=>{console.log(n)})}return b.onMounted(()=>{t()}),b.onBeforeMount(()=>{e.value=null}),(n,s)=>(b.openBlock(),b.createElementBlock("div",Db))}}),bN="",Ft=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},Rb=Ft(kb,[["__scopeId","data-v-32287327"]]);class Pb{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const un=Pb,sr={PROPERTYCHANGE:"propertychange"};class Lb{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const ch=Lb;function Ob(i,e,t){let n,s;t=t||cn;let r=0,a=i.length,o=!1;for(;r>1),s=+t(i[n],e),s<0?r=n+1:(a=n,o=!s);return o?r:~r}function cn(i,e){return i>e?1:i0?s-1:s}return n-1}if(t>0){for(let s=1;s0||t&&a===0)})}function Da(){return!0}function wl(){return!1}function rr(){}function jg(i){let e=!1,t,n,s;return function(){const r=Array.prototype.slice.call(arguments);return(!e||this!==s||!Bn(r,n))&&(e=!0,s=this,n=r,t=i.apply(this,arguments)),t}}function Fb(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}function ka(i){for(const e in i)delete i[e]}function ar(i){let e;for(e in i)return!1;return!e}class Bb extends ch{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),s=n[e]||(n[e]=[]);s.includes(t)||s.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const r=t?new un(e):e;r.target||(r.target=this.eventTarget_||this);const a=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});n in a||(a[n]=0,o[n]=0),++a[n];let l;for(let u=0,c=s.length;u0:!1}removeEventListener(e,t){if(!this.listeners_)return;const n=this.listeners_[e];if(!n)return;const s=n.indexOf(t);s!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[s]=rr,++this.pendingRemovals_[e]):(n.splice(s,1),n.length===0&&delete this.listeners_[e]))}}const Al=Bb,pe={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function be(i,e,t,n,s){if(n&&n!==i&&(t=t.bind(n)),s){const a=t;t=function(){i.removeEventListener(e,t),a.apply(this,arguments)}}const r={target:i,type:e,listener:t};return i.addEventListener(e,t),r}function Il(i,e,t,n){return be(i,e,t,n,!0)}function $e(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),ka(i))}class Dl extends Al{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(pe.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,s=new Array(n);for(let r=0;r1?(t=s,n=r):l>0&&(t+=a*l,n+=o*l)}return or(i,e,t,n)}function or(i,e,t,n){const s=t-i,r=n-e;return s*s+r*r}function zb(i){const e=i.length;for(let n=0;nr&&(r=l,s=o)}if(r===0)return null;const a=i[s];i[s]=i[n],i[n]=a;for(let o=n+1;o=0;n--){t[n]=i[n][e]/i[n][n];for(let s=n-1;s>=0;s--)i[s][e]-=i[s][n]*t[n]}return t}function kl(i){return i*Math.PI/180}function lr(i,e){const t=i%e;return t*e<0?t+e:t}function hi(i,e,t){return i+t*(e-i)}function fh(i,e){const t=Math.pow(10,e);return Math.round(i*t)/t}function Rl(i,e){return Math.floor(fh(i,e))}function Pl(i,e){return Math.ceil(fh(i,e))}class qb extends Bi{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Re.OPACITY]=e.opacity!==void 0?e.opacity:1,Te(typeof t[Re.OPACITY]=="number","Layer opacity must be a number"),t[Re.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Re.Z_INDEX]=e.zIndex,t[Re.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Re.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Re.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Re.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=it(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return Ee()}getLayerStatesArray(e){return Ee()}getExtent(){return this.get(Re.EXTENT)}getMaxResolution(){return this.get(Re.MAX_RESOLUTION)}getMinResolution(){return this.get(Re.MIN_RESOLUTION)}getMinZoom(){return this.get(Re.MIN_ZOOM)}getMaxZoom(){return this.get(Re.MAX_ZOOM)}getOpacity(){return this.get(Re.OPACITY)}getSourceState(){return Ee()}getVisible(){return this.get(Re.VISIBLE)}getZIndex(){return this.get(Re.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Re.EXTENT,e)}setMaxResolution(e){this.set(Re.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Re.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Re.MAX_ZOOM,e)}setMinZoom(e){this.set(Re.MIN_ZOOM,e)}setOpacity(e){Te(typeof e=="number","Layer opacity must be a number"),this.set(Re.OPACITY,e)}setVisible(e){this.set(Re.VISIBLE,e)}setZIndex(e){this.set(Re.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Gg=qb,di={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},xt={ANIMATING:0,INTERACTING:1},Ci={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Gb=42,ph=256,Ra={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Hb{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Ra[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const Hg=Hb,Pa=6378137,ur=Math.PI*Pa,Wb=[-ur,-ur,ur,ur],Xb=[-180,-85,180,85],Ll=Pa*Math.log(Math.tan(Math.PI/2));class cr extends Hg{constructor(e){super({code:e,units:"m",extent:Wb,global:!0,worldExtent:Xb,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Pa)}})}}const Wg=[new cr("EPSG:3857"),new cr("EPSG:102100"),new cr("EPSG:102113"),new cr("EPSG:900913"),new cr("http://www.opengis.net/def/crs/EPSG/0/3857"),new cr("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Kb(i,e,t){const n=i.length;t=t>1?t:2,e===void 0&&(t>2?e=i.slice():e=new Array(n));for(let s=0;sLl?r=Ll:r<-Ll&&(r=-Ll),e[s+1]=r}return e}function Yb(i,e,t){const n=i.length;t=t>1?t:2,e===void 0&&(t>2?e=i.slice():e=new Array(n));for(let s=0;ss&&(l=l|ut.RIGHT),or&&(l=l|ut.ABOVE),l===ut.UNKNOWN&&(l=ut.INTERSECTING),l}function fi(){return[1/0,1/0,-1/0,-1/0]}function Un(i,e,t,n,s){return s?(s[0]=i,s[1]=e,s[2]=t,s[3]=n,s):[i,e,t,n]}function Ml(i){return Un(1/0,1/0,-1/0,-1/0,i)}function em(i,e){const t=i[0],n=i[1];return Un(t,n,t,n,e)}function yh(i,e,t,n,s){const r=Ml(s);return tm(r,i,e,t,n)}function La(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function iE(i,e){return e[0]i[2]&&(i[2]=e[2]),e[1]i[3]&&(i[3]=e[3]),i}function Oa(i,e){e[0]i[2]&&(i[2]=e[0]),e[1]i[3]&&(i[3]=e[1])}function tm(i,e,t,n,s){for(;te[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function Ul(i){return i[2]=a&&T<=l),!n&&!!(r&ut.RIGHT)&&!(s&ut.RIGHT)&&(E=y-(p-l)*_,n=E>=o&&E<=u),!n&&!!(r&ut.BELOW)&&!(s&ut.BELOW)&&(T=p-(y-o)/_,n=T>=a&&T<=l),!n&&!!(r&ut.LEFT)&&!(s&ut.LEFT)&&(E=y-(p-a)*_,n=E>=o&&E<=u)}return n}function nm(i,e){const t=e.getExtent(),n=gs(i);if(e.canWrapX()&&(n[0]=t[2])){const s=Ie(t),a=Math.floor((n[0]-t[0])/s)*s;i[0]-=a,i[2]-=a}return i}function sm(i,e,t){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];nm(i,e);const s=Ie(n);if(Ie(i)>s&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-s,i[3]]]}return[i]}function oE(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function $l(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function bh(i,e){const t=Math.cos(e),n=Math.sin(e),s=i[0]*t-i[1]*n,r=i[1]*t+i[0]*n;return i[0]=s,i[1]=r,i}function lE(i,e){return i[0]*=e,i[1]*=e,i}function rm(i,e){if(e.canWrapX()){const t=Ie(e.getExtent()),n=uE(i,e,t);n&&(i[0]-=n*t)}return i}function uE(i,e,t){const n=e.getExtent();let s=0;return e.canWrapX()&&(i[0]n[2])&&(t=t||Ie(n),s=Math.floor((i[0]-n[0])/t)),s}const cE=63710088e-1;function am(i,e,t){t=t||cE;const n=kl(i[1]),s=kl(e[1]),r=(s-n)/2,a=kl(e[0]-i[0])/2,o=Math.sin(r)*Math.sin(r)+Math.sin(a)*Math.sin(a)*Math.cos(n)*Math.cos(s);return 2*t*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))}const om={info:1,warn:2,error:3,none:4};let hE=om.info;function lm(...i){hE>om.warn||console.warn(...i)}let Eh=!0;function um(i){Eh=!(i===void 0?!0:i)}function Sh(i,e){if(e!==void 0){for(let t=0,n=i.length;t=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Eh=!1,lm("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Ah(i,e){return i}function _s(i,e){return i}function _E(){dm(Wg),dm(Kg),pE(Kg,Wg,Kb,Yb)}_E();function gm(i,e,t){return function(n,s,r,a,o){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*s,u=e?0:r[1]*s,c=o?o[0]:0,d=o?o[1]:0;let p=i[0]+l/2+c,y=i[2]-l/2+c,_=i[1]+u/2+d,T=i[3]-u/2+d;p>y&&(p=(y+p)/2,y=p),_>T&&(_=(T+_)/2,T=_);let E=it(n[0],p,y),S=it(n[1],_,T);if(a&&t&&s){const C=30*s;E+=-C*Math.log(1+Math.max(0,p-n[0])/C)+C*Math.log(1+Math.max(0,n[0]-y)/C),S+=-C*Math.log(1+Math.max(0,_-n[1])/C)+C*Math.log(1+Math.max(0,n[1]-T)/C)}return[E,S]}}function yE(i){return i}function Ih(i,e,t,n){const s=Ie(e)/t[0],r=bt(e)/t[1];return n?Math.min(i,Math.max(s,r)):Math.min(i,Math.min(s,r))}function Dh(i,e,t){let n=Math.min(i,e);const s=50;return n*=Math.log(1+s*Math.max(0,i/e-1))/s+1,t&&(n=Math.max(n,t),n/=Math.log(1+s*Math.max(0,t/i-1))/s+1),it(n,t/2,e*2)}function vE(i,e,t,n){return e=e!==void 0?e:!0,function(s,r,a,o){if(s!==void 0){const l=i[0],u=i[i.length-1],c=t?Ih(l,t,a,n):l;if(o)return e?Dh(s,c,u):it(s,u,c);const d=Math.min(c,s),p=Math.floor(hh(i,d,r));return i[p]>c&&pMath.round(t*Tm[n])/Tm[n]).join(", ")+")"}function $n(i,e,t,n,s,r){r=r||[];let a=0;for(let o=e;o{if(!n)return this.getSimplifiedGeometry(t);const s=this.clone();return s.applyTransform(n),s.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return Ee()}closestPointXY(e,t,n,s){return Ee()}containsXY(e,t){const n=this.getClosestPoint([e,t]);return n[0]===e&&n[1]===t}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return Ee()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Ml(t),this.extentRevision_=this.getRevision()}return rE(this.extent_,e)}rotate(e,t){Ee()}scale(e,t,n){Ee()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Ee()}getType(){return Ee()}applyTransform(e){Ee()}intersectsExtent(e){return Ee()}translate(e,t){Ee()}transform(e,t){const n=pi(e),s=n.getUnits()=="tile-pixels"?function(r,a,o){const l=n.getExtent(),u=n.getWorldExtent(),c=bt(u)/bt(l);return dn(bm,u[0],u[3],c,-c,0,0,0),$n(r,0,r.length,o,bm,a),jl(n,t)(r,a,o)}:jl(n,t);return this.applyTransform(s),this}}const RE=kE;class PE extends RE{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return yh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Ee()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length1)d=t;else if(p>0){for(let y=0;ys&&(s=u),r=o,a=l}return s}function ME(i,e,t,n,s){for(let r=0,a=t.length;r0;){const d=u.pop(),p=u.pop();let y=0;const _=i[p],T=i[p+1],E=i[d],S=i[d+1];for(let C=p+n;Cy&&(c=C,y=w)}y>s&&(l[(c-e)/n]=1,p+n0&&T>y)&&(_<0&&E<_||_==E||_>0&&E>_)){u=d,c=p;continue}r[a++]=u,r[a++]=c,o=u,l=c,u=d,c=p}return r[a++]=u,r[a++]=c,a}function Im(i,e,t,n,s,r,a,o){for(let l=0,u=t.length;lr&&(u-o)*(r-l)-(s-o)*(c-l)>0&&a++:c<=r&&(u-o)*(r-l)-(s-o)*(c-l)<0&&a--,o=u,l=c}return a!==0}function Lm(i,e,t,n,s,r){if(t.length===0||!vs(i,e,t[0],n,s,r))return!1;for(let a=1,o=t.length;aS&&(u=(c+d)/2,Lm(i,e,t,n,u,_)&&(E=u,S=C)),c=d}return isNaN(E)&&(E=s[r]),a?(a.push(E,_,S),a):[E,_,S]}function zE(i,e,t,n,s){let r=[];for(let a=0,o=t.length;a=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:qE(i,e,t,n,function(a,o){return aE(s,a,o)}):!1}function Mm(i,e,t,n,s){return!!(Om(i,e,t,n,s)||vs(i,e,t,n,s[0],s[1])||vs(i,e,t,n,s[0],s[3])||vs(i,e,t,n,s[2],s[1])||vs(i,e,t,n,s[2],s[3]))}function GE(i,e,t,n,s){if(!Mm(i,e,t[0],n,s))return!1;if(t.length===1)return!0;for(let r=1,a=t.length;r0}function WE(i,e,t,n,s){s=s!==void 0?s:!1;for(let r=0,a=t.length;r1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let s=0;for(;s0}getInteracting(){return this.hints_[xt.INTERACTING]>0}cancelAnimations(){this.setHint(xt.ANIMATING,-this.hints_[xt.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t=0;--n){const s=this.animations_[n];let r=!0;for(let a=0,o=s.length;a0?u/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const d=l.easing(c);if(l.sourceCenter){const p=l.sourceCenter[0],y=l.sourceCenter[1],_=l.targetCenter[0],T=l.targetCenter[1];this.nextCenter_=l.targetCenter;const E=p+d*(_-p),S=y+d*(T-y);this.targetCenter_=[E,S]}if(l.sourceResolution&&l.targetResolution){const p=d===1?l.targetResolution:l.sourceResolution+d*(l.targetResolution-l.sourceResolution);if(l.anchor){const y=this.getViewportSize_(this.getRotation()),_=this.constraints_.resolution(p,0,y,!0);this.targetCenter_=this.calculateCenterZoom(_,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const p=d===1?lr(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+d*(l.targetRotation-l.sourceRotation);if(l.anchor){const y=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(y,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(r){this.animations_[n]=null,this.setHint(xt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const a=s[0].callback;a&&Gl(a,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-t[0],s[1]-t[1]],bh(n,e-this.getRotation()),oE(n,t)),n}calculateCenterZoom(e,t){let n;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const a=t[0]-e*(t[0]-s[0])/r,o=t[1]-e*(t[1]-s[1])/r;n=[a,o]}return n}getViewportSize_(e){const t=this.viewportSize_;if(e){const n=t[0],s=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(s*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(s*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&wh(e,this.getProjection())}getCenterInternal(){return this.get(Ci.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return Ah(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();Te(t,"The view center is not defined");const n=this.getResolution();Te(n!==void 0,"The view resolution is not defined");const s=this.getRotation();return Te(s!==void 0,"The view rotation is not defined"),Th(t,n,s,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Ci.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(_s(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const n=Ie(e)/t[0],s=bt(e)/t[1];return Math.max(n,s)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(t/n)/Math.log(e);return function(r){return t/Math.pow(e,r*s)}}getRotation(){return this.get(Ci.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(n/s)/t;return function(a){return Math.log(n/a)/t/r}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const a=this.getViewportSizeMinusPadding_();s=Fh(s,this.getViewportSize_(),[a[0]/2+r[3],a[1]/2+r[0]],t,n)}return{center:s.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,s;if(this.resolutions_){const r=hh(this.resolutions_,e,1);t=r,n=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=n/this.resolutions_[r+1]}else n=this.maxResolution_,s=this.zoomFactor_;return t+Math.log(n/e)/Math.log(s)}getResolutionForZoom(e){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const t=it(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,it(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Te(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Te(!Ul(e),"Cannot fit empty extent provided as `geometry`");const s=_s(e,this.getProjection());n=Fm(s)}else if(e.getType()==="Circle"){const s=_s(e.getExtent(),this.getProjection());n=Fm(s),n.rotate(this.getRotation(),gs(s))}else n=e;this.fitInternal(n,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),n=Math.cos(t),s=Math.sin(-t),r=e.getFlatCoordinates(),a=e.getStride();let o=1/0,l=1/0,u=-1/0,c=-1/0;for(let d=0,p=r.length;d{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t;const n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Ui?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let s;t.layerStatesArray?s=t.layerStatesArray.find(a=>a.layer===this):s=this.getLayerState();const r=this.getExtent();return Bh(s,t.viewState)&&(!r||Bt(r,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t;const n=this.getSource();if(n&&(t=n.getAttributions()),!t)return[];const s=e instanceof Ui?e.getViewStateAndExtent():e;let r=t(s);return Array.isArray(r)||(r=[r]),r}render(e,t){const n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();!t||t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Re.MAP,e)}getMapInternal(){return this.get(Re.MAP)}setMap(e){this.mapPrecomposeKey_&&($e(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&($e(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=be(e,di.PRECOMPOSE,function(t){const s=t.frameState.layerStatesArray,r=this.getLayerState(!1);Te(!s.some(function(a){return a.layer===r.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),s.push(r)},this),this.mapRenderKey_=be(this,pe.CHANGE,e.render,e),this.changed())}setSource(e){this.set(Re.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function Bh(i,e){if(!i.visible)return!1;const t=e.resolution;if(t=i.maxResolution)return!1;const n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}const Hl=eS,Wl={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class tS extends Hl{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getPreload(){return this.get(Wl.PRELOAD)}setPreload(e){this.set(Wl.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Wl.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Wl.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}const iS=tS,ye={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class nS extends zg{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e}getFeatures(e){return Ee()}getData(e){return null}prepareFrame(e){return Ee()}renderFrame(e,t){return Ee()}loadedTileCallback(e,t,n){e[t]||(e[t]={}),e[t][n.tileCoord.toString()]=n}createLoadedTileFinder(e,t,n){return(s,r)=>{const a=this.loadedTileCallback.bind(this,n,s);return e.forEachLoadedTile(t,s,r,a)}}forEachFeatureAtCoordinate(e,t,n,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===ye.LOADED||t.getState()===ye.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=ye.LOADED&&t!=ye.ERROR&&e.addEventListener(pe.CHANGE,this.boundHandleImageChange_),t==ye.IDLE&&(e.load(),t=e.getState()),t==ye.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const sS=nS;class rS extends un{constructor(e,t,n,s){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=s}}const Bm=rS,Vn=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",aS=Vn.includes("firefox");Vn.includes("safari")&&!Vn.includes("chrom")&&(Vn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Vn));const oS=Vn.includes("webkit")&&!Vn.includes("edge"),Um=Vn.includes("macintosh"),$m=typeof devicePixelRatio<"u"?devicePixelRatio:1,Vm=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,jm=typeof Image<"u"&&Image.prototype.decode,zm=function(){let i=!1;try{const e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i}();function mt(i,e,t,n){let s;return t&&t.length?s=t.shift():Vm?s=new OffscreenCanvas(i||300,e||300):s=document.createElement("canvas"),i&&(s.width=i),e&&(s.height=e),s.getContext("2d",n)}let Uh;function Xl(){return Uh||(Uh=mt(1,1)),Uh}function Kl(i){const e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function qm(i,e){const t=e.parentNode;t&&t.replaceChild(i,e)}function $h(i){return i&&i.parentNode?i.parentNode.removeChild(i):null}function lS(i){for(;i.lastChild;)i.removeChild(i.lastChild)}function uS(i,e){const t=i.childNodes;for(let n=0;;++n){const s=t[n],r=e[n];if(!s&&!r)break;if(s!==r){if(!s){i.appendChild(r);continue}if(!r){i.removeChild(s),--n;continue}i.insertBefore(r,s)}}}class cS{constructor(){Ux(this,"pushMethodArgs_",(...e)=>(this.instructions_[this.zIndex+this.offset_].push(e),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Xl(),{get:(e,t)=>{if(typeof Xl()[t]=="function")return this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(t),this.pushMethodArgs_},set:(e,t,n)=>(this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(t,n),!0)})}pushFunction(e){this.instructions_[this.zIndex+this.offset_].push(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,s=t.length;n.0031308?1.055*Math.pow(r,1/2.4)-.055:r=r*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a=a*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o=o*12.92,r=Math.min(Math.max(0,r),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[r*255,a*255,o*255]},Fa.xyz=function(i,e){var t=i[0]/255,n=i[1]/255,s=i[2]/255;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,s=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92;var r=t*.41239079926595+n*.35758433938387+s*.18048078840183,a=t*.21263900587151+n*.71516867876775+s*.072192315360733,o=t*.019330818715591+n*.11919477979462+s*.95053215224966;return e=e||_t.whitepoint[2].E,[r*e[0],a*e[1],o*e[2]]};const Vh={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(i,e,t){var n,s,r,a,o,l,u,c,d,p,y,_,T;if(r=i[0],a=i[1],o=i[2],r===0)return[0,0,0];var E=.0011070564598794539;return e=e||"D65",t=t||2,d=_t.whitepoint[t][e][0],p=_t.whitepoint[t][e][1],y=_t.whitepoint[t][e][2],_=4*d/(d+15*p+3*y),T=9*p/(d+15*p+3*y),n=a/(13*r)+_||0,s=o/(13*r)+T||0,u=r>8?p*Math.pow((r+16)/116,3):p*r*E,l=u*9*n/(4*s)||0,c=u*(12-3*n-20*s)/(4*s)||0,[l,u,c]}};_t.luv=function(i,e,t){var n,s,r,a,o,l,u,c,d,p,y,_,T,E=.008856451679035631,S=903.2962962962961;e=e||"D65",t=t||2,d=_t.whitepoint[t][e][0],p=_t.whitepoint[t][e][1],y=_t.whitepoint[t][e][2],_=4*d/(d+15*p+3*y),T=9*p/(d+15*p+3*y),l=i[0],u=i[1],c=i[2],n=4*l/(l+15*u+3*c)||0,s=9*u/(l+15*u+3*c)||0;var C=u/p;return r=C<=E?S*C:116*Math.pow(C,1/3)-16,a=13*r*(n-_),o=13*r*(s-T),[r,a,o]};var Hm={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(i){var e=i[0],t=i[1],n=i[2],s,r,a;return a=n/360*2*Math.PI,s=t*Math.cos(a),r=t*Math.sin(a),[e,s,r]},xyz:function(i){return Vh.xyz(Hm.luv(i))}};Vh.lchuv=function(i){var e=i[0],t=i[1],n=i[2],s=Math.sqrt(t*t+n*n),r=Math.atan2(n,t),a=r*360/2/Math.PI;return a<0&&(a+=360),[e,s,a]},_t.lchuv=function(i){return Vh.lchuv(_t.luv(i))};const Wm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var Xm={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function hS(i){var c,d;var e,t=[],n=1,s;if(typeof i=="number")return{space:"rgb",values:[i>>>16,(i&65280)>>>8,i&255],alpha:1};if(typeof i=="number")return{space:"rgb",values:[i>>>16,(i&65280)>>>8,i&255],alpha:1};if(i=String(i).toLowerCase(),Wm[i])t=Wm[i].slice(),s="rgb";else if(i==="transparent")n=0,s="rgb",t=[0,0,0];else if(i[0]==="#"){var r=i.slice(1),a=r.length,o=a<=4;n=1,o?(t=[parseInt(r[0]+r[0],16),parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16)],a===4&&(n=parseInt(r[3]+r[3],16)/255)):(t=[parseInt(r[0]+r[1],16),parseInt(r[2]+r[3],16),parseInt(r[4]+r[5],16)],a===8&&(n=parseInt(r[6]+r[7],16)/255)),t[0]||(t[0]=0),t[1]||(t[1]=0),t[2]||(t[2]=0),s="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(i)){var l=e[1];s=l.replace(/a$/,"");var u=s==="cmyk"?4:s==="gray"?1:3;t=e[2].trim().split(/\s*[,\/]\s*|\s+/),s==="color"&&(s=t.shift()),t=t.map(function(p,y){if(p[p.length-1]==="%")return p=parseFloat(p)/100,y===3?p:s==="rgb"?p*255:s[0]==="h"||s[0]==="l"&&!y?p*100:s==="lab"?p*125:s==="lch"?y<2?p*150:p*360:s[0]==="o"&&!y?p:s==="oklab"?p*.4:s==="oklch"?y<2?p*.4:p*360:p;if(s[y]==="h"||y===2&&s[s.length-1]==="h"){if(Xm[p]!==void 0)return Xm[p];if(p.endsWith("deg"))return parseFloat(p);if(p.endsWith("turn"))return parseFloat(p)*360;if(p.endsWith("grad"))return parseFloat(p)*360/400;if(p.endsWith("rad"))return parseFloat(p)*180/Math.PI}return p==="none"?0:parseFloat(p)}),n=t.length>u?t.pop():1}else/[0-9](?:\s|\/|,)/.test(i)&&(t=i.match(/([0-9]+)/g).map(function(p){return parseFloat(p)}),s=((d=(c=i.match(/([a-z])/ig))==null?void 0:c.join(""))==null?void 0:d.toLowerCase())||"rgb");return{space:s,values:t,alpha:n}}const jh={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(i){var e=i[0]/360,t=i[1]/100,n=i[2]/100,s,r,a,o,l,u=0;if(t===0)return l=n*255,[l,l,l];for(r=n<.5?n*(1+t):n+t-n*t,s=2*n-r,o=[0,0,0];u<3;)a=e+1/3*-(u-1),a<0?a++:a>1&&a--,l=6*a<1?s+(r-s)*6*a:2*a<1?r:3*a<2?s+(r-s)*(2/3-a)*6:s,o[u++]=l*255;return o}};Fa.hsl=function(i){var e=i[0]/255,t=i[1]/255,n=i[2]/255,s=Math.min(e,t,n),r=Math.max(e,t,n),a=r-s,o,l,u;return r===s?o=0:e===r?o=(t-n)/a:t===r?o=2+(n-e)/a:n===r&&(o=4+(e-t)/a),o=Math.min(o*60,360),o<0&&(o+=360),u=(s+r)/2,r===s?l=0:u<=.5?l=a/(r+s):l=a/(2-r-s),[o,l*100,u*100]};function dS(i){Array.isArray(i)&&i.raw&&(i=String.raw(...arguments)),i instanceof Number&&(i=+i);var e,t=hS(i);if(!t.space)return[];const n=t.space[0]==="h"?jh.min:Fa.min,s=t.space[0]==="h"?jh.max:Fa.max;return e=Array(3),e[0]=Math.min(Math.max(t.values[0],n[0]),s[0]),e[1]=Math.min(Math.max(t.values[1],n[1]),s[1]),e[2]=Math.min(Math.max(t.values[2],n[2]),s[2]),t.space[0]==="h"&&(e=jh.rgb(e)),e.push(Math.min(Math.max(t.alpha,0),1)),e}function fS(i){return typeof i=="string"?i:Gh(i)}const pS=1024,Ba={};let zh=0;function gS(i){if(i.length===4)return i;const e=i.slice();return e[3]=1,e}function Km(i){const e=_t.lchuv(Fa.xyz(i));return e[3]=i[3],e}function mS(i){const e=_t.rgb(Hm.xyz(i));return e[3]=i[3],e}function qh(i){if(Ba.hasOwnProperty(i))return Ba[i];if(zh>=pS){let t=0;for(const n in Ba)(t++&3)===0&&(delete Ba[n],--zh)}const e=dS(i);if(e.length!==4)throw new Error('Failed to parse "'+i+'" as color');for(const t of e)if(isNaN(t))throw new Error('Failed to parse "'+i+'" as color');return Ym(e),Ba[i]=e,++zh,e}function Ua(i){return Array.isArray(i)?i:qh(i)}function Ym(i){return i[0]=it(i[0]+.5|0,0,255),i[1]=it(i[1]+.5|0,0,255),i[2]=it(i[2]+.5|0,0,255),i[3]=it(i[3],0,1),i}function Gh(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const s=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+s+")"}function _S(i){try{return qh(i),!0}catch{return!1}}const Zm=[];let _r=null;function yS(){_r=mt(1,1,void 0,{willReadFrequently:!0})}class vS extends sS{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=wi(),this.pixelTransform=wi(),this.inversePixelTransform=wi(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,n){_r||yS(),_r.clearRect(0,0,1,1);let s;try{_r.drawImage(e,t,n,1,1,0,0,1,1),s=_r.getImageData(0,0,1,1).data}catch{return _r=null,null}return s}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n){const s=this.getLayer().getClassName();let r,a;if(e&&e.className===s&&(!n||e&&e.style.backgroundColor&&Bn(Ua(e.style.backgroundColor),Ua(n)))){const o=e.firstElementChild;o instanceof HTMLCanvasElement&&(a=o.getContext("2d"))}if(a&&a.canvas.style.transform===t?(this.container=e,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=s;let o=r.style;o.position="absolute",o.width="100%",o.height="100%",a=mt();const l=a.canvas;r.appendChild(l),o=l.style,o.position="absolute",o.left="0",o.transformOrigin="top left",this.container=r,this.context=a}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){const s=ms(n),r=Bl(n),a=Fl(n),o=Nl(n);gt(t.coordinateToPixelTransform,s),gt(t.coordinateToPixelTransform,r),gt(t.coordinateToPixelTransform,a),gt(t.coordinateToPixelTransform,o);const l=this.inversePixelTransform;gt(l,s),gt(l,r),gt(l,a),gt(l,o),e.save(),e.beginPath(),e.moveTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){const n=e.extent,s=e.viewState.resolution,r=e.viewState.rotation,a=e.pixelRatio,o=Math.round(Ie(n)/s*a),l=Math.round(bt(n)/s*a);dn(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/a,1/a,r,-o/2,-l/2),vm(this.inversePixelTransform,this.pixelTransform);const u=AE(this.pixelTransform);if(this.useContainer(t,u,this.getBackground(e)),!this.containerReused){const c=this.context.canvas;c.width!=o||c.height!=l?(c.width=o,c.height=l):this.context.clearRect(0,0,o,l),u!==c.style.transform&&(c.style.transform=u)}}dispatchRenderEvent_(e,t,n){const s=this.getLayer();if(s.hasListener(e)){const r=new Bm(e,this.inversePixelTransform,n,t);s.dispatchEvent(r)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(di.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(di.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Gm),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){!e.declutter||(this.dispatchRenderEvent_(di.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(di.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,s,r,a,o){const l=r/2,u=a/2,c=s/t,d=-c,p=-e[0]+o,y=-e[1];return dn(this.tempTransform,l,u,c,d,-n,p,y)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Qm=vS,se={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class TS extends Al{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.interimTile=null,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(pe.CHANGE)}release(){this.state===se.ERROR&&this.setState(se.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){let e=this.interimTile;if(!e)return this;do{if(e.getState()==se.LOADED)return this.transition_=0,e;e=e.interimTile}while(e);return this}refreshInterimChain(){let e=this.interimTile;if(!e)return;let t=this;do{if(e.getState()==se.LOADED){e.interimTile=null;break}e.getState()==se.LOADING?t=e:e.getState()==se.IDLE?t.interimTile=e.interimTile:t=e,e=t.interimTile}while(e)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==se.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){Ee()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;const s=t-n+1e3/60;return s>=this.transition_?1:ym(s/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}const Jm=TS;function xS(i,e,t){const n=i;let s=!0,r=!1,a=!1;const o=[Il(n,pe.LOAD,function(){a=!0,r||e()})];return n.src&&jm?(r=!0,n.decode().then(function(){s&&e()}).catch(function(l){s&&(a?e():t())})):o.push(Il(n,pe.ERROR,t)),function(){s=!1,o.forEach($e)}}function bS(i,e){return new Promise((t,n)=>{function s(){a(),t(i)}function r(){a(),n(new Error("Image load error"))}function a(){i.removeEventListener("load",s),i.removeEventListener("error",r)}i.addEventListener("load",s),i.addEventListener("error",r),e&&(i.src=e)})}function ES(i,e){return e&&(i.src=e),i.src&&jm?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(s=>i.complete&&i.width?t(i):n(s))):bS(i)}class SS extends Jm{constructor(e,t,n,s,r,a){super(e,t,a),this.crossOrigin_=s,this.src_=n,this.key=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(e){this.image_=e,this.state=se.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=se.ERROR,this.unlistenImage_(),this.image_=CS(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=se.LOADED:this.state=se.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==se.ERROR&&(this.state=se.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==se.IDLE&&(this.state=se.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=xS(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function CS(){const i=mt(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}const e0=SS,wS=.5,AS=10,t0=.25;class IS{constructor(e,t,n,s,r,a){this.sourceProj_=e,this.targetProj_=t;let o={};const l=jl(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const D=C[0]+"/"+C[1];return o[D]||(o[D]=l(C)),o[D]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&Ie(s)>=Ie(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ie(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ie(this.targetProj_.getExtent()):null;const u=ms(n),c=Bl(n),d=Fl(n),p=Nl(n),y=this.transformInv_(u),_=this.transformInv_(c),T=this.transformInv_(d),E=this.transformInv_(p),S=AS+(a?Math.max(0,Math.ceil(Math.log2(vh(n)/(a*a*256*256)))):0);if(this.addQuad_(u,c,d,p,y,_,T,E,S),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(D,k,w){C=Math.min(C,D.source[0][0],D.source[1][0],D.source[2][0])}),this.triangles_.forEach(D=>{if(Math.max(D.source[0][0],D.source[1][0],D.source[2][0])-C>this.sourceWorldWidth_/2){const k=[[D.source[0][0],D.source[0][1]],[D.source[1][0],D.source[1][1]],[D.source[2][0],D.source[2][1]]];k[0][0]-C>this.sourceWorldWidth_/2&&(k[0][0]-=this.sourceWorldWidth_),k[1][0]-C>this.sourceWorldWidth_/2&&(k[1][0]-=this.sourceWorldWidth_),k[2][0]-C>this.sourceWorldWidth_/2&&(k[2][0]-=this.sourceWorldWidth_);const w=Math.min(k[0][0],k[1][0],k[2][0]);Math.max(k[0][0],k[1][0],k[2][0])-w.5&&d<1;let _=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const E=Yg([e,t,n,s]);_=Ie(E)/this.targetWorldWidth_>t0||_}!y&&this.sourceProj_.isGlobal()&&d&&(_=d>t0||_)}if(!_&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Bt(c,this.maxSourceExtent_))return;let T=0;if(!_&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(l[0])||!isFinite(l[1]))){if(u>0)_=!0;else if(T=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(a[0])||!isFinite(a[1])?4:0)+(!isFinite(o[0])||!isFinite(o[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),T!=1&&T!=2&&T!=4&&T!=8)return}if(u>0){if(!_){const E=[(e[0]+n[0])/2,(e[1]+n[1])/2],S=this.transformInv_(E);let C;y?C=(lr(r[0],p)+lr(o[0],p))/2-lr(S[0],p):C=(r[0]+o[0])/2-S[0];const D=(r[1]+o[1])/2-S[1];_=C*C+D*D>this.errorThresholdSquared_}if(_){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){const E=[(t[0]+n[0])/2,(t[1]+n[1])/2],S=this.transformInv_(E),C=[(s[0]+e[0])/2,(s[1]+e[1])/2],D=this.transformInv_(C);this.addQuad_(e,t,E,C,r,a,S,D,u-1),this.addQuad_(C,E,n,s,D,S,o,l,u-1)}else{const E=[(e[0]+t[0])/2,(e[1]+t[1])/2],S=this.transformInv_(E),C=[(n[0]+s[0])/2,(n[1]+s[1])/2],D=this.transformInv_(C);this.addQuad_(e,E,C,s,r,S,D,l,u-1),this.addQuad_(E,t,n,C,S,a,o,D,u-1)}return}}if(y){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(T&11)==0&&this.addTriangle_(e,n,s,r,o,l),(T&14)==0&&this.addTriangle_(e,n,t,r,o,a),T&&((T&13)==0&&this.addTriangle_(t,s,e,a,l,r),(T&7)==0&&this.addTriangle_(t,s,n,a,l,o))}calculateSourceExtent(){const e=fi();return this.triangles_.forEach(function(t,n,s){const r=t.source;Oa(e,r[0]),Oa(e,r[1]),Oa(e,r[2])}),e}getTriangles(){return this.triangles_}}const DS=IS;let Hh;const yr=[];function i0(i,e,t,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,s)),i.restore()}function Wh(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function kS(){if(Hh===void 0){const i=mt(6,6,yr);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",i0(i,4,5,4,0),i0(i,4,5,0,5);const e=i.getImageData(0,0,3,3).data;Hh=Wh(e,0)||Wh(e,4)||Wh(e,8),Kl(i),yr.push(i.canvas)}return Hh}function n0(i,e,t,n){const s=pm(t,e,i);let r=hm(e,n,t);const a=e.getMetersPerUnit();a!==void 0&&(r*=a);const o=i.getMetersPerUnit();o!==void 0&&(r/=o);const l=i.getExtent();if(!l||dr(l,s)){const u=hm(i,r,s)/r;isFinite(u)&&u>0&&(r/=u)}return r}function RS(i,e,t,n){const s=gs(t);let r=n0(i,e,s,n);return(!isFinite(r)||r<=0)&&im(t,function(a){return r=n0(i,e,a,n),isFinite(r)&&r>0}),r}function PS(i,e,t,n,s,r,a,o,l,u,c,d,p,y){const _=mt(Math.round(t*i),Math.round(t*e),yr);if(d||(_.imageSmoothingEnabled=!1),l.length===0)return _.canvas;_.scale(t,t);function T(w){return Math.round(w*t)/t}_.globalCompositeOperation="lighter";const E=fi();l.forEach(function(w,O,N){iE(E,w.extent)});let S;const C=t/n,D=(d?1:1+Math.pow(2,-24))/C;if(!p||l.length!==1||u!==0){if(S=mt(Math.round(Ie(E)*C),Math.round(bt(E)*C),yr),d||(S.imageSmoothingEnabled=!1),s&&y){const w=(s[0]-E[0])*C,O=-(s[3]-E[3])*C,N=Ie(s)*C,F=bt(s)*C;S.rect(w,O,N,F),S.clip()}l.forEach(function(w,O,N){if(w.image.width>0&&w.image.height>0){if(w.clipExtent){S.save();const K=(w.clipExtent[0]-E[0])*C,G=-(w.clipExtent[3]-E[3])*C,Y=Ie(w.clipExtent)*C,ee=bt(w.clipExtent)*C;S.rect(d?K:Math.round(K),d?G:Math.round(G),d?Y:Math.round(K+Y)-Math.round(K),d?ee:Math.round(G+ee)-Math.round(G)),S.clip()}const F=(w.extent[0]-E[0])*C,$=-(w.extent[3]-E[3])*C,J=Ie(w.extent)*C,X=bt(w.extent)*C;S.drawImage(w.image,u,u,w.image.width-2*u,w.image.height-2*u,d?F:Math.round(F),d?$:Math.round($),d?J:Math.round(F+J)-Math.round(F),d?X:Math.round($+X)-Math.round($)),w.clipExtent&&S.restore()}})}const k=ms(a);return o.getTriangles().forEach(function(w,O,N){const F=w.source,$=w.target;let J=F[0][0],X=F[0][1],K=F[1][0],G=F[1][1],Y=F[2][0],ee=F[2][1];const q=T(($[0][0]-k[0])/r),ie=T(-($[0][1]-k[1])/r),ae=T(($[1][0]-k[0])/r),Se=T(-($[1][1]-k[1])/r),ue=T(($[2][0]-k[0])/r),ge=T(-($[2][1]-k[1])/r),fe=J,Ce=X;J=0,X=0,K-=fe,G-=Ce,Y-=fe,ee-=Ce;const W=[[K,G,0,0,ae-q],[Y,ee,0,0,ue-q],[0,0,K,G,Se-ie],[0,0,Y,ee,ge-ie]],pt=zb(W);if(!pt)return;if(_.save(),_.beginPath(),kS()||!d){_.moveTo(ae,Se);const Ze=4,ai=q-ae,kn=ie-Se;for(let Tt=0;Tt{const J=t.getTileRangeForExtentAndZ($,this.sourceZ_);for(let X=J.minX;X<=J.maxX;X++)for(let K=J.minY;K<=J.maxY;K++){const G=u(this.sourceZ_,X,K,o);if(G){const Y=N*O;this.sourceTiles_.push({tile:G,offset:Y})}}++N}),this.sourceTiles_.length===0&&(this.state=se.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{var s;const n=t.tile;if(n&&n.getState()==se.LOADED){const r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;const a=(s=this.clipExtent_)==null?void 0:s.slice();a&&(a[0]+=t.offset,a[2]+=t.offset),e.push({extent:r,clipExtent:a,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=se.ERROR;else{const t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),s=typeof n=="number"?n:n[0],r=typeof n=="number"?n:n[1],a=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=PS(s,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),a,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=se.LOADED}this.changed()}load(){if(this.state==se.IDLE){this.state=se.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const n=t.getState();if(n==se.IDLE||n==se.LOADING){e++;const s=be(t,pe.CHANGE,function(r){const a=t.getState();(a==se.LOADED||a==se.ERROR||a==se.EMPTY)&&($e(s),e--,e===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(s)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,s){t.getState()==se.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach($e),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Kl(this.canvas_.getContext("2d")),yr.push(this.canvas_),this.canvas_=null),super.release()}}const Xh=LS;class s0{constructor(e,t,n,s){this.minX=e,this.maxX=t,this.minY=n,this.maxY=s}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minXthis.maxX&&(this.maxX=e.maxX),e.minYthis.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function vr(i,e,t,n,s){return s!==void 0?(s.minX=i,s.maxX=e,s.minY=t,s.maxY=n,s):new s0(i,e,t,n)}const r0=s0;function a0(i){return i[0]>0&&i[1]>0}function OS(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function Qt(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}class MS extends Qm{constructor(e){super(e),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=fi(),this.tmpTileRange_=new r0(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),n=e.getState(),s=t.getUseInterimTilesOnError();return n==se.LOADED||n==se.EMPTY||n==se.ERROR&&!s}getTile(e,t,n,s){const r=s.pixelRatio,a=s.viewState.projection,o=this.getLayer();let u=o.getSource().getTile(e,t,n,r,a);return u.getState()==se.ERROR&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(u)||(u=u.getInterimTile()),u}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),s=gt(t.pixelToCoordinateTransform,e.slice()),r=n.getExtent();if(r&&!dr(r,s))return null;const a=t.pixelRatio,o=t.viewState.projection,l=t.viewState,u=n.getRenderSource(),c=u.getTileGridForProjection(l.projection),d=u.getTilePixelRatio(t.pixelRatio);for(let p=c.getZForResolution(l.resolution);p>=c.getMinZoom();--p){const y=c.getTileCoordForCoordAndZ(s,p),_=u.getTile(p,y[1],y[2],a,o);if(!(_ instanceof e0||_ instanceof Xh)||_ instanceof Xh&&_.getState()===se.EMPTY)return null;if(_.getState()!==se.LOADED)continue;const T=c.getOrigin(p),E=Qt(c.getTileSize(p)),S=c.getResolution(p),C=Math.floor(d*((s[0]-T[0])/S-y[1]*E[0])),D=Math.floor(d*((T[1]-s[1])/S-y[2]*E[1])),k=Math.round(d*u.getGutterForProjection(l.projection));return this.getImageData(_.getImage(),C+k,D+k)}return null}loadedTileCallback(e,t,n){return this.isDrawableTile(n)?super.loadedTileCallback(e,t,n):!1}prepareFrame(e){return!!this.getLayer().getSource()}renderFrame(e,t){const n=e.layerStatesArray[e.layerIndex],s=e.viewState,r=s.projection,a=s.resolution,o=s.center,l=s.rotation,u=e.pixelRatio,c=this.getLayer(),d=c.getSource(),p=d.getRevision(),y=d.getTileGridForProjection(r),_=y.getZForResolution(a,d.zDirection),T=y.getResolution(_);let E=e.extent;const S=e.viewState.resolution,C=d.getTilePixelRatio(u);this.prepareContainer(e,t);const D=this.context.canvas.width,k=this.context.canvas.height,w=n.extent&&_s(n.extent);w&&(E=Ma(E,_s(n.extent)));const O=T*D/2/C,N=T*k/2/C,F=[o[0]-O,o[1]-N,o[0]+O,o[1]+N],$=y.getTileRangeForExtentAndZ(E,_),J={};J[_]={};const X=this.createLoadedTileFinder(d,r,J),K=this.tmpExtent,G=this.tmpTileRange_;this.newTiles_=!1;const Y=l?xh(s.center,S,l,e.size):void 0;for(let ge=$.minX;ge<=$.maxX;++ge)for(let fe=$.minY;fe<=$.maxY;++fe){if(l&&!y.tileCoordIntersectsViewport([_,ge,fe],Y))continue;const Ce=this.getTile(_,ge,fe,e);if(this.isDrawableTile(Ce)){const at=Ae(this);if(Ce.getState()==se.LOADED){J[_][Ce.tileCoord.toString()]=Ce;let Ze=Ce.inTransition(at);Ze&&n.opacity!==1&&(Ce.endTransition(at),Ze=!1),!this.newTiles_&&(Ze||!this.renderedTiles.includes(Ce))&&(this.newTiles_=!0)}if(Ce.getAlpha(at,e.time)===1)continue}const W=y.getTileCoordChildTileRange(Ce.tileCoord,G,K);let pt=!1;W&&(pt=X(_+1,W)),pt||y.forEachTileCoordParentTileRange(Ce.tileCoord,X,G,K)}const ee=T/a*u/C,q=this.getRenderContext(e);dn(this.tempTransform,D/2,k/2,ee,ee,0,-D/2,-k/2),w&&this.clipUnrotated(q,e,w),d.getInterpolate()||(q.imageSmoothingEnabled=!1),this.preRender(q,e),this.renderedTiles.length=0;let ie=Object.keys(J).map(Number);ie.sort(cn);let ae,Se,ue;n.opacity===1&&(!this.containerReused||d.getOpaque(e.viewState.projection))?ie=ie.reverse():(ae=[],Se=[]);for(let ge=ie.length-1;ge>=0;--ge){const fe=ie[ge],Ce=d.getTilePixelSize(fe,u,r),pt=y.getResolution(fe)/T,at=Ce[0]*pt*ee,Ze=Ce[1]*pt*ee,ai=y.getTileCoordForCoordAndZ(ms(F),fe),kn=y.getTileCoordExtent(ai),Tt=gt(this.tempTransform,[C*(kn[0]-F[0])/T,C*(F[3]-kn[3])/T]),va=C*d.getGutterForProjection(r),ls=J[fe];for(const Jo in ls){const rn=ls[Jo],Vs=rn.tileCoord,an=ai[1]-Vs[1],js=Math.round(Tt[0]-(an-1)*at),oi=ai[2]-Vs[2],zs=Math.round(Tt[1]-(oi-1)*Ze),me=Math.round(Tt[0]-an*at),Kt=Math.round(Tt[1]-oi*Ze),li=js-me,Rn=zs-Kt,Li=_===fe,xi=Li&&rn.getAlpha(Ae(this),e.time)!==1;let Oi=!1;if(!xi)if(ae){ue=[me,Kt,me+li,Kt,me+li,Kt+Rn,me,Kt+Rn];for(let ui=0,on=ae.length;ui0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const n=this.entries_[e];return Te(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){const t=this.entries_[e];return Te(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){var t;return(t=this.entries_[e])==null?void 0:t.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){Te(!(e in this.entries_),"Tried to set a value for a key that is used already");const n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}}const $S=US;function o0(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Yl(i,e,t){return i+"/"+e+"/"+t}function l0(i){return Yl(i[0],i[1],i[2])}function VS(i){return i.split("/").map(Number)}function jS(i){return(i[1]<t||t>e.getMaxZoom())return!1;const r=e.getFullTileRange(t);return r?r.containsXY(n,s):!0}class qS extends $S{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(e){for(;this.canExpireCache()&&!(this.peekLast().getKey()in e);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const e=this.peekFirstKey(),n=VS(e)[0];this.forEach(s=>{s.tileCoord[0]!==n&&(this.remove(l0(s.tileCoord)),s.release())})}}const u0=qS,Kh={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class GS extends Bi{constructor(e){super(),this.projection=pi(e.projection),this.attributions_=c0(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible!==void 0?e.attributionsCollapsible:!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(n,s){t.viewResolver=n,t.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=c0(e),this.changed()}setState(e){this.state_=e,this.changed()}}function c0(i){return i?Array.isArray(i)?function(e){return i}:typeof i=="function"?i:function(e){return[i]}:null}const h0=GS,Tr=[0,0,0],jn=5;class HS{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,Te(Nb(this.resolutions_,(s,r)=>r-s,!0),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let s=0,r=this.resolutions_.length-1;s{const a=new r0(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const o=this.getTileRangeForExtentAndZ(n,r);a.minX=Math.max(o.minX,a.minX),a.maxX=Math.min(o.maxX,a.maxX),a.minY=Math.max(o.minY,a.minY),a.maxY=Math.min(o.maxY,a.maxY)}return a}):n&&this.calculateTileRanges_(n)}forEachTileCoord(e,t,n){const s=this.getTileRangeForExtentAndZ(e,t);for(let r=s.minX,a=s.maxX;r<=a;++r)for(let o=s.minY,l=s.maxY;o<=l;++o)n([t,r,o])}forEachTileCoordParentTileRange(e,t,n,s){let r,a,o,l=null,u=e[0]-1;for(this.zoomFactor_===2?(a=e[1],o=e[2]):l=this.getTileCoordExtent(e,s);u>=this.minZoom;){if(a!==void 0&&o!==void 0?(a=Math.floor(a/2),o=Math.floor(o/2),r=vr(a,a,o,o,n)):r=this.getTileRangeForExtentAndZ(l,u,n),t(u,r))return!0;--u}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]this.maxZoom||t0?n:Math.max(r/t[0],s/t[1]);const a=e+1,o=new Array(a);for(let l=0;ln.highWaterMark&&(n.highWaterMark=e)}useTile(e,t,n,s){}}class QS extends un{constructor(e,t){super(e),this.tile=t}}const JS=ZS;function eC(i,e){const t=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(a,o,l){if(!!a)return i.replace(t,a[0].toString()).replace(n,a[1].toString()).replace(s,a[2].toString()).replace(r,function(){const u=a[0],c=e.getFullTileRange(u);if(!c)throw new Error("The {-y} placeholder requires a tile grid with extent");return(c.getHeight()-a[2]-1).toString()})}}function tC(i,e){const t=i.length,n=new Array(t);for(let s=0;sthis.getTileInternal(E,S,C,D,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return T.key=d,u?(T.interimTile=u,T.refreshInterimChain(),o.replace(c,T)):o.set(c,T),T}getTileInternal(e,t,n,s,r){let a=null;const o=Yl(e,t,n),l=this.getKey();if(!this.tileCache.containsKey(o))a=this.createTile_(e,t,n,s,r,l),this.tileCache.set(o,a);else if(a=this.tileCache.get(o),a.key!=l){const u=a;a=this.createTile_(e,t,n,s,r,l),u.getState()==se.IDLE?a.interimTile=u.interimTile:a.interimTile=u,a.refreshInterimChain(),this.tileCache.replace(o,a)}return a}setRenderReprojectionEdges(e){if(this.renderReprojectionEdges_!=e){this.renderReprojectionEdges_=e;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(e,t){const n=pi(e);if(n){const s=Ae(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function aC(i,e){i.getImage().src=e}const oC=rC;class lC extends oC{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:KS({extent:Yh(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,opaque:e.opaque,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const uC=lC,SN="",Ut={ADD:"add",REMOVE:"remove"},g0={LENGTH:"length"};class Zl extends un{constructor(e,t,n){super(e),this.element=t,this.index=n}}class cC extends Bi{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let n=0,s=this.array_.length;n0;)this.pop()}extend(e){for(let t=0,n=e.length;tthis.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Zl(Ut.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let n=0,s=t.length;n=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Zl(Ut.REMOVE,t,e)),t}setAt(e,t){const n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const s=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Zl(Ut.REMOVE,s,e)),this.dispatchEvent(new Zl(Ut.ADD,t,e))}updateLength_(){this.set(g0.LENGTH,this.array_.length)}assertUnique_(e,t){for(let n=0,s=this.array_.length;nthis.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t,n){const s=Jh(e,t,n);return s in this.cache_?this.cache_[s]:null}getPattern(e,t,n){const s=Jh(e,t,n);return s in this.patternCache_?this.patternCache_[s]:null}set(e,t,n,s,r){const a=Jh(e,t,n),o=a in this.cache_;this.cache_[a]=s,r&&(s.getImageState()===ye.IDLE&&s.load(),s.getImageState()===ye.LOADING?s.ready().then(()=>{this.patternCache_[a]=Xl().createPattern(s.getImage(1),"repeat")}):this.patternCache_[a]=Xl().createPattern(s.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function Jh(i,e,t){const n=t?Ua(t):"null";return e+":"+i+":"+n}const Vi=new fC;let $a=null;class pC extends Al{constructor(e,t,n,s,r){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n,this.canvas_={},this.color_=r,this.imageState_=s===void 0?ye.IDLE:s,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===ye.LOADED){$a||($a=mt(1,1,void 0,{willReadFrequently:!0})),$a.drawImage(this.image_,0,0);try{$a.getImageData(0,0,1,1),this.tainted_=!1}catch{$a=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(pe.CHANGE)}handleImageError_(){this.imageState_=ye.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ye.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],n=mt(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ye.IDLE){this.image_||this.initializeImage_(),this.imageState_=ye.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&ES(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==ye.LOADED)return;const t=this.image_,n=document.createElement("canvas");n.width=Math.ceil(t.width*e),n.height=Math.ceil(t.height*e);const s=n.getContext("2d");s.scale(e,e),s.drawImage(t,0,0),s.globalCompositeOperation="multiply",s.fillStyle=fS(this.color_),s.fillRect(0,0,n.width/e,n.height/e),s.globalCompositeOperation="destination-in",s.drawImage(t,0,0),this.canvas_[e]=n}ready(){return this.ready_||(this.ready_=new Promise(e=>{this.imageState_===ye.LOADED||this.imageState_===ye.ERROR?e():this.addEventListener(pe.CHANGE,function t(){(this.imageState_===ye.LOADED||this.imageState_===ye.ERROR)&&(this.removeEventListener(pe.CHANGE,t),e())})})),this.ready_}}function ed(i,e,t,n,s,r){let a=e===void 0?void 0:Vi.get(e,t,s);return a||(a=new pC(i,i&&"src"in i?i.src||void 0:e,t,n,s),Vi.set(e,t,s,a,r)),r&&a&&!Vi.getPattern(e,t,s)&&Vi.set(e,t,s,a,r),a}class td{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){const e=this.getColor();return new td({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){const t=ed(null,e.src,"anonymous",void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===ye.IDLE&&t.load(),t.getImageState()===ye.LOADING&&(this.patternImage_=t)}this.color_=e}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const id=td;function m0(i,e,t,n,s,r,a){let o,l;const u=(t-e)/n;if(u===1)o=e;else if(u===2)o=e,l=s;else if(u!==0){let c=i[e],d=i[e+1],p=0;const y=[0];for(let E=e+n;E1?a:2,r=r||new Array(a);for(let c=0;cMath.max(s,tu(i,r)),0);return t[e]=n,n}function TC(i,e){const t=[],n=[],s=[];let r=0,a=0,o=0,l=0;for(let u=0,c=e.length;u<=c;u+=2){const d=e[u];if(d===` `||u===c){r=Math.max(r,a),s.push(a),a=0,o+=l,l=0;continue}const p=e[u+1]||i.font,y=tu(p,d);t.push(y),a+=y;const _=vC(p);n.push(_),l=Math.max(l,_)}return{width:r,height:o,widths:t,heights:n,lineWidths:s}}function xC(i,e,t,n,s,r,a,o,l,u,c){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=d=>d.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,u),i.scale(c[0],c[1]),bC(n,i)):c[0]<0||c[1]<0?(i.translate(l,u),i.scale(c[0],c[1]),i.drawImage(n,s,r,a,o,0,0,a,o)):i.drawImage(n,s,r,a,o,l,u,a*c[0],o*c[1]),i.restore()}function bC(i,e){const t=i.contextInstructions;for(let n=0,s=t.length;nthis.imageState_=ye.LOADED),this.render()}clone(){const e=this.getScale(),t=new ld({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.canvases_[e];if(!t){const n=this.renderOptions_,s=mt(n.size*e,n.size*e);this.draw_(n,s,e),t=s.canvas,this.canvases_[e]=t}return t}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let s=this.radius_,r=this.radius2_===void 0?s:this.radius2_;if(st;){if(n-t>600){var r=n-t+1,a=e-t+1,o=Math.log(r),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(r-l)/r)*(a-r/2<0?-1:1),c=Math.max(t,Math.floor(e-a*l/r+u)),d=Math.min(n,Math.floor(e+(r-a)*l/r+u));D0(i,e,c,d,s)}var p=i[e],y=t,_=n;for(Ha(i,t,e),s(i[n],p)>0&&Ha(i,t,n);y<_;){for(Ha(i,y,_),y++,_--;s(i[y],p)<0;)y++;for(;s(i[_],p)>0;)_--}s(i[t],p)===0?Ha(i,t,_):(_++,Ha(i,_,n)),_<=e&&(t=_+1),e<=_&&(n=_-1)}}function Ha(i,e,t){var n=i[e];i[e]=i[t],i[t]=n}function AC(i,e){return ie?1:0}class k0{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const n=[];if(!su(e,t))return n;const s=this.toBBox,r=[];for(;t;){for(let a=0;a=0&&r[t].children.length>this._maxEntries;)this._split(r,t),t--;this._adjustParentBBoxes(s,r,t)}_split(e,t){const n=e[t],s=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,s);const a=this._chooseSplitIndex(n,r,s),o=Cr(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,Sr(n,this.toBBox),Sr(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=Cr([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Sr(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let s,r=1/0,a=1/0;for(let o=t;o<=n-t;o++){const l=Wa(e,0,o,this.toBBox),u=Wa(e,o,n,this.toBBox),c=PC(l,u),d=dd(l)+dd(u);c=t;u--){const c=e.children[u];Xa(o,e.leaf?r(c):c),l+=nu(o)}return l}_adjustParentBBoxes(e,t,n){for(let s=n;s>=0;s--)Xa(t[s],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Sr(e[t],this.toBBox)}}function IC(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n=i.minX&&e.maxY>=i.minY}function Cr(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function R0(i,e,t,n,s){const r=[e,t];for(;r.length;){if(t=r.pop(),e=r.pop(),t-e<=n)continue;const a=e+Math.ceil((t-e)/n/2)*n;wC(i,a,e,t,s),r.push(e,a,a,t)}}function P0(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}class pd extends y0{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,s=e.scale!==void 0?e.scale:1,r=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:s,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:r,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;const a=e.img!==void 0?e.img:null;let o=e.src;Te(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||Ae(a)),Te(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),Te(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=ye.IDLE:a!==void 0&&("complete"in a?a.complete?l=a.src?ye.LOADED:ye.IDLE:l=ye.LOADING:l=ye.LOADED),this.color_=e.color!==void 0?Ua(e.color):null,this.iconImage_=ed(a,o,this.crossOrigin_,l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,e.width!==void 0||e.height!==void 0){let u,c;if(e.size)[u,c]=e.size;else{const d=this.getImage(1);if(d.width&&d.height)u=d.width,c=d.height;else if(d instanceof HTMLImageElement){this.initialOptions_=e;const p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;const y=this.iconImage_.getSize();this.setScale(P0(y[0],y[1],e.width,e.height))};this.listenImageChange(p);return}}u!==void 0&&this.setScale(P0(u,c,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new pd({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=s[0]),this.anchorYUnits_=="fraction"&&(e[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+s[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==ye.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==ye.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(pe.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(pe.CHANGE,e)}ready(){return this.iconImage_.ready()}}const L0=pd;let xs=0;const wr=0,We=1<",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string"},FC={[j.Get]:he(([i,e])=>e!==void 0?NC(e.value):Et,_e(1,2),BC),[j.Var]:he(([i])=>i.type,_e(1,1),UC),[j.Id]:he(te|Jt,Ya,$C),[j.Concat]:he(Jt,_e(2,1/0),xe(Et)),[j.GeometryType]:he(Jt,Ya,VC),[j.Resolution]:he(te,Ya),[j.Zoom]:he(te,Ya),[j.Time]:he(te,Ya),[j.Any]:he(We,_e(2,1/0),xe(We)),[j.All]:he(We,_e(2,1/0),xe(We)),[j.Not]:he(We,_e(1,1),xe(We)),[j.Equal]:he(We,_e(2,2),xe(Et),qn),[j.NotEqual]:he(We,_e(2,2),xe(Et),qn),[j.GreaterThan]:he(We,_e(2,2),xe(Et),qn),[j.GreaterThanOrEqualTo]:he(We,_e(2,2),xe(Et),qn),[j.LessThan]:he(We,_e(2,2),xe(Et),qn),[j.LessThanOrEqualTo]:he(We,_e(2,2),xe(Et),qn),[j.Multiply]:he(i=>{let e=te|ct;for(let t=0;t{let e=Et;for(let t=1;t{let e=Et;for(let t=2;t{let e=ct|te;for(let t=3;t{let e=Et;for(let t=1;ti.length===2?zi|Ka:i.length===3||i.length===4?zi|ct:zi,_e(1,1/0),xe(te)),[j.Color]:he(ct,_e(1,4),xe(te)),[j.Band]:he(te,_e(1,3),xe(te)),[j.Palette]:he(ct,_e(2,2),WC),[j.ToString]:he(Jt,_e(1,1),xe(We|te|Jt|ct))};function BC(i,e){const t=De(i[1],e);if(!(t instanceof zn))throw new Error("Expected a literal argument for get operation");if(typeof t.value!="string")throw new Error("Expected a string argument for get operation");if(e.properties.add(t.value),i.length===3){const n=De(i[2],e);return[t,n]}return[t]}function UC(i,e,t,n){const s=i[1];if(typeof s!="string")throw new Error("Expected a string argument for var operation");if(e.variables.add(s),!("variables"in e.style)||e.style.variables[s]===void 0)return[new zn(Et,s)];const r=e.style.variables[s],a=De(r,e);if(a.value=s,n&&!qi(n,a.type))throw new Error(`The variable ${s} has type ${St(a.type)} but the following type was expected: ${St(n)}`);return[a]}function $C(i,e){e.featureId=!0}function VC(i,e){e.geometryType=!0}function Ya(i,e){const t=i[0];if(i.length!==1)throw new Error(`Expected no arguments for ${t} operation`);return[]}function _e(i,e){return function(t,n){const s=t[0],r=t.length-1;if(i===e){if(r!==i){const a=i===1?"":"s";throw new Error(`Expected ${i} argument${a} for ${s}, got ${r}`)}}else if(re){const a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`Expected ${a} arguments for ${s}, got ${r}`)}}}function xe(i){return function(e,t){const n=e[0],s=e.length-1,r=new Array(s);for(let a=0;an.featureId;case j.GeometryType:return n=>n.geometryType;case j.Concat:{const n=i.args.map(s=>Ai(s));return s=>"".concat(...n.map(r=>r(s).toString()))}case j.Resolution:return n=>n.resolution;case j.Any:case j.All:case j.Between:case j.In:case j.Not:return QC(i);case j.Equal:case j.NotEqual:case j.LessThan:case j.LessThanOrEqualTo:case j.GreaterThan:case j.GreaterThanOrEqualTo:return ZC(i);case j.Multiply:case j.Divide:case j.Add:case j.Subtract:case j.Clamp:case j.Mod:case j.Pow:case j.Abs:case j.Floor:case j.Ceil:case j.Round:case j.Sin:case j.Cos:case j.Atan:case j.Sqrt:return JC(i);case j.Case:return ew(i);case j.Match:return tw(i);case j.Interpolate:return iw(i);case j.ToString:return nw(i);default:throw new Error(`Unsupported operator ${t}`)}}function KC(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r{for(let a=0;a{for(let a=0;as.properties[n];case j.Var:return s=>s.variables[n];default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function ZC(i,e){const t=i.operator,n=Ai(i.args[0]),s=Ai(i.args[1]);switch(t){case j.Equal:return r=>n(r)===s(r);case j.NotEqual:return r=>n(r)!==s(r);case j.LessThan:return r=>n(r)n(r)<=s(r);case j.GreaterThan:return r=>n(r)>s(r);case j.GreaterThanOrEqualTo:return r=>n(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${t}`)}}function QC(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r{for(let a=0;a{for(let a=0;a{const a=s[0](r),o=s[1](r),l=s[2](r);return a>=o&&a<=l};case j.In:return r=>{const a=s[0](r);for(let o=1;o!s[0](r);default:throw new Error(`Unsupported logical operator ${t}`)}}function JC(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r{let a=1;for(let o=0;os[0](r)/s[1](r);case j.Add:return r=>{let a=0;for(let o=0;os[0](r)-s[1](r);case j.Clamp:return r=>{const a=s[0](r),o=s[1](r);if(al?l:a};case j.Mod:return r=>s[0](r)%s[1](r);case j.Pow:return r=>Math.pow(s[0](r),s[1](r));case j.Abs:return r=>Math.abs(s[0](r));case j.Floor:return r=>Math.floor(s[0](r));case j.Ceil:return r=>Math.ceil(s[0](r));case j.Round:return r=>Math.round(s[0](r));case j.Sin:return r=>Math.sin(s[0](r));case j.Cos:return r=>Math.cos(s[0](r));case j.Atan:return n===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case j.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${t}`)}}function ew(i,e){const t=i.args.length,n=new Array(t);for(let s=0;s{for(let r=0;r{const r=n[0](s);for(let a=1;a{const r=n[0](s),a=n[1](s);let o,l;for(let u=2;u=a)return u===2?d:p?sw(r,a,o,l,c,d):Za(r,a,o,l,c,d);o=c,l=d}return l}}function nw(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r{const a=s[0](r);return i.args[0].type===ct?Gh(a):a.toString()};default:throw new Error(`Unsupported convert operator ${t}`)}}function Za(i,e,t,n,s,r){const a=s-t;if(a===0)return n;const o=e-t,l=i===1?o/a:(Math.pow(i,o)-1)/(Math.pow(i,a)-1);return n+l*(r-n)}function sw(i,e,t,n,s,r){if(s-t===0)return n;const o=Km(n),l=Km(r);let u=l[2]-o[2];u>180?u-=360:u<-180&&(u+=360);const c=[Za(i,e,t,o[0],s,l[0]),Za(i,e,t,o[1],s,l[1]),o[2]+Za(i,e,t,0,s,u),Za(i,e,t,n[3],s,r[3])];return Ym(mS(c))}function rw(i){return!0}function aw(i){const e=M0(),t=ow(i,e),n=B0();return function(s,r){if(n.properties=s.getPropertiesInternal(),n.resolution=r,e.featureId){const a=s.getId();a!==void 0?n.featureId=a:n.featureId=null}return e.geometryType&&(n.geometryType=F0(s.getGeometry())),t(n)}}function U0(i){const e=M0(),t=i.length,n=new Array(t);for(let a=0;a4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function H0(i,e){const t=to(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function yw(i,e){return typeof i=="number"?i:H0(i,e)}const W0={RENDER_ORDER:"renderOrder"};class vw extends Hl{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(W0.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new k0(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(W0.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?A0:e;const t=Tw(e);this.styleFunction_=e===null?void 0:EC(t),this.changed()}}function Tw(i){if(i===void 0)return A0;if(!i)return null;if(typeof i=="function"||i instanceof Ga)return i;if(!Array.isArray(i))return U0([i]);if(i.length===0)return[];const e=i.length,t=i[0];if(t instanceof Ga){const s=new Array(e);for(let r=0;rl&&(this.instructions.push([oe.CUSTOM,l,c,e,n,mr,r]),this.hitDetectionInstructions.push([oe.CUSTOM,l,c,e,s||n,mr,r]));break;case"Point":u=e.getFlatCoordinates(),this.coordinates.push(u[0],u[1]),c=this.coordinates.length,this.instructions.push([oe.CUSTOM,l,c,e,n,void 0,r]),this.hitDetectionInstructions.push([oe.CUSTOM,l,c,e,s||n,void 0,r]);break}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[oe.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[oe.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const n=e.length;let s,r,a=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=n.lineWidth,this.bufferedMaxExtent_=null)}else n.strokeStyle=void 0,n.lineCap=void 0,n.lineDash=null,n.lineDashOffset=void 0,n.lineJoin=void 0,n.lineWidth=void 0,n.miterLimit=void 0}createFill(e){const t=e.fillStyle,n=[oe.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[oe.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,this.applyPixelRatio(e.lineDash),e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const n=e.fillStyle;(typeof n!="string"||e.currentFillStyle!=n)&&(n!==void 0&&this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){const n=e.strokeStyle,s=e.lineCap,r=e.lineDash,a=e.lineDashOffset,o=e.lineJoin,l=e.lineWidth,u=e.miterLimit;(e.currentStrokeStyle!=n||e.currentLineCap!=s||r!=e.currentLineDash&&!Bn(e.currentLineDash,r)||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=l||e.currentMiterLimit!=u)&&(n!==void 0&&t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=s,e.currentLineDash=r,e.currentLineDashOffset=a,e.currentLineJoin=o,e.currentLineWidth=l,e.currentMiterLimit=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[oe.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Zg(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;mh(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const no=bw;class Ew extends no{constructor(e,t,n,s){super(e,t,n,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!dr(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);const s=e.getFlatCoordinates(),r=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(s,r);this.instructions.push([oe.DRAW_IMAGE,a,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([oe.DRAW_IMAGE,a,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);const s=e.getFlatCoordinates(),r=[];for(let l=0,u=s.length;l=i){const _=(i-o+y)/y,T=hi(u,d,_),E=hi(c,p,_);l.push(T,E),r.push(l),l=[T,E],o==i&&(a+=s),o=0}else if(o0&&r.push(l),r}function Dw(i,e,t,n,s){let r=t,a=t,o=0,l=0,u=t,c,d,p,y,_,T,E,S,C,D;for(d=t;di&&(l>o&&(o=l,r=u,a=d),l=0,u=d-s)),p=y,E=C,S=D),_=k,T=w}return l+=y,l>o?[u,d]:[r,a]}const hu={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class kw extends no{constructor(e,t,n,s){super(e,t,n,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[$t]={fillStyle:$t},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){const s=this.textFillState_,r=this.textStrokeState_,a=this.textState_;if(this.text_===""||!a||!s&&!r)return;const o=this.coordinates;let l=o.length;const u=e.getType();let c=null,d=e.getStride();if(a.placement==="line"&&(u=="LineString"||u=="MultiLineString"||u=="Polygon"||u=="MultiPolygon")){if(!Bt(this.maxExtent,e.getExtent()))return;let p;if(c=e.getFlatCoordinates(),u=="LineString")p=[c.length];else if(u=="MultiLineString")p=e.getEnds();else if(u=="Polygon")p=e.getEnds().slice(0,1);else if(u=="MultiPolygon"){const E=e.getEndss();p=[];for(let S=0,C=E.length;S{const w=o[(C+k)*2]===c[k*d]&&o[(C+k)*2+1]===c[k*d+1];return w||--C,w})}this.saveTextStates_(),(a.backgroundFill||a.backgroundStroke)&&(this.setFillStrokeStyle(a.backgroundFill,a.backgroundStroke),a.backgroundFill&&this.updateFillStyle(this.state,this.createFill),a.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(e,t,n);let _=a.padding;if(_!=Ts&&(a.scale[0]<0||a.scale[1]<0)){let C=a.padding[0],D=a.padding[1],k=a.padding[2],w=a.padding[3];a.scale[0]<0&&(D=-D,w=-w),a.scale[1]<0&&(C=-C,k=-k),_=[C,D,k,w]}const T=this.pixelRatio;this.instructions.push([oe.DRAW_IMAGE,l,y,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==Ts?Ts:_.map(function(C){return C*T}),!!a.backgroundFill,!!a.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);const E=1/T,S=this.state.fillStyle;a.backgroundFill&&(this.state.fillStyle=$t,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([oe.DRAW_IMAGE,l,y,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[E,E],NaN,this.declutterMode_,this.declutterImageWithText_,_,!!a.backgroundFill,!!a.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?$t:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),a.backgroundFill&&(this.state.fillStyle=S,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,s=this.strokeKey_;e&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:t.font,textAlign:t.textAlign||za,justify:t.justify,textBaseline:t.textBaseline||eu,scale:t.scale});const a=this.fillKey_;n&&(a in this.fillStates||(this.fillStates[a]={fillStyle:n.fillStyle}))}drawChars_(e,t){const n=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,a=this.textKey_,o=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,u=hu[s.textBaseline],c=this.textOffsetY_*l,d=this.text_,p=n?n.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([oe.DRAW_CHARS,e,t,u,s.overflow,o,s.maxAngle,l,c,r,p*l,d,a,1,this.declutterMode_]),this.hitDetectionInstructions.push([oe.DRAW_CHARS,e,t,u,s.overflow,o&&$t,s.maxAngle,l,c,r,p*l,d,a,1/l,this.declutterMode_])}setTextStyle(e,t){let n,s,r;if(!e)this.text_="";else{const a=e.getFill();a?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=ji(a.getColor()||$t)):(s=null,this.textFillState_=s);const o=e.getStroke();if(!o)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const _=o.getLineDash(),T=o.getLineDashOffset(),E=o.getWidth(),S=o.getMiterLimit();r.lineCap=o.getLineCap()||xr,r.lineDash=_?_.slice():fn,r.lineDashOffset=T===void 0?pn:T,r.lineJoin=o.getLineJoin()||br,r.lineWidth=E===void 0?qa:E,r.miterLimit=S===void 0?Va:S,r.strokeStyle=ji(o.getColor()||ja)}n=this.textState_;const l=e.getFont()||b0;yC(l);const u=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||eu,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||Ts,n.scale=u===void 0?[1,1]:u;const c=e.getOffsetX(),d=e.getOffsetY(),p=e.getRotateWithView(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=d===void 0?0:d,this.textRotateWithView_=p===void 0?!1:p,this.textRotation_=y===void 0?0:y,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:Ae(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+Ae(s.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const Rw={Circle:Z0,Default:no,Image:Sw,LineString:ww,Polygon:Z0,Text:kw};class Pw{constructor(e,t,n,s){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=s,this.resolution_=n,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const n=this.buildersByZIndex_[t];for(const s in n){const r=n[s].finish();e[t][s]=r}}return e}getBuilder(e,t){const n=e!==void 0?e.toString():"0";let s=this.buildersByZIndex_[n];s===void 0&&(s={},this.buildersByZIndex_[n]=s);let r=s[t];if(r===void 0){const a=Rw[t];r=new a(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[t]=r}return r}}const Lw=Pw;function Ow(i,e,t,n,s,r,a,o,l,u,c,d){let p=i[e],y=i[e+1],_=0,T=0,E=0,S=0;function C(){_=p,T=y,e+=n,p=i[e],y=i[e+1],S+=E,E=Math.sqrt((p-_)*(p-_)+(y-T)*(y-T))}do C();while(eq[2]}else X=k>$;const K=Math.PI,G=[],Y=O+n===e;e=O,E=0,S=N,p=i[e],y=i[e+1];let ee;if(Y){C(),ee=Math.atan2(y-T,p-_),X&&(ee+=ee>0?-K:K);const q=($+k)/2,ie=(J+w)/2;return G[0]=[q,ie,(F-r)/2,ee,s],G}s=s.replace(/\n/g," ");for(let q=0,ie=s.length;q0?-K:K),ee!==void 0){let W=ae-ee;if(W+=W>K?-2*K:W<-K?2*K:0,Math.abs(W)>a)return null}ee=ae;const Se=q;let ue=0;for(;q0&&i.push(` `,""),i.push(e,""),i}class Nw{constructor(e,t,n,s,r){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=wi(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Gm:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,s){const r=e+t+n+s;if(this.labels_[r])return this.labels_[r];const a=s?this.strokeStates[s]:null,o=n?this.fillStates[n]:null,l=this.textStates[t],u=this.pixelRatio,c=[l.scale[0]*u,l.scale[1]*u],d=Array.isArray(e),p=l.justify?hu[l.justify]:yd(Array.isArray(e)?e[0]:e,l.textAlign||za),y=s&&a.lineWidth?a.lineWidth:0,_=d?e:e.split(` `).reduce(Mw,[]),{width:T,height:E,widths:S,heights:C,lineWidths:D}=TC(l,_),k=T+y,w=[],O=(k+2)*c[0],N=(E+y)*c[1],F={width:O<0?Math.floor(O):Math.ceil(O),height:N<0?Math.floor(N):Math.ceil(N),contextInstructions:w};(c[0]!=1||c[1]!=1)&&w.push("scale",c),s&&(w.push("strokeStyle",a.strokeStyle),w.push("lineWidth",y),w.push("lineCap",a.lineCap),w.push("lineJoin",a.lineJoin),w.push("miterLimit",a.miterLimit),w.push("setLineDash",[a.lineDash]),w.push("lineDashOffset",a.lineDashOffset)),n&&w.push("fillStyle",o.fillStyle),w.push("textBaseline","middle"),w.push("textAlign","center");const $=.5-p;let J=p*k+$*y;const X=[],K=[];let G=0,Y=0,ee=0,q=0,ie;for(let ae=0,Se=_.length;aee?e-u:r,k=a+c>t?t-c:a,w=_[3]+D*p[0]+_[1],O=_[0]+k*p[1]+_[2],N=S-_[3],F=C-_[0];(T||d!==0)&&(Hn[0]=N,Wn[0]=N,Hn[1]=F,yn[1]=F,yn[0]=N+w,vn[0]=yn[0],vn[1]=F+O,Wn[1]=vn[1]);let $;return d!==0?($=dn(wi(),n,s,1,1,d,-n,-s),gt($,Hn),gt($,yn),gt($,vn),gt($,Wn),Un(Math.min(Hn[0],yn[0],vn[0],Wn[0]),Math.min(Hn[1],yn[1],vn[1],Wn[1]),Math.max(Hn[0],yn[0],vn[0],Wn[0]),Math.max(Hn[1],yn[1],vn[1],Wn[1]),Ar)):Un(Math.min(N,N+w),Math.min(F,F+O),Math.max(N,N+w),Math.max(F,F+O),Ar),y&&(S=Math.round(S),C=Math.round(C)),{drawImageX:S,drawImageY:C,drawImageW:D,drawImageH:k,originX:u,originY:c,declutterBox:{minX:Ar[0],minY:Ar[1],maxX:Ar[2],maxY:Ar[3],value:E},canvasTransform:$,scale:p}}replayImageOrLabel_(e,t,n,s,r,a,o){const l=!!(a||o),u=s.declutterBox,c=o?o[2]*s.scale[0]/2:0;return u.minX-c<=t[0]&&u.maxX+c>=0&&u.minY-c<=t[1]&&u.maxY+c>=0&&(l&&this.replayTextBackground_(e,Hn,yn,vn,Wn,a,o),xC(e,s.canvasTransform,r,n,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const n=gt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;e.save(),e.translate(n[0]%s,n[1]%s),t!==1&&e.scale(t,t),e.rotate(this.viewRotation_)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6])}drawLabelWithPointPlacement_(e,t,n,s){const r=this.textStates[t],a=this.createLabel(e,t,s,n),o=this.strokeStates[n],l=this.pixelRatio,u=yd(Array.isArray(e)?e[0]:e,r.textAlign||za),c=hu[r.textBaseline||eu],d=o&&o.lineWidth?o.lineWidth:0,p=a.width/l-2*r.scale[0],y=u*p+2*(.5-u)*d,_=c*a.height/l+2*(.5-c)*d;return{label:a,anchorX:y,anchorY:_}}execute_(e,t,n,s,r,a,o,l){const u=this.zIndexContext_;let c;this.pixelCoordinates_&&Bn(n,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=$n(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),CE(this.renderedTransform_,n));let d=0;const p=s.length;let y=0,_,T,E,S,C,D,k,w,O,N,F,$,J,X=0,K=0,G=null,Y=null;const ee=this.coordinateCache_,q=this.viewRotation_,ie=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:q},Se=this.instructions!=s||this.overlaps?0:200;let ue,ge,fe,Ce;for(;dSe&&(this.fill_(e),X=0),K>Se&&(e.stroke(),K=0),!X&&!K&&(e.beginPath(),C=NaN,D=NaN),++d;break;case oe.CIRCLE:y=W[1];const at=c[y],Ze=c[y+1],ai=c[y+2],kn=c[y+3],Tt=ai-at,va=kn-Ze,ls=Math.sqrt(Tt*Tt+va*va);e.moveTo(at+ls,Ze),e.arc(at,Ze,ls,0,2*Math.PI,!0),++d;break;case oe.CLOSE_PATH:e.closePath(),++d;break;case oe.CUSTOM:y=W[1],_=W[2];const Jo=W[3],rn=W[4],Vs=W[5];ae.geometry=Jo,ae.feature=ue,d in ee||(ee[d]=[]);const an=ee[d];Vs?Vs(c,y,_,2,an):(an[0]=c[y],an[1]=c[y+1],an.length=2),u&&(u.zIndex=W[6]),rn(an,ae),++d;break;case oe.DRAW_IMAGE:y=W[1],_=W[2],O=W[3],T=W[4],E=W[5];let js=W[6];const oi=W[7],zs=W[8],me=W[9],Kt=W[10];let li=W[11];const Rn=W[12];let Li=W[13];S=W[14]||"declutter";const xi=W[15];if(!O&&W.length>=20){N=W[19],F=W[20],$=W[21],J=W[22];const Mt=this.drawLabelWithPointPlacement_(N,F,$,J);O=Mt.label,W[3]=O;const Pn=W[23];T=(Mt.anchorX-Pn)*this.pixelRatio,W[4]=T;const Yt=W[24];E=(Mt.anchorY-Yt)*this.pixelRatio,W[5]=E,js=O.height,W[6]=js,Li=O.width,W[13]=Li}let Oi;W.length>25&&(Oi=W[25]);let ui,on,st;W.length>17?(ui=W[16],on=W[17],st=W[18]):(ui=Ts,on=!1,st=!1),Kt&&ie?li+=q:!Kt&&!ie&&(li-=q);let Ac=0;for(;y<_;y+=2){if(Oi&&Oi[Ac++]
  • !e_.includes(i));class Uw{constructor(e,t,n,s,r,a,o){this.maxExtent_=e,this.overlaps_=s,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=a,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=wi(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(e,t){const n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(const n in e){let s=this.executorsByZIndex_[n];s===void 0&&(s={},this.executorsByZIndex_[n]=s);const r=e[n];for(const a in r){const o=r[a];s[a]=new Fw(this.resolution_,this.pixelRatio_,this.overlaps_,o,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const n=this.executorsByZIndex_[t];for(let s=0,r=e.length;s0){if(!a||N==="none"||y!=="Image"&&y!=="Text"||a.includes(w)){const X=(p[$]-3)/4,K=s-X%o,G=s-(X/o|0),Y=r(w,O,K*K+G*G);if(Y)return Y}c.clearRect(0,0,o,o);break}}const T=Object.keys(this.executorsByZIndex_).map(Number);T.sort(cn);let E,S,C,D,k;for(E=T.length-1;E>=0;--E){const w=T[E].toString();for(C=this.executorsByZIndex_[w],S=Ir.length-1;S>=0;--S)if(y=Ir[S],D=C[y],D!==void 0&&(k=D.executeHitDetection(c,l,n,_,d),k))return k}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const n=t[0],s=t[1],r=t[2],a=t[3],o=[n,s,n,a,r,a,r,s];return $n(o,0,8,2,e,o),o}isEmpty(){return ar(this.executorsByZIndex_)}execute(e,t,n,s,r,a,o){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(cn),a=a||Ir;const u=Ir.length;let c,d,p,y,_;for(o&&l.reverse(),c=0,d=l.length;cS.execute(w,t,n,s,r,o)),k&&D.restore(),C){C.offset();const w=l[c]*u+p;this.deferredZIndexContexts_[w]||(this.deferredZIndexContexts_[w]=[]),this.deferredZIndexContexts_[w].push(C)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(cn);for(let n=0,s=t.length;n{r.draw(this.renderedContext_),r.clear()}),e[t[n]].length=0}}const vd={};function $w(i){if(vd[i]!==void 0)return vd[i];const e=i*2+1,t=i*i,n=new Array(t+1);for(let r=0;r<=i;++r)for(let a=0;a<=i;++a){const o=r*r+a*a;if(o>t)break;let l=n[o];l||(l=[],n[o]=l),l.push(((i+r)*e+(i+a))*4+3),r>0&&l.push(((i-r)*e+(i+a))*4+3),a>0&&(l.push(((i+r)*e+(i-a))*4+3),r>0&&l.push(((i-r)*e+(i-a))*4+3))}const s=[];for(let r=0,a=n.length;rd*this.pixelRatio_),lineDashOffset:(a||pn)*this.pixelRatio_,lineJoin:o!==void 0?o:br,lineWidth:(l!==void 0?l:qa)*this.pixelRatio_,miterLimit:u!==void 0?u:Va,strokeStyle:ji(n||ja)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const n=e.getPixelRatio(this.pixelRatio_),s=e.getAnchor(),r=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*n,this.imageAnchorY_=s[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/n,a[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const y=t.getColor();this.textFillState_={fillStyle:ji(y||$t)}}const n=e.getStroke();if(!n)this.textStrokeState_=null;else{const y=n.getColor(),_=n.getLineCap(),T=n.getLineDash(),E=n.getLineDashOffset(),S=n.getLineJoin(),C=n.getWidth(),D=n.getMiterLimit();this.textStrokeState_={lineCap:_!==void 0?_:xr,lineDash:T||fn,lineDashOffset:E||pn,lineJoin:S!==void 0?S:br,lineWidth:C!==void 0?C:qa,miterLimit:D!==void 0?D:Va,strokeStyle:ji(y||ja)}}const s=e.getFont(),r=e.getOffsetX(),a=e.getOffsetY(),o=e.getRotateWithView(),l=e.getRotation(),u=e.getScaleArray(),c=e.getText(),d=e.getTextAlign(),p=e.getTextBaseline();this.textState_={font:s!==void 0?s:b0,textAlign:d!==void 0?d:za,textBaseline:p!==void 0?p:eu},this.text_=c!==void 0?Array.isArray(c)?c.reduce((y,_,T)=>y+=T%2?" ":_,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=a!==void 0?this.pixelRatio_*a:0,this.textRotateWithView_=o!==void 0?o:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*u[0],this.pixelRatio_*u[1]]}}}const zw=jw,Gi=.5;function qw(i,e,t,n,s,r,a,o,l){const u=l?Ah(s):s,c=i[0]*Gi,d=i[1]*Gi,p=mt(c,d);p.imageSmoothingEnabled=!1;const y=p.canvas,_=new zw(p,Gi,s,null,a,o,l?Vl(mE(),l):null),T=t.length,E=Math.floor((256*256*256-1)/T),S={};for(let D=1;D<=T;++D){const k=t[D-1],w=k.getStyleFunction()||n;if(!w)continue;let O=w(k,r);if(!O)continue;Array.isArray(O)||(O=[O]);const F=(D*E).toString(16).padStart(7,"#00000");for(let $=0,J=O.length;$0;return d&&Promise.all(l).then(()=>s(null)),Kw(i,e,t,n,r,a,o),d}function Kw(i,e,t,n,s,r,a){const o=t.getGeometryFunction()(e);if(!o)return;const l=o.simplifyTransformed(n,s);if(t.getRenderer())r_(i,l,t,e,a);else{const c=t_[l.getType()];c(i,l,t,e,a,r)}}function r_(i,e,t,n,s){if(e.getType()=="GeometryCollection"){const a=e.getGeometries();for(let o=0,l=a.length;o{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,a=this.renderedRotation_,o=this.renderedProjection_,l=this.wrappedRenderedExtent_,u=this.getLayer(),c=[],d=n[0]*Gi,p=n[1]*Gi;c.push(this.getRenderTransform(s,r,a,Gi,d,p,0).slice());const y=u.getSource(),_=o.getExtent();if(y.getWrapX()&&o.canWrapX()&&!fr(_,l)){let T=l[0];const E=Ie(_);let S=0,C;for(;T<_[0];)--S,C=E*S,c.push(this.getRenderTransform(s,r,a,Gi,d,p,C).slice()),T+=E;for(S=0,T=l[2];T>_[2];)++S,C=E*S,c.push(this.getRenderTransform(s,r,a,Gi,d,p,C).slice()),T-=E}this.hitDetectionImageData_=qw(n,c,this.renderedFeatures_,u.getStyleFunction(),l,r,a,i_(r,this.renderedPixelRatio_),null)}t(Gw(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,s,r){if(!this.replayGroup_)return;const a=t.viewState.resolution,o=t.viewState.rotation,l=this.getLayer(),u={},c=function(_,T,E){const S=Ae(_),C=u[S];if(C){if(C!==!0&&Ed=_.forEachFeatureAtCoordinate(e,a,o,n,c,y&&t.declutter[y]?t.declutter[y].all().map(T=>T.value):null)),d}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),n=t.getSource();if(!n)return!1;const s=e.viewHints[xt.ANIMATING],r=e.viewHints[xt.INTERACTING],a=t.getUpdateWhileAnimating(),o=t.getUpdateWhileInteracting();if(this.ready&&!a&&s||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,u=e.viewState,c=u.projection,d=u.resolution,p=e.pixelRatio,y=t.getRevision(),_=t.getRenderBuffer();let T=t.getRenderOrder();T===void 0&&(T=Ww);const E=u.center.slice(),S=mh(l,_*d),C=S.slice(),D=[S.slice()],k=c.getExtent();if(n.getWrapX()&&c.canWrapX()&&!fr(k,e.extent)){const Y=Ie(k),ee=Math.max(Ie(S)/2,Y);S[0]=k[0]-ee,S[2]=k[2]+ee,rm(E,c);const q=nm(D[0],c);q[0]k[0]&&q[2]>k[2]&&D.push([q[0]-Y,q[1],q[2]-Y,q[3]])}if(this.ready&&this.renderedResolution_==d&&this.renderedRevision_==y&&this.renderedRenderOrder_==T&&this.renderedFrameDeclutter_===!!e.declutter&&fr(this.wrappedRenderedExtent_,S))return Bn(this.renderedExtent_,C)||(this.hitDetectionImageData_=null,this.renderedExtent_=C),this.renderedCenter_=E,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Lw(n_(d,p),S,d,p);let O;for(let Y=0,ee=D.length;Y{let q;const ie=Y.getStyleFunction()||t.getStyleFunction();if(ie&&(q=ie(Y,d)),q){const ae=this.renderFeature(Y,N,q,w,O,this.getLayer().getDeclutter(),ee);F=F&&!ae}},J=Ah(S),X=n.getFeaturesInExtent(J);T&&X.sort(T);for(let Y=0,ee=X.length;Y{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const n=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":n.length=Ph(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),s=[n.length];break;case"MultiLineString":s=[],n.length=UE(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,s);break;case"Polygon":s=[],n.length=Im(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,s);break}return s&&(this.simplifiedGeometry_=new Dr(this.type_,n,s,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}Dr.prototype.getFlatCoordinates=Dr.prototype.getOrientedFlatCoordinates;const Es=Dr,gi={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function uA(i,e){return[[-1/0,-1/0,1/0,1/0]]}let cA=!1;function hA(i,e,t,n,s,r,a){const o=new XMLHttpRequest;o.open("GET",typeof i=="function"?i(t,n,s):i,!0),e.getType()=="arraybuffer"&&(o.responseType="arraybuffer"),o.withCredentials=cA,o.onload=function(l){if(!o.status||o.status>=200&&o.status<300){const u=e.getType();try{let c;u=="text"||u=="json"?c=o.responseText:u=="xml"?c=o.responseXML||o.responseText:u=="arraybuffer"&&(c=o.response),c?r(e.readFeatures(c,{extent:t,featureProjection:s}),e.readProjection(c)):a()}catch{a()}}else a()},o.onerror=a,o.send()}function l_(i,e){return function(t,n,s,r,a){const o=this;hA(i,e,t,n,s,function(l,u){o.addFeatures(l),r!==void 0&&r(l)},a||rr)}}class Xn extends un{constructor(e,t,n){super(e),this.feature=t,this.features=n}}class dA extends h0{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=rr,this.format_=e.format,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Te(this.format_,"`format` must be set when `url` is set"),this.loader_=l_(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:uA;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new a_:null,this.loadedExtentsRtree_=new a_,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,s;Array.isArray(e.features)?s=e.features:e.features&&(n=e.features,s=n.getArray()),!t&&n===void 0&&(n=new $i(s)),s!==void 0&&this.addFeaturesInternal(s),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=Ae(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const n=e.getGeometry();if(n){const s=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Xn(gi.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Es||(this.featureChangeKeys_[e]=[be(t,pe.CHANGE,this.handleFeatureChange_,this),be(t,sr.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){const s=String(t.getId());if(!(s in this.idIndex_))this.idIndex_[s]=t;else if(t instanceof Es){const r=this.idIndex_[s];r instanceof Es?Array.isArray(r)?r.push(t):this.idIndex_[s]=[r,t]:n=!1}else n=!1}return n&&(Te(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],n=[],s=[];for(let r=0,a=e.length;r{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Ut.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach($e);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const n=s=>{this.removeFeatureInternal(s)};this.featuresRtree_.forEach(n);for(const s in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[s])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new Xn(gi.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(s){const r=s.getGeometry();if(r instanceof Es||r.intersectsCoordinate(e))return t(s)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){const s=n.getGeometry();if(s instanceof Es||s.intersectsExtent(e)){const r=t(n);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),ar(this.nullGeometryFeatures_)||dh(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const s=sm(e,t);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const n=e[0],s=e[1];let r=null;const a=[NaN,NaN];let o=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||Da,this.featuresRtree_.forEachInExtent(l,function(u){if(t(u)){const c=u.getGeometry(),d=o;if(o=c instanceof Es?0:c.closestPointXY(n,s,a,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new Xn(gi.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Xn(gi.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_;let n;t.forEachInExtent(e,function(s){if(La(s.extent,e))return n=s,!0}),n&&t.remove(n)}removeFeatures(e){const t=[];for(let n=0,s=e.length;n0&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=Ae(e);if(!(t in this.uidIndex_))return;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e);const n=this.featureChangeKeys_[t];n==null||n.forEach($e),delete this.featureChangeKeys_[t];const s=e.getId();if(s!==void 0){const r=s.toString(),a=this.idIndex_[r];a===e?delete this.idIndex_[r]:Array.isArray(a)&&(a.splice(a.indexOf(e),1),a.length===1&&(this.idIndex_[r]=a[0]))}return delete this.uidIndex_[t],this.hasListener(gi.REMOVEFEATURE)&&this.dispatchEvent(new Xn(gi.REMOVEFEATURE,e)),e}removeFromIdIndex_(e){let t=!1;for(const n in this.idIndex_){const s=this.idIndex_[n];if(e instanceof Es&&Array.isArray(s)&&s.includes(e))s.splice(s.indexOf(e),1);else if(this.idIndex_[n]===e){delete this.idIndex_[n],t=!0;break}}return t}setLoader(e){this.loader_=e}setUrl(e){Te(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(l_(e,this.format_))}}const fA=dA;class pA{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]0&&this.points_[n+2]>e;)n-=3;const s=this.points_[t+2]-this.points_[n+2];if(s<1e3/60)return!1;const r=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,r),this.initialVelocity_=Math.sqrt(r*r+a*a)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const gA=pA;class mA extends ch{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Ee()}calculateMatrices2D(e){const t=e.viewState,n=e.coordinateToPixelTransform,s=e.pixelToCoordinateTransform;dn(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),vm(s,n)}forEachFeatureAtCoordinate(e,t,n,s,r,a,o,l){let u;const c=t.viewState;function d(k,w,O,N){return r.call(a,w,k?O:null,N)}const p=c.projection,y=rm(e.slice(),p),_=[[0,0]];if(p.canWrapX()&&s){const k=p.getExtent(),w=Ie(k);_.push([-w,0],[w,0])}const T=t.layerStatesArray,E=T.length,S=[],C=[];for(let k=0;k<_.length;k++)for(let w=E-1;w>=0;--w){const O=T[w],N=O.layer;if(N.hasRenderer()&&Bh(O,c)&&o.call(l,N)){const F=N.getRenderer(),$=N.getSource();if(F&&$){const J=$.getWrapX()?y:e,X=d.bind(null,O.managed);C[0]=J[0]+_[k][0],C[1]=J[1]+_[k][1],u=F.forEachFeatureAtCoordinate(C,t,n,X,S)}if(u)return u}}if(S.length===0)return;const D=1/S.length;return S.forEach((k,w)=>k.distanceSq+=w*D),S.sort((k,w)=>k.distanceSq-w.distanceSq),S.some(k=>u=k.callback(k.feature,k.layer,k.geometry)),u}hasFeatureAtCoordinate(e,t,n,s,r,a){return this.forEachFeatureAtCoordinate(e,t,n,s,Da,this,r,a)!==void 0}getMap(){return this.map_}renderFrame(e){Ee()}scheduleExpireIconCache(e){Vi.canExpireCache()&&e.postRenderFunctions.push(_A)}}function _A(i,e){Vi.expire()}const yA=mA;class vA extends yA{constructor(e){super(e),this.fontChangeListenerKey_=be(gn,sr.PROPERTYCHANGE,e.redrawText.bind(e)),this.element_=document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Jl+" ol-layers";const n=e.getViewport();n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const n=this.getMap();if(n.hasListener(e)){const s=new Bm(e,void 0,t);n.dispatchEvent(s)}}disposeInternal(){$e(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(di.PRECOMPOSE,e);const t=e.layerStatesArray.sort(function(o,l){return o.zIndex-l.zIndex});t.some(o=>o.layer instanceof X0&&o.layer.getDeclutter())&&(e.declutter={});const s=e.viewState;this.children_.length=0;const r=[];let a=null;for(let o=0,l=t.length;o=0;--n){const s=t[n],r=s.layer;r.getDeclutter()&&r.renderDeclutter(e,s)}t.forEach(n=>n.layer.renderDeferred(e))}}}const TA=vA;class Kn extends un{constructor(e,t){super(e),this.layer=t}}const Td={LAYERS:"layers"};class xd extends Gg{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Td.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new $i(n.slice(),{unique:!0}):Te(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new $i(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach($e),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(be(e,Ut.ADD,this.handleLayersAdd_,this),be(e,Ut.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach($e);ka(this.listenerKeys_);const t=e.getArray();for(let n=0,s=t.length;n{this.clickTimeoutId_=void 0;const n=new Yn(Xe.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){const t=e,n=t.pointerId;if(t.type==Xe.POINTERUP||t.type==Xe.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==t.target){delete this.trackedTouches_[s];break}}else(t.type==Xe.POINTERDOWN||t.type==Xe.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new Yn(Xe.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach($e),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new Yn(Xe.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(be(n,Xe.POINTERMOVE,this.handlePointerMove_,this),be(n,Xe.POINTERUP,this.handlePointerUp_,this),be(this.element_,Xe.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(be(this.element_.getRootNode(),Xe.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new Yn(Xe.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Yn(Xe.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&($e(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(pe.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&($e(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach($e),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const SA=EA,Zn={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},Ct={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},fu=1/0;class CA{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ka(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(e){Te(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=fu?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,n=this.priorities_,s=t.length,r=t[e],a=n[e],o=e;for(;e>1;){const l=this.getLeftChildIndex_(e),u=this.getRightChildIndex_(e),c=ue;){const o=this.getParentIndex_(t);if(s[o]>a)n[t]=n[o],s[t]=s[o],t=o;else break}n[t]=r,s[t]=a}reprioritize(){const e=this.priorityFunction_,t=this.elements_,n=this.priorities_;let s=0;const r=t.length;let a,o,l;for(o=0;o0;)r=this.dequeue()[0],a=r.getKey(),s=r.getState(),s===se.IDLE&&!(a in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[a]=!0,++this.tilesLoading_,++n,r.load())}}const IA=AA;function DA(i,e,t,n,s){if(!i||!(t in i.wantedTiles)||!i.wantedTiles[t][e.getKey()])return fu;const r=i.viewState.center,a=n[0]-r[0],o=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(a*a+o*o)/s}class kA extends Bi{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){$h(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&$h(this.element);for(let t=0,n=this.listenerKeys.length;ts.getAttributions(e)))),n=!this.getMap().getAllLayers().some(s=>s.getSource()&&s.getSource().getAttributionsCollapsible()===!1);return this.overrideCollapsible_||this.setCollapsible(n),t}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=await Promise.all(this.collectSourceAttributions_(e).map(s=>Fb(()=>s))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Bn(t,this.renderedAttributions_)){lS(this.ulElement_);for(let s=0,r=t.length;s0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:gr}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const n=t.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Ql);!r&&n===0?this.element.classList.add(Ql):r&&n!==0&&this.element.classList.remove(Ql)}this.label_.style.transform=s}this.rotation_=n}}const OA=LA;class MA extends Ed{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,s=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",r=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",a=e.zoomInLabel!==void 0?e.zoomInLabel:"+",o=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",u=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof a=="string"?document.createTextNode(a):a),c.addEventListener(pe.CLICK,this.handleClick_.bind(this,n),!1);const d=document.createElement("button");d.className=r,d.setAttribute("type","button"),d.title=u,d.appendChild(typeof o=="string"?document.createTextNode(o):o),d.addEventListener(pe.CLICK,this.handleClick_.bind(this,-n),!1);const p=t+" "+Jl+" "+rd,y=this.element;y.className=p,y.appendChild(c),y.appendChild(d),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const r=n.getConstrainedZoom(s+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:r,duration:this.duration_,easing:gr})):n.setZoom(r)}}}const NA=MA;function FA(i){i=i||{};const e=new $i;return(i.zoom!==void 0?i.zoom:!0)&&e.push(new NA(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&e.push(new OA(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&e.push(new PA(i.attributionOptions)),e}const u_={ACTIVE:"active"};class BA extends Bi{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(u_.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(u_.ACTIVE,e)}setMap(e){this.map_=e}}function UA(i,e,t){const n=i.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:SE,center:i.getConstrainedCenter(s)})}}function Sd(i,e,t,n){const s=i.getZoom();if(s===void 0)return;const r=i.getConstrainedZoom(s+e),a=i.getResolutionForZoom(r);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:a,anchor:t,duration:n!==void 0?n:250,easing:gr})}const so=BA;class $A extends so{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==Xe.DBLCLICK){const n=e.originalEvent,s=e.map,r=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_,o=s.getView();Sd(o,a,r,this.duration_),n.preventDefault(),t=!0}return!t}}const VA=$A;class jA extends so{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==Xe.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Xe.POINTERUP){const n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==Xe.POINTERDOWN){const n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==Xe.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function Cd(i){const e=i.length;let t=0,n=0;for(let s=0;s0&&this.condition_(e)){const n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}const YA=KA;class ZA extends ro{constructor(e){e=e||{},super({stopDown:wl}),this.condition_=e.condition?e.condition:zA,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!Ad(e))return;const t=e.map,n=t.getView();if(n.getConstraints().rotation===kh)return;const s=t.getSize(),r=e.pixel,a=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const o=a-this.lastAngle_;n.adjustRotationInternal(-o)}this.lastAngle_=a}handleUpEvent(e){return Ad(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return Ad(e)&&h_(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const QA=ZA;class JA extends ch{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(e[0],t[0])+n,s.top=Math.min(e[1],t[1])+n,s.width=Math.abs(t[0]-e[0])+n,s.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,s=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Na([s])}getGeometry(){return this.geometry_}}const e3=JA,ao={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class pu extends un{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}}class t3 extends ro{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.box_=new e3(e.className||"ol-dragbox"),this.minArea_=e.minArea!==void 0?e.minArea:64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition?e.condition:h_,this.boxEndCondition_=e.boxEndCondition?e.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){const s=n[0]-t[0],r=n[1]-t[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){!this.startPixel_||(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new pu(ao.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;this.box_.setMap(null);const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new pu(t?ao.BOXEND:ao.BOXCANCEL,e.coordinate,e)),!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new pu(ao.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new pu(ao.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}}const i3=t3;class n3 extends i3{constructor(e){e=e||{};const t=e.condition?e.condition:WA;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const n=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=n.rotatedExtentForGeometry(s),a=n.getResolutionForExtentInternal(r),o=n.getResolution()/a;s=s.clone(),s.scale(o*o)}n.fitInternal(s,{duration:this.duration_,easing:gr})}}const s3=n3,Ss={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class r3 extends so{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return d_(t)&&f_(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==pe.KEYDOWN){const n=e.originalEvent,s=n.key;if(this.condition_(e)&&(s==Ss.DOWN||s==Ss.LEFT||s==Ss.RIGHT||s==Ss.UP)){const a=e.map.getView(),o=a.getResolution()*this.pixelDelta_;let l=0,u=0;s==Ss.DOWN?u=-o:s==Ss.LEFT?l=-o:s==Ss.RIGHT?l=o:u=o;const c=[l,u];bh(c,a.getRotation()),UA(a,c,this.duration_),n.preventDefault(),t=!0}}return!t}}const a3=r3;class o3 extends so{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!HA(t)&&f_(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==pe.KEYDOWN||e.type==pe.KEYPRESS){const n=e.originalEvent,s=n.key;if(this.condition_(e)&&(s==="+"||s==="-")){const r=e.map,a=s==="+"?this.delta_:-this.delta_,o=r.getView();Sd(o,a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}}const l3=o3;class u3 extends so{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:GA;this.condition_=e.onFocusOnly?wd(c_,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(e){if(!this.condition_(e)||e.type!==pe.WHEEL)return!0;const n=e.map,s=e.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.coordinate);let r;if(e.type==pe.WHEEL&&(r=s.deltaY,aS&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=$m),s.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),r===0)return!1;this.lastDelta_=r;const a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const o=n.getView();if(this.mode_==="trackpad"&&!(o.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=a,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),l),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-it(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Sd(t,n,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}const c3=u3;class h3 extends ro{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=wl),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const n=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-n.clientY,s.clientX-n.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=r;const a=e.map,o=a.getView();o.getConstraints().rotation!==kh&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Cd(this.targetPointers))),this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}const d3=h3;class f3 extends ro{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=wl),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const n=this.targetPointers[0],s=this.targetPointers[1],r=n.clientX-s.clientX,a=n.clientY-s.clientY,o=Math.sqrt(r*r+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;const l=e.map,u=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Cd(this.targetPointers))),l.render(),u.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const n=e.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}const p3=f3;function g3(i){i=i||{};const e=new $i,t=new gA(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&e.push(new QA),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&e.push(new VA({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&e.push(new YA({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&e.push(new d3),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&e.push(new p3({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(e.push(new a3),e.push(new l3({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&e.push(new c3({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&e.push(new s3({duration:i.zoomDuration})),e}function p_(i){if(i instanceof Hl){i.setMapInternal(null);return}i instanceof du&&i.getLayers().forEach(p_)}function g_(i,e){if(i instanceof Hl){i.setMapInternal(e);return}if(i instanceof du){const t=i.getLayers().getArray();for(let n=0,s=t.length;nthis.updateSize()),this.controls=t.controls||FA(),this.interactions=t.interactions||g3({onFocusOnly:!0}),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new IA(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ct.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ct.VIEW,this.handleViewChanged_),this.addChangeListener(Ct.SIZE,this.handleSizeChanged_),this.addChangeListener(Ct.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const n=this;e.view&&!(e.view instanceof Ui)&&e.view.then(function(s){n.setView(new Ui(s))}),this.controls.addEventListener(Ut.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Ut.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Ut.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Ut.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Ut.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Ut.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){g_(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};const r=n.hitTolerance!==void 0?n.hitTolerance:0,a=n.layerFilter!==void 0?n.layerFilter:Da,o=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,o,t,null,a,null)}getFeaturesAtPixel(e,t){const n=[];return this.forEachFeatureAtPixel(e,function(s){n.push(s)},t),n}getAllLayers(){const e=[];function t(n){n.forEach(function(s){s instanceof du?t(s.getLayers()):e.push(s)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const s=t.layerFilter!==void 0?t.layerFilter:Da,r=t.hitTolerance!==void 0?t.hitTolerance:0,a=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,r,a,s,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=n.width/s[0],a=n.height/s[1],o="changedTouches"in e?e.changedTouches[0]:e;return[(o.clientX-n.left)/r,(o.clientY-n.top)/a]}getTarget(){return this.get(Ct.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return wh(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?gt(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Ct.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof $i){t.setLayers(e);return}const n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t=0;r--){const a=s[r];if(a.getMap()!==this||!a.getActive()||!this.getTargetElement())continue;if(!a.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let s=this.maxTilesLoading_,r=s;if(e){const a=e.viewHints;if(a[xt.ANIMATING]||a[xt.INTERACTING]){const o=Date.now()-e.time>8;s=o?0:8,r=o?0:2}}t.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new Kn("removelayer",t)),this.set(Ct.LAYERGROUP,e)}setSize(e){this.set(Ct.SIZE,e)}setTarget(e){this.set(Ct.TARGET,e)}setView(e){if(!e||e instanceof Ui){this.set(Ct.VIEW,e);return}this.set(Ct.VIEW,new Ui);const t=this;e.then(function(n){t.setView(new Ui(n))})}updateSize(){const e=this.getTargetElement();let t;if(e){const s=getComputedStyle(e),r=e.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),a=e.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(a)&&(t=[r,a],!a0(t)&&!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&lm("No map visible because the map container's width or height are 0."))}const n=this.getSize();t&&(!n||!Bn(t,n))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}}function _3(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new du({layers:i.layers});t[Ct.LAYERGROUP]=n,t[Ct.TARGET]=i.target,t[Ct.VIEW]=i.view instanceof Ui?i.view:new Ui;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new $i(i.controls.slice()):(Te(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=i.controls));let r;i.interactions!==void 0&&(Array.isArray(i.interactions)?r=new $i(i.interactions.slice()):(Te(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=i.interactions));let a;return i.overlays!==void 0?Array.isArray(i.overlays)?a=new $i(i.overlays.slice()):(Te(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),a=i.overlays):a=new $i,{controls:s,interactions:r,keyboardEventTarget:e,overlays:a,values:t}}const y3=m3,v3={id:"tile-map"},T3="http://localhost/static/roadmap/{z}/{x}/{y}.png",x3=b.defineComponent({__name:"TileMap",setup(i){const e=Ug(null),t=b.ref(null),n={center:fm([110.23024,36.65505]),zoom:5,minZoom:5,constrainResolution:!0,maxZoom:13};function s(){const o=new BS({source:new uC({url:T3})});e.value=null,e.value=new y3({layers:[o],view:new Ui(n),target:"tile-map",projection:"EPSG:4326"}),r()}function r(o=[110.23024,36.65505]){t.value=new aA({source:new fA}),e.value.addLayer(t.value);const l=new dC({geometry:new Pm(fm(o))});l.setStyle(a()),t.value.getSource().addFeatures([l])}function a(o){return new Ga({})}return b.onMounted(()=>{s()}),b.onBeforeMount(()=>{e.value=null}),(o,l)=>(b.openBlock(),b.createElementBlock("div",v3))}}),CN="",b3=Ft(x3,[["__scopeId","data-v-58e4bb23"]]),E3={class:"map"},S3={class:"select"},C3=b.defineComponent({name:"HoskiMap",__name:"map",setup(i){const e=b.ref(),t=b.ref(),n=b.ref(1),s=b.reactive([{value:1,label:"\u9AD8\u5FB7\u5730\u56FE"},{value:2,label:"\u74E6\u7247\u5730\u56FE"}]);return(r,a)=>{const o=b.resolveComponent("el-option"),l=b.resolveComponent("el-select");return b.openBlock(),b.createElementBlock("div",E3,[n.value==1?(b.openBlock(),b.createBlock(Rb,{key:0,ref_key:"amap",ref:e},null,512)):(b.openBlock(),b.createBlock(b3,{key:1,ref_key:"tilemap",ref:t},null,512)),b.createElementVNode("div",S3,[b.createVNode(l,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=u=>n.value=u),"suffix-icon":b.unref(zx),placeholder:"\u9009\u62E9\u5730\u56FE",style:{width:"120px"}},{default:b.withCtx(()=>[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(s,u=>(b.openBlock(),b.createBlock(o,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","suffix-icon"])])])}}}),wN="",m_=(i,e)=>{if(i.install=t=>{for(const n of[i,...Object.values(e!=null?e:{})])t.component(n.name,n)},e)for(const[t,n]of Object.entries(e))i[t]=n;return i},__=m_(C3),AN="",w3={},Id=i=>(b.pushScopeId("data-v-2acef9b4"),i=i(),b.popScopeId(),i),A3={t:"1720974229691",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"10439",width:"200",height:"200"},I3=[Id(()=>b.createElementVNode("path",{d:"M373.76 450.56v337.92c0 20.48 5.12 40.96 20.48 56.32 15.36 15.36 30.72 20.48 56.32 20.48h337.92c20.48 0 40.96-5.12 56.32-20.48 15.36-15.36 20.48-30.72 20.48-56.32V450.56c0-20.48-5.12-40.96-20.48-56.32-15.36-15.36-30.72-20.48-56.32-20.48H450.56c-20.48 0-40.96 10.24-51.2 25.6-15.36 10.24-25.6 30.72-25.6 51.2z m61.44 358.4c-5.12-5.12-5.12-10.24-5.12-20.48V450.56c0-5.12 0-15.36 5.12-20.48 5.12-5.12 10.24-5.12 20.48-5.12h337.92c5.12 0 15.36 0 20.48 5.12 5.12 5.12 5.12 10.24 5.12 20.48v337.92c0 5.12 0 15.36-5.12 20.48-5.12 5.12-10.24 5.12-20.48 5.12H450.56c-5.12 0-10.24 0-15.36-5.12z","p-id":"10440"},null,-1)),Id(()=>b.createElementVNode("path",{d:"M706.56 399.36V343.04c0-5.12 0-15.36-5.12-20.48-5.12-5.12-10.24-5.12-20.48-5.12H343.04c-5.12 0-15.36 0-20.48 5.12-5.12 5.12-5.12 10.24-5.12 20.48v337.92c0 5.12 0 15.36 5.12 20.48 5.12 5.12 10.24 5.12 20.48 5.12h61.44v51.2H343.04c-20.48 0-40.96-5.12-56.32-20.48-15.36-15.36-20.48-30.72-20.48-56.32V343.04c0-20.48 5.12-40.96 20.48-56.32 15.36-15.36 30.72-20.48 56.32-20.48h337.92c20.48 0 40.96 5.12 56.32 20.48 15.36 15.36 20.48 30.72 20.48 56.32v61.44h-51.2z","p-id":"10441"},null,-1)),Id(()=>b.createElementVNode("path",{d:"M593.92 291.84V230.4c0-5.12 0-15.36-5.12-20.48-5.12-5.12-10.24-5.12-20.48-5.12H230.4c-5.12 0-15.36 0-20.48 5.12-5.12 5.12-5.12 15.36-5.12 20.48v337.92c0 5.12 0 15.36 5.12 20.48 5.12 5.12 10.24 5.12 20.48 5.12h61.44v51.2H230.4c-20.48 0-40.96-5.12-56.32-20.48-15.36-15.36-20.48-35.84-20.48-56.32V230.4c0-20.48 5.12-40.96 20.48-56.32S209.92 153.6 230.4 153.6h337.92c20.48 0 40.96 5.12 56.32 20.48 15.36 15.36 20.48 30.72 20.48 56.32v61.44h-51.2zM565.8112 614.0416v173.7728c0 14.4896 3.584 25.344 14.4896 36.1984 10.8544 10.8544 21.7088 14.4896 36.1984 14.4896h173.7728c14.4896 0 25.344-3.584 36.1984-14.4896 10.8544-10.8544 14.4896-21.7088 14.4896-36.1984v-173.7728a49.5104 49.5104 0 0 0-50.688-50.688h-173.7728c-14.4896 0-25.344 3.584-36.1984 14.4896-10.8544 10.8544-18.1248 25.344-14.4896 36.1984z m177.408 18.1248l-39.8336 39.7824-39.8336-39.7824c-10.8544-10.8544-25.344-10.8544-36.1984 0-10.8544 10.8544-10.8544 25.344 0 36.1984l39.8336 39.8336-39.8336 39.7824c-10.8544 10.9056-10.8544 25.344 0 36.2496s25.344 10.8544 36.1984 0l36.1984-36.2496 39.8336 39.8336c10.8544 10.8544 25.344 10.8544 36.1984 0 10.9056-10.8544 10.9056-25.344 0-36.1984l-39.7824-39.8336 39.7824-39.8336c10.9056-10.8544 10.9056-25.344 0-36.1984s-21.7088-14.4384-32.5632-3.584z","p-id":"10442"},null,-1))];function D3(i,e){return b.openBlock(),b.createElementBlock("svg",A3,I3)}const k3=Ft(w3,[["render",D3],["__scopeId","data-v-2acef9b4"]]),RN="",R3={},P3=i=>(b.pushScopeId("data-v-dbe1105a"),i=i(),b.popScopeId(),i),L3={t:"1720974155106",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"10153",width:"200",height:"200"},O3=[P3(()=>b.createElementVNode("path",{d:"M675.84 757.76H220.16c-35.84 0-66.56-30.72-66.56-66.56V271.36C153.6 235.52 184.32 204.8 220.16 204.8h455.68v66.56H512v163.84H394.24l10.24-10.24c5.12-10.24 10.24-15.36 10.24-25.6s-5.12-15.36-10.24-20.48c-10.24-15.36-30.72-15.36-46.08 0L291.84 440.32c-5.12 10.24-10.24 15.36-10.24 25.6s5.12 15.36 10.24 20.48L358.4 552.96c15.36 15.36 40.96 10.24 51.2-5.12 5.12-10.24 5.12-20.48 5.12-30.72l-10.24-10.24-10.24-10.24H512v194.56h163.84v66.56z m56.32-271.36L665.6 552.96c-10.24 15.36-35.84 15.36-46.08 0-15.36-15.36-10.24-35.84 0-46.08l10.24-10.24H512V435.2h117.76l-10.24-10.24c-10.24-10.24-10.24-35.84 0-46.08 10.24-10.24 25.6-10.24 35.84-5.12 5.12 0 5.12 5.12 10.24 5.12l66.56 66.56c10.24 10.24 10.24 30.72 0 40.96z m71.68-215.04h-66.56V204.8h66.56c35.84 0 66.56 30.72 66.56 66.56v66.56h-66.56V271.36z m0 128H870.4V563.2h-66.56V399.36z m-61.44 291.84h66.56v-66.56H870.4v66.56c0 35.84-30.72 66.56-66.56 66.56h-66.56v-66.56z m-424.96 133.12c0-20.48 15.36-30.72 30.72-30.72h327.68c10.24 0 25.6 5.12 30.72 15.36 5.12 10.24 5.12 25.6 0 35.84-5.12 10.24-15.36 15.36-25.6 15.36H348.16c-15.36-5.12-30.72-20.48-30.72-35.84z","p-id":"10154"},null,-1))];function M3(i,e){return b.openBlock(),b.createElementBlock("svg",L3,O3)}const N3=Ft(R3,[["render",M3],["__scopeId","data-v-dbe1105a"]]),LN="",F3={},B3=i=>(b.pushScopeId("data-v-c28b54c2"),i=i(),b.popScopeId(),i),U3={t:"1720974190972",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"10296",width:"200",height:"200"},$3=[B3(()=>b.createElementVNode("path",{d:"M788.48 204.8H235.52C189.44 204.8 153.6 240.64 153.6 281.6v460.8c0 40.96 35.84 76.8 81.92 76.8h558.08c46.08 0 81.92-35.84 81.92-76.8v-460.8C870.4 240.64 834.56 204.8 788.48 204.8z m-245.76 537.6h-256c-30.72 0-51.2-20.48-51.2-51.2v-51.2c0-30.72 20.48-51.2 51.2-51.2h256c30.72 0 51.2 20.48 51.2 51.2v51.2c0 30.72-25.6 51.2-51.2 51.2m0-189.44h-256c-30.72 0-51.2-20.48-51.2-51.2v-51.2c0-30.72 20.48-51.2 51.2-51.2h256c30.72 0 51.2 20.48 51.2 51.2v51.2c0 25.6-25.6 51.2-51.2 51.2m194.56 189.44h-56.32c-30.72 0-51.2-20.48-51.2-51.2V450.56c0-30.72 20.48-51.2 51.2-51.2h56.32c30.72 0 51.2 20.48 51.2 51.2v240.64c0 30.72-20.48 51.2-51.2 51.2","p-id":"10297"},null,-1))];function V3(i,e){return b.openBlock(),b.createElementBlock("svg",U3,$3)}const j3=Ft(F3,[["render",V3],["__scopeId","data-v-c28b54c2"]]),MN="",z3={},y_=i=>(b.pushScopeId("data-v-b5817836"),i=i(),b.popScopeId(),i),q3={t:"1720974104276",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"10009",width:"200",height:"200"},G3=[y_(()=>b.createElementVNode("path",{d:"M204.8 460.8v256c0 56.32 46.08 102.4 102.4 102.4h256V460.8H204.8z","p-id":"10010"},null,-1)),y_(()=>b.createElementVNode("path",{d:"M204.8 409.6h409.6v409.6h102.4c56.32 0 102.4-46.08 102.4-102.4V307.2c0-56.32-46.08-102.4-102.4-102.4H307.2c-56.32 0-102.4 46.08-102.4 102.4v102.4z","p-id":"10011"},null,-1))];function H3(i,e){return b.openBlock(),b.createElementBlock("svg",q3,G3)}const W3=Ft(z3,[["render",H3],["__scopeId","data-v-b5817836"]]),BN="",X3={},K3=i=>(b.pushScopeId("data-v-3f0adb81"),i=i(),b.popScopeId(),i),Y3={t:"1720973795671",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"9437",width:"200",height:"200"},Z3=[K3(()=>b.createElementVNode("path",{d:"M661.333333 554.666667l-238.933333 162.133333c-25.6 17.066667-55.466667 8.533333-72.533333-12.8-4.266667-12.8-8.533333-21.333333-8.533334-29.866667V349.866667C341.333333 324.266667 362.666667 298.666667 392.533333 298.666667c8.533333 0 21.333333 4.266667 29.866667 8.533333l238.933333 162.133333c25.6 17.066667 29.866667 46.933333 12.8 72.533334l-12.8 12.8z","p-id":"9438"},null,-1))];function Q3(i,e){return b.openBlock(),b.createElementBlock("svg",Y3,Z3)}const J3=Ft(X3,[["render",Q3],["__scopeId","data-v-3f0adb81"]]),$N="",eI={},tI=i=>(b.pushScopeId("data-v-3839e097"),i=i(),b.popScopeId(),i),iI={t:"1720974018287",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"9866",width:"200",height:"200"},nI=[tI(()=>b.createElementVNode("path",{d:"M584.533333 324.266667h157.866667c38.4 0 68.266667 29.866667 68.266667 68.266666v273.066667c0 38.4-29.866667 68.266667-68.266667 68.266667H324.266667c-38.4 0-68.266667-29.866667-68.266667-68.266667V392.533333c0-38.4 29.866667-68.266667 68.266667-68.266666h42.666666l12.8-38.4c8.533333-17.066667 29.866667-29.866667 51.2-29.866667h93.866667c17.066667 0 38.4 12.8 46.933333 29.866667l12.8 38.4z m89.6 76.8c0 12.8 8.533333 21.333333 21.333334 21.333333s21.333333-8.533333 21.333333-21.333333-8.533333-21.333333-21.333333-21.333334-21.333333 12.8-21.333334 21.333334z m-256 128c0 64 51.2 115.2 115.2 115.2s115.2-51.2 115.2-115.2c0-64-51.2-115.2-115.2-115.2s-115.2 51.2-115.2 115.2z m115.2 68.266666c38.4 0 68.266667-29.866667 68.266667-68.266666 0-38.4-29.866667-68.266667-68.266667-68.266667s-68.266667 29.866667-68.266666 68.266667c0 34.133333 29.866667 68.266667 68.266666 68.266666z","p-id":"9867"},null,-1))];function sI(i,e){return b.openBlock(),b.createElementBlock("svg",iI,nI)}const rI=Ft(eI,[["render",sI],["__scopeId","data-v-3839e097"]]),jN="",aI={},oI=i=>(b.pushScopeId("data-v-3f6e8f1b"),i=i(),b.popScopeId(),i),lI={t:"1720973946449",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"9723",width:"200",height:"200"},uI=[oI(()=>b.createElementVNode("path",{d:"M661.333333 256h-298.666666C302.933333 256 256 302.933333 256 362.666667v302.933333C256 721.066667 302.933333 768 362.666667 768h302.933333c59.733333 0 106.666667-46.933333 106.666667-106.666667v-298.666666C768 302.933333 721.066667 256 661.333333 256zM426.666667 716.8H332.8c-12.8 0-25.6-12.8-25.6-25.6v-98.133333c0-12.8 12.8-25.6 25.6-25.6 8.533333 0 12.8 4.266667 17.066667 8.533333 4.266667 4.266667 8.533333 12.8 8.533333 17.066667v38.4l89.6-89.6c8.533333-8.533333 25.6-8.533333 34.133333 0 8.533333 8.533333 8.533333 25.6 0 34.133333l-89.6 89.6h34.133334c12.8 0 25.6 12.8 25.6 25.6s-8.533333 25.6-25.6 25.6z m166.4-413.866667h98.133333c12.8 0 25.6 12.8 25.6 25.6V426.666667c0 12.8-12.8 25.6-25.6 25.6-8.533333 0-12.8-4.266667-17.066667-8.533334-4.266667-4.266667-8.533333-12.8-8.533333-17.066666V384l-89.6 89.6c-8.533333 8.533333-25.6 8.533333-34.133333 0-8.533333-8.533333-8.533333-25.6 0-34.133333l89.6-89.6h-38.4c-12.8 0-25.6-12.8-25.6-25.6s12.8-21.333333 25.6-21.333334z","p-id":"9724"},null,-1))];function cI(i,e){return b.openBlock(),b.createElementBlock("svg",lI,uI)}const hI=Ft(aI,[["render",cI],["__scopeId","data-v-3f6e8f1b"]]);var oo;typeof window<"u"?oo=window:typeof Ia<"u"?oo=Ia:typeof self<"u"?oo=self:oo={};var P=oo;const dI=$g(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var v_=typeof Ia<"u"?Ia:typeof window<"u"?window:{},fI=dI,lo;typeof document<"u"?lo=document:(lo=v_["__GLOBAL_DOCUMENT_CACHE@4"],lo||(lo=v_["__GLOBAL_DOCUMENT_CACHE@4"]=fI));var H=lo,pI=gI;function gI(i,e){var t,n=null;try{t=JSON.parse(i,e)}catch(s){n=s}return[n,t]}var gu={exports:{}};function Ke(){return Ke=Object.assign?Object.assign.bind():function(i){for(var e=1;e=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xI(i,e){if(!!i){if(typeof i=="string")return T_(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T_(i,e)}}function T_(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t=400&&s.statusCode<=599){var a=r;if(t)if(AI.TextDecoder){var o=DI(s.headers&&s.headers["content-type"]);try{a=new TextDecoder(o).decode(r)}catch{}}else a=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:a});return}e(null,r)}};function DI(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(e,t){var n=t.split("="),s=n[0],r=n[1];return s.trim()==="charset"?r.trim():e},"utf-8")}var kI=II,x_=P,RI=mI,PI=_I,b_=EI,LI=wI;Qe.httpHandler=kI,Qe.requestInterceptorsStorage=new b_,Qe.responseInterceptorsStorage=new b_,Qe.retryManager=new LI;/** * @license * slighly modified parse-headers 2.0.2 * Copyright (c) 2014 David Björklund * Available under the MIT license * */var OI=function(e){var t={};return e&&e.trim().split(` `).forEach(function(n){var s=n.indexOf(":"),r=n.slice(0,s).trim().toLowerCase(),a=n.slice(s+1).trim();typeof t[r]>"u"?t[r]=a:Array.isArray(t[r])?t[r].push(a):t[r]=[t[r],a]}),t};gu.exports=Qe,gu.exports.default=Qe,Qe.XMLHttpRequest=x_.XMLHttpRequest||BI,Qe.XDomainRequest="withCredentials"in new Qe.XMLHttpRequest?Qe.XMLHttpRequest:x_.XDomainRequest,MI(["get","put","post","patch","head","delete"],function(i){Qe[i==="delete"?"del":i]=function(e,t,n){return t=E_(e,t,n),t.method=i.toUpperCase(),Dd(t)}});function MI(i,e){for(var t=0;t"u")throw new Error("callback argument missing");if(i.requestType&&Qe.requestInterceptorsStorage.getIsEnabled()){var e={uri:i.uri||i.url,headers:i.headers||{},body:i.body,metadata:i.metadata||{},retry:i.retry,timeout:i.timeout},t=Qe.requestInterceptorsStorage.execute(i.requestType,e);i.uri=t.uri,i.headers=t.headers,i.body=t.body,i.metadata=t.metadata,i.retry=t.retry,i.timeout=t.timeout}var n=!1,s=function(w,O,N){n||(n=!0,i.callback(w,O,N))};function r(){u.readyState===4&&!Qe.responseInterceptorsStorage.getIsEnabled()&&setTimeout(l,0)}function a(){var k=void 0;if(u.response?k=u.response:k=u.responseText||FI(u),S)try{k=JSON.parse(k)}catch{}return k}function o(k){if(clearTimeout(C),clearTimeout(i.retryTimeout),k instanceof Error||(k=new Error(""+(k||"Unknown XMLHttpRequest Error"))),k.statusCode=0,!d&&Qe.retryManager.getIsEnabled()&&i.retry&&i.retry.shouldRetry()){i.retryTimeout=setTimeout(function(){i.retry.moveToNextAttempt(),i.xhr=u,Dd(i)},i.retry.getCurrentFuzzedDelay());return}if(i.requestType&&Qe.responseInterceptorsStorage.getIsEnabled()){var w={headers:D.headers||{},body:D.body,responseUrl:u.responseURL,responseType:u.responseType},O=Qe.responseInterceptorsStorage.execute(i.requestType,w);D.body=O.body,D.headers=O.headers}return s(k,D)}function l(){if(!d){var k;clearTimeout(C),clearTimeout(i.retryTimeout),i.useXDR&&u.status===void 0?k=200:k=u.status===1223?204:u.status;var w=D,O=null;if(k!==0?(w={body:a(),statusCode:k,method:y,headers:{},url:p,rawRequest:u},u.getAllResponseHeaders&&(w.headers=OI(u.getAllResponseHeaders()))):O=new Error("Internal XMLHttpRequest Error"),i.requestType&&Qe.responseInterceptorsStorage.getIsEnabled()){var N={headers:w.headers||{},body:w.body,responseUrl:u.responseURL,responseType:u.responseType},F=Qe.responseInterceptorsStorage.execute(i.requestType,N);w.body=F.body,w.headers=F.headers}return s(O,w,w.body)}}var u=i.xhr||null;u||(i.cors||i.useXDR?u=new Qe.XDomainRequest:u=new Qe.XMLHttpRequest);var c,d,p=u.url=i.uri||i.url,y=u.method=i.method||"GET",_=i.body||i.data,T=u.headers=i.headers||{},E=!!i.sync,S=!1,C,D={body:void 0,headers:{},statusCode:0,method:y,url:p,rawRequest:u};if("json"in i&&i.json!==!1&&(S=!0,T.accept||T.Accept||(T.Accept="application/json"),y!=="GET"&&y!=="HEAD"&&(T["content-type"]||T["Content-Type"]||(T["Content-Type"]="application/json"),_=JSON.stringify(i.json===!0?_:i.json))),u.onreadystatechange=r,u.onload=l,u.onerror=o,u.onprogress=function(){},u.onabort=function(){d=!0,clearTimeout(i.retryTimeout)},u.ontimeout=o,u.open(y,p,!E,i.username,i.password),E||(u.withCredentials=!!i.withCredentials),!E&&i.timeout>0&&(C=setTimeout(function(){if(!d){d=!0,u.abort("timeout");var k=new Error("XMLHttpRequest timeout");k.code="ETIMEDOUT",o(k)}},i.timeout)),u.setRequestHeader)for(c in T)T.hasOwnProperty(c)&&u.setRequestHeader(c,T[c]);else if(i.headers&&!NI(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(u.responseType=i.responseType),"beforeSend"in i&&typeof i.beforeSend=="function"&&i.beforeSend(u),u.send(_||null),u}function FI(i){try{if(i.responseType==="document")return i.responseXML;var e=i.responseXML&&i.responseXML.documentElement.nodeName==="parsererror";if(i.responseType===""&&!e)return i.responseXML}catch{}return null}function BI(){}var kd={exports:{}},S_=H,Rd=Object.create||function(){function i(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return i.prototype=e,new i}}();function ei(i,e){this.name="ParsingError",this.code=i.code,this.message=e||i.message}ei.prototype=Rd(Error.prototype),ei.prototype.constructor=ei,ei.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Pd(i){function e(n,s,r,a){return(n|0)*3600+(s|0)*60+(r|0)+(a|0)/1e3}var t=i.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function uo(){this.values=Rd(null)}uo.prototype={set:function(i,e){!this.get(i)&&e!==""&&(this.values[i]=e)},get:function(i,e,t){return t?this.has(i)?this.values[i]:e[t]:this.has(i)?this.values[i]:e},has:function(i){return i in this.values},alt:function(i,e,t){for(var n=0;n=0&&e<=100)?(this.set(i,e),!0):!1}};function co(i,e,t,n){var s=n?i.split(n):[i];for(var r in s)if(typeof s[r]=="string"){var a=s[r].split(t);if(a.length===2){var o=a[0].trim(),l=a[1].trim();e(o,l)}}}function UI(i,e,t){var n=i;function s(){var o=Pd(i);if(o===null)throw new ei(ei.Errors.BadTimeStamp,"Malformed timestamp: "+n);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function r(o,l){var u=new uo;co(o,function(c,d){switch(c){case"region":for(var p=t.length-1;p>=0;p--)if(t[p].id===d){u.set(c,t[p].region);break}break;case"vertical":u.alt(c,d,["rl","lr"]);break;case"line":var y=d.split(","),_=y[0];u.integer(c,_),u.percent(c,_)&&u.set("snapToLines",!1),u.alt(c,_,["auto"]),y.length===2&&u.alt("lineAlign",y[1],["start","center","end"]);break;case"position":y=d.split(","),u.percent(c,y[0]),y.length===2&&u.alt("positionAlign",y[1],["start","center","end"]);break;case"size":u.percent(c,d);break;case"align":u.alt(c,d,["start","center","end","left","right"]);break}},/:/,/\s/),l.region=u.get("region",null),l.vertical=u.get("vertical","");try{l.line=u.get("line","auto")}catch{}l.lineAlign=u.get("lineAlign","start"),l.snapToLines=u.get("snapToLines",!0),l.size=u.get("size",100);try{l.align=u.get("align","center")}catch{l.align=u.get("align","middle")}try{l.position=u.get("position","auto")}catch{l.position=u.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},l.align)}l.positionAlign=u.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},l.align)}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=s(),a(),i.substr(0,3)!=="-->")throw new ei(ei.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);i=i.substr(3),a(),e.endTime=s(),a(),r(i,e)}var Ld=S_.createElement&&S_.createElement("textarea"),$I={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},C_={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},VI={v:"title",lang:"lang"},w_={rt:"ruby"};function A_(i,e){function t(){if(!e)return null;function _(E){return e=e.substr(E.length),E}var T=e.match(/^([^<]*)(<[^>]*>?)?/);return _(T[1]?T[1]:T[2])}function n(_){return Ld.innerHTML=_,_=Ld.textContent,Ld.textContent="",_}function s(_,T){return!w_[T.localName]||w_[T.localName]===_.localName}function r(_,T){var E=$I[_];if(!E)return null;var S=i.document.createElement(E),C=VI[_];return C&&T&&(S[C]=T.trim()),S}for(var a=i.document.createElement("div"),o=a,l,u=[];(l=t())!==null;){if(l[0]==="<"){if(l[1]==="/"){u.length&&u[u.length-1]===l.substr(2).replace(">","")&&(u.pop(),o=o.parentNode);continue}var c=Pd(l.substr(1,l.length-2)),d;if(c){d=i.document.createProcessingInstruction("timestamp",c),o.appendChild(d);continue}var p=l.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!p||(d=r(p[1],p[3]),!d)||!s(o,d))continue;if(p[2]){var y=p[2].split(".");y.forEach(function(_){var T=/^bg_/.test(_),E=T?_.slice(3):_;if(C_.hasOwnProperty(E)){var S=T?"background-color":"color",C=C_[E];d.style[S]=C}}),d.className=y.join(" ")}u.push(p[1]),o.appendChild(d),o=d;continue}o.appendChild(i.document.createTextNode(n(l)))}return a}var I_=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function jI(i){for(var e=0;e=t[0]&&i<=t[1])return!0}return!1}function zI(i){var e=[],t="",n;if(!i||!i.childNodes)return"ltr";function s(o,l){for(var u=l.childNodes.length-1;u>=0;u--)o.push(l.childNodes[u])}function r(o){if(!o||!o.length)return null;var l=o.pop(),u=l.textContent||l.innerText;if(u){var c=u.match(/^.*(\n|\r)/);return c?(o.length=0,c[0]):u}if(l.tagName==="ruby")return r(o);if(l.childNodes)return s(o,l),r(o)}for(s(e,i);t=r(e);)for(var a=0;a=0&&i.line<=100))return i.line;if(!i.track||!i.track.textTrackList||!i.track.textTrackList.mediaElement)return-1;for(var e=i.track,t=e.textTrackList,n=0,s=0;si.left&&this.topi.top},Dt.prototype.overlapsAny=function(i){for(var e=0;e=i.top&&this.bottom<=i.bottom&&this.left>=i.left&&this.right<=i.right},Dt.prototype.overlapsOppositeAxis=function(i,e){switch(e){case"+x":return this.lefti.right;case"+y":return this.topi.bottom}},Dt.prototype.intersectPercentage=function(i){var e=Math.max(0,Math.min(this.right,i.right)-Math.max(this.left,i.left)),t=Math.max(0,Math.min(this.bottom,i.bottom)-Math.max(this.top,i.top)),n=e*t;return n/(this.height*this.width)},Dt.prototype.toCSSCompatValues=function(i){return{top:this.top-i.top,bottom:i.bottom-this.bottom,left:this.left-i.left,right:i.right-this.right,height:this.height,width:this.width}},Dt.getSimpleBoxPosition=function(i){var e=i.div?i.div.offsetHeight:i.tagName?i.offsetHeight:0,t=i.div?i.div.offsetWidth:i.tagName?i.offsetWidth:0,n=i.div?i.div.offsetTop:i.tagName?i.offsetTop:0;i=i.div?i.div.getBoundingClientRect():i.tagName?i.getBoundingClientRect():i;var s={left:i.left,right:i.right,top:i.top||n,height:i.height||e,bottom:i.bottom||n+(i.height||e),width:i.width||t};return s};function GI(i,e,t,n){function s(E,S){for(var C,D=new Dt(E),k=1,w=0;wO&&(C=new Dt(E),k=O),E=new Dt(D)}return C||D}var r=new Dt(e),a=e.cue,o=qI(a),l=[];if(a.snapToLines){var u;switch(a.vertical){case"":l=["+y","-y"],u="height";break;case"rl":l=["+x","-x"],u="width";break;case"lr":l=["-x","+x"],u="width";break}var c=r.lineHeight,d=c*Math.round(o),p=t[u]+c,y=l[0];Math.abs(d)>p&&(d=d<0?-1:1,d*=Math.ceil(p/c)*c),o<0&&(d+=a.vertical===""?t.height:t.width,l=l.reverse()),r.move(y,d)}else{var _=r.lineHeight/t.height*100;switch(a.lineAlign){case"center":o-=_/2;break;case"end":o-=_;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}l=["+y","-x","+x","-y"],r=new Dt(e)}var T=s(r,l);e.move(T.toCSSCompatValues(t))}function Rr(){}Rr.StringDecoder=function(){return{decode:function(i){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))}}},Rr.convertCueToDOMTree=function(i,e){return!i||!e?null:A_(i,e)};var HI=.05,WI="sans-serif",XI="1.5%";Rr.processCues=function(i,e,t){if(!i||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var n=i.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=XI,t.appendChild(n);function s(c){for(var d=0;d")===-1){e.cue.id=a;continue}case"CUE":try{UI(a,e.cue,e.regionList)}catch(c){e.reportOrThrowError(c),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var u=a.indexOf("-->")!==-1;if(!a||u&&(l=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=` `),e.cue.text+=a.replace(/\u2028/g,` `).replace(/u2029/g,` `);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(c){e.reportOrThrowError(c),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var i=this;try{if(i.buffer+=i.decoder.decode(),(i.cue||i.state==="HEADER")&&(i.buffer+=` `,i.parse()),i.state==="INITIAL")throw new ei(ei.Errors.BadSignature)}catch(e){i.reportOrThrowError(e)}return i.onflush&&i.onflush(),this}};var KI=Rr,YI="auto",ZI={"":1,lr:1,rl:1},QI={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function JI(i){if(typeof i!="string")return!1;var e=ZI[i.toLowerCase()];return e?i.toLowerCase():!1}function Od(i){if(typeof i!="string")return!1;var e=QI[i.toLowerCase()];return e?i.toLowerCase():!1}function D_(i,e,t){this.hasBeenReset=!1;var n="",s=!1,r=i,a=e,o=t,l=null,u="",c=!0,d="auto",p="start",y="auto",_="auto",T=100,E="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(S){n=""+S}},pauseOnExit:{enumerable:!0,get:function(){return s},set:function(S){s=!!S}},startTime:{enumerable:!0,get:function(){return r},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");r=S,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");a=S,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(S){o=""+S,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(S){l=S,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(S){var C=JI(S);if(C===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");u=C,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(S){c=!!S,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return d},set:function(S){if(typeof S!="number"&&S!==YI)throw new SyntaxError("Line: an invalid number or illegal string was specified.");d=S,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(S){var C=Od(S);C?(p=C,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return y},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");y=S,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return _},set:function(S){var C=Od(S);C?(_=C,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return T},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");T=S,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return E},set:function(S){var C=Od(S);if(!C)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");E=C,this.hasBeenReset=!0}}}),this.displayState=void 0}D_.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var eD=D_,tD={"":!0,up:!0};function iD(i){if(typeof i!="string")return!1;var e=tD[i.toLowerCase()];return e?i.toLowerCase():!1}function ho(i){return typeof i=="number"&&i>=0&&i<=100}function nD(){var i=100,e=3,t=0,n=100,s=0,r=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return i},set:function(o){if(!ho(o))throw new Error("Width must be between 0 and 100.");i=o}},lines:{enumerable:!0,get:function(){return e},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");e=o}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(o){if(!ho(o))throw new Error("RegionAnchorX must be between 0 and 100.");n=o}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(o){if(!ho(o))throw new Error("RegionAnchorY must be between 0 and 100.");t=o}},viewportAnchorY:{enumerable:!0,get:function(){return r},set:function(o){if(!ho(o))throw new Error("ViewportAnchorY must be between 0 and 100.");r=o}},viewportAnchorX:{enumerable:!0,get:function(){return s},set:function(o){if(!ho(o))throw new Error("ViewportAnchorX must be between 0 and 100.");s=o}},scroll:{enumerable:!0,get:function(){return a},set:function(o){var l=iD(o);l===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=l}}})}var sD=nD,Tn=P,Cs=kd.exports={WebVTT:KI,VTTCue:eD,VTTRegion:sD};Tn.vttjs=Cs,Tn.WebVTT=Cs.WebVTT;var rD=Cs.VTTCue,aD=Cs.VTTRegion,oD=Tn.VTTCue,lD=Tn.VTTRegion;Cs.shim=function(){Tn.VTTCue=rD,Tn.VTTRegion=aD},Cs.restore=function(){Tn.VTTCue=oD,Tn.VTTRegion=lD},Tn.VTTCue||Cs.shim();var k_={exports:{}};(function(i,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,u,c){if(c=c||{},l=l.trim(),u=u.trim(),!u){if(!c.alwaysNormalize)return l;var d=o.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var p=o.parseURL(u);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return c.alwaysNormalize?(p.path=o.normalizePath(p.path),o.buildURLFromParts(p)):u;var y=o.parseURL(l);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var _=s.exec(y.path);y.netLoc=_[1],y.path=_[2]}y.netLoc&&!y.path&&(y.path="/");var T={scheme:y.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(T.netLoc=y.netLoc,p.path[0]!=="/"))if(!p.path)T.path=y.path,p.params||(T.params=y.params,p.query||(T.query=y.query));else{var E=y.path,S=E.substring(0,E.lastIndexOf("/")+1)+p.path;T.path=o.normalizePath(S)}return T.path===null&&(T.path=c.alwaysNormalize?o.normalizePath(p.path):p.path),o.buildURLFromParts(T)},parseURL:function(l){var u=n.exec(l);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(r,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};i.exports=o})()})(k_);const R_=k_.exports;var P_="http://example.com",yu=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=P.location&&P.location.href||"");var n=typeof P.URL=="function",s=/^\/\//.test(e),r=!P.location&&!/\/\//i.test(e);if(n?e=new P.URL(e,P.location||P_):/\/\//i.test(e)||(e=R_.buildAbsoluteURL(P.location&&P.location.href||"",e)),n){var a=new URL(t,e);return r?a.href.slice(P_.length):s?a.href.slice(a.protocol.length):a.href}return R_.buildAbsoluteURL(e,t)},Md=function(){function i(){this.listeners={}}var e=i.prototype;return e.on=function(n,s){this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push(s)},e.off=function(n,s){if(!this.listeners[n])return!1;var r=this.listeners[n].indexOf(s);return this.listeners[n]=this.listeners[n].slice(0),this.listeners[n].splice(r,1),r>-1},e.trigger=function(n){var s=this.listeners[n];if(!!s)if(arguments.length===2)for(var r=s.length,a=0;a-1;t=this.buffer.indexOf(` `))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const dD=String.fromCharCode(9),Nd=function(i){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(i||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},fD=function(){const i="[^=]*",e='"[^"]*"|[^,]*',t="(?:"+i+")=(?:"+e+")";return new RegExp("(?:^|,)("+t+")")},ti=function(i){const e={};if(!i)return e;const t=i.split(fD());let n=t.length,s;for(;n--;)t[n]!==""&&(s=/([^=]*)=(.*)/.exec(t[n]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),e[s[0]]=s[1]);return e};class pD extends Md{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,n;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((r,a)=>{const o=a(e);return o===e?r:r.concat([o])},[e]).forEach(r=>{for(let a=0;ar),this.customParsers.push(r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:n(r),customType:t,segment:s}),!0})}addTagMapper({expression:e,map:t}){const n=s=>e.test(s)?t(s):s;this.tagMappers.push(n)}}const gD=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Qn=function(i){const e={};return Object.keys(i).forEach(function(t){e[gD(t)]=i[t]}),e},Fd=function(i){const{serverControl:e,targetDuration:t,partTargetDuration:n}=i;if(!e)return;const s="#EXT-X-SERVER-CONTROL",r="holdBack",a="partHoldBack",o=t&&t*3,l=n&&n*2;t&&!e.hasOwnProperty(r)&&(e[r]=o,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[r]{n.uri||!n.parts&&!n.preloadHints||(!n.map&&s&&(n.map=s),!n.key&&r&&(n.key=r),!n.timeline&&typeof c=="number"&&(n.timeline=c),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(_){let T,E;({tag(){({version(){_.version&&(this.manifest.version=_.version)},"allow-cache"(){this.manifest.allowCache=_.allowed,"allowed"in _||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const S={};"length"in _&&(n.byterange=S,S.length=_.length,"offset"in _||(_.offset=d)),"offset"in _&&(n.byterange=S,S.offset=_.offset),d=S.offset+S.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),_.title&&(n.title=_.title),_.duration>0&&(n.duration=_.duration),_.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=t},key(){if(!_.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(_.attributes.METHOD==="NONE"){r=null;return}if(!_.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(_.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:_.attributes};return}if(_.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:_.attributes.URI};return}if(_.attributes.KEYFORMAT===u){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(_.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(_.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),_.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(_.attributes.KEYID&&_.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:_.attributes.KEYFORMAT,keyId:_.attributes.KEYID.substring(2)},pssh:cD(_.attributes.URI.split(",")[1])};return}_.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:_.attributes.METHOD||"AES-128",uri:_.attributes.URI},typeof _.attributes.IV<"u"&&(r.iv=_.attributes.IV)},"media-sequence"(){if(!isFinite(_.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+_.number});return}this.manifest.mediaSequence=_.number},"discontinuity-sequence"(){if(!isFinite(_.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+_.number});return}this.manifest.discontinuitySequence=_.number,c=_.number},"playlist-type"(){if(!/VOD|EVENT/.test(_.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+_.playlist});return}this.manifest.playlistType=_.playlistType},map(){s={},_.uri&&(s.uri=_.uri),_.byterange&&(s.byterange=_.byterange),r&&(s.key=r)},"stream-inf"(){if(this.manifest.playlists=t,this.manifest.mediaGroups=this.manifest.mediaGroups||l,!_.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),Ke(n.attributes,_.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,!(_.attributes&&_.attributes.TYPE&&_.attributes["GROUP-ID"]&&_.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const S=this.manifest.mediaGroups[_.attributes.TYPE];S[_.attributes["GROUP-ID"]]=S[_.attributes["GROUP-ID"]]||{},T=S[_.attributes["GROUP-ID"]],E={default:/yes/i.test(_.attributes.DEFAULT)},E.default?E.autoselect=!0:E.autoselect=/yes/i.test(_.attributes.AUTOSELECT),_.attributes.LANGUAGE&&(E.language=_.attributes.LANGUAGE),_.attributes.URI&&(E.uri=_.attributes.URI),_.attributes["INSTREAM-ID"]&&(E.instreamId=_.attributes["INSTREAM-ID"]),_.attributes.CHARACTERISTICS&&(E.characteristics=_.attributes.CHARACTERISTICS),_.attributes.FORCED&&(E.forced=/yes/i.test(_.attributes.FORCED)),T[_.attributes.NAME]=E},discontinuity(){c+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(t.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=_.dateTimeString,this.manifest.dateTimeObject=_.dateTimeObject),n.dateTimeString=_.dateTimeString,n.dateTimeObject=_.dateTimeObject;const{lastProgramDateTime:S}=this;this.lastProgramDateTime=new Date(_.dateTimeString).getTime(),S===null&&this.manifest.segments.reduceRight((C,D)=>(D.programDateTime=C-D.duration*1e3,D.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(_.duration)||_.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+_.duration});return}this.manifest.targetDuration=_.duration,Fd.call(this,this.manifest)},start(){if(!_.attributes||isNaN(_.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:_.attributes["TIME-OFFSET"],precise:_.attributes.PRECISE}},"cue-out"(){n.cueOut=_.data},"cue-out-cont"(){n.cueOutCont=_.data},"cue-in"(){n.cueIn=_.data},skip(){this.manifest.skip=Qn(_.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",_.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;const S=this.manifest.segments.length,C=Qn(_.attributes);n.parts=n.parts||[],n.parts.push(C),C.byterange&&(C.byterange.hasOwnProperty("offset")||(C.byterange.offset=p),p=C.byterange.offset+C.byterange.length);const D=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${D} for segment #${S}`,_.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((k,w)=>{k.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${w} lacks required attribute(s): LAST-PART`})})},"server-control"(){const S=this.manifest.serverControl=Qn(_.attributes);S.hasOwnProperty("canBlockReload")||(S.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Fd.call(this,this.manifest),S.canSkipDateranges&&!S.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const S=this.manifest.segments.length,C=Qn(_.attributes),D=C.type&&C.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(C),C.byterange&&(C.byterange.hasOwnProperty("offset")||(C.byterange.offset=D?p:0,D&&(p=C.byterange.offset+C.byterange.length)));const k=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${k} for segment #${S}`,_.attributes,["TYPE","URI"]),!!C.type)for(let w=0;ww.id===C.id);this.manifest.dateRanges[k]=Ke(this.manifest.dateRanges[k],C),y[C.id]=Ke(y[C.id],C),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=Qn(_.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",_.attributes,["SERVER-URI"])}}[_.tagType]||o).call(e)},uri(){n.uri=_.uri,t.push(n),this.manifest.targetDuration&&!("duration"in n)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),r&&(n.key=r),n.timeline=c,s&&(n.map=s),p=0,this.lastProgramDateTime!==null&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=n.duration*1e3),n={}},comment(){},custom(){_.segment?(n.custom=n.custom||{},n.custom[_.customType]=_.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[_.customType]=_.data)}})[_.type].call(e)})}warnOnMissingAttributes_(e,t,n){const s=[];n.forEach(function(r){t.hasOwnProperty(r)||s.push(r)}),s.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${s.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(` `),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var ws={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},_D=["video","audio","text"],L_=["Video","Audio","Text"],O_=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,n,s){var r=("00"+Number(n).toString(16)).slice(-2),a=("00"+Number(s).toString(16)).slice(-2);return"avc1."+r+"00"+a})},Hi=function(e){e===void 0&&(e="");var t=e.split(","),n=[];return t.forEach(function(s){s=s.trim();var r;_D.forEach(function(a){var o=ws[a].exec(s.toLowerCase());if(!(!o||o.length<=1)){r=a;var l=s.substring(0,o[1].length),u=s.replace(l,"");n.push({type:l,details:u,mediaType:a})}}),r||n.push({type:s,details:"",mediaType:"unknown"})}),n},yD=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var n=e.mediaGroups.AUDIO[t];if(!n)return null;for(var s in n){var r=n[s];if(r.default&&r.playlists)return Hi(r.playlists[0].attributes.CODECS)}return null},M_=function(e){return e===void 0&&(e=""),ws.audio.test(e.trim().toLowerCase())},vD=function(e){return e===void 0&&(e=""),ws.text.test(e.trim().toLowerCase())},fo=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(r){return O_(r.trim())}),n="video";t.length===1&&M_(t[0])?n="audio":t.length===1&&vD(t[0])&&(n="application");var s="mp4";return t.every(function(r){return ws.mp4.test(r)})?s="mp4":t.every(function(r){return ws.webm.test(r)})?s="webm":t.every(function(r){return ws.ogg.test(r)})&&(s="ogg"),n+"/"+s+';codecs="'+e+'"'}},vu=function(e){return e===void 0&&(e=""),P.MediaSource&&P.MediaSource.isTypeSupported&&P.MediaSource.isTypeSupported(fo(e))||!1},Bd=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var n=0;nd&&(c-=d,c-=d,c-=yt(2))}return Number(c)},AD=function(e,t){var n=t===void 0?{}:t,s=n.le,r=s===void 0?!1:s;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=yt(e);for(var a=SD(e),o=new Uint8Array(new ArrayBuffer(a)),l=0;l=t.length&&u.call(t,function(c,d){var p=l[d]?l[d]&e[a+d]:e[a+d];return c===p})},DD=function(e,t,n){t.forEach(function(s){for(var r in e.mediaGroups[s])for(var a in e.mediaGroups[s][r]){var o=e.mediaGroups[s][r][a];n(o,s,r,a)}})},kD=function(e){return P.atob?P.atob(e):Buffer.from(e,"base64").toString("binary")};function RD(i){for(var e=kD(i),t=new Uint8Array(e.length),n=0;n=0&&i=0){for(var s=e.length-1;n0},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]===i)return n}e=e.nodeType==Pr?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i];e=e.nodeType==Pr?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function iy(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}go(zt,Pe),go(zt,Pe.prototype);function mo(i,e){if(e(i))return!0;if(i=i.firstChild)do if(mo(i,e))return!0;while(i=i.nextSibling)}function _o(){this.ownerDocument=this}function $D(i,e,t){i&&i._inc++;var n=t.namespaceURI;n===po.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function ny(i,e,t,n){i&&i._inc++;var s=t.namespaceURI;s===po.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function jd(i,e,t){if(i&&i._inc){i._inc++;var n=e.childNodes;if(t)n[n.length++]=t;else{for(var s=e.firstChild,r=0;s;)n[r++]=s,s=s.nextSibling;n.length=r,delete n[n.length]}}}function sy(i,e){var t=e.previousSibling,n=e.nextSibling;return t?t.nextSibling=n:i.firstChild=n,n?n.previousSibling=t:i.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,jd(i.ownerDocument,i),e}function VD(i){return i&&(i.nodeType===Pe.DOCUMENT_NODE||i.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||i.nodeType===Pe.ELEMENT_NODE)}function jD(i){return i&&(Xi(i)||zd(i)||Sn(i)||i.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||i.nodeType===Pe.COMMENT_NODE||i.nodeType===Pe.PROCESSING_INSTRUCTION_NODE)}function Sn(i){return i&&i.nodeType===Pe.DOCUMENT_TYPE_NODE}function Xi(i){return i&&i.nodeType===Pe.ELEMENT_NODE}function zd(i){return i&&i.nodeType===Pe.TEXT_NODE}function ry(i,e){var t=i.childNodes||[];if(Wi(t,Xi)||Sn(e))return!1;var n=Wi(t,Sn);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function ay(i,e){var t=i.childNodes||[];function n(r){return Xi(r)&&r!==e}if(Wi(t,n))return!1;var s=Wi(t,Sn);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}function zD(i,e,t){if(!VD(i))throw new Je(qt,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new Je(Y_,"child not in parent");if(!jD(e)||Sn(e)&&i.nodeType!==Pe.DOCUMENT_NODE)throw new Je(qt,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function qD(i,e,t){var n=i.childNodes||[],s=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var r=s.filter(Xi);if(r.length>1||Wi(s,zd))throw new Je(qt,"More than one element or text in fragment");if(r.length===1&&!ry(i,t))throw new Je(qt,"Element in fragment can not be inserted before doctype")}if(Xi(e)&&!ry(i,t))throw new Je(qt,"Only one element can be added and only after doctype");if(Sn(e)){if(Wi(n,Sn))throw new Je(qt,"Only one doctype is allowed");var a=Wi(n,Xi);if(t&&n.indexOf(a)1||Wi(s,zd))throw new Je(qt,"More than one element or text in fragment");if(r.length===1&&!ay(i,t))throw new Je(qt,"Element in fragment can not be inserted before doctype")}if(Xi(e)&&!ay(i,t))throw new Je(qt,"Only one element can be added and only after doctype");if(Sn(e)){if(Wi(n,function(l){return Sn(l)&&l!==t}))throw new Je(qt,"Only one doctype is allowed");var a=Wi(n,Xi);if(t&&n.indexOf(a)0&&mo(t.documentElement,function(s){if(s!==t&&s.nodeType===Ii){var r=s.getAttribute("class");if(r){var a=i===r;if(!a){var o=z_(r);a=e.every(FD(o))}a&&n.push(s)}}}),n})},createElement:function(i){var e=new As;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new En;var t=e.attributes=new xu;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Cu;return i.ownerDocument=this,i.childNodes=new En,i},createTextNode:function(i){var e=new qd;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new Gd;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new Hd;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Xd;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new Eu;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new Wd;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new As,n=e.split(":"),s=t.attributes=new xu;return t.childNodes=new En,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=i,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,s._ownerElement=t,t},createAttributeNS:function(i,e){var t=new Eu,n=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=i,t.specified=!0,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,t}},jt(_o,Pe);function As(){this._nsMap={}}As.prototype={nodeType:Ii,hasAttribute:function(i){return this.getAttributeNode(i)!=null},getAttribute:function(i){var e=this.getAttributeNode(i);return e&&e.value||""},getAttributeNode:function(i){return this.attributes.getNamedItem(i)},setAttribute:function(i,e){var t=this.ownerDocument.createAttribute(i);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},appendChild:function(i){return i.nodeType===bn?this.insertBefore(i,null):GD(this,i)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t&&t.value||""},setAttributeNS:function(i,e,t){var n=this.ownerDocument.createAttributeNS(i,e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByTagName:function(i){return new Lr(this,function(e){var t=[];return mo(e,function(n){n!==e&&n.nodeType==Ii&&(i==="*"||n.tagName==i)&&t.push(n)}),t})},getElementsByTagNameNS:function(i,e){return new Lr(this,function(t){var n=[];return mo(t,function(s){s!==t&&s.nodeType===Ii&&(i==="*"||s.namespaceURI===i)&&(e==="*"||s.localName==e)&&n.push(s)}),n})}},_o.prototype.getElementsByTagName=As.prototype.getElementsByTagName,_o.prototype.getElementsByTagNameNS=As.prototype.getElementsByTagNameNS,jt(As,Pe);function Eu(){}Eu.prototype.nodeType=Pr,jt(Eu,Pe);function yo(){}yo.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},appendChild:function(i){throw new Error(ht[qt])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var n=this.data.substring(0,i),s=this.data.substring(i+e);t=n+t+s,this.nodeValue=this.data=t,this.length=t.length}},jt(yo,Pe);function qd(){}qd.prototype={nodeName:"#text",nodeType:Tu,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},jt(qd,yo);function Gd(){}Gd.prototype={nodeName:"#comment",nodeType:W_},jt(Gd,yo);function Hd(){}Hd.prototype={nodeName:"#cdata-section",nodeType:q_},jt(Hd,yo);function Su(){}Su.prototype.nodeType=K_,jt(Su,Pe);function ly(){}ly.prototype.nodeType=UD,jt(ly,Pe);function uy(){}uy.prototype.nodeType=BD,jt(uy,Pe);function Wd(){}Wd.prototype.nodeType=G_,jt(Wd,Pe);function Cu(){}Cu.prototype.nodeName="#document-fragment",Cu.prototype.nodeType=bn,jt(Cu,Pe);function Xd(){}Xd.prototype.nodeType=H_,jt(Xd,Pe);function cy(){}cy.prototype.serializeToString=function(i,e,t){return hy.call(i,e,t)},Pe.prototype.toString=hy;function hy(i,e){var t=[],n=this.nodeType==9&&this.documentElement||this,s=n.prefix,r=n.namespaceURI;if(r&&s==null){var s=n.lookupPrefix(r);if(s==null)var a=[{namespace:r,prefix:null}]}return Or(this,t,i,e,a),t.join("")}function dy(i,e,t){var n=i.prefix||"",s=i.namespaceURI;if(!s||n==="xml"&&s===po.XML||s===po.XMLNS)return!1;for(var r=t.length;r--;){var a=t[r];if(a.prefix===n)return a.namespace!==s}return!0}function Kd(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,iy),'"')}function Or(i,e,t,n,s){if(s||(s=[]),n)if(i=n(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Ii:var r=i.attributes,a=r.length,S=i.firstChild,o=i.tagName;t=po.isHTML(i.namespaceURI)||t;var l=o;if(!t&&!i.prefix&&i.namespaceURI){for(var u,c=0;c=0;d--){var p=s[d];if(p.prefix===""&&p.namespace===i.namespaceURI){u=p.namespace;break}}if(u!==i.namespaceURI)for(var d=s.length-1;d>=0;d--){var p=s[d];if(p.namespace===i.namespaceURI){p.prefix&&(l=p.prefix+":"+o);break}}}e.push("<",l);for(var y=0;y"),t&&/^script$/i.test(o))for(;S;)S.data?e.push(S.data):Or(S,e,t,n,s.slice()),S=S.nextSibling;else for(;S;)Or(S,e,t,n,s.slice()),S=S.nextSibling;e.push("")}else e.push("/>");return;case X_:case bn:for(var S=i.firstChild;S;)Or(S,e,t,n,s.slice()),S=S.nextSibling;return;case Pr:return Kd(e,i.name,i.value);case Tu:return e.push(i.data.replace(/[<&>]/g,iy));case q_:return e.push("");case W_:return e.push("");case K_:var C=i.publicId,D=i.systemId;if(e.push("");else if(D&&D!=".")e.push(" SYSTEM ",D,">");else{var k=i.internalSubset;k&&e.push(" [",k,"]"),e.push(">")}return;case H_:return e.push("");case G_:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function fy(i,e,t){var n;switch(e.nodeType){case Ii:n=e.cloneNode(!1),n.ownerDocument=i;case bn:break;case Pr:t=!0;break}if(n||(n=e.cloneNode(!1)),n.ownerDocument=i,n.parentNode=null,t)for(var s=e.firstChild;s;)n.appendChild(fy(i,s,t)),s=s.nextSibling;return n}function Yd(i,e,t){var n=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];typeof r!="object"&&r!=n[s]&&(n[s]=r)}switch(e.childNodes&&(n.childNodes=new En),n.ownerDocument=i,n.nodeType){case Ii:var a=e.attributes,o=n.attributes=new xu,l=a.length;o._ownerElement=n;for(var u=0;u",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:` `,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}),i.entityMap=i.HTML_ENTITIES})(gy);var Zd={},vo=xn.NAMESPACE,Qd=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,my=new RegExp("[\\-\\.0-9"+Qd.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),_y=new RegExp("^"+Qd.source+my.source+"*(?::"+Qd.source+my.source+"*)?$"),To=0,es=1,Mr=2,xo=3,Nr=4,Fr=5,bo=6,Au=7;function Br(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Br)}Br.prototype=new Error,Br.prototype.name=Br.name;function yy(){}yy.prototype={parse:function(i,e,t){var n=this.domBuilder;n.startDocument(),xy(e,e={}),HD(i,e,t,n,this.errorHandler),n.endDocument()}};function HD(i,e,t,n,s){function r(q){if(q>65535){q-=65536;var ie=55296+(q>>10),ae=56320+(q&1023);return String.fromCharCode(ie,ae)}else return String.fromCharCode(q)}function a(q){var ie=q.slice(1,-1);return Object.hasOwnProperty.call(t,ie)?t[ie]:ie.charAt(0)==="#"?r(parseInt(ie.substr(1).replace("x","0x"))):(s.error("entity not found:"+q),q)}function o(q){if(q>T){var ie=i.substring(T,q).replace(/&#?\w+;/g,a);p&&l(T),n.characters(ie,0,q-T),T=q}}function l(q,ie){for(;q>=c&&(ie=d.exec(i));)u=ie.index,c=u+ie[0].length,p.lineNumber++;p.columnNumber=q-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,y=[{currentNSMap:e}],_={},T=0;;){try{var E=i.indexOf("<",T);if(E<0){if(!i.substr(T).match(/^\s*$/)){var S=n.doc,C=S.createTextNode(i.substr(T));S.appendChild(C),n.currentElement=C}return}switch(E>T&&o(E),i.charAt(E+1)){case"/":var X=i.indexOf(">",E+3),D=i.substring(E+2,X).replace(/[ \t\n\r]+$/g,""),k=y.pop();X<0?(D=i.substring(E+2).replace(/[\s<].*/,""),s.error("end tag name: "+D+" is not complete:"+k.tagName),X=E+1+D.length):D.match(/\sT?T=X:o(Math.max(E,T)+1)}}function vy(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function WD(i,e,t,n,s,r){function a(p,y,_){t.attributeNames.hasOwnProperty(p)&&r.fatalError("Attribute "+p+" redefined"),t.addValue(p,y.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),_)}for(var o,l,u=++e,c=To;;){var d=i.charAt(u);switch(d){case"=":if(c===es)o=i.slice(e,u),c=xo;else if(c===Mr)c=xo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===xo||c===es)if(c===es&&(r.warning('attribute value must after "="'),o=i.slice(e,u)),e=u+1,u=i.indexOf(d,e),u>0)l=i.slice(e,u),a(o,l,e-1),c=Fr;else throw new Error("attribute value no end '"+d+"' match");else if(c==Nr)l=i.slice(e,u),a(o,l,e),r.warning('attribute "'+o+'" missed start quot('+d+")!!"),e=u+1,c=Fr;else throw new Error('attribute value must after "="');break;case"/":switch(c){case To:t.setTagName(i.slice(e,u));case Fr:case bo:case Au:c=Au,t.closed=!0;case Nr:case es:break;case Mr:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return r.error("unexpected end of input"),c==To&&t.setTagName(i.slice(e,u)),u;case">":switch(c){case To:t.setTagName(i.slice(e,u));case Fr:case bo:case Au:break;case Nr:case es:l=i.slice(e,u),l.slice(-1)==="/"&&(t.closed=!0,l=l.slice(0,-1));case Mr:c===Mr&&(l=o),c==Nr?(r.warning('attribute "'+l+'" missed quot(")!'),a(o,l,e)):((!vo.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&r.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),a(l,l,e));break;case xo:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case To:t.setTagName(i.slice(e,u)),c=bo;break;case es:o=i.slice(e,u),c=Mr;break;case Nr:var l=i.slice(e,u);r.warning('attribute "'+l+'" missed quot(")!!'),a(o,l,e);case Fr:c=bo;break}else switch(c){case Mr:t.tagName,(!vo.isHTML(n[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&r.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=u,c=es;break;case Fr:r.warning('attribute space is required"'+o+'"!!');case bo:c=es,e=u;break;case xo:c=Nr,e=u;break;case Au:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function Ty(i,e,t){for(var n=i.tagName,s=null,d=i.length;d--;){var r=i[d],a=r.qName,o=r.value,p=a.indexOf(":");if(p>0)var l=r.prefix=a.slice(0,p),u=a.slice(p+1),c=l==="xmlns"&&u;else u=a,l=null,c=a==="xmlns"&&"";r.localName=u,c!==!1&&(s==null&&(s={},xy(t,t={})),t[c]=s[c]=o,r.uri=vo.XMLNS,e.startPrefixMapping(c,o))}for(var d=i.length;d--;){r=i[d];var l=r.prefix;l&&(l==="xml"&&(r.uri=vo.XML),l!=="xmlns"&&(r.uri=t[l||""]))}var p=n.indexOf(":");p>0?(l=i.prefix=n.slice(0,p),u=i.localName=n.slice(p+1)):(l=null,u=i.localName=n);var y=i.uri=t[l||""];if(e.startElement(y,u,n,i),i.closed){if(e.endElement(y,u,n),s)for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&e.endPrefixMapping(l)}else return i.currentNSMap=t,i.localNSMap=s,!0}function XD(i,e,t,n,s){if(/^(?:script|textarea)$/i.test(t)){var r=i.indexOf("",e),a=i.substring(e+1,r);if(/[&<]/.test(a))return/^script$/i.test(t)?(s.characters(a,0,a.length),r):(a=a.replace(/&#?\w+;/g,n),s.characters(a,0,a.length),r)}return e+1}function KD(i,e,t,n){var s=n[t];return s==null&&(s=i.lastIndexOf(""),s",e+4);return r>e?(t.comment(i,e+4,r-e-4),r+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var r=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,r-e-9),t.endCDATA(),r+3}var a=QD(i,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var l=a[1][0],u=!1,c=!1;o>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],c=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var d=a[o-1];return t.startDTD(l,u,c),t.endDTD(),d.index+d[0].length}}return-1}function ZD(i,e,t){var n=i.indexOf("?>",e);if(n){var s=i.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,t.processingInstruction(s[1],s[2]),n+2):-1}return-1}function by(){this.attributeNames={}}by.prototype={setTagName:function(i){if(!_y.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!_y.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function QD(i,e){var t,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=e,s.exec(i);t=s.exec(i);)if(n.push(t),t[1])return n}Zd.XMLReader=yy,Zd.ParseError=Br;var JD=xn,ek=Jn,Ey=gy,Sy=Zd,tk=ek.DOMImplementation,Cy=JD.NAMESPACE,ik=Sy.ParseError,nk=Sy.XMLReader;function wy(i){return i.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` `)}function Ay(i){this.options=i||{locator:{}}}Ay.prototype.parseFromString=function(i,e){var t=this.options,n=new nk,s=t.domBuilder||new Eo,r=t.errorHandler,a=t.locator,o=t.xmlns||{},l=/\/x?html?$/.test(e),u=l?Ey.HTML_ENTITIES:Ey.XML_ENTITIES;a&&s.setDocumentLocator(a),n.errorHandler=sk(r,s,a),n.domBuilder=t.domBuilder||s,l&&(o[""]=Cy.HTML),o.xml=o.xml||Cy.XML;var c=t.normalizeLineEndings||wy;return i&&typeof i=="string"?n.parse(c(i),o,u):n.errorHandler.error("invalid doc source"),s.doc};function sk(i,e,t){if(!i){if(e instanceof Eo)return e;i=e}var n={},s=i instanceof Function;t=t||{};function r(a){var o=i[a];!o&&s&&(o=i.length==2?function(l){i(a,l)}:i),n[a]=o&&function(l){o("[xmldom "+a+"] "+l+Jd(t))}||function(){}}return r("warning"),r("error"),r("fatalError"),n}function Eo(){this.cdata=!1}function Ur(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}Eo.prototype={startDocument:function(){this.doc=new tk().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,n){var s=this.doc,r=s.createElementNS(i,t||e),a=n.length;Iu(this,r),this.currentElement=r,this.locator&&Ur(this.locator,r);for(var o=0;o=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){Eo.prototype[i]=function(){return null}});function Iu(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}wu.__DOMHandler=Eo,wu.normalizeLineEndings=wy,wu.DOMParser=Ay;var rk=wu.DOMParser;/*! @name mpd-parser @version 1.3.0 @license Apache-2.0 */const Dy=i=>!!i&&typeof i=="object",dt=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(n=>{Array.isArray(e[n])&&Array.isArray(t[n])?e[n]=e[n].concat(t[n]):Dy(e[n])&&Dy(t[n])?e[n]=dt(e[n],t[n]):e[n]=t[n]}),e),{}),ky=i=>Object.keys(i).map(e=>i[e]),ak=(i,e)=>{const t=[];for(let n=i;ni.reduce((e,t)=>e.concat(t),[]),Ry=i=>{if(!i.length)return[];const e=[];for(let t=0;ti.reduce((t,n,s)=>(n[e]&&t.push(s),t),[]),lk=(i,e)=>ky(i.reduce((t,n)=>(n.forEach(s=>{t[e(s)]=s}),t),{}));var Vr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const So=({baseUrl:i="",source:e="",range:t="",indexRange:n=""})=>{const s={uri:e,resolvedUri:yu(i||"",e)};if(t||n){const a=(t||n).split("-");let o=P.BigInt?P.BigInt(a[0]):parseInt(a[0],10),l=P.BigInt?P.BigInt(a[1]):parseInt(a[1],10);o{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=P.BigInt(i.offset)+P.BigInt(i.length)-P.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},Py=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),ck={static(i){const{duration:e,timescale:t=1,sourceDuration:n,periodDuration:s}=i,r=Py(i.endNumber),a=e/t;return typeof r=="number"?{start:0,end:r}:typeof s=="number"?{start:0,end:s/a}:{start:0,end:n/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:n,timescale:s=1,duration:r,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=i,u=Py(i.endNumber),c=(e+t)/1e3,d=n+a,y=c+o-d,_=Math.ceil(y*s/r),T=Math.floor((c-d-l)*s/r),E=Math.floor((c-d)*s/r);return{start:Math.max(0,T),end:typeof u=="number"?u:Math.min(_,E)}}},hk=i=>e=>{const{duration:t,timescale:n=1,periodStart:s,startNumber:r=1}=i;return{number:r+e,duration:t/n,timeline:s,time:e*t}},ef=i=>{const{type:e,duration:t,timescale:n=1,periodDuration:s,sourceDuration:r}=i,{start:a,end:o}=ck[e](i),l=ak(a,o).map(hk(i));if(e==="static"){const u=l.length-1,c=typeof s=="number"?s:r;l[u].duration=c-t/n*u}return l},Ly=i=>{const{baseUrl:e,initialization:t={},sourceDuration:n,indexRange:s="",periodStart:r,presentationTime:a,number:o=0,duration:l}=i;if(!e)throw new Error(Vr.NO_BASE_URL);const u=So({baseUrl:e,source:t.sourceURL,range:t.range}),c=So({baseUrl:e,source:e,indexRange:s});if(c.map=u,l){const d=ef(i);d.length&&(c.duration=d[0].duration,c.timeline=d[0].timeline)}else n&&(c.duration=n,c.timeline=r);return c.presentationTime=a||r,c.number=o,[c]},tf=(i,e,t)=>{const n=i.sidx.map?i.sidx.map:null,s=i.sidx.duration,r=i.timeline||0,a=i.sidx.byterange,o=a.offset+a.length,l=e.timescale,u=e.references.filter(E=>E.referenceType!==1),c=[],d=i.endList?"static":"dynamic",p=i.sidx.timeline;let y=p,_=i.mediaSequence||0,T;typeof e.firstOffset=="bigint"?T=P.BigInt(o)+e.firstOffset:T=o+e.firstOffset;for(let E=0;Elk(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),pk=(i,e)=>{for(let t=0;t{let e=[];return DD(i,dk,(t,n,s,r)=>{e=e.concat(t.playlists||[])}),e},Ny=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,n)=>{t.number=i.mediaSequence+n})},gk=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(n=>{n.discontinuitySequence=t.findIndex(function({timeline:l}){return l===n.timeline});const s=pk(i,n.attributes.NAME);if(!s||n.sidx)return;const r=n.segments[0],a=s.segments.findIndex(function(l){return Math.abs(l.presentationTime-r.presentationTime)s.timeline||s.segments.length&&n.timeline>s.segments[s.segments.length-1].timeline)&&n.discontinuitySequence--;return}s.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,n.discontinuityStarts.unshift(0),n.discontinuitySequence--),Ny({playlist:n,mediaSequence:s.segments[a].number})})},mk=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(My(i)),n=e.playlists.concat(My(e));return e.timelineStarts=Oy([i.timelineStarts,e.timelineStarts]),gk({oldPlaylists:t,newPlaylists:n,timelineStarts:e.timelineStarts}),e},Du=i=>i&&i.uri+"-"+uk(i.byterange),nf=i=>{const e=i.reduce(function(n,s){return n[s.attributes.baseUrl]||(n[s.attributes.baseUrl]=[]),n[s.attributes.baseUrl].push(s),n},{});let t=[];return Object.values(e).forEach(n=>{const s=ky(n.reduce((r,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return r[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),r[o].segments.push(...a.segments)),a.attributes.contentProtection&&(r[o].attributes.contentProtection=a.attributes.contentProtection)):(r[o]=a,r[o].attributes.timelineStarts=[]),r[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),r},{}));t=t.concat(s)}),t.map(n=>(n.discontinuityStarts=ok(n.segments||[],"discontinuity"),n))},sf=(i,e)=>{const t=Du(i.sidx),n=t&&e[t]&&e[t].sidx;return n&&tf(i,n,i.sidx.resolvedUri),i},_k=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=sf(i[t],e);return i},yk=({attributes:i,segments:e,sidx:t,mediaSequence:n,discontinuitySequence:s,discontinuityStarts:r},a)=>{const o={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,["PROGRAM-ID"]:1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:s,discontinuityStarts:r,timelineStarts:i.timelineStarts,mediaSequence:n,segments:e};return i.contentProtection&&(o.contentProtection=i.contentProtection),i.serviceLocation&&(o.attributes.serviceLocation=i.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},vk=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:n,discontinuitySequence:s})=>{typeof e>"u"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const r={NAME:i.id,BANDWIDTH:i.bandwidth,["PROGRAM-ID"]:1};i.codecs&&(r.CODECS=i.codecs);const a={attributes:r,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:n,discontinuitySequence:s,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},Tk=(i,e={},t=!1)=>{let n;const s=i.reduce((r,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",l=a.attributes.lang||"";let u=a.attributes.label||"main";if(l&&!a.attributes.label){const d=o?` (${o})`:"";u=`${a.attributes.lang}${d}`}r[u]||(r[u]={language:l,autoselect:!0,default:o==="main",playlists:[],uri:""});const c=sf(yk(a,t),e);return r[u].playlists.push(c),typeof n>"u"&&o==="main"&&(n=a,n.default=!0),r},{});if(!n){const r=Object.keys(s)[0];s[r].default=!0}return s},xk=(i,e={})=>i.reduce((t,n)=>{const s=n.attributes.label||n.attributes.lang||"text";return t[s]||(t[s]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),t[s].playlists.push(sf(vk(n),e)),t},{}),bk=i=>i.reduce((e,t)=>(t&&t.forEach(n=>{const{channel:s,language:r}=n;e[r]={autoselect:!1,default:!1,instreamId:s,language:r},n.hasOwnProperty("aspectRatio")&&(e[r].aspectRatio=n.aspectRatio),n.hasOwnProperty("easyReader")&&(e[r].easyReader=n.easyReader),n.hasOwnProperty("3D")&&(e[r]["3D"]=n["3D"])}),e),{}),Ek=({attributes:i,segments:e,sidx:t,discontinuityStarts:n})=>{const s={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,["PROGRAM-ID"]:1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:n,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(s.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(s.contentProtection=i.contentProtection),i.serviceLocation&&(s.attributes.serviceLocation=i.serviceLocation),t&&(s.sidx=t),s},Sk=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",Ck=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",wk=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",Ak=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:n}){return n===t.timeline}),t.segments&&t.segments.forEach((n,s)=>{n.number=s})})},Fy=i=>i?Object.keys(i).reduce((e,t)=>{const n=i[t];return e.concat(n.playlists)},[]):[],Ik=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:n={},previousManifest:s,eventStream:r})=>{if(!i.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:l,minimumUpdatePeriod:u}=i[0].attributes,c=nf(i.filter(Sk)).map(Ek),d=nf(i.filter(Ck)),p=nf(i.filter(wk)),y=i.map(k=>k.attributes.captionServices).filter(Boolean),_={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},["CLOSED-CAPTIONS"]:{},SUBTITLES:{}},uri:"",duration:a,playlists:_k(c,n)};u>=0&&(_.minimumUpdatePeriod=u*1e3),e&&(_.locations=e),t&&(_.contentSteering=t),o==="dynamic"&&(_.suggestedPresentationDelay=l),r&&r.length>0&&(_.eventStream=r);const T=_.playlists.length===0,E=d.length?Tk(d,n,T):null,S=p.length?xk(p,n):null,C=c.concat(Fy(E),Fy(S)),D=C.map(({timelineStarts:k})=>k);return _.timelineStarts=Oy(D),Ak(C,_.timelineStarts),E&&(_.mediaGroups.AUDIO.audio=E),S&&(_.mediaGroups.SUBTITLES.subs=S),y.length&&(_.mediaGroups["CLOSED-CAPTIONS"].cc=bk(y)),s?mk({oldManifest:s,newManifest:_}):_},Dk=(i,e,t)=>{const{NOW:n,clientOffset:s,availabilityStartTime:r,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=i,u=(n+s)/1e3,c=r+o,p=u+l-c;return Math.ceil((p*a-e)/t)},By=(i,e)=>{const{type:t,minimumUpdatePeriod:n=0,media:s="",sourceDuration:r,timescale:a=1,startNumber:o=1,periodStart:l}=i,u=[];let c=-1;for(let d=0;dc&&(c=T);let E;if(_<0){const D=d+1;D===e.length?t==="dynamic"&&n>0&&s.indexOf("$Number$")>0?E=Dk(i,c,y):E=(r*a-c)/y:E=(e[D].t-c)/y}else E=_+1;const S=o+u.length+E;let C=o+u.length;for(;C(e,t,n,s)=>{if(e==="$$")return"$";if(typeof i[t]>"u")return e;const r=""+i[t];return t==="RepresentationID"||(n?s=parseInt(s,10):s=1,r.length>=s)?r:`${new Array(s-r.length+1).join("0")}${r}`},Uy=(i,e)=>i.replace(kk,Rk(e)),Pk=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?ef(i):By(i,e),Lk=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=i,s=So({baseUrl:i.baseUrl,source:Uy(n.sourceURL,t),range:n.range});return Pk(i,e).map(a=>{t.Number=a.number,t.Time=a.time;const o=Uy(i.media||"",t),l=i.timescale||1,u=i.presentationTimeOffset||0,c=i.periodStart+(a.time-u)/l;return{uri:o,timeline:a.timeline,duration:a.duration,resolvedUri:yu(i.baseUrl||"",o),map:s,number:a.number,presentationTime:c}})},Ok=(i,e)=>{const{baseUrl:t,initialization:n={}}=i,s=So({baseUrl:t,source:n.sourceURL,range:n.range}),r=So({baseUrl:t,source:e.media,range:e.mediaRange});return r.map=s,r},Mk=(i,e)=>{const{duration:t,segmentUrls:n=[],periodStart:s}=i;if(!t&&!e||t&&e)throw new Error(Vr.SEGMENT_TIME_UNSPECIFIED);const r=n.map(l=>Ok(i,l));let a;return t&&(a=ef(i)),e&&(a=By(i,e)),a.map((l,u)=>{if(r[u]){const c=r[u],d=i.timescale||1,p=i.presentationTimeOffset||0;return c.timeline=l.timeline,c.duration=l.duration,c.number=l.number,c.presentationTime=s+(l.time-p)/d,c}}).filter(l=>l)},Nk=({attributes:i,segmentInfo:e})=>{let t,n;e.template?(n=Lk,t=dt(i,e.template)):e.base?(n=Ly,t=dt(i,e.base)):e.list&&(n=Mk,t=dt(i,e.list));const s={attributes:i};if(!n)return s;const r=n(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else r.length?t.duration=r.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return s.attributes=t,s.segments=r,e.base&&t.indexRange&&(s.sidx=r[0],s.segments=[]),s},Fk=i=>i.map(Nk),je=(i,e)=>Ry(i.childNodes).filter(({tagName:t})=>t===e),Co=i=>i.textContent.trim(),Bk=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),jr=i=>{const o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!o)return 0;const[l,u,c,d,p,y]=o.slice(1);return parseFloat(l||0)*31536e3+parseFloat(u||0)*2592e3+parseFloat(c||0)*86400+parseFloat(d||0)*3600+parseFloat(p||0)*60+parseFloat(y||0)},Uk=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),$y={mediaPresentationDuration(i){return jr(i)},availabilityStartTime(i){return Uk(i)/1e3},minimumUpdatePeriod(i){return jr(i)},suggestedPresentationDelay(i){return jr(i)},type(i){return i},timeShiftBufferDepth(i){return jr(i)},start(i){return jr(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return Bk(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?jr(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},nt=i=>i&&i.attributes?Ry(i.attributes).reduce((e,t)=>{const n=$y[t.name]||$y.DEFAULT;return e[t.name]=n(t.value),e},{}):{},$k={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},ku=(i,e)=>e.length?$r(i.map(function(t){return e.map(function(n){const s=Co(n),r=yu(t.baseUrl,s),a=dt(nt(n),{baseUrl:r});return r!==s&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,rf=i=>{const e=je(i,"SegmentTemplate")[0],t=je(i,"SegmentList")[0],n=t&&je(t,"SegmentURL").map(d=>dt({tag:"SegmentURL"},nt(d))),s=je(i,"SegmentBase")[0],r=t||e,a=r&&je(r,"SegmentTimeline")[0],o=t||s||e,l=o&&je(o,"Initialization")[0],u=e&&nt(e);u&&l?u.initialization=l&&nt(l):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});const c={template:u,segmentTimeline:a&&je(a,"S").map(d=>nt(d)),list:t&&dt(nt(t),{segmentUrls:n,initialization:nt(l)}),base:s&&dt(nt(s),{initialization:nt(l)})};return Object.keys(c).forEach(d=>{c[d]||delete c[d]}),c},Vk=(i,e,t)=>n=>{const s=je(n,"BaseURL"),r=ku(e,s),a=dt(i,nt(n)),o=rf(n);return r.map(l=>({segmentInfo:dt(t,o),attributes:dt(a,l)}))},jk=i=>i.reduce((e,t)=>{const n=nt(t);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());const s=$k[n.schemeIdUri];if(s){e[s]={attributes:n};const r=je(t,"cenc:pssh")[0];if(r){const a=Co(r);e[s].pssh=a&&RD(a)}}return e},{}),zk=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{let n,s;return s=t,/^CC\d=/.test(t)?[n,s]=t.split("="):/^CC\d$/.test(t)&&(n=t),{channel:n,language:s}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{const n={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[s,r=""]=t.split("=");n.channel=s,n.language=t,r.split(",").forEach(a=>{const[o,l]=a.split(":");o==="lang"?n.language=l:o==="er"?n.easyReader=Number(l):o==="war"?n.aspectRatio=Number(l):o==="3D"&&(n["3D"]=Number(l))})}else n.language=t;return n.channel&&(n.channel="SERVICE"+n.channel),n})},qk=i=>$r(je(i.node,"EventStream").map(e=>{const t=nt(e),n=t.schemeIdUri;return je(e,"Event").map(s=>{const r=nt(s),a=r.presentationTime||0,o=t.timescale||1,l=r.duration||0,u=a/o+i.attributes.start;return{schemeIdUri:n,value:t.value,id:r.id,start:u,end:u+l/o,messageData:Co(s)||r.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),Gk=(i,e,t)=>n=>{const s=nt(n),r=ku(e,je(n,"BaseURL")),a=je(n,"Role")[0],o={role:nt(a)};let l=dt(i,s,o);const u=je(n,"Accessibility")[0],c=zk(nt(u));c&&(l=dt(l,{captionServices:c}));const d=je(n,"Label")[0];if(d&&d.childNodes.length){const E=d.childNodes[0].nodeValue.trim();l=dt(l,{label:E})}const p=jk(je(n,"ContentProtection"));Object.keys(p).length&&(l=dt(l,{contentProtection:p}));const y=rf(n),_=je(n,"Representation"),T=dt(t,y);return $r(_.map(Vk(l,r,T)))},Hk=(i,e)=>(t,n)=>{const s=ku(e,je(t.node,"BaseURL")),r=dt(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(r.periodDuration=t.attributes.duration);const a=je(t.node,"AdaptationSet"),o=rf(t.node);return $r(a.map(Gk(r,s,o)))},Wk=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=dt({serverURL:Co(i[0])},nt(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},Xk=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,Kk=(i,e={})=>{const{manifestUri:t="",NOW:n=Date.now(),clientOffset:s=0,eventHandler:r=function(){}}=e,a=je(i,"Period");if(!a.length)throw new Error(Vr.INVALID_NUMBER_OF_PERIOD);const o=je(i,"Location"),l=nt(i),u=ku([{baseUrl:t}],je(i,"BaseURL")),c=je(i,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=n,l.clientOffset=s,o.length&&(l.locations=o.map(Co));const d=[];return a.forEach((p,y)=>{const _=nt(p),T=d[y-1];_.start=Xk({attributes:_,priorPeriodAttributes:T?T.attributes:null,mpdType:l.type}),d.push({node:p,attributes:_})}),{locations:l.locations,contentSteeringInfo:Wk(c,r),representationInfo:$r(d.map(Hk(l,u))),eventStream:$r(d.map(qk))}},Vy=i=>{if(i==="")throw new Error(Vr.DASH_EMPTY_MANIFEST);const e=new rk;let t,n;try{t=e.parseFromString(i,"application/xml"),n=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Vr.DASH_INVALID_XML);return n},Yk=i=>{const e=je(i,"UTCTiming")[0];if(!e)return null;const t=nt(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Vr.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},Zk=(i,e={})=>{const t=Kk(Vy(i),e),n=Fk(t.representationInfo);return Ik({dashPlaylists:n,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},Qk=i=>Yk(Vy(i));var jy=Math.pow(2,32),Jk=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t0;n+=12,s--)t.references.push({referenceType:(i[n]&128)>>>7,referencedSize:e.getUint32(n)&2147483647,subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(i[n+8]&128),sapType:(i[n+8]&112)>>>4,sapDeltaTime:e.getUint32(n+8)&268435455});return t},iR=tR,nR=ne([73,68,51]),sR=function(e,t){t===void 0&&(t=0),e=ne(e);var n=e[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=(n&16)>>4;return r?s+20:s+10},wo=function i(e,t){return t===void 0&&(t=0),e=ne(e),e.length-t<10||!Ve(e,nR,{offset:t})?t:(t+=sR(e,t),i(e,t))},qy=function(e){return typeof e=="string"?U_(e):e},rR=function(e){return Array.isArray(e)?e.map(function(t){return qy(t)}):[qy(e)]},aR=function i(e,t,n){n===void 0&&(n=!1),t=rR(t),e=ne(e);var s=[];if(!t.length)return s;for(var r=0;r>>0,o=e.subarray(r+4,r+8);if(a===0)break;var l=r+a;if(l>e.length){if(n)break;l=e.length}var u=e.subarray(r+8,l);Ve(o,t[0])&&(t.length===1?s.push(u):s.push.apply(s,i(u,t.slice(1),n))),r=l}return s},Ru={EBML:ne([26,69,223,163]),DocType:ne([66,130]),Segment:ne([24,83,128,103]),SegmentInfo:ne([21,73,169,102]),Tracks:ne([22,84,174,107]),Track:ne([174]),TrackNumber:ne([215]),DefaultDuration:ne([35,227,131]),TrackEntry:ne([174]),TrackType:ne([131]),FlagDefault:ne([136]),CodecID:ne([134]),CodecPrivate:ne([99,162]),VideoTrack:ne([224]),AudioTrack:ne([225]),Cluster:ne([31,67,182,117]),Timestamp:ne([231]),TimestampScale:ne([42,215,177]),BlockGroup:ne([160]),BlockDuration:ne([155]),Block:ne([161]),SimpleBlock:ne([163])},af=[128,64,32,16,8,4,2,1],oR=function(e){for(var t=1,n=0;n=t.length)return t.length;var s=Pu(t,n,!1);if(Ve(e.bytes,s.bytes))return n;var r=Pu(t,n+s.length);return i(e,t,n+r.length+r.value+s.length)},Hy=function i(e,t){t=lR(t),e=ne(e);var n=[];if(!t.length)return n;for(var s=0;se.length?e.length:o+a.value,u=e.subarray(o,l);Ve(t[0],r.bytes)&&(t.length===1?n.push(u):n=n.concat(i(u,t.slice(1))));var c=r.length+a.length+u.length;s+=c}return n},cR=ne([0,0,0,1]),hR=ne([0,0,1]),dR=ne([0,0,3]),fR=function(e){for(var t=[],n=1;n>1&63),n.indexOf(u)!==-1&&(a=r+l),r+=l+(t==="h264"?1:2)}return e.subarray(0,0)},pR=function(e,t,n){return Wy(e,"h264",t,n)},gR=function(e,t,n){return Wy(e,"h265",t,n)},kt={webm:ne([119,101,98,109]),matroska:ne([109,97,116,114,111,115,107,97]),flac:ne([102,76,97,67]),ogg:ne([79,103,103,83]),ac3:ne([11,119]),riff:ne([82,73,70,70]),avi:ne([65,86,73]),wav:ne([87,65,86,69]),"3gp":ne([102,116,121,112,51,103]),mp4:ne([102,116,121,112]),fmp4:ne([115,116,121,112]),mov:ne([102,116,121,112,113,116]),moov:ne([109,111,111,118]),moof:ne([109,111,111,102])},zr={aac:function(e){var t=wo(e);return Ve(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=wo(e);return Ve(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Hy(e,[Ru.EBML,Ru.DocType])[0];return Ve(t,kt.webm)},mkv:function(e){var t=Hy(e,[Ru.EBML,Ru.DocType])[0];return Ve(t,kt.matroska)},mp4:function(e){if(zr["3gp"](e)||zr.mov(e))return!1;if(Ve(e,kt.mp4,{offset:4})||Ve(e,kt.fmp4,{offset:4})||Ve(e,kt.moof,{offset:4})||Ve(e,kt.moov,{offset:4}))return!0},mov:function(e){return Ve(e,kt.mov,{offset:4})},"3gp":function(e){return Ve(e,kt["3gp"],{offset:4})},ac3:function(e){var t=wo(e);return Ve(e,kt.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+1880},uf=9e4,cf,hf,Lu,df,Xy,Ky,Yy;cf=function(i){return i*uf},hf=function(i,e){return i*e},Lu=function(i){return i/uf},df=function(i,e){return i/e},Xy=function(i,e){return cf(df(i,e))},Ky=function(i,e){return hf(Lu(i),e)},Yy=function(i,e,t){return Lu(t?i:i-e)};var Is={ONE_SECOND_IN_TS:uf,secondsToVideoTs:cf,secondsToAudioTs:hf,videoTsToSeconds:Lu,audioTsToSeconds:df,audioTsToVideoTs:Xy,videoTsToAudioTs:Ky,metadataTsToSeconds:Yy};/** * @license * Video.js 8.16.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * * * Includes vtt.js * Available under Apache License Version 2.0 * */var ff="8.16.1";const Cn={},ts=function(i,e){return Cn[i]=Cn[i]||[],e&&(Cn[i]=Cn[i].concat(e)),Cn[i]},yR=function(i,e){ts(i,e)},Zy=function(i,e){const t=ts(i).indexOf(e);return t<=-1?!1:(Cn[i]=Cn[i].slice(),Cn[i].splice(t,1),!0)},vR=function(i,e){ts(i,[].concat(e).map(t=>{const n=(...s)=>(Zy(i,n),t(...s));return n}))},Ou={prefixed:!0},Mu=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Qy=Mu[0];let Ao;for(let i=0;i(n,s,r)=>{const a=e.levels[s],o=new RegExp(`^(${a})$`);let l=i;if(n!=="log"&&r.unshift(n.toUpperCase()+":"),t&&(l=`%c${i}`,r.unshift(t)),r.unshift(l+":"),Gt){Gt.push([].concat(r));const c=Gt.length-1e3;Gt.splice(0,c>0?c:0)}if(!P.console)return;let u=P.console[n];!u&&n==="debug"&&(u=P.console.info||P.console.log),!(!u||!a||!o.test(n))&&u[Array.isArray(r)?"apply":"call"](P.console,r)};function pf(i,e=":",t=""){let n="info",s;function r(...a){s("log",n,a)}return s=TR(i,r,t),r.createLogger=(a,o,l)=>{const u=o!==void 0?o:e,c=l!==void 0?l:t,d=`${i} ${u} ${a}`;return pf(d,u,c)},r.createNewLogger=(a,o,l)=>pf(a,o,l),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=a=>{if(typeof a=="string"){if(!r.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);n=a}return n},r.history=()=>Gt?[].concat(Gt):[],r.history.filter=a=>(Gt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),r.history.clear=()=>{Gt&&(Gt.length=0)},r.history.disable=()=>{Gt!==null&&(Gt.length=0,Gt=null)},r.history.enable=()=>{Gt===null&&(Gt=[])},r.error=(...a)=>s("error",n,a),r.warn=(...a)=>s("warn",n,a),r.debug=(...a)=>s("debug",n,a),r}const ve=pf("VIDEOJS"),Jy=ve.createLogger,xR=Object.prototype.toString,e2=function(i){return Ki(i)?Object.keys(i):[]};function qr(i,e){e2(i).forEach(t=>e(i[t],t))}function t2(i,e,t=0){return e2(i).reduce((n,s)=>e(n,i[s],s),t)}function Ki(i){return!!i&&typeof i=="object"}function Gr(i){return Ki(i)&&xR.call(i)==="[object Object]"&&i.constructor===Object}function Ne(...i){const e={};return i.forEach(t=>{!t||qr(t,(n,s)=>{if(!Gr(n)){e[s]=n;return}Gr(e[s])||(e[s]={}),e[s]=Ne(e[s],n)})}),e}function i2(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const n=i[t];e.push(n)}return e}function Nu(i,e,t,n=!0){const s=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){const a=t();return s(a),a}};return n&&(r.set=s),Object.defineProperty(i,e,r)}var bR=Object.freeze({__proto__:null,each:qr,reduce:t2,isObject:Ki,isPlain:Gr,merge:Ne,values:i2,defineLazyProperty:Nu});let gf=!1,n2=null,Yi=!1,s2,r2=!1,Hr=!1,Wr=!1,Zi=!1,mf=null,Fu=null;const ER=Boolean(P.cast&&P.cast.framework&&P.cast.framework.CastReceiverContext);let a2=null,Bu=!1,Uu=!1,$u=!1,Vu=!1,ju=!1,zu=!1,_f=!1;const Io=Boolean(Xr()&&("ontouchstart"in P||P.navigator.maxTouchPoints||P.DocumentTouch&&P.document instanceof P.DocumentTouch)),is=P.navigator&&P.navigator.userAgentData;if(is&&is.platform&&is.brands&&(Yi=is.platform==="Android",Hr=Boolean(is.brands.find(i=>i.brand==="Microsoft Edge")),Wr=Boolean(is.brands.find(i=>i.brand==="Chromium")),Zi=!Hr&&Wr,mf=Fu=(is.brands.find(i=>i.brand==="Chromium")||{}).version||null,Uu=is.platform==="Windows"),!Wr){const i=P.navigator&&P.navigator.userAgent||"";gf=/iPod/i.test(i),n2=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Yi=/Android/i.test(i),s2=function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),r2=/Firefox/i.test(i),Hr=/Edg/i.test(i),Wr=/Chrome/i.test(i)||/CriOS/i.test(i),Zi=!Hr&&Wr,mf=Fu=function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),a2=function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t}(),ju=/Tizen/i.test(i),zu=/Web0S/i.test(i),_f=ju||zu,Bu=/Safari/i.test(i)&&!Zi&&!Yi&&!Hr&&!_f,Uu=/Windows/i.test(i),$u=/iPad/i.test(i)||Bu&&Io&&!/iPhone/i.test(i),Vu=/iPhone/i.test(i)&&!$u}const Rt=Vu||$u||gf,qu=(Bu||Rt)&&!Zi;var o2=Object.freeze({__proto__:null,get IS_IPOD(){return gf},get IOS_VERSION(){return n2},get IS_ANDROID(){return Yi},get ANDROID_VERSION(){return s2},get IS_FIREFOX(){return r2},get IS_EDGE(){return Hr},get IS_CHROMIUM(){return Wr},get IS_CHROME(){return Zi},get CHROMIUM_VERSION(){return mf},get CHROME_VERSION(){return Fu},IS_CHROMECAST_RECEIVER:ER,get IE_VERSION(){return a2},get IS_SAFARI(){return Bu},get IS_WINDOWS(){return Uu},get IS_IPAD(){return $u},get IS_IPHONE(){return Vu},get IS_TIZEN(){return ju},get IS_WEBOS(){return zu},get IS_SMART_TV(){return _f},TOUCH_ENABLED:Io,IS_IOS:Rt,IS_ANY_SAFARI:qu});function l2(i){return typeof i=="string"&&Boolean(i.trim())}function SR(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Xr(){return H===P.document}function Kr(i){return Ki(i)&&i.nodeType===1}function u2(){try{return P.parent!==P.self}catch{return!0}}function c2(i){return function(e,t){if(!l2(e))return H[i](null);l2(t)&&(t=H.querySelector(t));const n=Kr(t)?t:H;return n[i]&&n[i](e)}}function le(i="div",e={},t={},n){const s=H.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(r){const a=e[r];r==="textContent"?ns(s,a):(s[r]!==a||r==="tabIndex")&&(s[r]=a)}),Object.getOwnPropertyNames(t).forEach(function(r){s.setAttribute(r,t[r])}),n&&vf(s,n),s}function ns(i,e){return typeof i.textContent>"u"?i.innerText=e:i.textContent=e,i}function yf(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function Do(i,e){return SR(e),i.classList.contains(e)}function Ds(i,...e){return i.classList.add(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),i}function Gu(i,...e){return i?(i.classList.remove(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),i):(ve.warn("removeClass was called with an element that doesn't exist"),null)}function h2(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(n=>i.classList.toggle(n,t)),i}function d2(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const n=e[t];n===null||typeof n>"u"||n===!1?i.removeAttribute(t):i.setAttribute(t,n===!0?"":n)})}function ss(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const n=i.attributes;for(let s=n.length-1;s>=0;s--){const r=n[s].name;let a=n[s].value;t.includes(r)&&(a=a!==null),e[r]=a}}return e}function f2(i,e){return i.getAttribute(e)}function Yr(i,e,t){i.setAttribute(e,t)}function Hu(i,e){i.removeAttribute(e)}function p2(){H.body.focus(),H.onselectstart=function(){return!1}}function g2(){H.onselectstart=function(){return!0}}function Zr(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(n=>{e[n]!==void 0&&(t[n]=e[n])}),t.height||(t.height=parseFloat(Qr(i,"height"))),t.width||(t.width=parseFloat(Qr(i,"width"))),t}}function ko(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let n=0,s=0;for(;i.offsetParent&&i!==H[Ou.fullscreenElement];)n+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;return{left:n,top:s,width:e,height:t}}function Wu(i,e){const t={x:0,y:0};if(Rt){let c=i;for(;c&&c.nodeName.toLowerCase()!=="html";){const d=Qr(c,"transform");if(/^matrix/.test(d)){const p=d.slice(7,-1).split(/,\s/).map(Number);t.x+=p[4],t.y+=p[5]}else if(/^matrix3d/.test(d)){const p=d.slice(9,-1).split(/,\s/).map(Number);t.x+=p[12],t.y+=p[13]}if(c.assignedSlot&&c.assignedSlot.parentElement&&P.WebKitCSSMatrix){const p=P.getComputedStyle(c.assignedSlot.parentElement).transform,y=new P.WebKitCSSMatrix(p);t.x+=y.m41,t.y+=y.m42}c=c.parentNode||c.host}}const n={},s=ko(e.target),r=ko(i),a=r.width,o=r.height;let l=e.offsetY-(r.top-s.top),u=e.offsetX-(r.left-s.left);return e.changedTouches&&(u=e.changedTouches[0].pageX-r.left,l=e.changedTouches[0].pageY+r.top,Rt&&(u-=t.x,l-=t.y)),n.y=1-Math.max(0,Math.min(1,l/o)),n.x=Math.max(0,Math.min(1,u/a)),n}function m2(i){return Ki(i)&&i.nodeType===3}function Xu(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function _2(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),Kr(e)||m2(e))return e;if(typeof e=="string"&&/\S/.test(e))return H.createTextNode(e)}).filter(e=>e)}function vf(i,e){return _2(e).forEach(t=>i.appendChild(t)),i}function y2(i,e){return vf(Xu(i),e)}function Ro(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0||i.type==="mousedown"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const rs=c2("querySelector"),v2=c2("querySelectorAll");function Qr(i,e){if(!i||!e)return"";if(typeof P.getComputedStyle=="function"){let t;try{t=P.getComputedStyle(i)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function T2(i){[...H.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(s=>s.cssText).join(""),n=H.createElement("style");n.textContent=t,i.document.head.appendChild(n)}catch{const n=H.createElement("link");n.rel="stylesheet",n.type=e.type,n.media=e.media.mediaText,n.href=e.href,i.document.head.appendChild(n)}})}var x2=Object.freeze({__proto__:null,isReal:Xr,isEl:Kr,isInFrame:u2,createEl:le,textContent:ns,prependTo:yf,hasClass:Do,addClass:Ds,removeClass:Gu,toggleClass:h2,setAttributes:d2,getAttributes:ss,getAttribute:f2,setAttribute:Yr,removeAttribute:Hu,blockTextSelection:p2,unblockTextSelection:g2,getBoundingClientRect:Zr,findPosition:ko,getPointerPosition:Wu,isTextNode:m2,emptyEl:Xu,normalizeContent:_2,appendContent:vf,insertContent:y2,isSingleLeftClick:Ro,$:rs,$$:v2,computedStyle:Qr,copyStyleSheetsToWindow:T2});let b2=!1,Tf;const CR=function(){if(Tf.options.autoSetup===!1)return;const i=Array.prototype.slice.call(H.getElementsByTagName("video")),e=Array.prototype.slice.call(H.getElementsByTagName("audio")),t=Array.prototype.slice.call(H.getElementsByTagName("video-js")),n=i.concat(e,t);if(n&&n.length>0)for(let s=0,r=n.length;s-1&&(s={passive:!0}),i.addEventListener(e,n.dispatcher,s)}else i.attachEvent&&i.attachEvent("on"+e,n.dispatcher)}function At(i,e,t){if(!Pt.has(i))return;const n=Pt.get(i);if(!n.handlers)return;if(Array.isArray(e))return Ef(At,i,e,t);const s=function(a,o){n.handlers[o]=[],C2(a,o)};if(e===void 0){for(const a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&s(i,a);return}const r=n.handlers[e];if(!!r){if(!t){s(i,e);return}if(t.guid)for(let a=0;a=e&&(i(...s),t=r)}},w2=function(i,e,t,n=P){let s;const r=()=>{n.clearTimeout(s),s=null},a=function(){const o=this,l=arguments;let u=function(){s=null,u=null,t||i.apply(o,l)};!s&&t&&i.apply(o,l),n.clearTimeout(s),s=n.setTimeout(u,e)};return a.cancel=r,a};var kR=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:_i,bind_:Fe,throttle:Qi,debounce:w2});let Po;class ni{on(e,t){const n=this.addEventListener;this.addEventListener=()=>{},ii(this,e,t),this.addEventListener=n}off(e,t){At(this,e,t)}one(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Zu(this,e,t),this.addEventListener=n}any(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Sf(this,e,t),this.addEventListener=n}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Ku(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Jr(this,e)}queueTrigger(e){Po||(Po=new Map);const t=e.type||e;let n=Po.get(this);n||(n=new Map,Po.set(this,n));const s=n.get(t);n.delete(t),P.clearTimeout(s);const r=P.setTimeout(()=>{n.delete(t),n.size===0&&(n=null,Po.delete(this)),this.trigger(e)},0);n.set(t,r)}}ni.prototype.allowedEvents_={},ni.prototype.addEventListener=ni.prototype.on,ni.prototype.removeEventListener=ni.prototype.off,ni.prototype.dispatchEvent=ni.prototype.trigger;const Qu=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,wn=i=>i instanceof ni||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),RR=(i,e)=>{wn(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},Cf=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,Ju=(i,e,t)=>{if(!i||!i.nodeName&&!wn(i))throw new Error(`Invalid target for ${Qu(e)}#${t}; must be a DOM node or evented object.`)},A2=(i,e,t)=>{if(!Cf(i))throw new Error(`Invalid event type for ${Qu(e)}#${t}; must be a non-empty string or array.`)},I2=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${Qu(e)}#${t}; must be a function.`)},wf=(i,e,t)=>{const n=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let s,r,a;return n?(s=i.eventBusEl_,e.length>=3&&e.shift(),[r,a]=e):[s,r,a]=e,Ju(s,i,t),A2(r,i,t),I2(a,i,t),a=Fe(i,a),{isTargetingSelf:n,target:s,type:r,listener:a}},ks=(i,e,t,n)=>{Ju(i,i,e),i.nodeName?DR[e](i,t,n):i[e](t,n)},PR={on(...i){const{isTargetingSelf:e,target:t,type:n,listener:s}=wf(this,i,"on");if(ks(t,"on",n,s),!e){const r=()=>this.off(t,n,s);r.guid=s.guid;const a=()=>this.off("dispose",r);a.guid=s.guid,ks(this,"on","dispose",r),ks(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:n,listener:s}=wf(this,i,"one");if(e)ks(t,"one",n,s);else{const r=(...a)=>{this.off(t,n,r),s.apply(null,a)};r.guid=s.guid,ks(t,"one",n,r)}},any(...i){const{isTargetingSelf:e,target:t,type:n,listener:s}=wf(this,i,"any");if(e)ks(t,"any",n,s);else{const r=(...a)=>{this.off(t,n,r),s.apply(null,a)};r.guid=s.guid,ks(t,"any",n,r)}},off(i,e,t){if(!i||Cf(i))At(this.eventBusEl_,i,e);else{const n=i,s=e;Ju(n,this,"off"),A2(s,this,"off"),I2(t,this,"off"),t=Fe(this,t),this.off("dispose",t),n.nodeName?(At(n,s,t),At(n,"dispose",t)):wn(n)&&(n.off(s,t),n.off("dispose",t))}},trigger(i,e){Ju(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!Cf(t))throw new Error(`Invalid event type for ${Qu(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Jr(this.eventBusEl_,i,e)}};function Af(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=le("span",{className:"vjs-event-bus"});return Object.assign(i,PR),i.eventedCallbacks&&i.eventedCallbacks.forEach(n=>{n()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(n){n&&Pt.has(n)&&Pt.delete(n)}),P.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const LR={state:{},setState(i){typeof i=="function"&&(i=i());let e;return qr(i,(t,n)=>{this.state[n]!==t&&(e=e||{},e[n]={from:this.state[n],to:t}),this.state[n]=t}),e&&wn(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function D2(i,e){return Object.assign(i,LR),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&wn(i)&&i.on("statechanged",i.handleStateChanged),i}const Lo=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},Ye=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},k2=function(i,e){return Ye(i)===Ye(e)};var OR=Object.freeze({__proto__:null,toLowerCase:Lo,toTitleCase:Ye,titleCaseEquals:k2});class V{constructor(e,t,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ne({},this.options_),t=this.options_=Ne(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const s=e&&e.id&&e.id()||"no_player";this.id_=`${s}_component_${mi()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(s=>this.addClass(s)),["on","off","one","any","trigger"].forEach(s=>{this[s]=void 0}),t.evented!==!1&&(Af(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),D2(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(n),t.reportTouchActivity!==!1&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e?(this.options_=Ne(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,n){return le(e,t,n)}localize(e,t,n=e){const s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[s],o=s&&s.split("-")[0],l=r&&r[o];let u=n;return a&&a[e]?u=a[e]:l&&l[e]&&(u=l[e]),t&&(u=u.replace(/\{(\d+)\}/g,function(c,d){const p=t[d-1];let y=p;return typeof p>"u"&&(y=c),y})),u}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(!!e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((n,s)=>n.concat(s),[]);let t=this;for(let n=0;n=0;s--)if(this.children_[s]===e){t=!0,this.children_.splice(s,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Ye(e.name())]=null,this.childNameIndex_[Lo(e.name())]=null;const n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,n=a=>{const o=a.name;let l=a.opts;if(t[o]!==void 0&&(l=t[o]),l===!1)return;l===!0&&(l={}),l.playerOptions=this.options_.playerOptions;const u=this.addChild(o,l);u&&(this[o]=u)};let s;const r=V.getComponent("Tech");Array.isArray(e)?s=e:s=Object.keys(e),s.concat(Object.keys(this.options_).filter(function(a){return!s.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,l;return typeof a=="string"?(o=a,l=e[o]||this.options_[o]||{}):(o=a.name,l=a),{name:o,opts:l}}).filter(a=>{const o=V.getComponent(a.opts.componentClass||Ye(a.name));return o&&!r.isTech(o)}).forEach(n)}}buildCSSClass(){return""}ready(e,t=!1){if(!!e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return rs(e,t||this.contentEl())}$$(e,t){return v2(e,t||this.contentEl())}hasClass(e){return Do(this.el_,e)}addClass(...e){Ds(this.el_,...e)}removeClass(...e){Gu(this.el_,...e)}toggleClass(e,t){h2(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return f2(this.el_,e)}setAttribute(e,t){Yr(this.el_,e,t)}removeAttribute(e){Hu(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,n){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",n||this.trigger("componentresize");return}if(!this.el_)return 0;const s=this.el_.style[e],r=s.indexOf("px");return parseInt(r!==-1?s.slice(0,r):this.el_["offset"+Ye(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Qr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const n=`offset${Ye(e)}`;t=this.el_[n]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},n={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:n}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const n=10,s=200;let r;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=P.performance.now(),r=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)r=!1;else if(t){const l=o.touches[0].pageX-t.pageX,u=o.touches[0].pageY-t.pageY;Math.sqrt(l*l+u*u)>n&&(r=!1)}});const a=function(){r=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,r===!0&&P.performance.now()-e{this.setTimeoutIds_.has(n)&&this.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),P.clearTimeout(e)),e}setInterval(e,t){e=Fe(this,e),this.clearTimersOnDispose_();const n=P.setInterval(e,t);return this.setIntervalIds_.add(n),n}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),P.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Fe(this,e),t=P.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),t=Fe(this,t);const n=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,n),e}cancelNamedAnimationFrame(e){!this.namedRafs_.has(e)||(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),P.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((n,s)=>this[t](s))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(r){const a=P.getComputedStyle(r,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function n(r){return!(!t(r.parentElement)||!t(r)||r.style.opacity==="0"||P.getComputedStyle(r).height==="0px"||P.getComputedStyle(r).width==="0px")}function s(r){if(r.offsetWidth+r.offsetHeight+r.getBoundingClientRect().height+r.getBoundingClientRect().width===0)return!1;const a={x:r.getBoundingClientRect().left+r.offsetWidth/2,y:r.getBoundingClientRect().top+r.offsetHeight/2};if(a.x<0||a.x>(H.documentElement.clientWidth||P.innerWidth)||a.y<0||a.y>(H.documentElement.clientHeight||P.innerHeight))return!1;let o=H.elementFromPoint(a.x,a.y);for(;o;){if(o===r)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(s(e)&&n(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const n=V.getComponent("Tech"),s=n&&n.isTech(t),r=V===t||V.prototype.isPrototypeOf(t.prototype);if(s||!r){let o;throw s?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=Ye(e),V.components_||(V.components_={});const a=V.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,l=Object.keys(o);if(o&&l.length>0&&l.map(u=>o[u]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return V.components_[e]=t,V.components_[Lo(e)]=t,t}static getComponent(e){if(!(!e||!V.components_))return V.components_[e]}}V.registerComponent("Component",V);function MR(i,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function R2(i,e,t,n){return MR(i,n,t.length-1),t[n][e]}function If(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:R2.bind(null,"start",0,i),end:R2.bind(null,"end",1,i)},P.Symbol&&P.Symbol.iterator&&(e[P.Symbol.iterator]=()=>(i||[]).values()),e}function Di(i,e){return Array.isArray(i)?If(i):i===void 0||e===void 0?If():If([[i,e]])}const P2=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),n=Math.floor(i/60%60),s=Math.floor(i/3600);const r=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(s=n=t="-"),s=s>0||a>0?s+":":"",n=((s||r>=10)&&n<10?"0"+n:n)+":",t=t<10?"0"+t:t,s+n+t};let Df=P2;function L2(i){Df=i}function O2(){Df=P2}function Rs(i,e=i){return Df(i,e)}var NR=Object.freeze({__proto__:null,createTimeRanges:Di,createTimeRange:Di,setFormatTime:L2,resetFormatTime:O2,formatTime:Rs});function M2(i,e){let t=0,n,s;if(!e)return 0;(!i||!i.length)&&(i=Di(0,0));for(let r=0;re&&(s=e),t+=s-n;return t/e}function Ge(i){if(i instanceof Ge)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:Ki(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),this.message||(this.message=Ge.defaultMessages[this.code]||"")}Ge.prototype.code=0,Ge.prototype.message="",Ge.prototype.status=null,Ge.prototype.metadata=null,Ge.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Ge.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."},Ge.MEDIA_ERR_CUSTOM=0,Ge.prototype.MEDIA_ERR_CUSTOM=0,Ge.MEDIA_ERR_ABORTED=1,Ge.prototype.MEDIA_ERR_ABORTED=1,Ge.MEDIA_ERR_NETWORK=2,Ge.prototype.MEDIA_ERR_NETWORK=2,Ge.MEDIA_ERR_DECODE=3,Ge.prototype.MEDIA_ERR_DECODE=3,Ge.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Ge.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Ge.MEDIA_ERR_ENCRYPTED=5,Ge.prototype.MEDIA_ERR_ENCRYPTED=5;function Oo(i){return i!=null&&typeof i.then=="function"}function Ji(i){Oo(i)&&i.then(null,e=>{})}const kf=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,n,s)=>(i[n]&&(t[n]=i[n]),t),{cues:i.cues&&Array.prototype.map.call(i.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})};var N2={textTracksToJson:function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,s=>s.track);return Array.prototype.map.call(e,function(s){const r=kf(s.track);return s.src&&(r.src=s.src),r}).concat(Array.prototype.filter.call(i.textTracks(),function(s){return t.indexOf(s)===-1}).map(kf))},jsonToTextTracks:function(i,e){return i.forEach(function(t){const n=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(s=>n.addCue(s))}),e.textTracks()},trackToJson_:kf};const Rf="vjs-modal-dialog";class ea extends V{constructor(e,t){super(e,t),this.handleKeyDown_=n=>this.handleKeyDown(n),this.close_=n=>this.close(n),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=le("div",{className:`${Rf}-content`},{role:"document"}),this.descEl_=le("p",{className:`${Rf}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),ns(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Rf} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let n=this.getChild("closeButton");if(t&&!n){const s=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(n,"close",this.close_)}!t&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),n=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),y2(t,e),this.trigger("modalfill"),s?n.insertBefore(t,s):n.appendChild(t);const r=this.getChild("closeButton");r&&n.appendChild(r.el_)}empty(){this.trigger("beforemodalempty"),Xu(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=H.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),n=this.el_.querySelector(":focus");let s;for(let r=0;r(t instanceof P.HTMLAnchorElement||t instanceof P.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof P.HTMLInputElement||t instanceof P.HTMLSelectElement||t instanceof P.HTMLTextAreaElement||t instanceof P.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof P.HTMLIFrameElement||t instanceof P.HTMLObjectElement||t instanceof P.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}ea.prototype.options_={pauseOnOpen:!0,temporary:!0},V.registerComponent("ModalDialog",ea);class ta extends ni{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},wn(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let n=0,s=this.length;n=0;t--)if(e[t].enabled){Pf(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Pf(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Pf(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Lf=function(i,e){for(let t=0;t=0;t--)if(e[t].selected){Lf(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t{this.changing_||(this.changing_=!0,Lf(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class F2 extends ta{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class UR{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,n=e.length;t0&&(P.console&&P.console.groupCollapsed&&P.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),n.forEach(s=>ve.error(s)),P.console&&P.console.groupEnd&&P.console.groupEnd()),t.flush()},V2=function(i,e){const t={uri:i},n=tc(i);n&&(t.cors=n);const s=e.tech_.crossOrigin()==="use-credentials";s&&(t.withCredentials=s),gu.exports(t,Fe(this,function(r,a,o){if(r)return ve.error(r,a);e.loaded_=!0,typeof P.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){ve.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return $2(o,e)}):$2(o,e)}))};class Mo extends Of{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ne(e,{kind:jR[e.kind]||"subtitles",language:e.language||e.srclang||""});let n=B2[t.mode]||"disabled";const s=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(n="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const r=new ec(this.cues_),a=new ec(this.activeCues_);let o=!1;this.timeupdateHandler=Fe(this,function(u={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){u.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),u.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const l=()=>{this.stopTracking()};this.tech_.one("dispose",l),n!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return n},set(u){!B2[u]||n!==u&&(n=u,!this.preload_&&n!=="disabled"&&this.cues.length===0&&V2(this.src,this),this.stopTracking(),n!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const u=this.tech_.currentTime(),c=[];for(let d=0,p=this.cues.length;d=u&&c.push(y)}if(o=!1,c.length!==this.activeCues_.length)o=!0;else for(let d=0;d{t=An.LOADED,this.trigger({type:"load",target:this})})}}An.prototype.allowedEvents_={load:"load"},An.NONE=0,An.LOADING=1,An.LOADED=2,An.ERROR=3;const yi={audio:{ListClass:FR,TrackClass:j2,capitalName:"Audio"},video:{ListClass:BR,TrackClass:z2,capitalName:"Video"},text:{ListClass:F2,TrackClass:Mo,capitalName:"Text"}};Object.keys(yi).forEach(function(i){yi[i].getterName=`${i}Tracks`,yi[i].privateName=`${i}Tracks_`});const ia={remoteText:{ListClass:F2,TrackClass:Mo,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:UR,TrackClass:An,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Lt=Object.assign({},yi,ia);ia.names=Object.keys(ia),yi.names=Object.keys(yi),Lt.names=[].concat(ia.names).concat(yi.names);function qR(i,e,t,n,s={}){const r=i.textTracks();s.kind=e,t&&(s.label=t),n&&(s.language=n),s.tech=i;const a=new Lt.text.TrackClass(s);return r.addTrack(a),a}class de extends V{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=n=>this.onDurationChange(n),this.trackProgress_=n=>this.trackProgress(n),this.trackCurrentTime_=n=>this.trackCurrentTime(n),this.stopTrackingCurrentTime_=n=>this.stopTrackingCurrentTime(n),this.disposeSourceHandler_=n=>this.disposeSourceHandler(n),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Lt.names.forEach(n=>{const s=Lt[n];e&&e[s.getterName]&&(this[s.privateName]=e[s.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(n=>{e[`native${n}Tracks`]===!1&&(this[`featuresNative${n}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new Lt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Fe(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Di(0,0)}bufferedPercent(){return M2(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(yi.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const n=this[`${t}Tracks`]()||[];let s=n.length;for(;s--;){const r=n[s];t==="text"&&this.removeRemoteTextTrack(r),n.removeTrack(r)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const n=e[t];this.removeRemoteTextTrack(n)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Ge(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Di(0,0):Di()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){yi.names.forEach(e=>{const t=yi[e],n=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",n),s.addEventListener("addtrack",n),this.on("dispose",()=>{s.removeEventListener("removetrack",n),s.removeEventListener("addtrack",n)})})}addWebVttScript_(){if(!P.WebVTT)if(H.body.contains(this.el())){if(!this.options_["vtt.js"]&&Gr(kd.exports)&&Object.keys(kd.exports).length>0){this.trigger("vttjsloaded");return}const e=H.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),P.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),n=o=>e.addTrack(o.track),s=o=>e.removeTrack(o.track);t.on("addtrack",n),t.on("removetrack",s),this.addWebVttScript_();const r=()=>this.trigger("texttrackchange"),a=()=>{r();for(let o=0;othis.autoRemoteTextTracks_.addTrack(n.track)),n}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=mi();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return de.canPlayType(e.type)}static isTech(e){return e.prototype instanceof de||e instanceof de||e===de}static registerTech(e,t){if(de.techs_||(de.techs_={}),!de.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!de.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!de.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Ye(e),de.techs_[e]=t,de.techs_[Lo(e)]=t,e!=="Tech"&&de.defaultTechOrder_.push(e),t}static getTech(e){if(!!e){if(de.techs_&&de.techs_[e])return de.techs_[e];if(e=Ye(e),P&&P.videojs&&P.videojs[e])return ve.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),P.videojs[e]}}}Lt.names.forEach(function(i){const e=Lt[i];de.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}}),de.prototype.featuresVolumeControl=!0,de.prototype.featuresMuteControl=!0,de.prototype.featuresFullscreenResize=!1,de.prototype.featuresPlaybackRate=!1,de.prototype.featuresProgressEvents=!1,de.prototype.featuresSourceset=!1,de.prototype.featuresTimeupdateEvents=!1,de.prototype.featuresNativeTextTracks=!1,de.prototype.featuresVideoFrameCallback=!1,de.withSourceHandlers=function(i){i.registerSourceHandler=function(t,n){let s=i.sourceHandlers;s||(s=i.sourceHandlers=[]),n===void 0&&(n=s.length),s.splice(n,0,t)},i.canPlayType=function(t){const n=i.sourceHandlers||[];let s;for(let r=0;rLs(e,Ps[e.type],t,i),1)}function WR(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function XR(i,e,t){return i.reduceRight(Bf(t),e[t]())}function KR(i,e,t,n){return e[t](i.reduce(Bf(t),n))}function q2(i,e,t,n=null){const s="call"+Ye(t),r=i.reduce(Bf(s),n),a=r===ic,o=a?null:e[t](r);return QR(i,t,o,a),o}const YR={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},ZR={setCurrentTime:1,setMuted:1,setVolume:1},G2={play:1,pause:1};function Bf(i){return(e,t)=>e===ic?ic:t[i]?t[i](e):e}function QR(i,e,t,n){for(let s=i.length-1;s>=0;s--){const r=i[s];r[e]&&r[e](n,t)}}function JR(i){Ff[i.id()]=null}function e4(i,e){const t=Ff[i.id()];let n=null;if(t==null)return n=e(i),Ff[i.id()]=[[e,n]],n;for(let s=0;s{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(s=>s.src===e);if(t.length)return t[0].type;const n=i.$$("source");for(let s=0;s `;const X2=ju?10009:zu?461:8,na={codes:{play:415,pause:19,ff:417,rw:412,back:X2},names:{415:"play",19:"pause",417:"ff",412:"rw",[X2]:"back"},isEventKey(i,e){return e=e.toLowerCase(),!!(this.names[i.keyCode]&&this.names[i.keyCode]===e)},getEventName(i){if(this.names[i.keyCode])return this.names[i.keyCode];if(this.codes[i.code]){const e=this.codes[i.code];return this.names[e]}return null}},K2=5;class s4 extends ni{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0)}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const n=t.key.substring(5).toLowerCase();this.move(n)}else if(na.isEventKey(t,"play")||na.isEventKey(t,"pause")||na.isEventKey(t,"ff")||na.isEventKey(t,"rw")){t.preventDefault();const n=na.getEventName(t);this.performMediaAction_(n)}else na.isEventKey(t,"Back")&&e.target&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+K2);break;case"rw":this.userSeek_(this.player_.currentTime()-K2);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let n=null;const s=this.getCurrentComponent(e.target);t&&(n=Boolean(t.closest(".video-js")),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!n||!t)&&(s.name()==="CloseButton"?this.refocusComponent():(this.pause(),s&&s.el()&&(this.lastFocusedComponent_=s)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function n(s){for(const r of s)r.hasOwnProperty("el_")&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())&&t.push(r),r.hasOwnProperty("children_")&&r.children_.length>0&&n(r.children_)}return e.children_.forEach(s=>{if(s.hasOwnProperty("el_"))if(s.getIsFocusable&&s.getIsAvailableToBeFocused&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())){t.push(s);return}else s.hasOwnProperty("children_")&&s.children_.length>0?n(s.children_):s.hasOwnProperty("items")&&s.items.length>0?n(s.items):this.findSuitableDOMChild(s)&&t.push(s)}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(n){if(e.getIsFocusable(n)&&e.getIsAvailableToBeFocused(n))return n;for(let s=0;s0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const n=t.getPositions(),s=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(n.boundingClientRect,a.getPositions().boundingClientRect,e)),r=this.findBestCandidate_(n.center,s,e);r?this.focus(r):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,n){let s=1/0,r=null;for(const a of t){const o=a.getPositions().center,l=this.calculateDistance_(e,o,n);l=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.handleMouseOver(n),this.handleMouseOut_=n=>this.handleMouseOut(n),this.handleClick_=n=>this.handleClick(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.emitTapEvents(),this.enable()}createEl(e="div",t={},n={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&ve.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),n=Object.assign({role:"button"},n),this.tabIndex_=t.tabIndex;const s=le(e,t,n);return this.player_.options_.experimentalSvgIcons||s.appendChild(le("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=le("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const n=this.localize(e);this.controlText_=e,ns(this.controlTextEl_,n),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",n)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}V.registerComponent("ClickableComponent",sc);class Uf extends sc{constructor(e,t){super(e,t),this.update(),this.update_=n=>this.update(n),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return le("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(le("picture",{className:"vjs-poster",tabIndex:-1},{},le("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){!this.player_.controls()||(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Ji(this.player_.play()):this.player_.pause())}}Uf.prototype.crossorigin=Uf.prototype.crossOrigin,V.registerComponent("PosterImage",Uf);const vi="#222",Y2="#ccc",a4={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function $f(i,e){let t;if(i.length===4)t=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else if(i.length===7)t=i.slice(1);else throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function No(i,e,t){try{i.style[e]=t}catch{return}}function Z2(i){return i?`${i}px`:""}class o4 extends V{constructor(e,t,n){super(e,t,n);const s=a=>this.updateDisplay(a),r=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",s),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Fe(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",r),e.on("playerresize",r);const a=P.screen.orientation||P,o=P.screen.orientation?"change":"orientationchange";a.addEventListener(o,r),e.on("dispose",()=>a.removeEventListener(o,r));const l=this.options_.playerOptions.tracks||[];for(let u=0;u.1&&(n>s?r=Math.round((e-t*s)/2):a=Math.round((t-e/s)/2)),No(this.el_,"insetInline",Z2(r)),No(this.el_,"insetBlock",Z2(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),n=e.activeCues;let s=n.length;for(;s--;){const r=n[s];if(!r)continue;const a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&No(a.firstChild,"color",$f(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&No(a.firstChild,"backgroundColor",$f(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?No(a,"backgroundColor",$f(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${vi}, 2px 2px 4px ${vi}, 2px 2px 5px ${vi}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${vi}, 2px 2px ${vi}, 3px 3px ${vi}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Y2}, 0 1px ${Y2}, -1px -1px ${vi}, 0 -1px ${vi}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${vi}, 0 0 4px ${vi}, 0 0 4px ${vi}, 0 0 4px ${vi}`)),t.fontPercent&&t.fontPercent!==1){const o=P.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=a4[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof P.WebVTT!="function"||e.every(n=>!n.activeCues))return;const t=[];for(let n=0;nthis.handleMouseDown(n))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){Ji(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const n=this.player_.getChild("controlBar"),s=n&&n.getChild("playToggle");if(!s){this.player_.tech(!0).focus();return}const r=()=>s.focus();Oo(t)?t.then(r,()=>{}):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Q2.prototype.controlText_="Play Video",V.registerComponent("BigPlayButton",Q2);class u4 extends Ot{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}V.registerComponent("CloseButton",u4);class J2 extends Ot{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",n=>this.handlePlay(n)),this.on(e,"pause",n=>this.handlePause(n)),t.replay&&this.on(e,"ended",n=>this.handleEnded(n))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Ji(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}J2.prototype.controlText_="Play",V.registerComponent("PlayToggle",J2);class sa extends V{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],n=>this.update(n)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),n=le("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)}\xA0`},{role:"presentation"});return t.appendChild(n),this.contentEl_=le("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Rs(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,ve.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=H.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}sa.prototype.labelText_="Time",sa.prototype.controlText_="Time",V.registerComponent("TimeDisplay",sa);class Vf extends sa{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Vf.prototype.labelText_="Current Time",Vf.prototype.controlText_="Current Time",V.registerComponent("CurrentTimeDisplay",Vf);class jf extends sa{constructor(e,t){super(e,t);const n=s=>this.updateContent(s);this.on(e,"durationchange",n),this.on(e,"loadstart",n),this.on(e,"loadedmetadata",n)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}jf.prototype.labelText_="Duration",jf.prototype.controlText_="Duration",V.registerComponent("DurationDisplay",jf);class c4 extends V{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),n=super.createEl("span",{textContent:"/"});return t.appendChild(n),e.appendChild(t),e}}V.registerComponent("TimeDivider",c4);class zf extends sa{constructor(e,t){super(e,t),this.on(e,"durationchange",n=>this.updateContent(n))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(le("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}zf.prototype.labelText_="Remaining Time",zf.prototype.controlText_="Remaining Time",V.registerComponent("RemainingTimeDisplay",zf);class h4 extends V{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",n=>this.updateShowing(n))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=le("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(le("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")}\xA0`})),this.contentEl_.appendChild(H.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}V.registerComponent("LiveDisplay",h4);class e1 extends Ot{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=n=>this.updateLiveEdgeStatus(n),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=le("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}e1.prototype.controlText_="Seek to live, currently playing live",V.registerComponent("SeekToLive",e1);function Fo(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var d4=Object.freeze({__proto__:null,clamp:Fo});class qf extends V{constructor(e,t){super(e,t),this.handleMouseDown_=n=>this.handleMouseDown(n),this.handleMouseUp_=n=>this.handleMouseUp(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.handleClick_=n=>this.handleClick(n),this.handleMouseMove_=n=>this.handleMouseMove(n),this.update_=n=>this.update(n),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},n={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),n=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},n),super.createEl(e,t,n)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!Zi&&e.preventDefault(),p2(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;g2(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Fo(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Wu(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,n=t&&t.enabled,s=t&&t.horizontalSeek;n?s&&e.key==="ArrowLeft"||!s&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):s&&e.key==="ArrowRight"||!s&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}V.registerComponent("Slider",qf);const Gf=(i,e)=>Fo(i/e*100,0,100).toFixed(2)+"%";class f4 extends V{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",n=>this.update(n))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=le("span",{className:"vjs-control-text"}),n=le("span",{textContent:this.localize("Loaded")}),s=H.createTextNode(": ");return this.percentageEl_=le("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(n),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,n=this.player_.buffered(),s=t&&t.isLive()?t.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),a=this.partEls_,o=Gf(r,s);this.percent_!==o&&(this.el_.style.width=o,ns(this.percentageEl_,o),this.percent_=o);for(let l=0;ln.length;l--)this.el_.removeChild(a[l-1]);a.length=n.length})}}V.registerComponent("LoadProgressBar",f4);class p4 extends V{constructor(e,t){super(e,t),this.update=Qi(Fe(this,this.update),_i)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,n){const s=ko(this.el_),r=Zr(this.player_.el()),a=e.width*t;if(!r||!s)return;let o=e.left-r.left+a,l=e.width-a+(r.right-e.right);l||(l=e.width-a,o=a);let u=s.width/2;os.width&&(u=s.width),u=Math.round(u),this.el_.style.right=`-${u}px`,this.write(n)}write(e){ns(this.el_,e)}updateTime(e,t,n,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let r;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),l=o-t*o;r=(l<1?"":"-")+Rs(l,o)}else r=Rs(n,a);this.update(e,t,r),s&&s()})}}V.registerComponent("TimeTooltip",p4);class Hf extends V{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Qi(Fe(this,this.update),_i)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const n=this.getChild("timeTooltip");if(!n)return;const s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,s)}}Hf.prototype.options_={children:[]},!Rt&&!Yi&&Hf.prototype.options_.children.push("timeTooltip"),V.registerComponent("PlayProgressBar",Hf);class t1 extends V{constructor(e,t){super(e,t),this.update=Qi(Fe(this,this.update),_i)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,()=>{this.el_.style.left=`${e.width*t}px`})}}t1.prototype.options_={children:["timeTooltip"]},V.registerComponent("MouseTimeDisplay",t1);const rc=5,i1=12;class Wf extends qf{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=Fe(this,this.update),this.update=Qi(this.update_,_i),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in H&&"visibilityState"in H&&this.on(H,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){H.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,_i))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||!this.updateInterval||(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(H.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const n=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),s=this.player_.liveTracker;let r=this.player_.duration();s&&s.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==n||this.duration_!==r)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Rs(n,r),Rs(r,r)],"{1} of {2}")),this.currentTime_=n,this.duration_=r),this.bar&&this.bar.update(Zr(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){const e=this.getCurrentTime_();let t;const n=this.player_.liveTracker;return n&&n.isLive()?(t=(e-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){!Ro(e)||(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Ro(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let n;const s=this.calculateDistance(e),r=this.player_.liveTracker;if(!r||!r.isLive())n=s*this.player_.duration(),n===this.player_.duration()&&(n=n-.1);else{if(s>=.99){r.seekToLiveEdge();return}const a=r.seekableStart(),o=r.liveCurrentTime();if(n=a+s*r.liveWindow(),n>=o&&(n=o),n<=a&&(n=a+.1),n===1/0)return}this.userSeek_(n),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");!e||e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");!e||e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Ji(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+rc)}stepBack(){this.userSeek_(this.player_.currentTime()-rc)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const n=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-rc*i1)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+rc*i1)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in H&&"visibilityState"in H&&this.off(H,"visibilitychange",this.toggleVisibility_),super.dispose()}}Wf.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},!Rt&&!Yi&&Wf.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),V.registerComponent("SeekBar",Wf);class n1 extends V{constructor(e,t){super(e,t),this.handleMouseMove=Qi(Fe(this,this.handleMouseMove),_i),this.throttledHandleMouseSeek=Qi(Fe(this,this.handleMouseSeek),_i),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.handleMouseDownHandler_=n=>this.handleMouseDown(n),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const n=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!n&&!s)return;const r=t.el(),a=ko(r);let o=Wu(r,e).x;o=Fo(o,0,1),s&&s.update(a,o),n&&n.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Ji(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}n1.prototype.options_={children:["seekBar"]},V.registerComponent("ProgressControl",n1);class s1 extends Ot{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],n=>this.handlePictureInPictureChange(n)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],n=>this.handlePictureInPictureEnabledChange(n)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){H.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in P?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof H.exitPictureInPicture=="function"&&super.show()}}s1.prototype.controlText_="Picture-in-Picture",V.registerComponent("PictureInPictureToggle",s1);class r1 extends Ot{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",n=>this.handleFullscreenChange(n)),H[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}r1.prototype.controlText_="Fullscreen",V.registerComponent("FullscreenToggle",r1);const g4=function(i,e){e.tech_&&!e.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class m4 extends V{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}V.registerComponent("VolumeLevel",m4);class _4 extends V{constructor(e,t){super(e,t),this.update=Qi(Fe(this,this.update),_i)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,n,s){if(!n){const r=Zr(this.el_),a=Zr(this.player_.el()),o=e.width*t;if(!a||!r)return;const l=e.left-a.left+o,u=e.width-o+(a.right-e.right);let c=r.width/2;lr.width&&(c=r.width),this.el_.style.right=`-${c}px`}this.write(`${s}%`)}write(e){ns(this.el_,e)}updateVolume(e,t,n,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,n,s.toFixed(0)),r&&r()})}}V.registerComponent("VolumeLevelTooltip",_4);class a1 extends V{constructor(e,t){super(e,t),this.update=Qi(Fe(this,this.update),_i)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,n){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,s,()=>{n?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}a1.prototype.options_={children:["volumeLevelTooltip"]},V.registerComponent("MouseVolumeLevelDisplay",a1);class ac extends qf{constructor(e,t){super(e,t),this.on("slideractive",n=>this.updateLastVolume_(n)),this.on(e,"volumechange",n=>this.updateARIAAttributes(n)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){!Ro(e)||super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const n=this.el(),s=Zr(n),r=this.vertical();let a=Wu(n,e);a=r?a.y:a.x,a=Fo(a,0,1),t.update(s,a,r)}!Ro(e)||(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}ac.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},!Rt&&!Yi&&ac.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),ac.prototype.playerEvent="volumechange",V.registerComponent("VolumeBar",ac);class o1 extends V{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Gr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),g4(this,e),this.throttledHandleMouseMove=Qi(Fe(this,this.handleMouseMove),_i),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.on("mousedown",n=>this.handleMouseDown(n)),this.on("touchstart",n=>this.handleMouseDown(n)),this.on("mousemove",n=>this.handleMouseMove(n)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}o1.prototype.options_={children:["volumeBar"]},V.registerComponent("VolumeControl",o1);const y4=function(i,e){e.tech_&&!e.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class l1 extends Ot{constructor(e,t){super(e,t),y4(this,e),this.on(e,["loadstart","volumechange"],n=>this.update(n))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),n=this.player_.lastVolume_();if(t===0){const s=n<.1?.1:n;this.player_.volume(s),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),Rt&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Gu(this.el_,[0,1,2,3].reduce((n,s)=>n+`${s?" ":""}vjs-vol-${s}`,"")),Ds(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}l1.prototype.controlText_="Mute",V.registerComponent("MuteToggle",l1);class u1 extends V{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Gr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=n=>this.handleKeyPress(n),this.on(e,["loadstart"],n=>this.volumePanelState_(n)),this.on(this.muteToggle,"keyup",n=>this.handleKeyPress(n)),this.on(this.volumeControl,"keyup",n=>this.handleVolumeControlKeyUp(n)),this.on("keydown",n=>this.handleKeyPress(n)),this.on("mouseover",n=>this.handleMouseOver(n)),this.on("mouseout",n=>this.handleMouseOut(n)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),ii(H,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),At(H,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}u1.prototype.options_={children:["muteToggle","volumeControl"]},V.registerComponent("VolumePanel",u1);class c1 extends Ot{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),n=this.player_.liveTracker,s=n&&n.isLive()?n.seekableEnd():this.player_.duration();let r;t+this.skipTime<=s?r=t+this.skipTime:r=s,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}c1.prototype.controlText_="Skip Forward",V.registerComponent("SkipForward",c1);class h1 extends Ot{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),n=this.player_.liveTracker,s=n&&n.isLive()&&n.seekableStart();let r;s&&t-this.skipTime<=s?r=s:t>=this.skipTime?r=t-this.skipTime:r=0,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}h1.prototype.controlText_="Skip Backward",V.registerComponent("SkipBackward",h1);class d1 extends V{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",n=>this.handleKeyDown(n)),this.boundHandleBlur_=n=>this.handleBlur(n),this.boundHandleTapClick_=n=>this.handleTapClick(n)}addEventListenerForItem(e){e instanceof V&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof V&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=le(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),ii(t,"click",function(n){n.preventDefault(),n.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||H.activeElement;if(!this.children().some(n=>n.el()===t)){const n=this.menuButton_;n&&n.buttonPressed_&&t!==n.el().firstChild&&n.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const n=t.filter(s=>s.el()===e.target)[0];if(!n)return;n.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}V.registerComponent("Menu",d1);class Xf extends V{constructor(e,t={}){super(e,t),this.menuButton_=new Ot(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const n=Ot.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+n,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const s=r=>this.handleClick(r);this.handleMenuKeyUp_=r=>this.handleMenuKeyUp(r),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",r=>this.handleKeyDown(r)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),ii(H,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",r=>this.handleMouseLeave(r)),this.on("keydown",r=>this.handleSubmenuKeyDown(r))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new d1(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=le("li",{className:"vjs-menu-title",textContent:Ye(this.options_.title),tabIndex:-1}),n=new V(this.player_,{el:t});e.addItem(n)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",a)}),s.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof P.Event!="object")try{o=new P.Event("change")}catch{}o||(o=H.createEvent("Event"),o.initEvent("change",!0,!0)),s.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,n=this.player_.textTracks();if(super.handleClick(e),!!n)for(let s=0;s-1&&a.mode==="showing"){n=!1;break}}n!==this.isSelected_&&this.selected(n)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let n=!0;for(let s=0,r=t.length;s-1&&a.mode==="showing"){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}V.registerComponent("OffTextTrackMenuItem",f1);class ra extends Kf{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Uo){let n;this.label_&&(n=`${this.label_} off`),e.push(new f1(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;const s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let r=0;r-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}V.registerComponent("TextTrackButton",ra);class p1 extends Bo{constructor(e,t){const n=t.track,s=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=r&&r{this.items.forEach(s=>{s.selected(this.track_.activeCues[0]===s.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind===this.kind_)return n}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Ye(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let n=0,s=t.length;n-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(Ye(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Jf(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,g1),e}}tp.prototype.kinds_=["captions","subtitles"],tp.prototype.controlText_="Subtitles",V.registerComponent("SubsCapsButton",tp);class m1 extends Bo{constructor(e,t){const n=t.track,s=e.audioTracks();t.label=n.label||n.language||"Unknown",t.selected=n.enabled,super(e,t),this.track=n,this.addClass(`vjs-${n.kind}-menu-item`);const r=(...a)=>{this.handleTracksChange.apply(this,a)};s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,n){const s=super.createEl(e,t,n),r=s.querySelector(".vjs-menu-item-text");return["main-desc","description"].indexOf(this.options_.track.kind)>=0&&(r.appendChild(le("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(le("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let n=0;nthis.update(r))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}ip.prototype.contentElType="button",V.registerComponent("PlaybackRateMenuItem",ip);class y1 extends Xf{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",n=>this.updateVisibility(n)),this.on(e,"ratechange",n=>this.updateLabel(n)),this.on(e,"playbackrateschange",n=>this.handlePlaybackRateschange(n))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=le("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let n=e.length-1;n>=0;n--)t.push(new ip(this.player(),{rate:e[n]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}y1.prototype.controlText_="Playback Rate",V.registerComponent("PlaybackRateMenuButton",y1);class v1 extends V{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},n={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,n)}}V.registerComponent("Spacer",v1);class v4 extends v1{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:"\xA0"})}}V.registerComponent("CustomControlSpacer",v4);class T1 extends V{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}T1.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]},V.registerComponent("ControlBar",T1);class x1 extends ea{constructor(e,t){super(e,t),this.on(e,"error",n=>{this.open(n)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}x1.prototype.options_=Object.assign({},ea.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),V.registerComponent("ErrorDisplay",x1);class b1 extends V{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),le("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const n=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${mi()}`)+"-"+t[1].replace(/\W+/g,""),s=le("option",{id:n,value:this.localize(t[0]),textContent:t[1]});return s.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${n}`),s}))}}V.registerComponent("TextTrackSelect",b1);class Os extends V{constructor(e,t={}){super(e,t);const n=le("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(n);const s=this.options_.selects;for(const r of s){const a=this.options_.selectConfigs[r],o=a.className,l=a.id.replace("%s",this.options_.id_);let u=null;const c=`vjs_select_${mi()}`;if(this.options_.type==="colors"){u=le("span",{className:o});const p=le("label",{id:l,className:"vjs-label",textContent:a.label});p.setAttribute("for",c),u.appendChild(p)}const d=new b1(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:c,labelId:l});this.addChild(d),this.options_.type==="colors"&&(u.appendChild(d.el()),this.el().appendChild(u))}}createEl(){return le("fieldset",{className:this.options_.className})}}V.registerComponent("TextTrackFieldset",Os);class E1 extends V{constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,s=new Os(e,{id_:n,legendId:`captions-text-legend-${n}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);const r=new Os(e,{id_:n,legendId:`captions-background-${n}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const a=new Os(e,{id_:n,legendId:`captions-window-${n}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return le("div",{className:"vjs-track-settings-colors"})}}V.registerComponent("TextTrackSettingsColors",E1);class S1 extends V{constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,s=new Os(e,{id_:n,legendId:`captions-font-size-${n}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);const r=new Os(e,{id_:n,legendId:`captions-edge-style-${n}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const a=new Os(e,{id_:n,legendId:`captions-font-family-${n}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return le("div",{className:"vjs-track-settings-font"})}}V.registerComponent("TextTrackSettingsFont",S1);class C1 extends V{constructor(e,t={}){super(e,t);const n=this.localize("restore all settings to the default values"),s=new Ot(e,{controlText:n,className:"vjs-default-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Reset"),this.addChild(s);const r=new Ot(e,{controlText:n,className:"vjs-done-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Done"),this.addChild(r)}createEl(){return le("div",{className:"vjs-track-settings-controls"})}}V.registerComponent("TrackSettingsControls",C1);const np="vjs-text-track-settings",w1=["#000","Black"],A1=["#00F","Blue"],I1=["#0FF","Cyan"],D1=["#0F0","Green"],k1=["#F0F","Magenta"],R1=["#F00","Red"],P1=["#FFF","White"],L1=["#FF0","Yellow"],sp=["1","Opaque"],rp=["0.5","Semi-Transparent"],O1=["0","Transparent"],as={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[w1,P1,R1,D1,A1,L1,k1,I1],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[sp,rp,O1],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[P1,w1,R1,D1,A1,L1,k1,I1],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:i=>i==="1.00"?null:Number(i)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[sp,rp],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[O1,rp,sp],className:"vjs-window-opacity vjs-opacity"}};as.windowColor.options=as.backgroundColor.options;function M1(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function T4(i,e){const t=i.options[i.options.selectedIndex].value;return M1(t,e)}function x4(i,e,t){if(!!e){for(let n=0;n{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),qr(as,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return t2(as,(e,t,n)=>{const s=T4(this.$(t.selector),t.parser);return s!==void 0&&(e[n]=s),e},{})}setValues(e){qr(as,(t,n)=>{x4(this.$(t.selector),e[n],t.parser)})}setDefaults(){qr(as,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(P.localStorage.getItem(np))}catch(t){ve.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?P.localStorage.setItem(np,JSON.stringify(e)):P.localStorage.removeItem(np)}catch(t){ve.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}V.registerComponent("TextTrackSettings",b4);class E4 extends V{constructor(e,t){let n=t.ResizeObserver||P.ResizeObserver;t.ResizeObserver===null&&(n=!1);const s=Ne({createEl:!n,reportTouchActivity:!1},t);super(e,s),this.ResizeObserver=t.ResizeObserver||P.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=w2(()=>{this.resizeHandler()},100,!1,this),n?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const r=this.debouncedHandler_;let a=this.unloadListener_=function(){At(this,"resize",r),At(this,"unload",a),a=null};ii(this.el_.contentWindow,"unload",a),ii(this.el_.contentWindow,"resize",r)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}V.registerComponent("ResizeManager",E4);const S4={trackingThreshold:20,liveTolerance:15};class C4 extends V{constructor(e,t){const n=Ne(S4,t,{createEl:!1});super(e,n),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=s=>this.handlePlay(s),this.handleFirstTimeupdate_=s=>this.handleFirstTimeupdate(s),this.handleSeeked_=s=>this.handleSeeked(s),this.seekToLiveEdge_=s=>this.seekToLiveEdge(s),this.reset_(),this.on(this.player_,"durationchange",s=>this.handleDurationchange(s)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(P.performance.now().toFixed(4)),n=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+n;const s=this.liveCurrentTime(),r=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-r)>this.options_.liveTolerance;(!this.timeupdateSeen_||s===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,_i),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){!this.isTracking()||(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let n=e?e.length:0;for(;n--;)t.push(e.end(n));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let n=e?e.length:0;for(;n--;)t.push(e.start(n));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}V.registerComponent("LiveTracker",C4);class w4 extends V{constructor(e,t){super(e,t),this.on("statechanged",n=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:le("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${mi()}`}),description:le("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${mi()}`})},le("div",{className:"vjs-title-bar"},{},i2(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,n={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(s=>{const r=this.state[s],a=this.els[s],o=n[s];Xu(a),r&&ns(a,r),t&&(t.removeAttribute(o),r&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}V.registerComponent("TitleBar",w4);const ap=i=>{const e=i.el();if(e.hasAttribute("src"))return i.triggerSourceset(e.src),!0;const t=i.$$("source"),n=[];let s="";if(!t.length)return!1;for(let r=0;r{let t={};for(let n=0;nN1([i.el(),P.HTMLMediaElement.prototype,P.Element.prototype,A4],"innerHTML"),F1=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},n=I4(i),s=r=>(...a)=>{const o=r.apply(e,a);return ap(i),o};["append","appendChild","insertAdjacentHTML"].forEach(r=>{!e[r]||(t[r]=e[r],e[r]=s(t[r]))}),Object.defineProperty(e,"innerHTML",Ne(n,{set:s(n.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(r=>{e[r]=t[r]}),Object.defineProperty(e,"innerHTML",n)},i.one("sourceset",e.resetSourceWatch_)},D4=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?U2(P.Element.prototype.getAttribute.call(this,"src")):""},set(i){return P.Element.prototype.setAttribute.call(this,"src",i),i}}),k4=i=>N1([i.el(),P.HTMLMediaElement.prototype,D4],"src"),R4=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=k4(i),n=e.setAttribute,s=e.load;Object.defineProperty(e,"src",Ne(t,{set:r=>{const a=t.set.call(e,r);return i.triggerSourceset(e.src),a}})),e.setAttribute=(r,a)=>{const o=n.call(e,r,a);return/src/i.test(r)&&i.triggerSourceset(e.src),o},e.load=()=>{const r=s.call(e);return ap(i)||(i.triggerSourceset(""),F1(i)),r},e.currentSrc?i.triggerSourceset(e.currentSrc):ap(i)||F1(i),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=s,e.setAttribute=n,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Q extends de{constructor(e,t){super(e,t);const n=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",n&&(this.el_.currentSrc!==n.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(n):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const r=this.el_.childNodes;let a=r.length;const o=[];for(;a--;){const l=r[a];l.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(l),this.remoteTextTracks().addTrack(l.track),this.textTracks().addTrack(l.track),!s&&!this.el_.hasAttribute("crossorigin")&&tc(l.src)&&(s=!0)):o.push(l))}for(let l=0;l{t=[];for(let r=0;re.removeEventListener("change",n));const s=()=>{for(let r=0;r{e.removeEventListener("change",n),e.removeEventListener("change",s),e.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",n),e.addEventListener("change",n),e.removeEventListener("change",s)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const n=e.toLowerCase();this[`${n}TracksListeners_`]&&Object.keys(this[`${n}TracksListeners_`]).forEach(s=>{this.el()[`${n}Tracks`].removeEventListener(s,this[`${n}TracksListeners_`][s])}),this[`featuresNative${e}Tracks`]=!t,this[`${n}TracksListeners_`]=null,this.proxyNativeTracksForType_(n)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=yi[e],n=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!n||!n.addEventListener)return;const r={change:o=>{const l={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(l),e==="text"&&this[ia.remoteText.getterName]().trigger(l)},addtrack(o){s.addTrack(o.track)},removetrack(o){s.removeTrack(o.track)}},a=function(){const o=[];for(let l=0;l{const l=r[o];n.addEventListener(o,l),this.on("dispose",u=>n.removeEventListener(o,l))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){yi.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const n=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(n,e),Q.disposeMediaElement(e),e=n}else{e=H.createElement("video");const n=this.options_.tag&&ss(this.options_.tag),s=Ne({},n);(!Io||this.options_.nativeControlsForTouch!==!0)&&delete s.controls,d2(e,Object.assign(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Yr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let n=0;n=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(n){this.trigger(n)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&qu?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){ve(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Yi&&Zi&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Ji(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}reset(){Q.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):super.addTextTrack(e,t,n)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=H.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const n=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let n=t.length;for(;n--;)(e===t[n]||e===t[n].track)&&this.el().removeChild(t[n])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),P.performance&&(e.creationTime=P.performance.now()),e}}Nu(Q,"TEST_VID",function(){if(!Xr())return;const i=H.createElement("video"),e=H.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",i.appendChild(e),i}),Q.isSupported=function(){try{Q.TEST_VID.volume=.5}catch{return!1}return!!(Q.TEST_VID&&Q.TEST_VID.canPlayType)},Q.canPlayType=function(i){return Q.TEST_VID.canPlayType(i)},Q.canPlaySource=function(i,e){return Q.canPlayType(i.type)},Q.canControlVolume=function(){try{const i=Q.TEST_VID.volume;Q.TEST_VID.volume=i/2+.1;const e=i!==Q.TEST_VID.volume;return e&&Rt?(P.setTimeout(()=>{Q&&Q.prototype&&(Q.prototype.featuresVolumeControl=i!==Q.TEST_VID.volume)}),!1):e}catch{return!1}},Q.canMuteVolume=function(){try{const i=Q.TEST_VID.muted;return Q.TEST_VID.muted=!i,Q.TEST_VID.muted?Yr(Q.TEST_VID,"muted","muted"):Hu(Q.TEST_VID,"muted","muted"),i!==Q.TEST_VID.muted}catch{return!1}},Q.canControlPlaybackRate=function(){if(Yi&&Zi&&Fu<58)return!1;try{const i=Q.TEST_VID.playbackRate;return Q.TEST_VID.playbackRate=i/2+.1,i!==Q.TEST_VID.playbackRate}catch{return!1}},Q.canOverrideAttributes=function(){try{const i=()=>{};Object.defineProperty(H.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(H.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(H.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(H.createElement("audio"),"innerHTML",{get:i,set:i})}catch{return!1}return!0},Q.supportsNativeTextTracks=function(){return qu||Rt&&Zi},Q.supportsNativeVideoTracks=function(){return!!(Q.TEST_VID&&Q.TEST_VID.videoTracks)},Q.supportsNativeAudioTracks=function(){return!!(Q.TEST_VID&&Q.TEST_VID.audioTracks)},Q.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([i,e]){Nu(Q.prototype,i,()=>Q[e](),!0)}),Q.prototype.featuresVolumeControl=Q.canControlVolume(),Q.prototype.movingMediaElementInDOM=!Rt,Q.prototype.featuresFullscreenResize=!0,Q.prototype.featuresProgressEvents=!0,Q.prototype.featuresTimeupdateEvents=!0,Q.prototype.featuresVideoFrameCallback=!!(Q.TEST_VID&&Q.TEST_VID.requestVideoFrameCallback),Q.disposeMediaElement=function(i){if(!!i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()}},Q.resetMediaElement=function(i){if(!i)return;const e=i.querySelectorAll("source");let t=e.length;for(;t--;)i.removeChild(e[t]);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){Q.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){Q.prototype["set"+Ye(i)]=function(e){this.el_[i]=e,e?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(i){Q.prototype[i]=function(){return this.el_[i]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(i){Q.prototype["set"+Ye(i)]=function(e){this.el_[i]=e}}),["pause","load","play"].forEach(function(i){Q.prototype[i]=function(){return this.el_[i]()}}),de.withSourceHandlers(Q),Q.nativeSourceHandler={},Q.nativeSourceHandler.canPlayType=function(i){try{return Q.TEST_VID.canPlayType(i)}catch{return""}},Q.nativeSourceHandler.canHandleSource=function(i,e){if(i.type)return Q.nativeSourceHandler.canPlayType(i.type);if(i.src){const t=Nf(i.src);return Q.nativeSourceHandler.canPlayType(`video/${t}`)}return""},Q.nativeSourceHandler.handleSource=function(i,e,t){e.setSrc(i.src)},Q.nativeSourceHandler.dispose=function(){},Q.registerSourceHandler(Q.nativeSourceHandler),de.registerTech("Html5",Q);const B1=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],op={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},lp=["tiny","xsmall","small","medium","large","xlarge","huge"],oc={};lp.forEach(i=>{const e=i.charAt(0)==="x"?`x-${i.substring(1)}`:i;oc[i]=`vjs-layout-${e}`});const P4={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ue extends V{constructor(e,t,n){if(e.id=e.id||t.id||`vjs_video_${mi()}`,t=Object.assign(Ue.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,n),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=Jy(this.id_),this.fsApi_=Ou,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&ss(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=Ue.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Af(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(ii(H,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=Ne(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const o=new P.DOMParser().parseFromString(n4,"image/svg+xml");if(o.querySelector("parsererror"))ve.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const u=o.documentElement;u.style.display="none",this.el_.appendChild(u),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new s4(this),this.addClass("vjs-spatial-navigation-enabled")),Io&&this.addClass("vjs-touch-enabled"),Rt||this.addClass("vjs-workinghover"),Ue.players[this.id_]=this;const r=ff.split(".")[0];this.addClass(`vjs-v${r}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),At(H,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),At(H,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ue.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),JR(this),Lt.names.forEach(e=>{const t=Lt[e],n=this[t.getterName]();n&&n.off&&n.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,n=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const s=this.tag.tagName.toLowerCase()==="video-js";n?t=this.el_=e.parentNode:s||(t=this.el_=super.createEl("div"));const r=ss(e);if(s){for(t=this.el_=e,e=this.tag=H.createElement("video");t.children.length;)e.appendChild(t.firstChild);Do(t,"video-js")||Ds(t,"video-js"),t.appendChild(e),n=this.playerElIngest_=t,Object.keys(t).forEach(l=>{try{e[l]=t[l]}catch{}})}e.setAttribute("tabindex","-1"),r.tabindex="-1",Zi&&Uu&&(e.setAttribute("role","application"),r.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(l){s&&l==="class"||t.setAttribute(l,r[l]),s&&e.setAttribute(l,r[l])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(l=>o2[l]).map(l=>"vjs-device-"+l.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),P.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=E2("vjs-styles-dimensions");const l=rs(".vjs-styles-defaults"),u=rs("head");u.insertBefore(this.styleEl_,l?l.nextSibling:u.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const o=e.getElementsByTagName("a");for(let l=0;l"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){ve.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const n=e+"_";if(t===void 0)return this[n]||0;if(t===""||t==="auto"){this[n]=void 0,this.updateStyleEl_();return}const s=parseFloat(t);if(isNaN(s)){ve.error(`Improper value "${t}" supplied for for ${e}`);return}this[n]=s,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,wn(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),RR(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(P.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,l=typeof this.height_=="number"?this.height_:this.options_.height,u=this.tech_&&this.tech_.el();u&&(o>=0&&(u.width=o),l>=0&&(u.height=l));return}let e,t,n,s;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?n=this.aspectRatio_:this.videoWidth()>0?n=this.videoWidth()+":"+this.videoHeight():n="16:9";const r=n.split(":"),a=r[1]/r[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?s="dimensions-"+this.id():s=this.id()+"-dimensions",this.addClass(s),S2(this.styleEl_,` .${s} { width: ${e}px; height: ${t}px; } .${s}.vjs-fluid:not(.vjs-audio-only-mode) { padding-top: ${a*100}%; } `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const n=Ye(e),s=e.charAt(0).toLowerCase()+e.slice(1);n!=="Html5"&&this.tag&&(de.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;let r=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(r=!1);const a={source:t,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Lt.names.forEach(l=>{const u=Lt[l];a[u.getterName]=this[u.privateName]}),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[s]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const o=de.getTech(e);if(!o)throw new Error(`No Tech named '${n}' exists! '${n}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(Fe(this,this.handleTechReady_),!0),N2.jsonToTextTracks(this.textTracksJson_||[],this.tech_),B1.forEach(l=>{this.on(this.tech_,l,u=>this[`handleTech${Ye(l)}_`](u))}),Object.keys(op).forEach(l=>{this.on(this.tech_,l,u=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${op[l]}_`].bind(this),event:u});return}this[`handleTech${op[l]}_`](u)})}),this.on(this.tech_,"loadstart",l=>this.handleTechLoadStart_(l)),this.on(this.tech_,"sourceset",l=>this.handleTechSourceset_(l)),this.on(this.tech_,"waiting",l=>this.handleTechWaiting_(l)),this.on(this.tech_,"ended",l=>this.handleTechEnded_(l)),this.on(this.tech_,"seeking",l=>this.handleTechSeeking_(l)),this.on(this.tech_,"play",l=>this.handleTechPlay_(l)),this.on(this.tech_,"pause",l=>this.handleTechPause_(l)),this.on(this.tech_,"durationchange",l=>this.handleTechDurationChange_(l)),this.on(this.tech_,"fullscreenchange",(l,u)=>this.handleTechFullscreenChange_(l,u)),this.on(this.tech_,"fullscreenerror",(l,u)=>this.handleTechFullscreenError_(l,u)),this.on(this.tech_,"enterpictureinpicture",l=>this.handleTechEnterPictureInPicture_(l)),this.on(this.tech_,"leavepictureinpicture",l=>this.handleTechLeavePictureInPicture_(l)),this.on(this.tech_,"error",l=>this.handleTechError_(l)),this.on(this.tech_,"posterchange",l=>this.handleTechPosterChange_(l)),this.on(this.tech_,"textdata",l=>this.handleTechTextData_(l)),this.on(this.tech_,"ratechange",l=>this.handleTechRateChange_(l)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(n!=="Html5"||!this.tag)&&yf(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Lt.names.forEach(e=>{const t=Lt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=N2.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&ve.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. See https://github.com/videojs/video.js/issues/2617 for more info. `),this.tech_}version(){return{"video.js":ff}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const s=this.muted();this.muted(!0);const r=()=>{this.muted(s)};this.playTerminatedQueue_.push(r);const a=this.play();if(!!Oo(a))return a.catch(o=>{throw r(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let n;if(e==="any"&&!this.muted()?(n=this.play(),Oo(n)&&(n=n.catch(t))):e==="muted"&&!this.muted()?n=t():n=this.play(),!!Oo(n))return n.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,n="";typeof t!="string"&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=i4(this,t)),this.cache_.source=Ne({},e,{src:t,type:n});const s=this.cache_.sources.filter(l=>l.src&&l.src===t),r=[],a=this.$$("source"),o=[];for(let l=0;lthis.updateSourceCaches_(r);const n=this.currentSource().src,s=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==n)&&(t=()=>{}),t(s),e.src||this.tech_.any(["sourceset","loadstart"],r=>{if(r.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Ji(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),n=>n.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const n=this.el();let s=H[this.fsApi_.fullscreenElement]===n;!s&&n.matches&&(s=n.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in ZR)return KR(this.middleware_,this.tech_,e,t);if(e in G2)return q2(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(n){throw ve(n),n}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in YR)return XR(this.middleware_,this.tech_,e);if(e in G2)return q2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(ve(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(ve(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(ve(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Ji){this.playCallbacks_.push(e);const t=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),n=Boolean(qu||Rt);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&n&&this.load();return}const s=this.techGet_("play");n&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),s===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(n){n(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Di(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Di(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Di(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return M2(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let n=e.end(e.length-1);return n>t&&(n=t),n}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((n,s)=>{function r(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){r(),n()}function o(u,c){r(),s(c)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const l=t.requestFullscreenHelper_(e);l&&(l.then(r,r),l.then(n,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),n}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,n)=>{function s(){e.off("fullscreenerror",a),e.off("fullscreenchange",r)}function r(){s(),t()}function a(l,u){s(),n(u)}e.one("fullscreenchange",r),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(s,s),o.then(t,n))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=H[this.fsApi_.exitFullscreen]();return e&&Ji(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=H.documentElement.style.overflow,ii(H,"keydown",this.boundFullWindowOnEscKey_),H.documentElement.style.overflow="hidden",Ds(H.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,At(H,"keydown",this.boundFullWindowOnEscKey_),H.documentElement.style.overflow=this.docOrigOverflow,Gu(H.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&P.documentPictureInPicture){const e=H.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(le("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),P.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(T2(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",n=>{const s=n.target.querySelector(".video-js");e.parentNode.replaceChild(s,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in H&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(P.documentPictureInPicture&&P.documentPictureInPicture.window)return P.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in H)return H.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(s=>{const r=s.tagName.toLowerCase();if(s.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return r==="input"?a.indexOf(s.type)===-1:["textarea"].indexOf(r)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:n=a=>e.key.toLowerCase()==="f",muteKey:s=a=>e.key.toLowerCase()==="m",playPauseKey:r=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();const a=V.getComponent("FullscreenToggle");H[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else s.call(this,e)?(e.preventDefault(),e.stopPropagation(),V.getComponent("MuteToggle").prototype.handleClick.call(this,e)):r.call(this,e)&&(e.preventDefault(),e.stopPropagation(),V.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let n=0,s=this.options_.techOrder;n[o,de.getTech(o)]).filter(([o,l])=>l?l.isSupported():(ve.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),n=function(o,l,u){let c;return o.some(d=>l.some(p=>{if(c=u(d,p),c)return!0})),c};let s;const r=o=>(l,u)=>o(u,l),a=([o,l],u)=>{if(l.canPlaySource(u,this.options_[o.toLowerCase()]))return{source:u,tech:o}};return this.options_.sourceOrder?s=n(e,t,r(a)):s=n(t,e,a),s||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const n=H2(e);if(!n.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),HR(this,n[0],(s,r)=>{if(this.middleware_=r,t||(this.cache_.sources=n),this.updateSourceCaches_(s),this.src_(s)){if(n.length>1)return this.handleSrc_(n.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}WR(r,this.tech_)}),n.length>1){const s=()=>{this.error(null),this.handleSrc_(n.slice(1),!0)},r=()=>{this.off("error",s)};this.one("error",s),this.one("playing",r),this.resetRetryOnError_=()=>{this.off("error",s),this.off("playing",r)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?k2(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Ji(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),wn(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:n,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:r}=n||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),r&&(r.update(),r.loadProgressBar&&r.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(ts("beforeerror").forEach(t=>{const n=t(this,e);if(!(Ki(n)&&!Array.isArray(n)||typeof n=="string"||typeof n=="number"||n===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=n}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Ge(e),this.addClass("vjs-error"),ve.error(`(CODE:${this.error_.code} ${Ge.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),ts("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,n;const s=Fe(this,this.reportUserActivity),r=function(d){(d.screenX!==t||d.screenY!==n)&&(t=d.screenX,n=d.screenY,s())},a=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},o=function(d){s(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",r),this.on("mouseup",o),this.on("mouseleave",o);const l=this.getChild("controlBar");l&&!Rt&&!Yi&&(l.on("mouseenter",function(d){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),l.on("mouseleave",function(d){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",s),this.on("keyup",s);let u;const c=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(u);const d=this.options_.inactivityTimeout;d<=0||(u=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},d))};this.setInterval(c,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),n=t&&t.currentHeight();e.forEach(s=>{s!==t&&s.el_&&!s.hasClass("vjs-hidden")&&(s.hide(),this.audioOnlyCache_.hiddenChildren.push(s))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=n,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(n),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,n){if(this.tech_)return this.tech_.addTextTrack(e,t,n)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),wn(this)&&this.trigger("languagechange"))}languages(){return Ne(Ue.prototype.options_.languages,this.languages_)}toJSON(){const e=Ne(this.options_),t=e.tracks;e.tracks=[];for(let n=0;n{this.removeChild(n)}),n.open(),n}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let n=0;nthis.addRemoteTextTrack(d,!1)),this.titleBar&&this.titleBar.update({title:c,description:a||s||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),n=Array.prototype.map.call(this.remoteTextTracks(),r=>({kind:r.kind,label:r.label,language:r.language,src:r.src})),s={src:t,textTracks:n};return e&&(s.poster=e,s.artwork=[{src:s.poster,type:nc(s.poster)}]),s}return Ne(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},n=ss(e),s=n["data-setup"];if(Do(e,"vjs-fill")&&(n.fill=!0),Do(e,"vjs-fluid")&&(n.fluid=!0),s!==null){const[r,a]=pI(s||"{}");r&&ve.error(r),Object.assign(n,a)}if(Object.assign(t,n),e.hasChildNodes()){const r=e.childNodes;for(let a=0,o=r.length;atypeof t=="number")||(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}Lt.names.forEach(function(i){const e=Lt[i];Ue.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),Ue.prototype.crossorigin=Ue.prototype.crossOrigin,Ue.players={};const $o=P.navigator;Ue.prototype.options_={techOrder:de.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:$o&&($o.languages&&$o.languages[0]||$o.userLanguage||$o.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1},B1.forEach(function(i){Ue.prototype[`handleTech${Ye(i)}_`]=function(){return this.trigger(i)}}),V.registerComponent("Player",Ue);const lc="plugin",aa="activePlugins_",oa={},uc=i=>oa.hasOwnProperty(i),cc=i=>uc(i)?oa[i]:void 0,U1=(i,e)=>{i[aa]=i[aa]||{},i[aa][e]=!0},hc=(i,e,t)=>{const n=(t?"before":"")+"pluginsetup";i.trigger(n,e),i.trigger(n+":"+e.name,e)},L4=function(i,e){const t=function(){hc(this,{name:i,plugin:e,instance:null},!0);const n=e.apply(this,arguments);return U1(this,i),hc(this,{name:i,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(n){t[n]=e[n]}),t},$1=(i,e)=>(e.prototype.name=i,function(...t){hc(this,{name:i,plugin:e,instance:null},!0);const n=new e(this,...t);return this[i]=()=>n,hc(this,n.getEventHash()),n});class Ht{constructor(e){if(this.constructor===Ht)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Af(this),delete this.trigger,D2(this,this.constructor.defaultState),U1(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Jr(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[aa][e]=!1,this.player=this.state=null,t[e]=$1(e,oa[e])}static isBasic(e){const t=typeof e=="string"?cc(e):e;return typeof t=="function"&&!Ht.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(uc(e))ve.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ue.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return oa[e]=t,e!==lc&&(Ht.isBasic(t)?Ue.prototype[e]=L4(e,t):Ue.prototype[e]=$1(e,t)),t}static deregisterPlugin(e){if(e===lc)throw new Error("Cannot de-register base plugin.");uc(e)&&(delete oa[e],delete Ue.prototype[e])}static getPlugins(e=Object.keys(oa)){let t;return e.forEach(n=>{const s=cc(n);s&&(t=t||{},t[n]=s)}),t}static getPluginVersion(e){const t=cc(e);return t&&t.VERSION||""}}Ht.getPlugin=cc,Ht.BASE_PLUGIN_NAME=lc,Ht.registerPlugin(lc,Ht),Ue.prototype.usingPlugin=function(i){return!!this[aa]&&this[aa][i]===!0},Ue.prototype.hasPlugin=function(i){return!!uc(i)};function O4(i,e){let t=!1;return function(...n){return t||ve.warn(i),t=!0,e.apply(this,n)}}function ki(i,e,t,n){return O4(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,n)}var M4={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const V1=i=>i.indexOf("#")===0?i.slice(1):i;function B(i,e,t){let n=B.getPlayer(i);if(n)return e&&ve.warn(`Player "${i}" is already initialised. Options will not be applied.`),t&&n.ready(t),n;const s=typeof i=="string"?rs("#"+V1(i)):i;if(!Kr(s))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in s?s.getRootNode()instanceof P.ShadowRoot:!1)?s.getRootNode():s.ownerDocument.body;(!s.ownerDocument.defaultView||!a.contains(s))&&ve.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(s.parentNode&&s.parentNode.hasAttribute&&s.parentNode.hasAttribute("data-vjs-player")?s.parentNode:s).cloneNode(!0)),ts("beforesetup").forEach(l=>{const u=l(s,Ne(e));if(!Ki(u)||Array.isArray(u)){ve.error("please return an object in beforesetup hooks");return}e=Ne(e,u)});const o=V.getComponent("Player");return n=new o(s,e,t),ts("setup").forEach(l=>l(n)),n}if(B.hooks_=Cn,B.hooks=ts,B.hook=yR,B.hookOnce=vR,B.removeHook=Zy,P.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Xr()){let i=rs(".vjs-styles-defaults");if(!i){i=E2("vjs-styles-defaults");const e=rs("head");e&&e.insertBefore(i,e.firstChild),S2(i,` .video-js { width: 300px; height: 150px; } .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } `)}}xf(1,B),B.VERSION=ff,B.options=Ue.prototype.options_,B.getPlayers=()=>Ue.players,B.getPlayer=i=>{const e=Ue.players;let t;if(typeof i=="string"){const n=V1(i),s=e[n];if(s)return s;t=rs("#"+n)}else t=i;if(Kr(t)){const{player:n,playerId:s}=t;if(n||e[s])return n||e[s]}},B.getAllPlayers=()=>Object.keys(Ue.players).map(i=>Ue.players[i]).filter(Boolean),B.players=Ue.players,B.getComponent=V.getComponent,B.registerComponent=(i,e)=>(de.isTech(e)&&ve.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),V.registerComponent.call(V,i,e)),B.getTech=de.getTech,B.registerTech=de.registerTech,B.use=GR,Object.defineProperty(B,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(B.middleware,"TERMINATOR",{value:ic,writeable:!1,enumerable:!0}),B.browser=o2,B.obj=bR,B.mergeOptions=ki(9,"videojs.mergeOptions","videojs.obj.merge",Ne),B.defineLazyProperty=ki(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Nu),B.bind=ki(9,"videojs.bind","native Function.prototype.bind",Fe),B.registerPlugin=Ht.registerPlugin,B.deregisterPlugin=Ht.deregisterPlugin,B.plugin=(i,e)=>(ve.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Ht.registerPlugin(i,e)),B.getPlugins=Ht.getPlugins,B.getPlugin=Ht.getPlugin,B.getPluginVersion=Ht.getPluginVersion,B.addLanguage=function(i,e){return i=(""+i).toLowerCase(),B.options.languages=Ne(B.options.languages,{[i]:e}),B.options.languages[i]},B.log=ve,B.createLogger=Jy,B.time=NR,B.createTimeRange=ki(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Di),B.createTimeRanges=ki(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Di),B.formatTime=ki(9,"videojs.formatTime","videojs.time.formatTime",Rs),B.setFormatTime=ki(9,"videojs.setFormatTime","videojs.time.setFormatTime",L2),B.resetFormatTime=ki(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",O2),B.parseUrl=ki(9,"videojs.parseUrl","videojs.url.parseUrl",Mf),B.isCrossOrigin=ki(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",tc),B.EventTarget=ni,B.any=Sf,B.on=ii,B.one=Zu,B.off=At,B.trigger=Jr,B.xhr=gu.exports,B.TextTrack=Mo,B.AudioTrack=j2,B.VideoTrack=z2,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{B[i]=function(){return ve.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),x2[i].apply(null,arguments)}}),B.computedStyle=ki(9,"videojs.computedStyle","videojs.dom.computedStyle",Qr),B.dom=x2,B.fn=kR,B.num=d4,B.str=OR,B.url=zR,B.Error=M4;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class N4{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(n){t.enabled_(n)}}),t}}class dc extends B.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const n=this.levels_.length;return t=new N4(e),""+n in this||Object.defineProperty(this,n,{get(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let n=0,s=this.length;nn&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,n=this.length;tn,i.qualityLevels.VERSION=j1,n},z1=function(i){return F4(this,B.obj.merge({},i))};B.registerPlugin("qualityLevels",z1),z1.VERSION=j1;/*! @name @videojs/http-streaming @version 3.13.1 @license Apache-2.0 */const Wt=yu,fc=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,Ti=i=>B.log.debug?B.log.debug.bind(B,"VHS:",`${i} >`):function(){};function ke(...i){const e=B.obj||B;return(e.merge||e.mergeOptions).apply(e,i)}function vt(...i){const e=B.time||B;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function B4(i){if(i.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: `;for(let t=0;t ${s}. Duration (${s-n}) `}return e}const en=1/30,tn=en*3,q1=function(i,e){const t=[];let n;if(i&&i.length)for(n=0;n=e})},pc=function(i,e){return q1(i,function(t){return t-en>=e})},U4=function(i){if(i.length<2)return vt();const e=[];for(let t=1;t{const e=[];if(!i||!i.length)return"";for(let t=0;t "+i.end(t));return e.join(", ")},V4=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},Ms=i=>{const e=[];for(let t=0;tr)){if(e>s&&e<=r){t+=r-e;continue}t+=r-s}}return t},hp=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(n){t+=n.duration}),(e.preloadHints||[]).forEach(function(n){n.type==="PART"&&(t+=i.partTargetDuration)}),t},dp=i=>(i.segments||[]).reduce((e,t,n)=>(t.parts?t.parts.forEach(function(s,r){e.push({duration:s.duration,segmentIndex:n,partIndex:r,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e),[]),H1=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},W1=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let n=(t||[]).reduce((s,r)=>s+(r.type==="PART"?1:0),0);return n+=e&&e.length?e.length:0,n},X1=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=H1(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},z4=function(i,e){let t=0,n=e-i.mediaSequence,s=i.segments[n];if(s){if(typeof s.start<"u")return{result:s.start,precise:!0};if(typeof s.end<"u")return{result:s.end-s.duration,precise:!0}}for(;n--;){if(s=i.segments[n],typeof s.end<"u")return{result:t+s.end,precise:!0};if(t+=hp(i,s),typeof s.start<"u")return{result:t+s.start,precise:!0}}return{result:t,precise:!1}},q4=function(i,e){let t=0,n,s=e-i.mediaSequence;for(;s"u"&&(e=i.mediaSequence+i.segments.length),e"u"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return P.Infinity}return K1(i,e,t)},Vo=function({defaultDuration:i,durationList:e,startIndex:t,endIndex:n}){let s=0;if(t>n&&([t,n]=[n,t]),t<0){for(let r=t;r0)for(let u=l-1;u>=0;u--){const c=o[u];if(a+=c.duration,r){if(a<0)continue}else if(a+en<=0)continue;return{partIndex:c.partIndex,segmentIndex:c.segmentIndex,startTime:s-Vo({defaultDuration:i.targetDuration,durationList:o,startIndex:l,endIndex:u})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(l<0){for(let u=l;u<0;u++)if(a-=i.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};l=0}for(let u=l;uen,p=a===0,y=d&&a+en>=0;if(!((p||y)&&u!==o.length-1)){if(r){if(a>0)continue}else if(a-en>=0)continue;return{partIndex:c.partIndex,segmentIndex:c.segmentIndex,startTime:s+Vo({defaultDuration:i.targetDuration,durationList:o,startIndex:l,endIndex:u})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},Q1=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},fp=function(i){return i.excludeUntil&&i.excludeUntil===1/0},gc=function(i){const e=Q1(i);return!i.disabled&&!e},W4=function(i){return i.disabled},X4=function(i){for(let e=0;e{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(n=>gc(n)?(n.attributes.BANDWIDTH||0)!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),ev=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let n=!1;for(const s in t){for(const r in t[s])if(n=e(t[s][r]),n)break;if(n)break}return!!n},jo=i=>{if(!i||!i.playlists||!i.playlists.length)return ev(i,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;eM_(r))||ev(i,r=>gp(t,r))))return!1}return!0};var Xt={liveEdgeDelay:X1,duration:Y1,seekable:G4,getMediaInfoForTime:H4,isEnabled:gc,isDisabled:W4,isExcluded:Q1,isIncompatible:fp,playlistEnd:Z1,isAes:X4,hasAttribute:J1,estimateSegmentRequestTime:K4,isLowestEnabledRendition:pp,isAudioOnly:jo,playlistMatch:gp,segmentDurationWithParts:hp};const{log:tv}=B,ua=(i,e)=>`${i}-${e}`,iv=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,Y4=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:n=[],customTagMappers:s=[],llhls:r})=>{const a=new mD;i&&a.on("warn",i),e&&a.on("info",e),n.forEach(u=>a.addParser(u)),s.forEach(u=>a.addTagMapper(u)),a.push(t),a.end();const o=a.manifest;if(r||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(u){o.hasOwnProperty(u)&&delete o[u]}),o.segments&&o.segments.forEach(function(u){["parts","preloadHints"].forEach(function(c){u.hasOwnProperty(c)&&delete u[c]})})),!o.targetDuration){let u=10;o.segments&&o.segments.length&&(u=o.segments.reduce((c,d)=>Math.max(c,d.duration),0)),i&&i({message:`manifest has no targetDuration defaulting to ${u}`}),o.targetDuration=u}const l=H1(o);if(l.length&&!o.partTargetDuration){const u=l.reduce((c,d)=>Math.max(c,d.duration),0);i&&(i({message:`manifest has no partTargetDuration defaulting to ${u}`}),tv.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=u}return o},ca=(i,e)=>{!i.mediaGroups||["AUDIO","SUBTITLES"].forEach(t=>{if(!!i.mediaGroups[t])for(const n in i.mediaGroups[t])for(const s in i.mediaGroups[t][n]){const r=i.mediaGroups[t][n][s];e(r,t,n,s)}})},nv=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},Z4=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];nv({playlist:t,id:ua(e,t.uri)}),t.resolvedUri=Wt(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||tv.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},Q4=i=>{ca(i,e=>{e.uri&&(e.resolvedUri=Wt(i.uri,e.uri))})},J4=(i,e)=>{const t=ua(0,e),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:P.location.href,resolvedUri:P.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return n.playlists[t]=n.playlists[0],n.playlists[e]=n.playlists[0],n},sv=(i,e,t=iv)=>{i.uri=e;for(let s=0;s{if(!s.playlists||!s.playlists.length){if(n&&r==="AUDIO"&&!s.uri)for(let l=0;l(s.set(r.id,r),s),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((n,s)=>{if(!this.processedDateRanges_.has(s)&&(n.startTime=n.startDate.getTime()/1e3-this.offset_,n.processDateRange=()=>this.processDateRange(n),t.push(n),!!n.class))if(e[n.class]){const r=e[n.class].push(n);n.classListIndex=r-1}else e[n.class]=[n],n.classListIndex=0});for(const n of t){const s=e[n.class]||[];n.endDate?n.endTime=n.endDate.getTime()/1e3-this.offset_:n.endOnNext&&s[n.classListIndex+1]?n.endTime=s[n.classListIndex+1].startTime:n.duration?n.endTime=n.startTime+n.duration:n.plannedDuration?n.endTime=n.startTime+n.plannedDuration:n.endTime=n.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((n,s)=>{n.startDate.getTime(){const s=e.status<200||e.status>299,r=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:i},o=s&&!r||n;if(t&&r)a.error=Ke({},t),a.errorType=B.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=B.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=B.Error.NetworkRequestTimeout;else if(o){const l=n?B.Error.NetworkBodyParserFailed:B.Error.NetworkBadStatus;a.errorType=l,a.status=e.status,a.headers=e.headers}return a},{EventTarget:e5}=B,t5=(i,e)=>{if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:n}=e;let s=e.mediaSequence+e.segments.length;if(n){const r=n.parts||[],a=W1(e)-1;a>-1&&a!==r.length-1&&(t._HLS_part=a),(a>-1||r.length)&&s--}t._HLS_msn=s}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const n=new P.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(s){!t.hasOwnProperty(s)||n.searchParams.set(s,t[s])}),i=n.toString()}return i},i5=(i,e)=>{if(!i)return e;const t=ke(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let n=0;n{const n=i.slice(),s=e.slice();t=t||0;const r=[];let a;for(let o=0;o{!i.resolvedUri&&i.uri&&(i.resolvedUri=Wt(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=Wt(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=Wt(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=Wt(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Wt(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Wt(e,t.uri))})},lv=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let n=0;ni===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,mp=(i,e,t=uv)=>{const n=ke(i,{}),s=n.playlists[e.id];if(!s||t(s,e))return null;e.segments=lv(e);const r=ke(s,e);if(r.preloadSegment&&!e.preloadSegment&&delete r.preloadSegment,s.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a{ov(a,r.resolvedUri)});for(let a=0;a{if(!!a.playlists)for(let c=0;c{const t=i.segments||[],n=t[t.length-1],s=n&&n.parts&&n.parts[n.parts.length-1],r=s&&s.duration||n&&n.duration;return e&&r?r*1e3:(i.partTargetDuration||i.targetDuration||10)*500},cv=(i,e,t)=>{if(!i)return;const n=[];return i.forEach(s=>{if(!s.attributes)return;const{BANDWIDTH:r,RESOLUTION:a,CODECS:o}=s.attributes;n.push({id:s.id,bandwidth:r,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:n}};class ha extends e5{constructor(e,t,n={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Ti("PlaylistLoader");const{withCredentials:s=!1}=n;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=n.addDateRangesToTextTrack;const r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.dateRangesStorage_=new rv,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=Wt(this.main.uri,e.uri);this.llhls&&(t=t5(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(n,s)=>{if(!!this.request){if(n)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,n){const{uri:s,id:r}=t;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:Ns({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return Y4({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(n){this.error=n,this.error.metadata={errorType:B.Error.StreamingHlsPlaylistParserError,error:n}}}haveMetadata({playlistString:e,playlistObject:t,url:n,id:s}){this.request=null,this.state="HAVE_METADATA";const r={playlistInfo:{type:"media",uri:n}};this.trigger({type:"playlistparsestart",metadata:r});const a=t||this.parseManifest_({url:n,manifestString:e});a.lastRequest=Date.now(),nv({playlist:a,uri:n,id:s});const o=mp(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(_p(this.media(),!!o)),r.parsedPlaylist=cv(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),P.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new rv,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(P.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=P.setTimeout(this.media.bind(this,e,!1),o);return}const n=this.state,s=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,s&&(this.trigger("mediachanging"),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(_p(e,!0)),!s)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(o,l)=>{if(!!this.request){if(e.lastRequest=Date.now(),e.resolvedUri=fc(e.resolvedUri,l),o)return this.playlistRequestError(this.request,e,n);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:l.responseText,url:e.uri,id:e.id}),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const n=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},n);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=P.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,n)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:n.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:n.responseText,code:2,metadata:Ns({requestType:n.requestType,request:n,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=fc(this.src,n),this.trigger({type:"playlistparsestart",metadata:e});const s=this.parseManifest_({manifestString:n.responseText,url:this.src});e.parsedPlaylist=cv(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,sv(this.main,this.srcUri()),e.playlists.forEach(n=>{n.segments=lv(n),n.segments.forEach(s=>{ov(s,n.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||P.location.href;this.main=J4(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const n=this.main,s=e.ID;let r=n.playlists.length;for(;r--;){const a=n.playlists[r];if(a.attributes["PATHWAY-ID"]===s){const o=a.resolvedUri,l=a.id;if(t){const u=this.createCloneURI_(a.resolvedUri,e),c=ua(s,u),d=this.createCloneAttributes_(s,a.attributes),p=this.createClonePlaylist_(a,c,e,d);n.playlists[r]=p,n.playlists[c]=p,n.playlists[u]=p}else n.playlists.splice(r,1);delete n.playlists[l],delete n.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const n=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!n.mediaGroups[r]||!n.mediaGroups[r][s])){for(const a in n.mediaGroups[r])if(a===s){for(const o in n.mediaGroups[r][a])n.mediaGroups[r][a][o].playlists.forEach((u,c)=>{const d=n.playlists[u.id],p=d.id,y=d.resolvedUri;delete n.playlists[p],delete n.playlists[y]});delete n.mediaGroups[r][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const n=this.main,s=n.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),a=ua(e.ID,r),o=this.createCloneAttributes_(e.ID,t.attributes),l=this.createClonePlaylist_(t,a,e,o);n.playlists[s]=l,n.playlists[a]=l,n.playlists[r]=l,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,n=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!s.mediaGroups[r]||s.mediaGroups[r][t]))for(const a in s.mediaGroups[r]){if(a===n)s.mediaGroups[r][t]={};else continue;for(const o in s.mediaGroups[r][a]){const l=s.mediaGroups[r][a][o];s.mediaGroups[r][t][o]=Ke({},l);const u=s.mediaGroups[r][t][o],c=this.createCloneURI_(l.resolvedUri,e);u.resolvedUri=c,u.uri=c,u.playlists=[],l.playlists.forEach((d,p)=>{const y=s.playlists[d.id],_=iv(r,t,o),T=ua(t,_);if(y&&!s.playlists[T]){const E=this.createClonePlaylist_(y,T,e),S=E.resolvedUri;s.playlists[T]=E,s.playlists[S]=E}u.playlists[p]=this.createClonePlaylist_(d,T,e)})}}})}createClonePlaylist_(e,t,n,s){const r=this.createCloneURI_(e.resolvedUri,n),a={resolvedUri:r,uri:r,id:t};return e.segments&&(a.segments=[]),s&&(a.attributes=s),ke(e,a)}createCloneURI_(e,t){const n=new URL(e);n.hostname=t["URI-REPLACEMENT"].HOST;const s=t["URI-REPLACEMENT"].PARAMS;for(const r of Object.keys(s))n.searchParams.set(r,s[r]);return n.href}createCloneAttributes_(e,t){const n={["PATHWAY-ID"]:e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{t[s]&&(n[s]=e)}),n}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const s=e.contentProtection[n].attributes.keyId;s&&t.add(s.toLowerCase())}return t}}}const yp=function(i,e,t,n){const s=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&s&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=s.byteLength||s.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(s||i.responseText)))),n(e,i)},s5=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(n=>{t=n(t)}),t},r5=(i,e,t,n)=>{!i||!i.size||i.forEach(s=>{s(e,t,n)})},hv=function(){const i=function e(t,n){t=ke({timeout:45e3},t);const s=e.beforeRequest||B.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||B.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||B.Vhs.xhr._responseCallbackSet;s&&typeof s=="function"&&(B.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(s));const o=B.Vhs.xhr.original===!0?B.xhr:B.Vhs.xhr,l=s5(r,t);r.delete(s);const u=o(l||t,function(d,p){return r5(a,u,d,p),yp(u,d,p,n)}),c=u.abort;return u.abort=function(){return u.aborted=!0,c.apply(u,arguments)},u.uri=t.uri,u.requestType=t.requestType,u.requestTime=Date.now(),u};return i.original=!0,i},a5=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=P.BigInt(i.offset)+P.BigInt(i.length)-P.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},vp=function(i){const e={};return i.byterange&&(e.Range=a5(i.byterange)),e},o5=function(i,e){return i.start(e)+"-"+i.end(e)},l5=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},u5=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},dv=function(i){const e={};return Object.keys(i).forEach(t=>{const n=i[t];B_(n)?e[t]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:e[t]=n}),e},mc=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},fv=function(i){return i.resolvedUri},pv=i=>{const e=Array.prototype.slice.call(i),t=16;let n="",s,r;for(let a=0;apv(i),textRanges:i=>{let e="",t;for(t=0;t{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,s=e.videoTimingInfo.transmuxedPresentationStart+t,r=i-s;return new Date(e.dateTimeObject.getTime()+r*1e3)},d5=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,f5=(i,e)=>{let t;try{t=new Date(i)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let n=e.segments[0];if(to?null:(t>new Date(r)&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Xt.duration(e,e.mediaSequence+e.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})},p5=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,n;for(let r=0;rt){if(i>t+s.duration*gv)return null;n=s}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:t-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},g5=(i,e)=>{let t,n;try{t=new Date(i),n=new Date(e)}catch{}const s=t.getTime();return(n.getTime()-s)/1e3},m5=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const n=p5(e,i);if(!n)return t({message:"valid programTime was not found"});if(n.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const s={mediaSeconds:e},r=h5(e,n.segment);return r&&(s.programDateTime=r.toISOString()),t(null,s)},mv=({programTime:i,playlist:e,retryCount:t=2,seekTo:n,pauseAfterSeek:s=!0,tech:r,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i>"u"||!e||!n)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!r.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!m5(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=f5(i,e);if(!o)return a({message:`${i} was not found in the stream`});const l=o.segment,u=g5(l.dateTimeObject,i);if(o.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});n(o.estimatedStart+u),r.one("seeked",()=>{mv({programTime:i,playlist:e,retryCount:t-1,seekTo:n,pauseAfterSeek:s,tech:r,callback:a})});return}const c=l.start+u,d=()=>a(null,r.currentTime());r.one("seeked",d),s&&r.pause(),n(c)},Tp=(i,e)=>{if(i.readyState===4)return e()},y5=(i,e,t,n)=>{let s=[],r,a=!1;const o=function(d,p,y,_){return p.abort(),a=!0,t(d,p,y,_)},l=function(d,p){if(a)return;if(d)return d.metadata=Ns({requestType:n,request:p,error:d}),o(d,p,"",s);const y=p.responseText.substring(s&&s.byteLength||0,p.responseText.length);if(s=ID(s,U_(y,!0)),r=r||wo(s),s.length<10||r&&s.lengtho(d,p,"",s));const _=lf(s);return _==="ts"&&s.length<188?Tp(p,()=>o(d,p,"",s)):!_&&s.length<376?Tp(p,()=>o(d,p,"",s)):o(null,p,_,s)},c=e({uri:i,beforeSend(d){d.overrideMimeType("text/plain; charset=x-user-defined"),d.addEventListener("progress",function({total:p,loaded:y}){return yp(d,null,{statusCode:d.status},l)})}},function(d,p){return yp(c,d,p,l)});return c},{EventTarget:v5}=B,_v=function(i,e){if(!uv(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length))return!1;if(!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t{const s=n.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${s}`},x5=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:n,previousManifest:s})=>{const r=Zk(i,{manifestUri:e,clientOffset:t,sidxMapping:n,previousManifest:s});return sv(r,e,T5),r},b5=(i,e)=>{ca(i,(t,n,s,r)=>{r in e.mediaGroups[n][s]||delete i.mediaGroups[n][s][r]})},E5=(i,e,t)=>{let n=!0,s=ke(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let r=0;r{if(r.playlists&&r.playlists.length){const u=r.playlists[0].id,c=mp(s,r.playlists[0],_v);c&&(s=c,l in s.mediaGroups[a][o]||(s.mediaGroups[a][o][l]=r),s.mediaGroups[a][o][l].playlists[0]=s.playlists[u],n=!1)}}),b5(s,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(n=!1),n?null:s},S5=(i,e)=>(Boolean(!i.map&&!e.map)||Boolean(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,yv=(i,e)=>{const t={};for(const n in i){const r=i[n].sidx;if(r){const a=Du(r);if(!e[a])break;const o=e[a].sidxInfo;S5(o,r)&&(t[a]=e[a])}}return t},C5=(i,e)=>{let n=yv(i.playlists,e);return ca(i,(s,r,a,o)=>{if(s.playlists&&s.playlists.length){const l=s.playlists;n=ke(n,yv(l,e))}}),n};class xp extends v5{constructor(e,t,n={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:r=!1}=n;if(this.vhs_=t,this.withCredentials=r,this.addMetadataToTextTrack=n.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Ti("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,n){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},n&&(this.state=n),this.trigger("error"),!0}addSidxSegments_(e,t,n){const s=e.sidx&&Du(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){this.mediaRequest_=P.setTimeout(()=>n(!1),0);return}const r=fc(e.sidx.resolvedUri),a=(l,u)=>{if(this.requestErrored_(l,u,t))return;const c=this.mainPlaylistLoader_.sidxMapping_,{requestType:d}=u;let p;try{p=iR(ne(u.response).subarray(8))}catch(y){y.metadata=Ns({requestType:d,request:u,parseFailure:!0}),this.requestErrored_(y,u,t);return}return c[s]={sidxInfo:e.sidx,sidx:p},tf(e,p,e.sidx.resolvedUri),n(!0)},o="dash-sidx";this.request=y5(r,this.vhs_.xhr,(l,u,c,d)=>{if(l)return a(l,u);if(!c||c!=="mp4"){const _=c||"unknown";return a({status:u.status,message:`Unsupported ${_} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},u)}const{offset:p,length:y}=e.sidx.byterange;if(d.length>=y+p)return a(l,{response:d.subarray(p,p+y),status:u.status,uri:u.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",requestType:"dash-sidx",headers:vp({byterange:e.sidx.byterange})},a)},o)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},P.clearTimeout(this.minimumUpdatePeriodTimeout_),P.clearTimeout(this.mediaRequest_),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}!n||(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,s=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(P.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const n=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>this.load(),n);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){this.mediaRequest_=P.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(n,s)=>{if(n){const{requestType:a}=s;n.metadata=Ns({requestType:a,request:s,error:n})}if(this.requestErrored_(n,s)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const r=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=fc(this.mainPlaylistLoader_.srcUrl,s),r){this.handleMain_(),this.syncClientServerClock_(()=>e(s,r));return}return e(s,r)})}syncClientServerClock_(e){const t=Qk(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Wt(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(n,s)=>{if(!this.request)return;if(n){const{requestType:a}=s;return this.error.metadata=Ns({requestType:a,request:s,error:n}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let r;t.method==="HEAD"?!s.responseHeaders||!s.responseHeaders.date?r=this.mainLoaded_:r=Date.parse(s.responseHeaders.date):r=Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let n;try{n=x5({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(r){this.error=r,this.error.metadata={errorType:B.Error.StreamingDashManifestParserError,error:r},this.trigger("error")}e&&(n=E5(e,n,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=n||e;const s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!e||n&&n.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(n),n){const{duration:r,endList:a}=n,o=[];n.playlists.forEach(u=>{o.push({id:u.id,bandwidth:u.attributes.BANDWIDTH,resolution:u.attributes.RESOLUTION,codecs:u.attributes.CODECS})});const l={duration:r,isLive:!a,renditions:o};t.parsedManifest=l,this.trigger({type:"manifestparsecomplete",metadata:t})}return Boolean(n)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(P.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=P.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{!t||(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=C5(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,n=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,n=!this.media_||this.media_!==t[e];if(n?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=P.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},_p(this.media(),Boolean(n))))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(n=>({cueTime:n.start,frames:[{data:n.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const s=e.contentProtection[n].attributes["cenc:default_KID"];s&&t.add(s.replace(/-/g,"").toLowerCase())}return t}}}var ft={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const w5=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t-1):!1},this.trigger=function(f){var m,g,v,x;if(m=h[f],!!m)if(arguments.length===2)for(v=m.length,g=0;g"u")){for(h in G)G.hasOwnProperty(h)&&(G[h]=[h.charCodeAt(0),h.charCodeAt(1),h.charCodeAt(2),h.charCodeAt(3)]);Y=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),q=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),ee=new Uint8Array([0,0,0,1]),ie=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),ae=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),Se={video:ie,audio:ae},fe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ge=new Uint8Array([0,0,0,0,0,0,0,0]),Ce=new Uint8Array([0,0,0,0,0,0,0,0]),W=Ce,pt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),at=Ce,ue=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(h){var f=[],m=0,g,v,x;for(g=1;g>>1,h.samplingfrequencyindex<<7|h.channelcount<<3,6,1,2]))},c=function(){return o(G.ftyp,Y,ee,Y,q)},O=function(h){return o(G.hdlr,Se[h])},d=function(h){return o(G.mdat,h)},w=function(h){var f=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,h.duration>>>24&255,h.duration>>>16&255,h.duration>>>8&255,h.duration&255,85,196,0,0]);return h.samplerate&&(f[12]=h.samplerate>>>24&255,f[13]=h.samplerate>>>16&255,f[14]=h.samplerate>>>8&255,f[15]=h.samplerate&255),o(G.mdhd,f)},k=function(h){return o(G.mdia,w(h),O(h.type),y(h))},p=function(h){return o(G.mfhd,new Uint8Array([0,0,0,0,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255]))},y=function(h){return o(G.minf,h.type==="video"?o(G.vmhd,ue):o(G.smhd,ge),l(),F(h))},_=function(h,f){for(var m=[],g=f.length;g--;)m[g]=J(f[g]);return o.apply(null,[G.moof,p(h)].concat(m))},T=function(h){for(var f=h.length,m=[];f--;)m[f]=C(h[f]);return o.apply(null,[G.moov,S(4294967295)].concat(m).concat(E(h)))},E=function(h){for(var f=h.length,m=[];f--;)m[f]=X(h[f]);return o.apply(null,[G.mvex].concat(m))},S=function(h){var f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return o(G.mvhd,f)},N=function(h){var f=h.samples||[],m=new Uint8Array(4+f.length),g,v;for(v=0;v>>8),x.push(g[I].byteLength&255),x=x.concat(Array.prototype.slice.call(g[I]));for(I=0;I>>8),A.push(v[I].byteLength&255),A=A.concat(Array.prototype.slice.call(v[I]));if(R=[G.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(m.width&65280)>>8,m.width&255,(m.height&65280)>>8,m.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(G.avcC,new Uint8Array([1,m.profileIdc,m.profileCompatibility,m.levelIdc,255].concat([g.length],x,[v.length],A))),o(G.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],m.sarRatio){var L=m.sarRatio[0],M=m.sarRatio[1];R.push(o(G.pasp,new Uint8Array([(L&4278190080)>>24,(L&16711680)>>16,(L&65280)>>8,L&255,(M&4278190080)>>24,(M&16711680)>>16,(M&65280)>>8,M&255])))}return o.apply(null,R)},f=function(m){return o(G.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(m.channelcount&65280)>>8,m.channelcount&255,(m.samplesize&65280)>>8,m.samplesize&255,0,0,0,0,(m.samplerate&65280)>>8,m.samplerate&255,0,0]),u(m))}}(),D=function(h){var f=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,0,(h.duration&4278190080)>>24,(h.duration&16711680)>>16,(h.duration&65280)>>8,h.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(h.width&65280)>>8,h.width&255,0,0,(h.height&65280)>>8,h.height&255,0,0]);return o(G.tkhd,f)},J=function(h){var f,m,g,v,x,A,I;return f=o(G.tfhd,new Uint8Array([0,0,0,58,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),A=Math.floor(h.baseMediaDecodeTime/a),I=Math.floor(h.baseMediaDecodeTime%a),m=o(G.tfdt,new Uint8Array([1,0,0,0,A>>>24&255,A>>>16&255,A>>>8&255,A&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255])),x=32+20+8+16+8+8,h.type==="audio"?(g=K(h,x),o(G.traf,f,m,g)):(v=N(h),g=K(h,v.length+x),o(G.traf,f,m,g,v))},C=function(h){return h.duration=h.duration||4294967295,o(G.trak,D(h),k(h))},X=function(h){var f=new Uint8Array([0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return h.type!=="video"&&(f[f.length-1]=0),o(G.trex,f)},function(){var h,f,m;m=function(g,v){var x=0,A=0,I=0,R=0;return g.length&&(g[0].duration!==void 0&&(x=1),g[0].size!==void 0&&(A=2),g[0].flags!==void 0&&(I=4),g[0].compositionTimeOffset!==void 0&&(R=8)),[0,0,x|A|I|R,1,(g.length&4278190080)>>>24,(g.length&16711680)>>>16,(g.length&65280)>>>8,g.length&255,(v&4278190080)>>>24,(v&16711680)>>>16,(v&65280)>>>8,v&255]},f=function(g,v){var x,A,I,R,L,M;for(R=g.samples||[],v+=8+12+16*R.length,I=m(R,v),A=new Uint8Array(I.length+R.length*16),A.set(I),x=I.length,M=0;M>>24,A[x++]=(L.duration&16711680)>>>16,A[x++]=(L.duration&65280)>>>8,A[x++]=L.duration&255,A[x++]=(L.size&4278190080)>>>24,A[x++]=(L.size&16711680)>>>16,A[x++]=(L.size&65280)>>>8,A[x++]=L.size&255,A[x++]=L.flags.isLeading<<2|L.flags.dependsOn,A[x++]=L.flags.isDependedOn<<6|L.flags.hasRedundancy<<4|L.flags.paddingValue<<1|L.flags.isNonSyncSample,A[x++]=L.flags.degradationPriority&240<<8,A[x++]=L.flags.degradationPriority&15,A[x++]=(L.compositionTimeOffset&4278190080)>>>24,A[x++]=(L.compositionTimeOffset&16711680)>>>16,A[x++]=(L.compositionTimeOffset&65280)>>>8,A[x++]=L.compositionTimeOffset&255;return o(G.trun,A)},h=function(g,v){var x,A,I,R,L,M;for(R=g.samples||[],v+=8+12+8*R.length,I=m(R,v),x=new Uint8Array(I.length+R.length*8),x.set(I),A=I.length,M=0;M>>24,x[A++]=(L.duration&16711680)>>>16,x[A++]=(L.duration&65280)>>>8,x[A++]=L.duration&255,x[A++]=(L.size&4278190080)>>>24,x[A++]=(L.size&16711680)>>>16,x[A++]=(L.size&65280)>>>8,x[A++]=L.size&255;return o(G.trun,x)},K=function(g,v){return g.type==="audio"?h(g,v):f(g,v)}}();var Ze={ftyp:c,mdat:d,moof:_,moov:T,initSegment:function(h){var f=c(),m=T(h),g;return g=new Uint8Array(f.byteLength+m.byteLength),g.set(f),g.set(m,f.byteLength),g}},ai=function(h){var f,m,g=[],v=[];for(v.byteLength=0,v.nalCount=0,v.duration=0,g.byteLength=0,f=0;f1&&(f=h.shift(),h.byteLength-=f.byteLength,h.nalCount-=f.nalCount,h[0][0].dts=f.dts,h[0][0].pts=f.pts,h[0][0].duration+=f.duration),h},va=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ls=function(h,f){var m=va();return m.dataOffset=f,m.compositionTimeOffset=h.pts-h.dts,m.duration=h.duration,m.size=4*h.length,m.size+=h.byteLength,h.keyFrame&&(m.flags.dependsOn=2,m.flags.isNonSyncSample=0),m},Jo=function(h,f){var m,g,v,x,A,I=f||0,R=[];for(m=0;mTa.ONE_SECOND_IN_TS/2))){for(L=tl()[h.samplerate],L||(L=f[0].data),M=0;M=m?h:(f.minSegmentDts=1/0,h.filter(function(g){return g.dts>=m?(f.minSegmentDts=Math.min(f.minSegmentDts,g.dts),f.minSegmentPts=f.minSegmentDts,!0):!1}))},il=function(h){var f,m,g=[];for(f=0;f=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(h),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Ln.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Ln.prototype.addText=function(h){this.rows[this.rowIdx]+=h},Ln.prototype.backspace=function(){if(!this.isEmpty()){var h=this.rows[this.rowIdx];this.rows[this.rowIdx]=h.substr(0,h.length-1)}};var Oc=function(h,f,m){this.serviceNum=h,this.text="",this.currentWindow=new Ln(-1),this.windows=[],this.stream=m,typeof f=="string"&&this.createTextDecoder(f)};Oc.prototype.init=function(h,f){this.startPts=h;for(var m=0;m<8;m++)this.windows[m]=new Ln(m),typeof f=="function"&&(this.windows[m].beforeRowOverflow=f)},Oc.prototype.setCurrentWindow=function(h){this.currentWindow=this.windows[h]},Oc.prototype.createTextDecoder=function(h){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(h)}catch(f){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+h+" encoding. "+f})}};var Me=function(h){h=h||{},Me.prototype.init.call(this);var f=this,m=h.captionServices||{},g={},v;Object.keys(m).forEach(x=>{v=m[x],/^SERVICE/.test(x)&&(g[x]=v.encoding)}),this.serviceEncodings=g,this.current708Packet=null,this.services={},this.push=function(x){x.type===3?(f.new708Packet(),f.add708Bytes(x)):(f.current708Packet===null&&f.new708Packet(),f.add708Bytes(x))}};Me.prototype=new Be,Me.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Me.prototype.add708Bytes=function(h){var f=h.ccData,m=f>>>8,g=f&255;this.current708Packet.ptsVals.push(h.pts),this.current708Packet.data.push(m),this.current708Packet.data.push(g)},Me.prototype.push708Packet=function(){var h=this.current708Packet,f=h.data,m=null,g=null,v=0,x=f[v++];for(h.seq=x>>6,h.sizeCode=x&63;v>5,g=x&31,m===7&&g>0&&(x=f[v++],m=x),this.pushServiceBlock(m,v,g),g>0&&(v+=g-1)},Me.prototype.pushServiceBlock=function(h,f,m){var g,v=f,x=this.current708Packet.data,A=this.services[h];for(A||(A=this.initService(h,v));v("0"+(re&255).toString(16)).slice(-2)).join("")}if(v?(U=[I,R],h++):U=[I],f.textDecoder_&&!g)M=f.textDecoder_.decode(new Uint8Array(U));else if(v){const z=Z(U);M=String.fromCharCode(parseInt(z,16))}else M=N8(A|I);return L.pendingNewLine&&!L.isEmpty()&&L.newLine(this.getPts(h)),L.pendingNewLine=!1,L.addText(M),h},Me.prototype.multiByteCharacter=function(h,f){var m=this.current708Packet.data,g=m[h+1],v=m[h+2];return Lc(g)&&Lc(v)&&(h=this.handleText(++h,f,{isMultiByte:!0})),h},Me.prototype.setCurrentWindow=function(h,f){var m=this.current708Packet.data,g=m[h],v=g&7;return f.setCurrentWindow(v),h},Me.prototype.defineWindow=function(h,f){var m=this.current708Packet.data,g=m[h],v=g&7;f.setCurrentWindow(v);var x=f.currentWindow;return g=m[++h],x.visible=(g&32)>>5,x.rowLock=(g&16)>>4,x.columnLock=(g&8)>>3,x.priority=g&7,g=m[++h],x.relativePositioning=(g&128)>>7,x.anchorVertical=g&127,g=m[++h],x.anchorHorizontal=g,g=m[++h],x.anchorPoint=(g&240)>>4,x.rowCount=g&15,g=m[++h],x.columnCount=g&63,g=m[++h],x.windowStyle=(g&56)>>3,x.penStyle=g&7,x.virtualRowCount=x.rowCount+1,h},Me.prototype.setWindowAttributes=function(h,f){var m=this.current708Packet.data,g=m[h],v=f.currentWindow.winAttr;return g=m[++h],v.fillOpacity=(g&192)>>6,v.fillRed=(g&48)>>4,v.fillGreen=(g&12)>>2,v.fillBlue=g&3,g=m[++h],v.borderType=(g&192)>>6,v.borderRed=(g&48)>>4,v.borderGreen=(g&12)>>2,v.borderBlue=g&3,g=m[++h],v.borderType+=(g&128)>>5,v.wordWrap=(g&64)>>6,v.printDirection=(g&48)>>4,v.scrollDirection=(g&12)>>2,v.justify=g&3,g=m[++h],v.effectSpeed=(g&240)>>4,v.effectDirection=(g&12)>>2,v.displayEffect=g&3,h},Me.prototype.flushDisplayed=function(h,f){for(var m=[],g=0;g<8;g++)f.windows[g].visible&&!f.windows[g].isEmpty()&&m.push(f.windows[g].getText());f.endPts=h,f.text=m.join(` `),this.pushCaption(f),f.startPts=h},Me.prototype.pushCaption=function(h){h.text!==""&&(this.trigger("data",{startPts:h.startPts,endPts:h.endPts,text:h.text,stream:"cc708_"+h.serviceNum}),h.text="",h.startPts=h.endPts)},Me.prototype.displayWindows=function(h,f){var m=this.current708Packet.data,g=m[++h],v=this.getPts(h);this.flushDisplayed(v,f);for(var x=0;x<8;x++)g&1<>4,v.offset=(g&12)>>2,v.penSize=g&3,g=m[++h],v.italics=(g&128)>>7,v.underline=(g&64)>>6,v.edgeType=(g&56)>>3,v.fontStyle=g&7,h},Me.prototype.setPenColor=function(h,f){var m=this.current708Packet.data,g=m[h],v=f.currentWindow.penColor;return g=m[++h],v.fgOpacity=(g&192)>>6,v.fgRed=(g&48)>>4,v.fgGreen=(g&12)>>2,v.fgBlue=g&3,g=m[++h],v.bgOpacity=(g&192)>>6,v.bgRed=(g&48)>>4,v.bgGreen=(g&12)>>2,v.bgBlue=g&3,g=m[++h],v.edgeRed=(g&48)>>4,v.edgeGreen=(g&12)>>2,v.edgeBlue=g&3,h},Me.prototype.setPenLocation=function(h,f){var m=this.current708Packet.data,g=m[h],v=f.currentWindow.penLoc;return f.currentWindow.pendingNewLine=!0,g=m[++h],v.row=g&15,g=m[++h],v.column=g&63,h},Me.prototype.reset=function(h,f){var m=this.getPts(h);return this.flushDisplayed(m,f),this.initService(f.serviceNum,h)};var F8={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Mc=function(h){return h===null?"":(h=F8[h]||h,String.fromCharCode(h))},Nc=14,B8=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ws=function(){for(var h=[],f=Nc+1;f--;)h.push({text:"",indent:0,offset:0});return h},qe=function(h,f){qe.prototype.init.call(this),this.field_=h||0,this.dataChannel_=f||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(m){var g,v,x,A,I;if(g=m.ccData&32639,g===this.lastControlCode_){this.lastControlCode_=null;return}if((g&61440)===4096?this.lastControlCode_=g:g!==this.PADDING_&&(this.lastControlCode_=null),x=g>>>8,A=g&255,g!==this.PADDING_)if(g===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(g===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(m.pts),this.flushDisplayed(m.pts),v=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=v,this.startPts_=m.pts;else if(g===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(m.pts);else if(g===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(m.pts);else if(g===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(m.pts);else if(g===this.CARRIAGE_RETURN_)this.clearFormatting(m.pts),this.flushDisplayed(m.pts),this.shiftRowsUp_(),this.startPts_=m.pts;else if(g===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(g===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(m.pts),this.displayed_=Ws();else if(g===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ws();else if(g===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(m.pts),this.displayed_=Ws()),this.mode_="paintOn",this.startPts_=m.pts;else if(this.isSpecialCharacter(x,A))x=(x&3)<<8,I=Mc(x|A),this[this.mode_](m.pts,I),this.column_++;else if(this.isExtCharacter(x,A))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),x=(x&3)<<8,I=Mc(x|A),this[this.mode_](m.pts,I),this.column_++;else if(this.isMidRowCode(x,A))this.clearFormatting(m.pts),this[this.mode_](m.pts," "),this.column_++,(A&14)===14&&this.addFormatting(m.pts,["i"]),(A&1)===1&&this.addFormatting(m.pts,["u"]);else if(this.isOffsetControlCode(x,A)){const L=A&3;this.nonDisplayed_[this.row_].offset=L,this.column_+=L}else if(this.isPAC(x,A)){var R=B8.indexOf(g&7968);if(this.mode_==="rollUp"&&(R-this.rollUpRows_+1<0&&(R=this.rollUpRows_-1),this.setRollUp(m.pts,R)),R!==this.row_&&R>=0&&R<=14&&(this.clearFormatting(m.pts),this.row_=R),A&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(m.pts,["u"]),(g&16)===16){const L=(g&14)>>1;this.column_=L*4,this.nonDisplayed_[this.row_].indent+=L}this.isColorPAC(A)&&(A&14)===14&&this.addFormatting(m.pts,["i"])}else this.isNormalChar(x)&&(A===0&&(A=null),I=Mc(x),I+=Mc(A),this[this.mode_](m.pts,I),this.column_+=I.length)}};qe.prototype=new Be,qe.prototype.flushDisplayed=function(h){const f=g=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+g+"."})},m=[];this.displayed_.forEach((g,v)=>{if(g&&g.text&&g.text.length){try{g.text=g.text.trim()}catch{f(v)}g.text.length&&m.push({text:g.text,line:v+1,position:10+Math.min(70,g.indent*10)+g.offset*2.5})}else g==null&&f(v)}),m.length&&this.trigger("data",{startPts:this.startPts_,endPts:h,content:m,stream:this.name_})},qe.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ws(),this.nonDisplayed_=Ws(),this.lastControlCode_=null,this.column_=0,this.row_=Nc,this.rollUpRows_=2,this.formatting_=[]},qe.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},qe.prototype.isSpecialCharacter=function(h,f){return h===this.EXT_&&f>=48&&f<=63},qe.prototype.isExtCharacter=function(h,f){return(h===this.EXT_+1||h===this.EXT_+2)&&f>=32&&f<=63},qe.prototype.isMidRowCode=function(h,f){return h===this.EXT_&&f>=32&&f<=47},qe.prototype.isOffsetControlCode=function(h,f){return h===this.OFFSET_&&f>=33&&f<=35},qe.prototype.isPAC=function(h,f){return h>=this.BASE_&&h=64&&f<=127},qe.prototype.isColorPAC=function(h){return h>=64&&h<=79||h>=96&&h<=127},qe.prototype.isNormalChar=function(h){return h>=32&&h<=127},qe.prototype.setRollUp=function(h,f){if(this.mode_!=="rollUp"&&(this.row_=Nc,this.mode_="rollUp",this.flushDisplayed(h),this.nonDisplayed_=Ws(),this.displayed_=Ws()),f!==void 0&&f!==this.row_)for(var m=0;m"},"");this[this.mode_](h,m)},qe.prototype.clearFormatting=function(h){if(!!this.formatting_.length){var f=this.formatting_.reverse().reduce(function(m,g){return m+""},"");this.formatting_=[],this[this.mode_](h,f)}},qe.prototype.popOn=function(h,f){var m=this.nonDisplayed_[this.row_].text;m+=f,this.nonDisplayed_[this.row_].text=m},qe.prototype.rollUp=function(h,f){var m=this.displayed_[this.row_].text;m+=f,this.displayed_[this.row_].text=m},qe.prototype.shiftRowsUp_=function(){var h;for(h=0;hf&&(m=-1);Math.abs(f-h)>V8;)h+=m*$8;return h},Hp=function(h){var f,m;Hp.prototype.init.call(this),this.type_=h||QT,this.push=function(g){if(g.type==="metadata"){this.trigger("data",g);return}this.type_!==QT&&g.type!==this.type_||(m===void 0&&(m=g.dts),g.dts=Gp(g.dts,m),g.pts=Gp(g.pts,m),f=g.dts,this.trigger("data",g))},this.flush=function(){m=f,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){m=void 0,f=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Hp.prototype=new U8;var JT={TimestampRolloverStream:Hp,handleRollover:Gp},j8=(h,f,m)=>{if(!h)return-1;for(var g=m;g";h.data[0]===Uc.Utf8&&(m=Bc(h.data,0,f),!(m<0)&&(h.mimeType=rl(h.data,f,m),f=m+1,h.pictureType=h.data[f],f++,g=Bc(h.data,0,f),!(g<0)&&(h.description=sl(h.data,f,g),f=g+1,h.mimeType===v?h.url=rl(h.data,f,h.data.length):h.pictureData=h.data.subarray(f,h.data.length))))},"T*":function(h){h.data[0]===Uc.Utf8&&(h.value=sl(h.data,1,h.data.length).replace(/\0*$/,""),h.values=h.value.split("\0"))},TXXX:function(h){var f;h.data[0]===Uc.Utf8&&(f=Bc(h.data,0,1),f!==-1&&(h.description=sl(h.data,1,f),h.value=sl(h.data,f+1,h.data.length).replace(/\0*$/,""),h.data=h.value))},"W*":function(h){h.url=rl(h.data,0,h.data.length).replace(/\0.*$/,"")},WXXX:function(h){var f;h.data[0]===Uc.Utf8&&(f=Bc(h.data,0,1),f!==-1&&(h.description=sl(h.data,1,f),h.url=rl(h.data,f+1,h.data.length).replace(/\0.*$/,"")))},PRIV:function(h){var f;for(f=0;f>>2;re*=4,re+=z[7]&3,M.timeStamp=re,I.pts===void 0&&I.dts===void 0&&(I.pts=M.timeStamp,I.dts=M.timeStamp),this.trigger("timestamp",M)}I.frames.push(M),R+=10,R+=L}while(R>>4>1&&(A+=v[A]+1),x.pid===0)x.type="pat",h(v.subarray(A),x),this.trigger("data",x);else if(x.pid===this.pmtPid)for(x.type="pmt",h(v.subarray(A),x),this.trigger("data",x);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([v,A,x]):this.processPes_(v,A,x)},this.processPes_=function(v,x,A){A.pid===this.programMapTable.video?A.streamType=Ni.H264_STREAM_TYPE:A.pid===this.programMapTable.audio?A.streamType=Ni.ADTS_STREAM_TYPE:A.streamType=this.programMapTable["timed-metadata"][A.pid],A.type="pes",A.data=v.subarray(x),this.trigger("data",A)}},ll.prototype=new Wp,ll.STREAM_TYPES={h264:27,adts:15},jc=function(){var h=this,f=!1,m={data:[],size:0},g={data:[],size:0},v={data:[],size:0},x,A=function(R,L){var M;const U=R[0]<<16|R[1]<<8|R[2];L.data=new Uint8Array,U===1&&(L.packetLength=6+(R[4]<<8|R[5]),L.dataAlignmentIndicator=(R[6]&4)!==0,M=R[7],M&192&&(L.pts=(R[9]&14)<<27|(R[10]&255)<<20|(R[11]&254)<<12|(R[12]&255)<<5|(R[13]&254)>>>3,L.pts*=4,L.pts+=(R[13]&6)>>>1,L.dts=L.pts,M&64&&(L.dts=(R[14]&14)<<27|(R[15]&255)<<20|(R[16]&254)<<12|(R[17]&255)<<5|(R[18]&254)>>>3,L.dts*=4,L.dts+=(R[18]&6)>>>1)),L.data=R.subarray(9+R[8]))},I=function(R,L,M){var U=new Uint8Array(R.size),Z={type:L},z=0,re=0,ce=!1,ot;if(!(!R.data.length||R.size<9)){for(Z.trackId=R.data[0].pid,z=0;z>5,R=((f[v+6]&3)+1)*1024,L=R*Z8/nx[(f[v+2]&60)>>>2],f.byteLength-v>>6&3)+1,channelcount:(f[v+2]&1)<<2|(f[v+3]&192)>>>6,samplerate:nx[(f[v+2]&60)>>>2],samplingfrequencyindex:(f[v+2]&60)>>>2,samplesize:16,data:f.subarray(v+7+A,v+x)}),m++,v+=x}typeof M=="number"&&(this.skipWarn_(M,v),M=null),f=f.subarray(v)}},this.flush=function(){m=0,this.trigger("done")},this.reset=function(){f=void 0,this.trigger("reset")},this.endTimeline=function(){f=void 0,this.trigger("endedtimeline")}},zc.prototype=new Y8;var Q8=zc,sx;sx=function(h){var f=h.byteLength,m=0,g=0;this.length=function(){return 8*f},this.bitsAvailable=function(){return 8*f+g},this.loadWord=function(){var v=h.byteLength-f,x=new Uint8Array(4),A=Math.min(4,f);if(A===0)throw new Error("no bytes available");x.set(h.subarray(v,v+A)),m=new DataView(x.buffer).getUint32(0),g=A*8,f-=A},this.skipBits=function(v){var x;g>v?(m<<=v,g-=v):(v-=g,x=Math.floor(v/8),v-=x*8,f-=x,this.loadWord(),m<<=v,g-=v)},this.readBits=function(v){var x=Math.min(g,v),A=m>>>32-x;return g-=x,g>0?m<<=x:f>0&&this.loadWord(),x=v-x,x>0?A<>>v)!==0)return m<<=v,g-=v,v;return this.loadWord(),v+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var v=this.skipLeadingZeros();return this.readBits(v+1)-1},this.readExpGolomb=function(){var v=this.readUnsignedExpGolomb();return 1&v?1+v>>>1:-1*(v>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var J8=sx,rx=t,eM=J8,qc,ul,ax;ul=function(){var h=0,f,m;ul.prototype.init.call(this),this.push=function(g){var v;m?(v=new Uint8Array(m.byteLength+g.data.byteLength),v.set(m),v.set(g.data,m.byteLength),m=v):m=g.data;for(var x=m.byteLength;h3&&this.trigger("data",m.subarray(h+3)),m=null,h=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},ul.prototype=new rx,ax={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},qc=function(){var h=new ul,f,m,g,v,x,A,I;qc.prototype.init.call(this),f=this,this.push=function(R){R.type==="video"&&(m=R.trackId,g=R.pts,v=R.dts,h.push(R))},h.on("data",function(R){var L={trackId:m,pts:g,dts:v,data:R,nalUnitTypeCode:R[0]&31};switch(L.nalUnitTypeCode){case 5:L.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:L.nalUnitType="sei_rbsp",L.escapedRBSP=x(R.subarray(1));break;case 7:L.nalUnitType="seq_parameter_set_rbsp",L.escapedRBSP=x(R.subarray(1)),L.config=A(L.escapedRBSP);break;case 8:L.nalUnitType="pic_parameter_set_rbsp";break;case 9:L.nalUnitType="access_unit_delimiter_rbsp";break}f.trigger("data",L)}),h.on("done",function(){f.trigger("done")}),h.on("partialdone",function(){f.trigger("partialdone")}),h.on("reset",function(){f.trigger("reset")}),h.on("endedtimeline",function(){f.trigger("endedtimeline")}),this.flush=function(){h.flush()},this.partialFlush=function(){h.partialFlush()},this.reset=function(){h.reset()},this.endTimeline=function(){h.endTimeline()},I=function(R,L){var M=8,U=8,Z,z;for(Z=0;Z>4;return m=m>=0?m:0,v?m+20:m+10},lx=function(h,f){return h.length-f<10||h[f]!=="I".charCodeAt(0)||h[f+1]!=="D".charCodeAt(0)||h[f+2]!=="3".charCodeAt(0)?f:(f+=ox(h,f),lx(h,f))},nM=function(h){var f=lx(h,0);return h.length>=f+2&&(h[f]&255)===255&&(h[f+1]&240)===240&&(h[f+1]&22)===16},ux=function(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]},sM=function(h,f,m){var g,v="";for(g=f;g>5,g=h[f+4]<<3,v=h[f+3]&3<<11;return v|g|m},oM=function(h,f){return h[f]==="I".charCodeAt(0)&&h[f+1]==="D".charCodeAt(0)&&h[f+2]==="3".charCodeAt(0)?"timed-metadata":h[f]&!0&&(h[f+1]&240)===240?"audio":null},lM=function(h){for(var f=0;f+5>>2]}return null},uM=function(h){var f,m,g,v;f=10,h[5]&64&&(f+=4,f+=ux(h.subarray(10,14)));do{if(m=ux(h.subarray(f+4,f+8)),m<1)return null;if(v=String.fromCharCode(h[f],h[f+1],h[f+2],h[f+3]),v==="PRIV"){g=h.subarray(f+10,f+m+10);for(var x=0;x>>2;return R*=4,R+=I[7]&3,R}break}}f+=10,f+=m}while(f=3;){if(h[v]==="I".charCodeAt(0)&&h[v+1]==="D".charCodeAt(0)&&h[v+2]==="3".charCodeAt(0)){if(h.length-v<10||(g=cx.parseId3TagSize(h,v),v+g>h.length))break;A={type:"timed-metadata",data:h.subarray(v,v+g)},this.trigger("data",A),v+=g;continue}else if((h[v]&255)===255&&(h[v+1]&240)===240){if(h.length-v<7||(g=cx.parseAdtsSize(h,v),v+g>h.length))break;I={type:"audio",data:h.subarray(v,v+g),pts:f,dts:f},this.trigger("data",I),v+=g;continue}v++}x=h.length-v,x>0?h=h.subarray(v):h=new Uint8Array},this.reset=function(){h=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){h=new Uint8Array,this.trigger("endedtimeline")}},Gc.prototype=new cM;var hM=Gc,dM=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],fM=dM,pM=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],gM=pM,Hc=t,cl=Ze,hl=js,Wc=nl,Fi=Pc,On=K8,Xc=Oe,hx=Q8,mM=tM.H264Stream,_M=hM,yM=Zp.isLikelyAacData,vM=Oe.ONE_SECOND_IN_TS,Qp=fM,Jp=gM,dl,ba,Kc,Xs,TM=function(h,f){f.stream=h,this.trigger("log",f)},dx=function(h,f){for(var m=Object.keys(f),g=0;g=-L&&U<=R&&(!Z||M>U)&&(Z=re,M=U)));return Z?Z.gop:null},this.alignGopsAtStart_=function(I){var R,L,M,U,Z,z,re,ce;for(Z=I.byteLength,z=I.nalCount,re=I.duration,R=L=0;RM.pts){R++;continue}L++,Z-=U.byteLength,z-=U.nalCount,re-=U.duration}return L===0?I:L===I.length?null:(ce=I.slice(L),ce.byteLength=Z,ce.duration=re,ce.nalCount=z,ce.pts=ce[0].pts,ce.dts=ce[0].dts,ce)},this.alignGopsAtEnd_=function(I){var R,L,M,U,Z,z;for(R=v.length-1,L=I.length-1,Z=null,z=!1;R>=0&&L>=0;){if(M=v[R],U=I[L],M.pts===U.pts){z=!0;break}if(M.pts>U.pts){R--;continue}R===v.length-1&&(Z=L),L--}if(!z&&Z===null)return null;var re;if(z?re=L:re=Z,re===0)return I;var ce=I.slice(re),ot=ce.reduce(function(Si,Ys){return Si.byteLength+=Ys.byteLength,Si.duration+=Ys.duration,Si.nalCount+=Ys.nalCount,Si},{byteLength:0,duration:0,nalCount:0});return ce.byteLength=ot.byteLength,ce.duration=ot.duration,ce.nalCount=ot.nalCount,ce.pts=ce[0].pts,ce.dts=ce[0].dts,ce},this.alignGopsWith=function(I){v=I}},dl.prototype=new Hc,Xs=function(h,f){this.numberOfTracks=0,this.metadataStream=f,h=h||{},typeof h.remux<"u"?this.remuxTracks=!!h.remux:this.remuxTracks=!0,typeof h.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=h.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Xs.prototype.init.call(this),this.push=function(m){if(m.content||m.text)return this.pendingCaptions.push(m);if(m.frames)return this.pendingMetadata.push(m);this.pendingTracks.push(m.track),this.pendingBytes+=m.boxes.byteLength,m.track.type==="video"&&(this.videoTrack=m.track,this.pendingBoxes.push(m.boxes)),m.track.type==="audio"&&(this.audioTrack=m.track,this.pendingBoxes.unshift(m.boxes))}},Xs.prototype=new Hc,Xs.prototype.flush=function(h){var f=0,m={captions:[],captionStreams:{},metadata:[],info:{}},g,v,x,A=0,I;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(A=this.videoTrack.timelineStartInfo.pts,Jp.forEach(function(R){m.info[R]=this.videoTrack[R]},this)):this.audioTrack&&(A=this.audioTrack.timelineStartInfo.pts,Qp.forEach(function(R){m.info[R]=this.audioTrack[R]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?m.type=this.pendingTracks[0].type:m.type="combined",this.emittedTracks+=this.pendingTracks.length,x=cl.initSegment(this.pendingTracks),m.initSegment=new Uint8Array(x.byteLength),m.initSegment.set(x),m.data=new Uint8Array(this.pendingBytes),I=0;I=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Xs.prototype.setRemux=function(h){this.remuxTracks=h},Kc=function(h){var f=this,m=!0,g,v;Kc.prototype.init.call(this),h=h||{},this.baseMediaDecodeTime=h.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var x={};this.transmuxPipeline_=x,x.type="aac",x.metadataStream=new On.MetadataStream,x.aacStream=new _M,x.audioTimestampRolloverStream=new On.TimestampRolloverStream("audio"),x.timedMetadataTimestampRolloverStream=new On.TimestampRolloverStream("timed-metadata"),x.adtsStream=new hx,x.coalesceStream=new Xs(h,x.metadataStream),x.headOfPipeline=x.aacStream,x.aacStream.pipe(x.audioTimestampRolloverStream).pipe(x.adtsStream),x.aacStream.pipe(x.timedMetadataTimestampRolloverStream).pipe(x.metadataStream).pipe(x.coalesceStream),x.metadataStream.on("timestamp",function(A){x.aacStream.setTimestamp(A.timeStamp)}),x.aacStream.on("data",function(A){A.type!=="timed-metadata"&&A.type!=="audio"||x.audioSegmentStream||(v=v||{timelineStartInfo:{baseMediaDecodeTime:f.baseMediaDecodeTime},codec:"adts",type:"audio"},x.coalesceStream.numberOfTracks++,x.audioSegmentStream=new ba(v,h),x.audioSegmentStream.on("log",f.getLogTrigger_("audioSegmentStream")),x.audioSegmentStream.on("timingInfo",f.trigger.bind(f,"audioTimingInfo")),x.adtsStream.pipe(x.audioSegmentStream).pipe(x.coalesceStream),f.trigger("trackinfo",{hasAudio:!!v,hasVideo:!!g}))}),x.coalesceStream.on("data",this.trigger.bind(this,"data")),x.coalesceStream.on("done",this.trigger.bind(this,"done")),dx(this,x)},this.setupTsPipeline=function(){var x={};this.transmuxPipeline_=x,x.type="ts",x.metadataStream=new On.MetadataStream,x.packetStream=new On.TransportPacketStream,x.parseStream=new On.TransportParseStream,x.elementaryStream=new On.ElementaryStream,x.timestampRolloverStream=new On.TimestampRolloverStream,x.adtsStream=new hx,x.h264Stream=new mM,x.captionStream=new On.CaptionStream(h),x.coalesceStream=new Xs(h,x.metadataStream),x.headOfPipeline=x.packetStream,x.packetStream.pipe(x.parseStream).pipe(x.elementaryStream).pipe(x.timestampRolloverStream),x.timestampRolloverStream.pipe(x.h264Stream),x.timestampRolloverStream.pipe(x.adtsStream),x.timestampRolloverStream.pipe(x.metadataStream).pipe(x.coalesceStream),x.h264Stream.pipe(x.captionStream).pipe(x.coalesceStream),x.elementaryStream.on("data",function(A){var I;if(A.type==="metadata"){for(I=A.tracks.length;I--;)!g&&A.tracks[I].type==="video"?(g=A.tracks[I],g.timelineStartInfo.baseMediaDecodeTime=f.baseMediaDecodeTime):!v&&A.tracks[I].type==="audio"&&(v=A.tracks[I],v.timelineStartInfo.baseMediaDecodeTime=f.baseMediaDecodeTime);g&&!x.videoSegmentStream&&(x.coalesceStream.numberOfTracks++,x.videoSegmentStream=new dl(g,h),x.videoSegmentStream.on("log",f.getLogTrigger_("videoSegmentStream")),x.videoSegmentStream.on("timelineStartInfo",function(R){v&&!h.keepOriginalTimestamps&&(v.timelineStartInfo=R,x.audioSegmentStream.setEarliestDts(R.dts-f.baseMediaDecodeTime))}),x.videoSegmentStream.on("processedGopsInfo",f.trigger.bind(f,"gopInfo")),x.videoSegmentStream.on("segmentTimingInfo",f.trigger.bind(f,"videoSegmentTimingInfo")),x.videoSegmentStream.on("baseMediaDecodeTime",function(R){v&&x.audioSegmentStream.setVideoBaseMediaDecodeTime(R)}),x.videoSegmentStream.on("timingInfo",f.trigger.bind(f,"videoTimingInfo")),x.h264Stream.pipe(x.videoSegmentStream).pipe(x.coalesceStream)),v&&!x.audioSegmentStream&&(x.coalesceStream.numberOfTracks++,x.audioSegmentStream=new ba(v,h),x.audioSegmentStream.on("log",f.getLogTrigger_("audioSegmentStream")),x.audioSegmentStream.on("timingInfo",f.trigger.bind(f,"audioTimingInfo")),x.audioSegmentStream.on("segmentTimingInfo",f.trigger.bind(f,"audioSegmentTimingInfo")),x.adtsStream.pipe(x.audioSegmentStream).pipe(x.coalesceStream)),f.trigger("trackinfo",{hasAudio:!!v,hasVideo:!!g})}}),x.coalesceStream.on("data",this.trigger.bind(this,"data")),x.coalesceStream.on("id3Frame",function(A){A.dispatchType=x.metadataStream.dispatchType,f.trigger("id3Frame",A)}),x.coalesceStream.on("caption",this.trigger.bind(this,"caption")),x.coalesceStream.on("done",this.trigger.bind(this,"done")),dx(this,x)},this.setBaseMediaDecodeTime=function(x){var A=this.transmuxPipeline_;h.keepOriginalTimestamps||(this.baseMediaDecodeTime=x),v&&(v.timelineStartInfo.dts=void 0,v.timelineStartInfo.pts=void 0,Fi.clearDtsInfo(v),A.audioTimestampRolloverStream&&A.audioTimestampRolloverStream.discontinuity()),g&&(A.videoSegmentStream&&(A.videoSegmentStream.gopCache_=[]),g.timelineStartInfo.dts=void 0,g.timelineStartInfo.pts=void 0,Fi.clearDtsInfo(g),A.captionStream.reset()),A.timestampRolloverStream&&A.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(x){v&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(x)},this.setRemux=function(x){var A=this.transmuxPipeline_;h.remux=x,A&&A.coalesceStream&&A.coalesceStream.setRemux(x)},this.alignGopsWith=function(x){g&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(x)},this.getLogTrigger_=function(x){var A=this;return function(I){I.stream=x,A.trigger("log",I)}},this.push=function(x){if(m){var A=yM(x);A&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!A&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),m=!1}this.transmuxPipeline_.headOfPipeline.push(x)},this.flush=function(){m=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Kc.prototype=new Hc;var xM={Transmuxer:Kc,VideoSegmentStream:dl,AudioSegmentStream:ba,AUDIO_PROPERTIES:Qp,VIDEO_PROPERTIES:Jp,generateSegmentTimingInfo:eg},bM=function(h){return h>>>0},EM=function(h){return("00"+h.toString(16)).slice(-2)},Yc={toUnsigned:bM,toHexString:EM},SM=function(h){var f="";return f+=String.fromCharCode(h[0]),f+=String.fromCharCode(h[1]),f+=String.fromCharCode(h[2]),f+=String.fromCharCode(h[3]),f},px=SM,CM=Yc.toUnsigned,wM=px,gx=function(h,f){var m=[],g,v,x,A,I;if(!f.length)return null;for(g=0;g1?g+v:h.byteLength,x===f[0]&&(f.length===1?m.push(h.subarray(g+8,A)):(I=gx(h.subarray(g+8,A),f.slice(1)),I.length&&(m=m.concat(I)))),g=A;return m},mx=gx,AM=Yc.toUnsigned,IM=r.getUint64,DM=function(h){var f={version:h[0],flags:new Uint8Array(h.subarray(1,4))};return f.version===1?f.baseMediaDecodeTime=IM(h.subarray(4)):f.baseMediaDecodeTime=AM(h[4]<<24|h[5]<<16|h[6]<<8|h[7]),f},_x=DM,kM=function(h){return{isLeading:(h[0]&12)>>>2,dependsOn:h[0]&3,isDependedOn:(h[1]&192)>>>6,hasRedundancy:(h[1]&48)>>>4,paddingValue:(h[1]&14)>>>1,isNonSyncSample:h[1]&1,degradationPriority:h[2]<<8|h[3]}},RM=kM,yx=RM,PM=function(h){var f={version:h[0],flags:new Uint8Array(h.subarray(1,4)),samples:[]},m=new DataView(h.buffer,h.byteOffset,h.byteLength),g=f.flags[2]&1,v=f.flags[2]&4,x=f.flags[1]&1,A=f.flags[1]&2,I=f.flags[1]&4,R=f.flags[1]&8,L=m.getUint32(4),M=8,U;for(g&&(f.dataOffset=m.getInt32(M),M+=4),v&&L&&(U={flags:yx(h.subarray(M,M+4))},M+=4,x&&(U.duration=m.getUint32(M),M+=4),A&&(U.size=m.getUint32(M),M+=4),R&&(f.version===1?U.compositionTimeOffset=m.getInt32(M):U.compositionTimeOffset=m.getUint32(M),M+=4),f.samples.push(U),L--);L--;)U={},x&&(U.duration=m.getUint32(M),M+=4),A&&(U.size=m.getUint32(M),M+=4),I&&(U.flags=yx(h.subarray(M,M+4)),M+=4),R&&(f.version===1?U.compositionTimeOffset=m.getInt32(M):U.compositionTimeOffset=m.getUint32(M),M+=4),f.samples.push(U);return f},vx=PM,LM=function(h){var f=new DataView(h.buffer,h.byteOffset,h.byteLength),m={version:h[0],flags:new Uint8Array(h.subarray(1,4)),trackId:f.getUint32(4)},g=m.flags[2]&1,v=m.flags[2]&2,x=m.flags[2]&8,A=m.flags[2]&16,I=m.flags[2]&32,R=m.flags[0]&65536,L=m.flags[0]&131072,M;return M=8,g&&(M+=4,m.baseDataOffset=f.getUint32(12),M+=4),v&&(m.sampleDescriptionIndex=f.getUint32(M),M+=4),x&&(m.defaultSampleDuration=f.getUint32(M),M+=4),A&&(m.defaultSampleSize=f.getUint32(M),M+=4),I&&(m.defaultSampleFlags=f.getUint32(M)),R&&(m.durationIsEmpty=!0),!g&&L&&(m.baseDataOffsetIsMoof=!0),m},Tx=LM,fl;typeof window<"u"?fl=window:typeof i<"u"?fl=i:typeof self<"u"?fl=self:fl={};var xx=fl,OM=Ei.discardEmulationPreventionBytes,MM=ZT.CaptionStream,pl=mx,NM=_x,FM=vx,BM=Tx,bx=xx,UM=function(h,f){for(var m=h,g=0;g0?NM(Z[0]).baseMediaDecodeTime:0,re=pl(R,["trun"]),ce,ot;f===U&&re.length>0&&(ce=VM(re,z,M),ot=$M(I,ce,U),v[U]||(v[U]={seiNals:[],logs:[]}),v[U].seiNals=v[U].seiNals.concat(ot.seiNals),v[U].logs=v[U].logs.concat(ot.logs))}),v},zM=function(h,f,m){var g;if(f===null)return null;g=jM(h,f);var v=g[f]||{};return{seiNals:v.seiNals,logs:v.logs,timescale:m}},qM=function(){var h=!1,f,m,g,v,x,A;this.isInitialized=function(){return h},this.init=function(I){f=new MM,h=!0,A=I?I.isPartial:!1,f.on("data",function(R){R.startTime=R.startPts/v,R.endTime=R.endPts/v,x.captions.push(R),x.captionStreams[R.stream]=!0}),f.on("log",function(R){x.logs.push(R)})},this.isNewInit=function(I,R){return I&&I.length===0||R&&typeof R=="object"&&Object.keys(R).length===0?!1:g!==I[0]||v!==R[g]},this.parse=function(I,R,L){var M;if(this.isInitialized()){if(!R||!L)return null;if(this.isNewInit(R,L))g=R[0],v=L[g];else if(g===null||!v)return m.push(I),null}else return null;for(;m.length>0;){var U=m.shift();this.parse(U,R,L)}return M=zM(I,g,v),M&&M.logs&&(x.logs=x.logs.concat(M.logs)),M===null||!M.seiNals?x.logs.length?{logs:x.logs,captions:[],captionStreams:[]}:null:(this.pushNals(M.seiNals),this.flushStream(),x)},this.pushNals=function(I){if(!this.isInitialized()||!I||I.length===0)return null;I.forEach(function(R){f.push(R)})},this.flushStream=function(){if(!this.isInitialized())return null;A?f.partialFlush():f.flush()},this.clearParsedCaptions=function(){x.captions=[],x.captionStreams={},x.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;f.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){m=[],g=null,v=null,x?this.clearParsedCaptions():x={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},GM=qM,HM=function(h){for(var f=0,m=String.fromCharCode(h[f]),g="";m!=="\0";)g+=m,f++,m=String.fromCharCode(h[f]);return g+=m,g},WM={uint8ToCString:HM},Zc=WM.uint8ToCString,XM=r.getUint64,KM=function(h){var f=4,m=h[0],g,v,x,A,I,R,L,M;if(m===0){g=Zc(h.subarray(f)),f+=g.length,v=Zc(h.subarray(f)),f+=v.length;var U=new DataView(h.buffer);x=U.getUint32(f),f+=4,I=U.getUint32(f),f+=4,R=U.getUint32(f),f+=4,L=U.getUint32(f),f+=4}else if(m===1){var U=new DataView(h.buffer);x=U.getUint32(f),f+=4,A=XM(h.subarray(f)),f+=8,R=U.getUint32(f),f+=4,L=U.getUint32(f),f+=4,g=Zc(h.subarray(f)),f+=g.length,v=Zc(h.subarray(f)),f+=v.length}M=new Uint8Array(h.subarray(f,h.byteLength));var Z={scheme_id_uri:g,value:v,timescale:x||1,presentation_time:A,presentation_time_delta:I,event_duration:R,id:L,message_data:M};return ZM(m,Z)?Z:void 0},YM=function(h,f,m,g){return h||h===0?h/f:g+m/f},ZM=function(h,f){var m=f.scheme_id_uri!=="\0",g=h===0&&Ex(f.presentation_time_delta)&&m,v=h===1&&Ex(f.presentation_time)&&m;return!(h>1)&&g||v},Ex=function(h){return h!==void 0||h!==null},QM={parseEmsgBox:KM,scaleTime:YM},Qc=Yc.toUnsigned,gl=Yc.toHexString,et=mx,Ea=px,tg=QM,JM=Tx,eN=vx,tN=_x,iN=r.getUint64,Sx,Cx,wx,Ax,Ix,ig,Dx,ng=xx,nN=tx.parseId3Frames;Sx=function(h){var f={},m=et(h,["moov","trak"]);return m.reduce(function(g,v){var x,A,I,R,L;return x=et(v,["tkhd"])[0],!x||(A=x[0],I=A===0?12:20,R=Qc(x[I]<<24|x[I+1]<<16|x[I+2]<<8|x[I+3]),L=et(v,["mdia","mdhd"])[0],!L)?null:(A=L[0],I=A===0?12:20,g[R]=Qc(L[I]<<24|L[I+1]<<16|L[I+2]<<8|L[I+3]),g)},f)},Cx=function(h,f){var m;m=et(f,["moof","traf"]);var g=m.reduce(function(v,x){var A=et(x,["tfhd"])[0],I=Qc(A[4]<<24|A[5]<<16|A[6]<<8|A[7]),R=h[I]||9e4,L=et(x,["tfdt"])[0],M=new DataView(L.buffer,L.byteOffset,L.byteLength),U;L[0]===1?U=iN(L.subarray(4,12)):U=M.getUint32(4);let Z;return typeof U=="bigint"?Z=U/ng.BigInt(R):typeof U=="number"&&!isNaN(U)&&(Z=U/R),Z11?(v.codec+=".",v.codec+=gl(z[9]),v.codec+=gl(z[10]),v.codec+=gl(z[11])):v.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(v.codec)?(z=Z.subarray(28),re=Ea(z.subarray(4,8)),re==="esds"&&z.length>20&&z[19]!==0?(v.codec+="."+gl(z[19]),v.codec+="."+gl(z[20]>>>2&63).replace(/^0/,"")):v.codec="mp4a.40.2"):v.codec=v.codec.toLowerCase())}var ce=et(g,["mdia","mdhd"])[0];ce&&(v.timescale=ig(ce)),m.push(v)}),m},Dx=function(h,f=0){var m=et(h,["emsg"]);return m.map(g=>{var v=tg.parseEmsgBox(new Uint8Array(g)),x=nN(v.message_data);return{cueTime:tg.scaleTime(v.presentation_time,v.timescale,v.presentation_time_delta,f),duration:tg.scaleTime(v.event_duration,v.timescale),frames:x}})};var sg={findBox:et,parseType:Ea,timescale:Sx,startTime:Cx,compositionStartTime:wx,videoTrackIds:Ax,tracks:Ix,getTimescaleFromMediaHeader:ig,getEmsgID3:Dx},rg=Fc,kx=function(h){var f=h[1]&31;return f<<=8,f|=h[2],f},Jc=function(h){return!!(h[1]&64)},eh=function(h){var f=0;return(h[3]&48)>>>4>1&&(f+=h[4]+1),f},sN=function(h,f){var m=kx(h);return m===0?"pat":m===f?"pmt":f?"pes":null},rN=function(h){var f=Jc(h),m=4+eh(h);return f&&(m+=h[m]+1),(h[m+10]&31)<<8|h[m+11]},aN=function(h){var f={},m=Jc(h),g=4+eh(h);if(m&&(g+=h[g]+1),!!(h[g+5]&1)){var v,x,A;v=(h[g+1]&15)<<8|h[g+2],x=3+v-4,A=(h[g+10]&15)<<8|h[g+11];for(var I=12+A;I=h.byteLength)return null;var g=null,v;return v=h[m+7],v&192&&(g={},g.pts=(h[m+9]&14)<<27|(h[m+10]&255)<<20|(h[m+11]&254)<<12|(h[m+12]&255)<<5|(h[m+13]&254)>>>3,g.pts*=4,g.pts+=(h[m+13]&6)>>>1,g.dts=g.pts,v&64&&(g.dts=(h[m+14]&14)<<27|(h[m+15]&255)<<20|(h[m+16]&254)<<12|(h[m+17]&255)<<5|(h[m+18]&254)>>>3,g.dts*=4,g.dts+=(h[m+18]&6)>>>1)),g},ag=function(h){switch(h){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},uN=function(h){for(var f=4+eh(h),m=h.subarray(f),g=0,v=0,x=!1,A;v3&&(A=ag(m[v+3]&31),A==="slice_layer_without_partitioning_rbsp_idr"&&(x=!0)),x},cN={parseType:sN,parsePat:rN,parsePmt:aN,parsePayloadUnitStartIndicator:Jc,parsePesType:oN,parsePesTime:lN,videoPacketContainsKeyFrame:uN},Rx=Fc,Sa=JT.handleRollover,Le={};Le.ts=cN,Le.aac=Zp;var Ks=Oe.ONE_SECOND_IN_TS,Nt=188,ln=71,hN=function(h,f){for(var m=0,g=Nt,v,x;g=0;){if(h[g]===ln&&(h[v]===ln||v===h.byteLength)){switch(x=h.subarray(g,v),A=Le.ts.parseType(x,f.pid),A){case"pes":I=Le.ts.parsePesType(x,f.table),R=Le.ts.parsePayloadUnitStartIndicator(x),I==="audio"&&R&&(L=Le.ts.parsePesTime(x),L&&(L.type="audio",m.audio.push(L),M=!0));break}if(M)break;g-=Nt,v-=Nt;continue}g--,v--}},dN=function(h,f,m){for(var g=0,v=Nt,x,A,I,R,L,M,U,Z,z=!1,re={data:[],size:0};v=0;){if(h[g]===ln&&h[v]===ln){switch(x=h.subarray(g,v),A=Le.ts.parseType(x,f.pid),A){case"pes":I=Le.ts.parsePesType(x,f.table),R=Le.ts.parsePayloadUnitStartIndicator(x),I==="video"&&R&&(L=Le.ts.parsePesTime(x),L&&(L.type="video",m.video.push(L),z=!0));break}if(z)break;g-=Nt,v-=Nt;continue}g--,v--}},fN=function(h,f){if(h.audio&&h.audio.length){var m=f;(typeof m>"u"||isNaN(m))&&(m=h.audio[0].dts),h.audio.forEach(function(x){x.dts=Sa(x.dts,m),x.pts=Sa(x.pts,m),x.dtsTime=x.dts/Ks,x.ptsTime=x.pts/Ks})}if(h.video&&h.video.length){var g=f;if((typeof g>"u"||isNaN(g))&&(g=h.video[0].dts),h.video.forEach(function(x){x.dts=Sa(x.dts,g),x.pts=Sa(x.pts,g),x.dtsTime=x.dts/Ks,x.ptsTime=x.pts/Ks}),h.firstKeyFrame){var v=h.firstKeyFrame;v.dts=Sa(v.dts,g),v.pts=Sa(v.pts,g),v.dtsTime=v.dts/Ks,v.ptsTime=v.pts/Ks}}},pN=function(h){for(var f=!1,m=0,g=null,v=null,x=0,A=0,I;h.length-A>=3;){var R=Le.aac.parseType(h,A);switch(R){case"timed-metadata":if(h.length-A<10){f=!0;break}if(x=Le.aac.parseId3TagSize(h,A),x>h.length){f=!0;break}v===null&&(I=h.subarray(A,A+x),v=Le.aac.parseAacTimestamp(I)),A+=x;break;case"audio":if(h.length-A<7){f=!0;break}if(x=Le.aac.parseAdtsSize(h,A),x>h.length){f=!0;break}g===null&&(I=h.subarray(A,A+x),g=Le.aac.parseSampleRate(I)),m++,A+=x;break;default:A++;break}if(f)return null}if(g===null||v===null)return null;var L=Ks/g,M={audio:[{type:"audio",dts:v,pts:v},{type:"audio",dts:v+m*1024*L,pts:v+m*1024*L}]};return M},gN=function(h){var f={pid:null,table:null},m={};hN(h,f);for(var g in f.table)if(f.table.hasOwnProperty(g)){var v=f.table[g];switch(v){case Rx.H264_STREAM_TYPE:m.video=[],dN(h,f,m),m.video.length===0&&delete m.video;break;case Rx.ADTS_STREAM_TYPE:m.audio=[],Px(h,f,m),m.audio.length===0&&delete m.audio;break}}return m},mN=function(h,f){var m=Le.aac.isLikelyAacData(h),g;return m?g=pN(h):g=gN(h),!g||!g.audio&&!g.video?null:(fN(g,f),g)},_N={inspect:mN,parseAudioPes_:Px};const yN=function(h,f){f.on("data",function(m){const g=m.initSegment;m.initSegment={data:g.buffer,byteOffset:g.byteOffset,byteLength:g.byteLength};const v=m.data;m.data=v.buffer,h.postMessage({action:"data",segment:m,byteOffset:v.byteOffset,byteLength:v.byteLength},[m.data])}),f.on("done",function(m){h.postMessage({action:"done"})}),f.on("gopInfo",function(m){h.postMessage({action:"gopInfo",gopInfo:m})}),f.on("videoSegmentTimingInfo",function(m){const g={start:{decode:Oe.videoTsToSeconds(m.start.dts),presentation:Oe.videoTsToSeconds(m.start.pts)},end:{decode:Oe.videoTsToSeconds(m.end.dts),presentation:Oe.videoTsToSeconds(m.end.pts)},baseMediaDecodeTime:Oe.videoTsToSeconds(m.baseMediaDecodeTime)};m.prependedContentDuration&&(g.prependedContentDuration=Oe.videoTsToSeconds(m.prependedContentDuration)),h.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:g})}),f.on("audioSegmentTimingInfo",function(m){const g={start:{decode:Oe.videoTsToSeconds(m.start.dts),presentation:Oe.videoTsToSeconds(m.start.pts)},end:{decode:Oe.videoTsToSeconds(m.end.dts),presentation:Oe.videoTsToSeconds(m.end.pts)},baseMediaDecodeTime:Oe.videoTsToSeconds(m.baseMediaDecodeTime)};m.prependedContentDuration&&(g.prependedContentDuration=Oe.videoTsToSeconds(m.prependedContentDuration)),h.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:g})}),f.on("id3Frame",function(m){h.postMessage({action:"id3Frame",id3Frame:m})}),f.on("caption",function(m){h.postMessage({action:"caption",caption:m})}),f.on("trackinfo",function(m){h.postMessage({action:"trackinfo",trackInfo:m})}),f.on("audioTimingInfo",function(m){h.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Oe.videoTsToSeconds(m.start),end:Oe.videoTsToSeconds(m.end)}})}),f.on("videoTimingInfo",function(m){h.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Oe.videoTsToSeconds(m.start),end:Oe.videoTsToSeconds(m.end)}})}),f.on("log",function(m){h.postMessage({action:"log",log:m})})};class Lx{constructor(f,m){this.options=m||{},this.self=f,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new xM.Transmuxer(this.options),yN(this.self,this.transmuxer)}pushMp4Captions(f){this.captionParser||(this.captionParser=new GM,this.captionParser.init());const m=new Uint8Array(f.data,f.byteOffset,f.byteLength),g=this.captionParser.parse(m,f.trackIds,f.timescales);this.self.postMessage({action:"mp4Captions",captions:g&&g.captions||[],logs:g&&g.logs||[],data:m.buffer},[m.buffer])}probeMp4StartTime({timescales:f,data:m}){const g=sg.startTime(f,m);this.self.postMessage({action:"probeMp4StartTime",startTime:g,data:m},[m.buffer])}probeMp4Tracks({data:f}){const m=sg.tracks(f);this.self.postMessage({action:"probeMp4Tracks",tracks:m,data:f},[f.buffer])}probeEmsgID3({data:f,offset:m}){const g=sg.getEmsgID3(f,m);this.self.postMessage({action:"probeEmsgID3",id3Frames:g,emsgData:f},[f.buffer])}probeTs({data:f,baseStartTime:m}){const g=typeof m=="number"&&!isNaN(m)?m*Oe.ONE_SECOND_IN_TS:void 0,v=_N.inspect(f,g);let x=null;v&&(x={hasVideo:v.video&&v.video.length===2||!1,hasAudio:v.audio&&v.audio.length===2||!1},x.hasVideo&&(x.videoStart=v.video[0].ptsTime),x.hasAudio&&(x.audioStart=v.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:x,data:f},[f.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(f){const m=new Uint8Array(f.data,f.byteOffset,f.byteLength);this.transmuxer.push(m)}reset(){this.transmuxer.reset()}setTimestampOffset(f){const m=f.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Oe.secondsToVideoTs(m)))}setAudioAppendStart(f){this.transmuxer.setAudioAppendStart(Math.ceil(Oe.secondsToVideoTs(f.appendStart)))}setRemux(f){this.transmuxer.setRemux(f.remux)}flush(f){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(f){this.transmuxer.alignGopsWith(f.gopsToAlignWith.slice())}}self.onmessage=function(h){if(h.data.action==="init"&&h.data.options){this.messageHandlers=new Lx(self,h.data.options);return}this.messageHandlers||(this.messageHandlers=new Lx(self)),h.data&&h.data.action&&h.data.action!=="init"&&this.messageHandlers[h.data.action]&&this.messageHandlers[h.data.action](h.data)}}));var D5=Tv(I5);const k5=(i,e,t)=>{const{type:n,initSegment:s,captions:r,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:u}=i.data.segment;e.buffer.push({captions:r,captionStreams:a,metadata:o});const c=i.data.segment.boxes||{data:i.data.segment.data},d={type:n,data:new Uint8Array(c.data,c.data.byteOffset,c.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};typeof l<"u"&&(d.videoFrameDtsTime=l),typeof u<"u"&&(d.videoFramePtsTime=u),t(d)},R5=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},P5=(i,e)=>{e.gopInfo=i.data.gopInfo},Ev=i=>{const{transmuxer:e,bytes:t,audioAppendStart:n,gopsToAlignWith:s,remux:r,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:u,onVideoSegmentTimingInfo:c,onAudioSegmentTimingInfo:d,onId3:p,onCaptions:y,onDone:_,onEndedTimeline:T,onTransmuxerLog:E,isEndOfTimeline:S,segment:C,triggerSegmentEventFn:D}=i,k={buffer:[]};let w=S;const O=F=>{e.currentTransmux===i&&(F.data.action==="data"&&k5(F,k,a),F.data.action==="trackinfo"&&o(F.data.trackInfo),F.data.action==="gopInfo"&&P5(F,k),F.data.action==="audioTimingInfo"&&l(F.data.audioTimingInfo),F.data.action==="videoTimingInfo"&&u(F.data.videoTimingInfo),F.data.action==="videoSegmentTimingInfo"&&c(F.data.videoSegmentTimingInfo),F.data.action==="audioSegmentTimingInfo"&&d(F.data.audioSegmentTimingInfo),F.data.action==="id3Frame"&&p([F.data.id3Frame],F.data.id3Frame.dispatchType),F.data.action==="caption"&&y(F.data.caption),F.data.action==="endedtimeline"&&(w=!1,T()),F.data.action==="log"&&E(F.data.log),F.data.type==="transmuxed"&&(w||(e.onmessage=null,R5({transmuxedData:k,callback:_}),Sv(e))))},N=()=>{const F={message:"Received an error message from the transmuxer worker",metadata:{errorType:B.Error.StreamingFailedToTransmuxSegment,segmentInfo:Fs({segment:C})}};_(null,F)};if(e.onmessage=O,e.onerror=N,n&&e.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(s)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),typeof r<"u"&&e.postMessage({action:"setRemux",remux:r}),t.byteLength){const F=t instanceof ArrayBuffer?t:t.buffer,$=t instanceof ArrayBuffer?0:t.byteOffset;D({type:"segmenttransmuxingstart",segment:C}),e.postMessage({action:"push",data:F,byteOffset:$,byteLength:t.byteLength},[F])}S&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Sv=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():Ev(i.currentTransmux))},Cv=(i,e)=>{i.postMessage({action:e}),Sv(i)},wv=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,Cv(e,i);return}e.transmuxQueue.push(Cv.bind(null,e,i))},L5=i=>{wv("reset",i)},O5=i=>{wv("endTimeline",i)},Av=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,Ev(i);return}i.transmuxer.transmuxQueue.push(i)};var bp={reset:L5,endTimeline:O5,transmux:Av,createTransmuxer:i=>{const e=new D5;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:i}),e}};const zo=function(i){const e=i.transmuxer,t=i.endAction||i.action,n=i.callback,s=Ke({},i,{endAction:null,transmuxer:null,callback:null}),r=a=>{a.data.action===t&&(e.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,i.byteOffset||0,i.byteLength||a.data.data.byteLength),i.data&&(i.data=a.data.data)),n(a.data))};if(e.addEventListener("message",r),i.data){const a=i.data instanceof ArrayBuffer;s.byteOffset=a?0:i.data.byteOffset,s.byteLength=i.data.byteLength;const o=[a?i.data:i.data.buffer];e.postMessage(s,o)}else e.postMessage(s)},nn={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Ep=i=>{i.forEach(e=>{e.abort()})},M5=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),N5=i=>{const e=i.target,n={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return n.bytesReceived=i.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n},Sp=(i,e)=>{const{requestType:t}=e,n=Ns({requestType:t,request:e,error:i});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:nn.TIMEOUT,xhr:e,metadata:n}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:nn.ABORTED,xhr:e,metadata:n}:i?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:nn.FAILURE,xhr:e,metadata:n}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:nn.FAILURE,xhr:e,metadata:n}:null},Iv=(i,e,t,n)=>(s,r)=>{const a=r.response,o=Sp(s,r);if(o)return t(o,i);if(a.byteLength!==16)return t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:nn.FAILURE,xhr:r},i);const l=new DataView(a),u=new Uint32Array([l.getUint32(0),l.getUint32(4),l.getUint32(8),l.getUint32(12)]);for(let d=0;d{const t=lf(i.map.bytes);if(t!=="mp4"){const n=i.map.resolvedUri||i.map.uri,s=t||"unknown";return e({internal:!0,message:`Found unsupported ${s} container for initialization segment at URL: ${n}`,code:nn.FAILURE,metadata:{mediaType:s}})}zo({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:n,data:s})=>(i.map.bytes=s,n.forEach(function(r){i.map.tracks=i.map.tracks||{},!i.map.tracks[r.type]&&(i.map.tracks[r.type]=r,typeof r.id=="number"&&r.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[r.id]=r.timescale))}),e(null))})},F5=({segment:i,finishProcessingFn:e,triggerSegmentEventFn:t})=>(n,s)=>{const r=Sp(n,s);if(r)return e(r,i);const a=new Uint8Array(s.response);if(t({type:"segmentloaded",segment:i}),i.map.key)return i.map.encryptedBytes=a,e(null,i);i.map.bytes=a,Dv(i,function(o){if(o)return o.xhr=s,o.status=s.status,e(o,i);e(null,i)})},B5=({segment:i,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:n})=>(s,r)=>{const a=Sp(s,r);if(a)return e(a,i);n({type:"segmentloaded",segment:i});const o=t==="arraybuffer"||!r.responseText?r.response:w5(r.responseText.substring(i.lastReachedChar||0));return i.stats=M5(r),i.key?i.encryptedBytes=new Uint8Array(o):i.bytes=new Uint8Array(o),e(null,i)},U5=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y})=>{const _=i.map&&i.map.tracks||{},T=Boolean(_.audio&&_.video);let E=n.bind(null,i,"audio","start");const S=n.bind(null,i,"audio","end");let C=n.bind(null,i,"video","start");const D=n.bind(null,i,"video","end"),k=()=>Av({bytes:e,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:T,onData:w=>{w.type=w.type==="combined"?"video":w.type,c(i,w)},onTrackInfo:w=>{t&&(T&&(w.isMuxed=!0),t(i,w))},onAudioTimingInfo:w=>{E&&typeof w.start<"u"&&(E(w.start),E=null),S&&typeof w.end<"u"&&S(w.end)},onVideoTimingInfo:w=>{C&&typeof w.start<"u"&&(C(w.start),C=null),D&&typeof w.end<"u"&&D(w.end)},onVideoSegmentTimingInfo:w=>{const O={pts:{start:w.start.presentation,end:w.end.presentation},dts:{start:w.start.decode,end:w.end.decode}};y({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:O}),s(w)},onAudioSegmentTimingInfo:w=>{const O={pts:{start:w.start.pts,end:w.end.pts},dts:{start:w.start.dts,end:w.end.dts}};y({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:O}),r(w)},onId3:(w,O)=>{a(i,w,O)},onCaptions:w=>{o(i,[w])},isEndOfTimeline:l,onEndedTimeline:()=>{u()},onTransmuxerLog:p,onDone:(w,O)=>{!d||(w.type=w.type==="combined"?"video":w.type,y({type:"segmenttransmuxingcomplete",segment:i}),d(O,i,w))},segment:i,triggerSegmentEventFn:y});zo({action:"probeTs",transmuxer:i.transmuxer,data:e,baseStartTime:i.baseStartTime,callback:w=>{i.bytes=e=w.data;const O=w.result;O&&(t(i,{hasAudio:O.hasAudio,hasVideo:O.hasVideo,isMuxed:T}),t=null),k()}})},kv=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y})=>{let _=new Uint8Array(e);if(_R(_)){i.isFmp4=!0;const{tracks:T}=i.map,E={isFmp4:!0,hasVideo:!!T.video,hasAudio:!!T.audio};T.audio&&T.audio.codec&&T.audio.codec!=="enca"&&(E.audioCodec=T.audio.codec),T.video&&T.video.codec&&T.video.codec!=="encv"&&(E.videoCodec=T.video.codec),T.video&&T.audio&&(E.isMuxed=!0),t(i,E);const S=(C,D)=>{c(i,{data:_,type:E.hasAudio&&!E.isMuxed?"audio":"video"}),D&&D.length&&a(i,D),C&&C.length&&o(i,C),d(null,i,{})};zo({action:"probeMp4StartTime",timescales:i.map.timescales,data:_,transmuxer:i.transmuxer,callback:({data:C,startTime:D})=>{e=C.buffer,i.bytes=_=C,E.hasAudio&&!E.isMuxed&&n(i,"audio","start",D),E.hasVideo&&n(i,"video","start",D),zo({action:"probeEmsgID3",data:_,transmuxer:i.transmuxer,offset:D,callback:({emsgData:k,id3Frames:w})=>{if(e=k.buffer,i.bytes=_=k,!T.video||!k.byteLength||!i.transmuxer){S(void 0,w);return}zo({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:_,timescales:i.map.timescales,trackIds:[T.video.id],callback:O=>{e=O.data.buffer,i.bytes=_=O.data,O.logs.forEach(function(N){p(ke(N,{stream:"mp4CaptionParser"}))}),S(O.captions,w)}})}})}});return}if(!i.transmuxer){d(null,i,{});return}if(typeof i.container>"u"&&(i.container=lf(_)),i.container!=="ts"&&i.container!=="aac"){t(i,{hasAudio:!1,hasVideo:!1}),d(null,i,{});return}U5({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y})},Rv=function({id:i,key:e,encryptedBytes:t,decryptionWorker:n,segment:s,doneFn:r},a){const o=u=>{if(u.data.source===i){n.removeEventListener("message",o);const c=u.data.decrypted;a(new Uint8Array(c.bytes,c.byteOffset,c.byteLength))}};n.onerror=()=>{const u="An error occurred in the decryption worker",c=Fs({segment:s}),d={message:u,metadata:{error:new Error(u),errorType:B.Error.StreamingFailedToDecryptSegment,segmentInfo:c,keyInfo:{uri:s.key.resolvedUri||s.map.key.resolvedUri}}};r(d,s)},n.addEventListener("message",o);let l;e.bytes.slice?l=e.bytes.slice():l=new Uint32Array(Array.prototype.slice.call(e.bytes)),n.postMessage(dv({source:i,encrypted:t,key:l,iv:e.iv}),[t.buffer,l.buffer])},$5=({decryptionWorker:i,segment:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y})=>{y({type:"segmentdecryptionstart"}),Rv({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i,segment:e,doneFn:d},_=>{e.bytes=_,y({type:"segmentdecryptioncomplete",segment:e}),kv({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y})})},V5=({activeXhrs:i,decryptionWorker:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y})=>{let _=0,T=!1;return(E,S)=>{if(!T){if(E)return T=!0,Ep(i),d(E,S);if(_+=1,_===i.length){const C=function(){if(S.encryptedBytes)return $5({decryptionWorker:e,segment:S,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y});kv({segment:S,bytes:S.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c,doneFn:d,onTransmuxerLog:p,triggerSegmentEventFn:y})};if(S.endOfAllRequests=Date.now(),S.map&&S.map.encryptedBytes&&!S.map.bytes)return y({type:"segmentdecryptionstart",segment:S}),Rv({decryptionWorker:e,id:S.requestId+"-init",encryptedBytes:S.map.encryptedBytes,key:S.map.key,segment:S,doneFn:d},D=>{S.map.bytes=D,y({type:"segmentdecryptioncomplete",segment:S}),Dv(S,k=>{if(k)return Ep(i),d(k,S);C()})});C()}}}},j5=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},z5=({segment:i,progressFn:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:c})=>d=>{if(!d.target.aborted)return i.stats=ke(i.stats,N5(d)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(d,i)},q5=({xhr:i,xhrOptions:e,decryptionWorker:t,segment:n,abortFn:s,progressFn:r,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:d,isEndOfTimeline:p,endedTimelineFn:y,dataFn:_,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:S})=>{const C=[],D=V5({activeXhrs:C,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:d,isEndOfTimeline:p,endedTimelineFn:y,dataFn:_,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:S});if(n.key&&!n.key.bytes){const F=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&F.push(n.map.key);const $=ke(e,{uri:n.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),J=Iv(n,F,D,S),X={uri:n.key.resolvedUri};S({type:"segmentkeyloadstart",segment:n,keyInfo:X});const K=i($,J);C.push(K)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const K=ke(e,{uri:n.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),G=Iv(n,[n.map.key],D,S),Y={uri:n.map.key.resolvedUri};S({type:"segmentkeyloadstart",segment:n,keyInfo:Y});const ee=i(K,G);C.push(ee)}const $=ke(e,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:vp(n.map),requestType:"segment-media-initialization"}),J=F5({segment:n,finishProcessingFn:D,triggerSegmentEventFn:S});S({type:"segmentloadstart",segment:n});const X=i($,J);C.push(X)}const k=ke(e,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:vp(n),requestType:"segment"}),w=B5({segment:n,finishProcessingFn:D,responseType:k.responseType,triggerSegmentEventFn:S});S({type:"segmentloadstart",segment:n});const O=i(k,w);O.addEventListener("progress",z5({segment:n,progressFn:r,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:d,isEndOfTimeline:p,endedTimelineFn:y,dataFn:_})),C.push(O);const N={};return C.forEach(F=>{F.addEventListener("loadend",j5({loadendState:N,abortFn:s}))}),()=>Ep(C)},G5=Ti("CodecUtils"),H5=function(i){const e=i.attributes||{};if(e.CODECS)return Hi(e.CODECS)},Pv=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},W5=(i,e)=>{if(!Pv(i,e))return!0;const t=e.attributes||{},n=i.mediaGroups.AUDIO[t.AUDIO];for(const s in n)if(!n[s].uri&&!n[s].playlists)return!0;return!1},_c=function(i){const e={};return i.forEach(({mediaType:t,type:n,details:s})=>{e[t]=e[t]||[],e[t].push(O_(`${n}${s}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){G5(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},Lv=function(i){let e=0;return i.audio&&e++,i.video&&e++,e},qo=function(i,e){const t=e.attributes||{},n=_c(H5(e)||[]);if(Pv(i,e)&&!n.audio&&!W5(i,e)){const s=_c(yD(i,t.AUDIO)||[]);s.audio&&(n.audio=s.audio)}return n},yc=Ti("PlaylistSelector"),Ov=function(i){if(!i||!i.playlist)return;const e=i.playlist;return JSON.stringify({id:e.id,bandwidth:i.bandwidth,width:i.width,height:i.height,codecs:e.attributes&&e.attributes.CODECS||""})},vc=function(i,e){if(!i)return"";const t=P.getComputedStyle(i);return t?t[e]:""},da=function(i,e){const t=i.slice();i.sort(function(n,s){const r=e(n,s);return r===0?t.indexOf(n)-t.indexOf(s):r})},Cp=function(i,e){let t,n;return i.attributes.BANDWIDTH&&(t=i.attributes.BANDWIDTH),t=t||P.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||P.Number.MAX_VALUE,t-n},X5=function(i,e){let t,n;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(t=i.attributes.RESOLUTION.width),t=t||P.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||P.Number.MAX_VALUE,t===n&&i.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?i.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-n};let Mv=function(i,e,t,n,s,r){if(!i)return;const a={bandwidth:e,width:t,height:n,limitRenditionByPlayerDimensions:s};let o=i.playlists;Xt.isAudioOnly(i)&&(o=r.getAudioTrackPlaylists_(),a.audioOnly=!0);let l=o.map(w=>{let O;const N=w.attributes&&w.attributes.RESOLUTION&&w.attributes.RESOLUTION.width,F=w.attributes&&w.attributes.RESOLUTION&&w.attributes.RESOLUTION.height;return O=w.attributes&&w.attributes.BANDWIDTH,O=O||P.Number.MAX_VALUE,{bandwidth:O,width:N,height:F,playlist:w}});da(l,(w,O)=>w.bandwidth-O.bandwidth),l=l.filter(w=>!Xt.isIncompatible(w.playlist));let u=l.filter(w=>Xt.isEnabled(w.playlist));u.length||(u=l.filter(w=>!Xt.isDisabled(w.playlist)));const c=u.filter(w=>w.bandwidth*ft.BANDWIDTH_VARIANCEw.bandwidth===d.bandwidth)[0];if(s===!1){const w=p||u[0]||l[0];if(w&&w.playlist){let O="sortedPlaylistReps";return p&&(O="bandwidthBestRep"),u[0]&&(O="enabledPlaylistReps"),yc(`choosing ${Ov(w)} using ${O} with options`,a),w.playlist}return yc("could not choose a playlist with options",a),null}const y=c.filter(w=>w.width&&w.height);da(y,(w,O)=>w.width-O.width);const _=y.filter(w=>w.width===t&&w.height===n);d=_[_.length-1];const T=_.filter(w=>w.bandwidth===d.bandwidth)[0];let E,S,C;T||(E=y.filter(w=>w.width>t||w.height>n),S=E.filter(w=>w.width===E[0].width&&w.height===E[0].height),d=S[S.length-1],C=S.filter(w=>w.bandwidth===d.bandwidth)[0]);let D;if(r.leastPixelDiffSelector){const w=y.map(O=>(O.pixelDiff=Math.abs(O.width-t)+Math.abs(O.height-n),O));da(w,(O,N)=>O.pixelDiff===N.pixelDiff?N.bandwidth-O.bandwidth:O.pixelDiff-N.pixelDiff),D=w[0]}const k=D||C||T||p||u[0]||l[0];if(k&&k.playlist){let w="sortedPlaylistReps";return D?w="leastPixelDiffRep":C?w="resolutionPlusOneRep":T?w="resolutionBestRep":p?w="bandwidthBestRep":u[0]&&(w="enabledPlaylistReps"),yc(`choosing ${Ov(k)} using ${w} with options`,a),k.playlist}return yc("could not choose a playlist with options",a),null};const Nv=function(){let i=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),Mv(this.playlists.main,this.systemBandwidth,parseInt(vc(this.tech_.el(),"width"),10)*i,parseInt(vc(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)},K5=function(i){let e=-1,t=-1;if(i<0||i>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let n=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=i*this.systemBandwidth+(1-i)*e,t=this.systemBandwidth),Mv(this.playlists.main,e,parseInt(vc(this.tech_.el(),"width"),10)*n,parseInt(vc(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},Y5=function(i){const{main:e,currentTime:t,bandwidth:n,duration:s,segmentDuration:r,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=i,u=e.playlists.filter(_=>!Xt.isIncompatible(_));let c=u.filter(Xt.isEnabled);c.length||(c=u.filter(_=>!Xt.isDisabled(_)));const p=c.filter(Xt.hasAttribute.bind(null,"BANDWIDTH")).map(_=>{const E=l.getSyncPoint(_,s,o,t)?1:2,C=Xt.estimateSegmentRequestTime(r,n,_)*E-a;return{playlist:_,rebufferingImpact:C}}),y=p.filter(_=>_.rebufferingImpact<=0);return da(y,(_,T)=>Cp(T.playlist,_.playlist)),y.length?y[0]:(da(p,(_,T)=>_.rebufferingImpact-T.rebufferingImpact),p[0]||null)},Z5=function(){const i=this.playlists.main.playlists.filter(Xt.isEnabled);return da(i,(t,n)=>Cp(t,n)),i.filter(t=>!!qo(this.playlists.main,t).video)[0]||null},Q5=i=>{let e=0,t;return i.bytes&&(t=new Uint8Array(i.bytes),i.segments.forEach(n=>{t.set(n,e),e+=n.byteLength})),t};function Fv(i){try{return new URL(i).pathname.split("/").slice(-2).join("/")}catch{return""}}const J5=function(i,e,t){if(!i[t]){e.trigger({type:"usage",name:"vhs-608"});let n=t;/^cc708_/.test(t)&&(n="SERVICE"+t.split("_")[1]);const s=e.textTracks().getTrackById(n);if(s)i[t]=s;else{const r=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,l=!1;const u=r[n];u&&(a=u.label,o=u.language,l=u.default),i[t]=e.addRemoteTextTrack({kind:"captions",id:n,default:l,label:a,language:o},!1).track}}},eP=function({inbandTextTracks:i,captionArray:e,timestampOffset:t}){if(!e)return;const n=P.WebKitDataCue||P.VTTCue;e.forEach(s=>{const r=s.stream;s.content?s.content.forEach(a=>{const o=new n(s.startTime+t,s.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",i[r].addCue(o)}):i[r].addCue(new n(s.startTime+t,s.endTime+t,s.text))})},tP=function(i){Object.defineProperties(i.frame,{id:{get(){return B.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get(){return B.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get(){return B.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}})},iP=({inbandTextTracks:i,metadataArray:e,timestampOffset:t,videoDuration:n})=>{if(!e)return;const s=P.WebKitDataCue||P.VTTCue,r=i.metadataTrack_;if(!r||(e.forEach(c=>{const d=c.cueTime+t;typeof d!="number"||P.isNaN(d)||d<0||!(d<1/0)||!c.frames||!c.frames.length||c.frames.forEach(p=>{const y=new s(d,d,p.value||p.url||p.data||"");y.frame=p,y.value=p,tP(y),r.addCue(y)})}),!r.cues||!r.cues.length))return;const a=r.cues,o=[];for(let c=0;c{const p=c[d.startTime]||[];return p.push(d),c[d.startTime]=p,c},{}),u=Object.keys(l).sort((c,d)=>Number(c)-Number(d));u.forEach((c,d)=>{const p=l[c],y=isFinite(n)?n:c,_=Number(u[d+1])||y;p.forEach(T=>{T.endTime=_})})},nP={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},sP=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),rP=({inbandTextTracks:i,dateRanges:e})=>{const t=i.metadataTrack_;if(!t)return;const n=P.WebKitDataCue||P.VTTCue;e.forEach(s=>{for(const r of Object.keys(s)){if(sP.has(r))continue;const a=new n(s.startTime,s.endTime,"");a.id=s.id,a.type="com.apple.quicktime.HLS",a.value={key:nP[r],data:s[r]},(r==="scte35Out"||r==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}s.processDateRange()})},Bv=(i,e,t)=>{i.metadataTrack_||(i.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,B.browser.IS_ANY_SAFARI||(i.metadataTrack_.inBandMetadataTrackDispatchType=e))},Go=function(i,e,t){let n,s;if(!!t&&!!t.cues)for(n=t.cues.length;n--;)s=t.cues[n],s.startTime>=i&&s.endTime<=e&&t.removeCue(s)},aP=function(i){const e=i.cues;if(!e)return;const t={};for(let n=e.length-1;n>=0;n--){const s=e[n],r=`${s.startTime}-${s.endTime}-${s.text}`;t[r]?i.removeCue(s):t[r]=s}},oP=(i,e,t)=>{if(typeof e>"u"||e===null||!i.length)return[];const n=Math.ceil((e-t+3)*Is.ONE_SECOND_IN_TS);let s;for(s=0;sn);s++);return i.slice(s)},lP=(i,e,t)=>{if(!e.length)return i;if(t)return e.slice();const n=e[0].pts;let s=0;for(s;s=n);s++);return i.slice(0,s).concat(e)},uP=(i,e,t,n)=>{const s=Math.ceil((e-n)*Is.ONE_SECOND_IN_TS),r=Math.ceil((t-n)*Is.ONE_SECOND_IN_TS),a=i.slice();let o=i.length;for(;o--&&!(i[o].pts<=r););if(o===-1)return a;let l=o+1;for(;l--&&!(i[l].pts<=s););return l=Math.max(l,0),a.splice(l,o-l+1),a},cP=function(i,e){if(!i&&!e||!i&&e||i&&!e)return!1;if(i===e)return!0;const t=Object.keys(i).sort(),n=Object.keys(e).sort();if(t.length!==n.length)return!1;for(let s=0;st))return r}return n.length===0?0:n[n.length-1]},Ho=1,dP=500,Uv=i=>typeof i=="number"&&isFinite(i),Tc=1/60,fP=(i,e,t)=>i!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,pP=(i,e,t)=>{let n=e-ft.BACK_BUFFER_LENGTH;i.length&&(n=Math.max(n,i.start(0)));const s=e-t;return Math.min(s,n)},fa=i=>{const{startOfSegment:e,duration:t,segment:n,part:s,playlist:{mediaSequence:r,id:a,segments:o=[]},mediaIndex:l,partIndex:u,timeline:c}=i,d=o.length-1;let p="mediaIndex/partIndex increment";i.getMediaInfoForTime?p=`getMediaInfoForTime (${i.getMediaInfoForTime})`:i.isSyncRequest&&(p="getSyncSegmentCandidate (isSyncRequest)"),i.independent&&(p+=` with independent ${i.independent}`);const y=typeof u=="number",_=i.segment.uri?"segment":"pre-segment",T=y?W1({preloadSegment:n})-1:0;return`${_} [${r+l}/${r+d}]`+(y?` part [${u}/${T}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(y?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${c}] selected by [${p}] playlist [${a}]`},$v=i=>`${i}TimingInfo`,gP=({segmentTimeline:i,currentTimeline:e,startOfSegment:t,buffered:n,overrideCheck:s})=>!s&&i===e?null:i{if(e===t)return!1;if(n==="audio"){const r=i.lastTimelineChange({type:"main"});return!r||r.to!==t}if(n==="main"&&s){const r=i.pendingTimelineChange({type:"audio"});return!(r&&r.to===t)}return!1},mP=i=>{let e=0;return["video","audio"].forEach(function(t){const n=i[`${t}TimingInfo`];if(!n)return;const{start:s,end:r}=n;let a;typeof s=="bigint"||typeof r=="bigint"?a=P.BigInt(r)-P.BigInt(s):typeof s=="number"&&typeof r=="number"&&(a=r-s),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&ei?Math.round(i)>e+en:!1,_P=(i,e)=>{if(e!=="hls")return null;const t=mP({audioTimingInfo:i.audioTimingInfo,videoTimingInfo:i.videoTimingInfo});if(!t)return null;const n=i.playlist.targetDuration,s=jv({segmentDuration:t,maxDuration:n*2}),r=jv({segmentDuration:t,maxDuration:n}),a=`Segment with index ${i.mediaIndex} from playlist ${i.playlist.id} has a duration of ${t} when the reported duration is ${i.duration} and the target duration is ${n}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return s||r?{severity:s?"warn":"info",message:a}:null},Fs=({type:i,segment:e})=>{if(!e)return;const t=Boolean(e.key||e.map&&e.map.ke),n=Boolean(e.map&&!e.map.bytes),s=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:i||e.type,uri:e.resolvedUri||e.uri,start:s,duration:e.duration,isEncrypted:t,isMediaInitialization:n}};class wp extends B.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Ti(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(n){n!==this.state_&&(this.logger_(`${this.state_} -> ${n}`),this.state_=n,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.sourceUpdater_.on("codecschange",n=>{this.trigger(Ke({type:"codecschange"},n))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",n=>{this.trigger(Ke({type:"timelinechange"},n)),this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return bp.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&P.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,P.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&bp.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return vt();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:n,isMuxed:s}=e;if(n&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const n=mc(e);let s=this.initSegments_[n];return t&&!s&&e.bytes&&(this.initSegments_[n]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;const n=fv(e);let s=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[n]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});const r={resolvedUri:(s||e).resolvedUri};return s&&(r.bytes=s.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const n=this.playlist_,s=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let r=null;if(n&&(n.id?r=n.id:n.uri&&(r=n.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: currentTime: ${this.currentTime_()} bufferedEnd: ${up(this.buffered_())} `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!n||n.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-n.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const l=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=l}}s&&(s.mediaIndex-=a,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(n,e)}pause(){this.checkBufferTimeout_&&(P.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&bp.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,n=()=>{},s=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let r=1;const a=()=>{r--,r===0&&n()};(s||!this.audioDisabled_)&&(r++,this.sourceUpdater_.removeAudio(e,t,a)),(s||this.loaderType_==="main")&&(this.gopBuffer_=uP(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a));for(const o in this.inbandTextTracks_)Go(e,t,this.inbandTextTracks_[o]);Go(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&P.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=P.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&P.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=P.setTimeout(this.monitorBufferTick_.bind(this),dP)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:Fs({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,n=this.partIndex){if(!t||!this.mediaSource_)return!1;const s=typeof e=="number"&&t.segments[e],r=e+1===t.segments.length,a=!s||!s.parts||n+1===s.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&r&&a}chooseNextRequest_(){const e=this.buffered_(),t=up(e)||0,n=cp(e,this.currentTime_()),s=!this.hasPlayed_()&&n>=1,r=n>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||s||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(o.isSyncRequest)o.mediaIndex=hP(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${o.mediaIndex}`);else if(this.mediaIndex!==null){const p=a[this.mediaIndex],y=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=p.end?p.end:t,p.parts&&p.parts[y+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=y+1):o.mediaIndex=this.mediaIndex+1}else{let p,y,_;const T=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: For TargetTime: ${T}. CurrentTime: ${this.currentTime_()} BufferedEnd: ${t} Fetch At Buffer: ${this.fetchAtBuffer_} `,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const E=this.getSyncInfoFromMediaSequenceSync_(T);if(!E){const S="No sync info found while using media sequence sync";return this.error({message:S,metadata:{errorType:B.Error.StreamingFailedToSelectNextSegment,error:new Error(S)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${E.start} --> ${E.end})`),p=E.segmentIndex,y=E.partIndex,_=E.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const E=Xt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:T,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});p=E.segmentIndex,y=E.partIndex,_=E.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${T}`:`currentTime ${T}`,o.mediaIndex=p,o.startOfSegment=_,o.partIndex=y,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const l=a[o.mediaIndex];let u=l&&typeof o.partIndex=="number"&&l.parts&&l.parts[o.partIndex];if(!l||typeof o.partIndex=="number"&&!u)return null;typeof o.partIndex!="number"&&l.parts&&(o.partIndex=0,u=l.parts[0]);const c=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&u&&!c&&!u.independent)if(o.partIndex===0){const p=a[o.mediaIndex-1],y=p.parts&&p.parts.length&&p.parts[p.parts.length-1];y&&y.independent&&(o.mediaIndex-=1,o.partIndex=p.parts.length-1,o.independent="previous segment")}else l.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const d=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&d&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const n=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!n)return null;if(!n.isAppended)return n;const s=this.mediaSequenceSync_.getSyncInfoForTime(n.end);return s?(s.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),s):null}generateSegmentInfo_(e){const{independent:t,playlist:n,mediaIndex:s,startOfSegment:r,isSyncRequest:a,partIndex:o,forceTimestampOffset:l,getMediaInfoForTime:u}=e,c=n.segments[s],d=typeof o=="number"&&c.parts[o],p={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||c.resolvedUri,mediaIndex:s,partIndex:d?o:null,isSyncRequest:a,startOfSegment:r,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:c.timeline,duration:d&&d.duration||c.duration,segment:c,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},y=typeof l<"u"?l:this.isPendingTimestampOffset_;p.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:c.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:y});const _=up(this.sourceUpdater_.audioBuffered());return typeof _=="number"&&(p.audioAppendStart=_-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(p.gopsToAlignWith=oP(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),p}timestampOffsetForSegment_(e){return gP(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),n=e.bandwidth,s=this.pendingSegment_.duration,r=Xt.estimateSegmentRequestTime(s,n,this.playlist_,e.bytesReceived),a=V4(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=a)return;const o=Y5({main:this.vhs_.playlists.main,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const u=r-a-o.rebufferingImpact;let c=.5;a<=en&&(c=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||u{r[a.stream]=r[a.stream]||{startTime:1/0,captions:[],endTime:0};const o=r[a.stream];o.startTime=Math.min(o.startTime,a.startTime+s),o.endTime=Math.max(o.endTime,a.endTime+s),o.captions.push(a)}),Object.keys(r).forEach(a=>{const{startTime:o,endTime:l,captions:u}=r[a],c=this.inbandTextTracks_;this.logger_(`adding cues from ${o} -> ${l} for ${a}`),J5(c,this.vhs_.tech_,a),Go(o,l,c[a]),eP({captionArray:u,inbandTextTracks:c,timestampOffset:s})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n));return}this.addMetadataToTextTrack(n,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Vv({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:n,hasVideo:s,isMuxed:r}=t;return!(s&&!e.videoTimingInfo||n&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||Vv({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,e,t));return}const n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[$v(t.type)].start;else{const s=this.getCurrentMediaInfo_(),r=this.loaderType_==="main"&&s&&s.hasVideo;let a;r&&(a=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:r,firstVideoFrameTimeForData:a,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:this.loaderType_==="main"});const s=this.chooseNextRequest_();if(s.mediaIndex!==n.mediaIndex||s.partIndex!==n.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:n,playlist:s}){if(n){const r=mc(n);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n},s){const r=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ms(r).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ms(a).join(", "));const o=r.length?r.start(0):0,l=r.length?r.end(r.length-1):0,u=a.length?a.start(0):0,c=a.length?a.end(a.length-1):0;if(l-o<=Ho&&c-u<=Ho){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${n.byteLength}, audio buffer: ${Ms(r).join(", ")}, video buffer: ${Ms(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:n}));const p=this.currentTime_()-Ho;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${p}`),this.remove(0,p,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Ho}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=P.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Ho*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:n},s){if(!!s){if(s.code===av){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:B.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:n,data:s,bytes:r}){if(!r){const o=[s];let l=s.byteLength;n&&(o.unshift(n),l+=n.byteLength),r=Q5({bytes:l,segments:o})}const a={segmentInfo:Fs({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,n){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,r=`${e}TimingInfo`;s[r]||(s[r]={}),s[r].transmuxerPrependedSeconds=n.prependedContentDuration||0,s[r].transmuxedPresentationStart=n.start.presentation,s[r].transmuxedDecodeStart=n.start.decode,s[r].transmuxedPresentationEnd=n.end.presentation,s[r].transmuxedDecodeEnd=n.end.decode,s[r].baseMediaDecodeTime=n.baseMediaDecodeTime}appendData_(e,t){const{type:n,data:s}=t;if(!s||!s.byteLength||n==="audio"&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:r,data:s})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(()=>{const t=Ke({},e,{forceTimestampOffset:!0});Ke(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=this.mediaIndex!==null,r=e.timeline!==this.currentTimeline_&&e.timeline>0,a=n||s&&r;this.logger_(`Requesting ${Fv(e.uri)} ${fa(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=q5({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:l,stream:u})=>{this.logger_(`${fa(e)} logged from transmuxer stream ${u} as a ${l}: ${o}`)},triggerSegmentEventFn:({type:o,segment:l,keyInfo:u,trackInfo:c,timingInfo:d})=>{const y={segmentInfo:Fs({segment:l})};u&&(y.keyInfo=u),c&&(y.trackInfo=c),d&&(y.timingInfo=d),this.trigger({type:o,metadata:y})}})}trimBackBuffer_(e){const t=pP(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,n=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:r},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const l=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=l}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e"u"||u.end!==s+r?s:o.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:n,hasVideo:s,isMuxed:r}=t,a=this.loaderType_==="main"&&s,o=!this.audioDisabled_&&n&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=fP(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:n}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:n.start:n.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),s=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;!s||(e.timingInfo.end=typeof s.end=="number"?s.end:s.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const l={segmentInfo:Fs({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:l})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=_P(e,this.sourceType_);if(t&&(t.severity==="warn"?B.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${fa(e)}`);return}this.logger_(`Appended ${fa(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const n=e.segment,s=e.part,r=n.end&&this.currentTime_()-n.end>e.playlist.targetDuration*3,a=s&&s.end&&this.currentTime_()-s.end>e.playlist.partTargetDuration*3;if(r||a){this.logger_(`bad ${r?"segment":"part"} ${fa(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},yP=["video","audio"],Ap=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},vP=(i,e)=>{for(let t=0;t{if(e.queue.length===0)return;let t=0,n=e.queue[t];if(n.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),n.action(e),n.doneFn&&n.doneFn(),pa("audio",e),pa("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Ap(i,e))){if(n.type!==i){if(t=vP(i,e.queue),t===null)return;n=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=n,n.action(i,e),!n.doneFn){e.queuePending[i]=null,pa(i,e);return}}},qv=(i,e)=>{const t=e[`${i}Buffer`],n=zv(i);!t||(t.removeEventListener("updateend",e[`on${n}UpdateEnd_`]),t.removeEventListener("error",e[`on${n}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},sn=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,si={appendBuffer:(i,e,t)=>(n,s)=>{const r=s[`${n}Buffer`];if(!!sn(s.mediaSource,r)){s.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${n}Buffer`);try{r.appendBuffer(i)}catch(a){s.logger_(`Error with code ${a.code} `+(a.code===av?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${n}Buffer`),s.queuePending[n]=null,t(a)}}},remove:(i,e)=>(t,n)=>{const s=n[`${t}Buffer`];if(!!sn(n.mediaSource,s)){n.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{s.remove(i,e)}catch{n.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const n=t[`${e}Buffer`];!sn(t.mediaSource,n)||(t.logger_(`Setting ${e}timestampOffset to ${i}`),n.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){B.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){B.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(!!sn(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(n){B.log.warn(`Failed to abort on ${i}Buffer`,n)}}},addSourceBuffer:(i,e)=>t=>{const n=zv(i),s=fo(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const r=t.mediaSource.addSourceBuffer(s);r.addEventListener("updateend",t[`on${n}UpdateEnd_`]),r.addEventListener("error",t[`on${n}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=r},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(qv(i,e),!!sn(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(n){B.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,n)}}},changeType:i=>(e,t)=>{const n=t[`${e}Buffer`],s=fo(i);if(!sn(t.mediaSource,n))return;const r=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===r)return;const l={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:l}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{n.changeType(s),t.codecs[e]=i}catch(u){l.errorType=B.Error.StreamingCodecsChangeError,l.error=u,u.metadata=l,t.error_=u,t.trigger("error"),B.log.warn(`Failed to changeType on ${e}Buffer`,u)}}},ri=({type:i,sourceUpdater:e,action:t,doneFn:n,name:s})=>{e.queue.push({type:i,action:t,doneFn:n,name:s}),pa(i,e)},Gv=(i,e)=>t=>{const n=e[`${i}Buffered`](),s=B4(n);if(e.logger_(`received "updateend" event for ${i} Source Buffer: `,s),e.queuePending[i]){const r=e.queuePending[i].doneFn;e.queuePending[i]=null,r&&r(e[`${i}Error_`])}pa(i,e)};class Hv extends B.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>pa("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Ti("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Gv("video",this),this.onAudioUpdateEnd_=Gv("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){ri({type:"mediaSource",sourceUpdater:this,action:si.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){ri({type:e,sourceUpdater:this,action:si.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){B.log.error("removeSourceBuffer is not supported!");return}ri({type:"mediaSource",sourceUpdater:this,action:si.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!B.browser.IS_FIREFOX&&P.MediaSource&&P.MediaSource.prototype&&typeof P.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return P.SourceBuffer&&P.SourceBuffer.prototype&&typeof P.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){B.log.error("changeType is not supported!");return}ri({type:e,sourceUpdater:this,action:si.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const n=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,n);this.canChangeType()&&this.changeType(t,n)})}appendBuffer(e,t){const{segmentInfo:n,type:s,bytes:r}=e;if(this.processedAppend_=!0,s==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`);return}const a=t;if(ri({type:s,sourceUpdater:this,action:si.appendBuffer(r,n||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(l=>{this.appendBuffer.apply(this,l)})}}audioBuffered(){return sn(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:vt()}videoBuffered(){return sn(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:vt()}buffered(){const e=sn(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=sn(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():$4(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=In){ri({type:"mediaSource",sourceUpdater:this,action:si.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=In){typeof e!="string"&&(e=void 0),ri({type:"mediaSource",sourceUpdater:this,action:si.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,n=In){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){n();return}ri({type:"audio",sourceUpdater:this,action:si.remove(e,t),doneFn:n,name:"remove"})}removeVideo(e,t,n=In){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){n();return}ri({type:"video",sourceUpdater:this,action:si.remove(e,t),doneFn:n,name:"remove"})}updating(){return!!(Ap("audio",this)||Ap("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(ri({type:"audio",sourceUpdater:this,action:si.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset!==e&&(ri({type:"video",sourceUpdater:this,action:si.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){!this.audioBuffer||ri({type:"audio",sourceUpdater:this,action:si.callback(e),name:"callback"})}videoQueueCallback(e){!this.videoBuffer||ri({type:"video",sourceUpdater:this,action:si.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),yP.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>qv(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Wv=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),TP=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},Xv=new Uint8Array(` `.split("").map(i=>i.charCodeAt(0)));class xP extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class bP extends wp{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return vt();const e=this.subtitlesTrack_.cues,t=e[0].startTime,n=e[e.length-1].startTime;return vt([[t,n]])}initSegmentForMap(e,t=!1){if(!e)return null;const n=mc(e);let s=this.initSegments_[n];if(t&&!s&&e.bytes){const r=Xv.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(Xv,e.bytes.byteLength),this.initSegments_[n]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Go(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(!!e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,n){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===nn.TIMEOUT&&this.handleTimeout_(),e.code===nn.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const r=s.segment;if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,typeof P.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,n),()=>this.stopForError({message:"Error loading vtt.js"}));return}r.requested=!0;try{this.parseVTTCues_(s)}catch(a){this.stopForError({message:a.message,metadata:{errorType:B.Error.StreamingVttParserError,error:a}});return}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach(a=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new P.VTTCue(a.startTime,a.endTime,a.text):a)}),aP(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,n=!1;if(typeof P.WebVTT!="function")throw new xP;typeof P.TextDecoder=="function"?t=new P.TextDecoder("utf8"):(t=P.WebVTT.StringDecoder(),n=!0);const s=new P.WebVTT.Parser(P,P.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=a=>{e.timestampmap=a},s.onparsingerror=a=>{B.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;n&&(a=Wv(a)),s.parse(a)}let r=e.bytes;n&&(r=Wv(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,n){const s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}const{MPEGTS:r,LOCAL:a}=e.timestampmap,l=r/Is.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(u=>{const c=u.endTime-u.startTime,d=r===0?u.startTime+l:this.handleRollover_(u.startTime+l,t.time);u.startTime=Math.max(d,0),u.endTime=Math.max(d+c,0)}),!n.syncInfo){const u=e.cues[0].startTime,c=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(u,c-s.duration)}}}handleRollover_(e,t){if(t===null)return e;let n=e*Is.ONE_SECOND_IN_TS;const s=t*Is.ONE_SECOND_IN_TS;let r;for(s4294967296;)n+=r;return n/Is.ONE_SECOND_IN_TS}}const EP=function(i,e){const t=i.cues;for(let n=0;n=s.adStartTime&&e<=s.adEndTime)return s}return null},SP=function(i,e,t=0){if(!i.segments)return;let n=t,s;for(let r=0;r=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class Yv{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:n,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(n,s),!!this.isReliable_)return this.updateStorage_(s,n,this.calculateBaseTime_(n,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:n}of this.storage_.values())if(n.length){for(const s of n)if(s.isInRange(e))return s}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,n){const s=new Map;let r=` `,a=n,o=t;this.start_=a,e.forEach((l,u)=>{const c=this.storage_.get(o),d=a,p=d+l.duration,y=Boolean(c&&c.segmentSyncInfo&&c.segmentSyncInfo.isAppended),_=new Kv({start:d,end:p,appended:y,segmentIndex:u});l.syncInfo=_;let T=a;const E=(l.parts||[]).map((S,C)=>{const D=T,k=T+S.duration,w=Boolean(c&&c.partsSyncInfo&&c.partsSyncInfo[C]&&c.partsSyncInfo[C].isAppended),O=new Kv({start:D,end:k,appended:w,segmentIndex:u,partIndex:C});return T=k,r+=`Media Sequence: ${o}.${C} | Range: ${D} --> ${k} | Appended: ${w} `,S.syncInfo=O,O});s.set(o,new CP(_,E)),r+=`${Fv(l.resolvedUri)} | Media Sequence: ${o} | Range: ${d} --> ${p} | Appended: ${y} `,o++,a=p}),this.end_=a,this.storage_=s,this.diagnostics_=r}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Zv extends Yv{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t)}}const wP=86400,Ip=[{name:"VOD",run:(i,e,t,n,s)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,n,s,r)=>{const a=i.getMediaSequenceSync(r);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(s);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,n,s)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let r=null,a=null;const o=dp(e);s=s||0;for(let l=0;l{let r=null,a=null;s=s||0;const o=dp(e);for(let l=0;l=y)&&(a=y,r={time:p,segmentIndex:c.segmentIndex,partIndex:c.partIndex})}}return r}},{name:"Discontinuity",run:(i,e,t,n,s)=>{let r=null;if(s=s||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o=d)&&(a=d,r={time:c.time,segmentIndex:l,partIndex:null})}}}return r}},{name:"Playlist",run:(i,e,t,n,s)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class AP extends B.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Yv,n=new Zv(t),s=new Zv(t);this.mediaSequenceStorage_={main:t,audio:n,vtt:s},this.logger_=Ti("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,n,s,r){if(t!==1/0)return Ip.find(({name:l})=>l==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,n,s,r);if(!a.length)return null;for(const o of a){const{syncPoint:l,strategy:u}=o,{segmentIndex:c,time:d}=l;if(c<0)continue;const p=e.segments[c],y=d,_=y+p.duration;if(this.logger_(`Strategy: ${u}. Current time: ${s}. selected segment: ${c}. Time: [${y} -> ${_}]}`),s>=y&&s<_)return this.logger_("Found sync point with exact match: ",l),l}return this.selectSyncPoint_(a,{key:"time",value:s})}getExpiredTime(e,t){if(!e||!e.segments)return null;const n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;const s=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+Vo({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,n,s,r){const a=[];for(let o=0;owP){B.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);return}for(let s=n-1;s>=0;s--){const r=e.segments[s];if(r&&typeof r.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+s,time:r.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const n=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;n&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const r=s.dateTimeObject;s.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[s.timeline]=-(r.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,n){const s=e.segment,r=e.part;let a=this.timelines[e.timeline],o,l;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,l=t.end+a.mapping;else if(a)o=t.start+a.mapping,l=t.end+a.mapping;else return!1;return r&&(r.start=o,r.end=l),(!s.start||ol){let u;o<0?u=n.start-Vo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):u=n.end+Vo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class IP extends B.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:n}){return typeof t=="number"&&typeof n=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:n}){if(typeof t=="number"&&typeof n=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:n},delete this.pendingTimelineChanges_[e];const s={timelineChangeInfo:{from:t,to:n}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const DP=xv(bv(function(){var i=function(){function T(){this.listeners={}}var E=T.prototype;return E.on=function(C,D){this.listeners[C]||(this.listeners[C]=[]),this.listeners[C].push(D)},E.off=function(C,D){if(!this.listeners[C])return!1;var k=this.listeners[C].indexOf(D);return this.listeners[C]=this.listeners[C].slice(0),this.listeners[C].splice(k,1),k>-1},E.trigger=function(C){var D=this.listeners[C];if(!!D)if(arguments.length===2)for(var k=D.length,w=0;w>7)*283)^k]=k;for(w=O=0;!C[w];w^=$||1,O=F[O]||1)for(K=O^O<<1^O<<2^O<<3^O<<4,K=K>>8^K&255^99,C[w]=K,D[K]=w,X=N[J=N[$=N[w]]],Y=X*16843009^J*65537^$*257^w*16843008,G=N[K]*257^K*16843008,k=0;k<4;k++)E[k][w]=G=G<<24^G>>>8,S[k][K]=Y=Y<<24^Y>>>8;for(k=0;k<5;k++)E[k]=E[k].slice(0),S[k]=S[k].slice(0);return T};let n=null;class s{constructor(E){n||(n=t()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let S,C,D;const k=this._tables[0][4],w=this._tables[1],O=E.length;let N=1;if(O!==4&&O!==6&&O!==8)throw new Error("Invalid aes key size");const F=E.slice(0),$=[];for(this._key=[F,$],S=O;S<4*O+28;S++)D=F[S-1],(S%O===0||O===8&&S%O===4)&&(D=k[D>>>24]<<24^k[D>>16&255]<<16^k[D>>8&255]<<8^k[D&255],S%O===0&&(D=D<<8^D>>>24^N<<24,N=N<<1^(N>>7)*283)),F[S]=F[S-O]^D;for(C=0;S;C++,S--)D=F[C&3?S:S-4],S<=4||C<4?$[C]=D:$[C]=w[0][k[D>>>24]]^w[1][k[D>>16&255]]^w[2][k[D>>8&255]]^w[3][k[D&255]]}decrypt(E,S,C,D,k,w){const O=this._key[1];let N=E^O[0],F=D^O[1],$=C^O[2],J=S^O[3],X,K,G;const Y=O.length/4-2;let ee,q=4;const ie=this._tables[1],ae=ie[0],Se=ie[1],ue=ie[2],ge=ie[3],fe=ie[4];for(ee=0;ee>>24]^Se[F>>16&255]^ue[$>>8&255]^ge[J&255]^O[q],K=ae[F>>>24]^Se[$>>16&255]^ue[J>>8&255]^ge[N&255]^O[q+1],G=ae[$>>>24]^Se[J>>16&255]^ue[N>>8&255]^ge[F&255]^O[q+2],J=ae[J>>>24]^Se[N>>16&255]^ue[F>>8&255]^ge[$&255]^O[q+3],q+=4,N=X,F=K,$=G;for(ee=0;ee<4;ee++)k[(3&-ee)+w]=fe[N>>>24]<<24^fe[F>>16&255]<<16^fe[$>>8&255]<<8^fe[J&255]^O[q++],X=N,N=F,F=$,$=J,J=X}}class r extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(E){this.jobs.push(E),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(T){return T<<24|(T&65280)<<8|(T&16711680)>>8|T>>>24},o=function(T,E,S){const C=new Int32Array(T.buffer,T.byteOffset,T.byteLength>>2),D=new s(Array.prototype.slice.call(E)),k=new Uint8Array(T.byteLength),w=new Int32Array(k.buffer);let O,N,F,$,J,X,K,G,Y;for(O=S[0],N=S[1],F=S[2],$=S[3],Y=0;Y{const C=T[S];p(C)?E[S]={bytes:C.buffer,byteOffset:C.byteOffset,byteLength:C.byteLength}:E[S]=C}),E};self.onmessage=function(T){const E=T.data,S=new Uint8Array(E.encrypted.bytes,E.encrypted.byteOffset,E.encrypted.byteLength),C=new Uint32Array(E.key.bytes,E.key.byteOffset,E.key.byteLength/4),D=new Uint32Array(E.iv.bytes,E.iv.byteOffset,E.iv.byteLength/4);new l(S,C,D,function(k,w){self.postMessage(_({source:E.source,decrypted:w}),[w.buffer])})}}));var kP=Tv(DP);const RP=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Qv=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Dp=(i,e)=>{e.activePlaylistLoader=i,i.load()},PP=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:n},mediaTypes:{[i]:s}}=e,r=s.activeTrack(),a=s.getActiveGroup(),o=s.activePlaylistLoader,l=s.lastGroup_;if(!(a&&l&&a.id===l.id)&&(s.lastGroup_=a,s.lastTrack_=r,Qv(t,s),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&n.resetEverything();return}t.resyncLoader(),Dp(a.playlistLoader,s)}},LP=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:n}}=e;n.lastGroup_=null,t.abort(),t.pause()},OP=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:n,main:s},mediaTypes:{[i]:r}}=e,a=r.activeTrack(),o=r.getActiveGroup(),l=r.activePlaylistLoader,u=r.lastTrack_;if(!(u&&a&&u.id===a.id)&&(r.lastGroup_=o,r.lastTrack_=a,Qv(n,r),!!o)){if(o.isMainPlaylist){if(!a||!u||a.id===u.id)return;const c=e.vhs.playlistController_,d=c.selectPlaylist();if(c.media()===d)return;r.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),t.pause(),s.resetEverything(),c.fastQualityChange_(d);return}if(i==="AUDIO"){if(!o.playlistLoader){s.setAudio(!0),s.resetEverything();return}n.setAudio(!0),s.setAudio(!1)}if(l===o.playlistLoader){Dp(o.playlistLoader,r);return}n.track&&n.track(a),n.resetEverything(),Dp(o.playlistLoader,r)}},xc={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:n}=e,s=t.activeTrack(),r=t.activeGroup(),a=(r.filter(l=>l.default)[0]||r[0]).id,o=t.tracks[a];if(s===o){n({error:{message:"Problem encountered loading the default audio track."}});return}B.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const l in t.tracks)t.tracks[l].enabled=t.tracks[l]===o;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;B.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const n=t.activeTrack();n&&(n.mode="disabled"),t.onTrackChanged()}},Jv={AUDIO:(i,e,t)=>{if(!e)return;const{tech:n,requestOptions:s,segmentLoaders:{[i]:r}}=t;e.on("loadedmetadata",()=>{const a=e.media();r.playlist(a,s),(!n.paused()||a.endList&&n.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),s),n.paused()||r.load()}),e.on("error",xc[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:n,requestOptions:s,segmentLoaders:{[i]:r},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();r.playlist(o,s),r.track(a.activeTrack()),(!n.paused()||o.endList&&n.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),s),n.paused()||r.load()}),e.on("error",xc[i](i,t))}},MP={AUDIO:(i,e)=>{const{vhs:t,sourceType:n,segmentLoaders:{[i]:s},requestOptions:r,main:{mediaGroups:a},mediaTypes:{[i]:{groups:o,tracks:l,logger_:u}},mainPlaylistLoader:c}=e,d=jo(c.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},d&&(a[i].main.default.playlists=c.main.playlists));for(const p in a[i]){o[p]||(o[p]=[]);for(const y in a[i][p]){let _=a[i][p][y],T;if(d?(u(`AUDIO group '${p}' label '${y}' is a main playlist`),_.isMainPlaylist=!0,T=null):n==="vhs-json"&&_.playlists?T=new ha(_.playlists[0],t,r):_.resolvedUri?T=new ha(_.resolvedUri,t,r):_.playlists&&n==="dash"?T=new xp(_.playlists[0],t,r,c):T=null,_=ke({id:y,playlistLoader:T},_),Jv[i](i,_.playlistLoader,e),o[p].push(_),typeof l[y]>"u"){const E=new B.AudioTrack({id:y,kind:RP(_),enabled:!1,language:_.language,default:_.default,label:y});l[y]=E}}}s.on("error",xc[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:n,sourceType:s,segmentLoaders:{[i]:r},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[i]:{groups:l,tracks:u}},mainPlaylistLoader:c}=e;for(const d in o[i]){l[d]||(l[d]=[]);for(const p in o[i][d]){if(!n.options_.useForcedSubtitles&&o[i][d][p].forced)continue;let y=o[i][d][p],_;if(s==="hls")_=new ha(y.resolvedUri,n,a);else if(s==="dash"){if(!y.playlists.filter(E=>E.excludeUntil!==1/0).length)return;_=new xp(y.playlists[0],n,a,c)}else s==="vhs-json"&&(_=new ha(y.playlists?y.playlists[0]:y.resolvedUri,n,a));if(y=ke({id:p,playlistLoader:_},y),Jv[i](i,y.playlistLoader,e),l[d].push(y),typeof u[p]>"u"){const T=t.addRemoteTextTrack({id:p,kind:"subtitles",default:y.default&&y.autoselect,language:y.language,label:p},!1).track;u[p]=T}}}r.on("error",xc[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:n},mediaTypes:{[i]:{groups:s,tracks:r}}}=e;for(const a in n[i]){s[a]||(s[a]=[]);for(const o in n[i][a]){const l=n[i][a][o];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const u=t.options_.vhs&&t.options_.vhs.captionServices||{};let c={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(u[c.instreamId]&&(c=ke(c,u[c.instreamId])),c.default===void 0&&delete c.default,s[a].push(ke({id:o},l)),typeof r[o]>"u"){const d=t.addRemoteTextTrack({id:c.instreamId,kind:"captions",default:c.default,language:c.language,label:c.label},!1).track;r[o]=d}}}}},eT=(i,e)=>{for(let t=0;tt=>{const{mainPlaylistLoader:n,mediaTypes:{[i]:{groups:s}}}=e,r=n.media();if(!r)return null;let a=null;r.attributes[i]&&(a=s[r.attributes[i]]);const o=Object.keys(s);if(!a)if(i==="AUDIO"&&o.length>1&&jo(e.main))for(let l=0;l"u"?a:t===null||!a?null:a.filter(l=>l.id===t.id)[0]||null},FP={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const n in t)if(t[n].enabled)return t[n];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const n in t)if(t[n].mode==="showing"||t[n].mode==="hidden")return t[n];return null}},BP=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},UP=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{MP[u](u,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:n,vhs:s,segmentLoaders:{["AUDIO"]:r,main:a}}=i;["AUDIO","SUBTITLES"].forEach(u=>{e[u].activeGroup=NP(u,i),e[u].activeTrack=FP[u](u,i),e[u].onGroupChanged=PP(u,i),e[u].onGroupChanging=LP(u,i),e[u].onTrackChanged=OP(u,i),e[u].getActiveGroup=BP(u,i)});const o=e.AUDIO.activeGroup();if(o){const u=(o.filter(d=>d.default)[0]||o[0]).id;e.AUDIO.tracks[u].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),r.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanging())});const l=()=>{e.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",l),n.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),s.on("dispose",()=>{n.audioTracks().removeEventListener("change",l),n.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),n.clearTracks("audio");for(const u in e.AUDIO.tracks)n.audioTracks().addTrack(e.AUDIO.tracks[u])},$P=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:In,activeTrack:In,getActiveGroup:In,onGroupChanged:In,onTrackChanged:In,lastTrack_:null,logger_:Ti(`MediaGroups[${e}]`)}}),i};class tT{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Wt(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class VP extends B.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new tT,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Ti("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const n=t.serverUri||t.serverURL;if(!n){this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`),this.trigger("error");return}if(n.startsWith("data:")){this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1));return}this.steeringManifest.reloadUri=Wt(e,n),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const n=e?t:this.getRequestURI(t);if(!n){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const s={contentSteeringInfo:{uri:n}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:n,requestType:"content-steering-manifest"},(r,a)=>{if(r){if(a.status===410){this.logger_(`manifest request 410 ${r}.`),this.logger_(`There will be no more content steering requests to ${n} this session.`),this.excludedSteeringManifestURLs.add(n);return}if(a.status===429){const u=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${r}.`),this.logger_(`content steering will retry in ${u} seconds.`),this.startTTLTimeout_(parseInt(u,10));return}this.logger_(`manifest failed to load ${r}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});let o;try{o=JSON.parse(this.request_.responseText)}catch(u){const c={errorType:B.Error.StreamingContentSteeringParserError,error:u};this.trigger({type:"error",metadata:c})}this.assignSteeringProperties_(o);const l={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:l}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new P.URL(e),n=new P.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(n.toString())}decodeDataUriManifest_(e){const t=JSON.parse(P.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new P.URL(e),n=this.getPathway(),s=this.getBandwidth_();if(n){const r=`_${this.manifestType_}_pathway`;t.searchParams.set(r,n)}if(s){const r=`_${this.manifestType_}_throughput`;t.searchParams.set(r,s)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const n=(s=>{for(const r of s)if(this.availablePathways_.has(r))return r;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==n&&(this.currentPathway=n,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=s=>this.excludedSteeringManifestURLs.has(s);if(this.proxyServerUrl_){const s=this.setProxyServerUrl_(e);if(!t(s))return s}const n=this.setSteeringParams_(e);return t(n)?null:n}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=P.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){P.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new tT}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(Wt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const jP=10;let Dn;const zP=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],qP=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},GP=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:n,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:a,bufferBasedABR:o,log:l}){if(!n)return B.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${i&&i.id||"null"} -> ${n.id}`;if(!i)return l(`${u} as current playlist is not set`),!0;if(n.id===i.id)return!1;const c=Boolean(la(e,t).length);if(!i.endList)return!c&&typeof i.partTargetDuration=="number"?(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${u} as current playlist is live`),!0);const d=cp(e,t),p=o?ft.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ft.MAX_BUFFER_LOW_WATER_LINE;if(a_)&&d>=s){let T=`${u} as forwardBuffer >= bufferLowWaterLine (${d} >= ${s})`;return o&&(T+=` and next bandwidth > current bandwidth (${y} > ${_})`),l(T),!0}return l(`not ${u} as no switching criteria met`),!1};class HP extends B.EventTarget{constructor(e){super();const{src:t,withCredentials:n,tech:s,bandwidth:r,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:u,sourceType:c,cacheEncryptionKeys:d,bufferBasedABR:p,leastPixelDiffSelector:y,captionServices:_}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:T}=e;(T===null||typeof T>"u")&&(T=1/0),Dn=a,this.bufferBasedABR=Boolean(p),this.leastPixelDiffSelector=Boolean(y),this.withCredentials=n,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=c,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=T,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:n,maxPlaylistRetries:T,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=$P(),this.mediaSource=new P.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=vt(),this.hasPlayed_=!1,this.syncController_=new AP(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new kP,this.sourceUpdater_=new Hv(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new IP,this.keyStatusMap_=new Map;const E={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:_,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new xp(t,this.vhs_,ke(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ha(t,this.vhs_,ke(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new wp(ke(E,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new wp(ke(E,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new bP(ke(E,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((D,k)=>{function w(){s.off("vttjserror",O),D()}function O(){s.off("vttjsloaded",w),k()}s.one("vttjsloaded",w),s.one("vttjserror",O),s.addWebVttScript_()})}),e);const S=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new VP(this.vhs_.xhr,S),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),zP.forEach(D=>{this[D+"_"]=qP.bind(this,D)}),this.logger_=Ti("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const C=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(C,()=>{const D=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-D,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,n){const s=this.media(),r=s&&(s.id||s.uri),a=e&&(e.id||e.uri);if(r&&r!==a){this.logger_(`switch media ${r} -> ${a} from ${t}`);const o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,n)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],n=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(n&&s){const a=(n.length?n[0].playlists:n.playlists).filter(o=>o.attributes.serviceLocation===s);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=P.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(P.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const n=e.mediaGroups.AUDIO,s=Object.keys(n);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const o=n.main||s.length&&n[s[0]];for(const l in o)if(o[l].default){r={label:l};break}}if(!r)return t;const a=[];for(const o in n)if(n[o][r.label]){const l=n[o][r.label];if(l.playlists&&l.playlists.length)a.push.apply(a,l.playlists);else if(l.uri)a.push(l);else if(e.playlists.length)for(let u=0;u{const t=this.mainPlaylistLoader_.media(),n=t.targetDuration*1.5*1e3;pp(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=n,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),UP({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let n;if(this.enableLowInitialPlaylist&&(n=this.selectInitialPlaylist()),n||(n=this.selectPlaylist()),!n||!this.shouldSwitchToMedia_(n)||(this.initialMedia_=n,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),n=t.targetDuration*1.5*1e3;pp(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=n,this.sourceType_==="dash"&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,n=>{this.player_.trigger(Ke({},n))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const n=e.mediaGroups||{};let s=!0;const r=Object.keys(n.AUDIO);for(const a in n.AUDIO)for(const o in n.AUDIO[a])n.AUDIO[a][o].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Dn.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(n.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,n=this.tech_.currentTime(),s=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),a=this.tech_.buffered();return GP({buffered:a,currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const n=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",n=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:jP}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const n=this.getCodecsOrExclude_();!n||this.sourceUpdater_.addOrChangeSourceBuffers(n)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(n=>{this.mainSegmentLoader_.on(n,s=>{this.player_.trigger(Ke({},s))}),this.audioSegmentLoader_.on(n,s=>{this.player_.trigger(Ke({},s))}),this.subtitleSegmentLoader_.on(n,s=>{this.player_.trigger(Ke({},s))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.tech_.setCurrentTime(this.tech_.currentTime())})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}!e||(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const n=this.syncController_.getExpiredTime(e,this.duration());if(n===null)return!1;const s=Dn.Playlist.playlistEnd(e,n),r=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return s-r<=tn;const o=a.end(a.length-1);return o-r<=tn&&s-o<=tn}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:n}){if(e=e||this.mainPlaylistLoader_.media(),n=n||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,r=s.filter(gc),a=r.length===1&&r[0]===e;if(s.length===1&&n!==1/0)return B.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const _=this.pathwayAttribute_(e),T=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(_),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(_)},T);return}let y=!1;s.forEach(_=>{if(_===e)return;const T=_.excludeUntil;typeof T<"u"&&T!==1/0&&(y=!0,delete _.excludeUntil)}),y&&(B.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+n*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const l=this.selectPlaylist();if(!l){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const u=t.internal?this.logger_:B.log.warn,c=t.message?" "+t.message:"";u(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${c} Switching to playlist ${l.id}.`),l.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const d=l.targetDuration/2*1e3||5*1e3,p=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=d;return this.switchMedia_(l,"exclude",a||p)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const n=[],s=e==="all";(s||e==="main")&&n.push(this.mainPlaylistLoader_);const r=[];(s||e==="audio")&&r.push("AUDIO"),(s||e==="subtitle")&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&n.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&n.push(o)}),n.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=la(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Dn.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let n=this.syncController_.getExpiredTime(t,this.duration());if(n===null)return;const s=this.mainPlaylistLoader_.main,r=Dn.Playlist.seekable(t,n,Dn.Playlist.liveEdgeDelay(s,t));if(r.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),n=this.syncController_.getExpiredTime(t,this.duration()),n===null||(e=Dn.Playlist.seekable(t,n,Dn.Playlist.liveEdgeDelay(s,t)),e.length===0)))return;let a,o;if(this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),o=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=vt([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)0&&(n=Math.max(n,t.end(t.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const n in t)t[n].forEach(s=>{s.playlistLoader&&s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),n=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!n)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const n=qo(this.main(),t),s={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=n.video||e.main.videoCodec||TD),e.main.isMuxed&&(s.video+=`,${n.audio||e.main.audioCodec||N_}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(s.audio=n.audio||e.main.audioCodec||e.audio.audioCodec||N_,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(u,c)=>u?vu(c):Bd(c),o={};let l;if(["video","audio"].forEach(function(u){if(s.hasOwnProperty(u)&&!a(e[u].isFmp4,s[u])){const c=e[u].isFmp4?"browser":"muxer";o[c]=o[c]||[],o[c].push(s[u]),u==="audio"&&(l=c)}}),r&&l&&t.attributes.AUDIO){const u=t.attributes.AUDIO;this.main().playlists.forEach(c=>{(c.attributes&&c.attributes.AUDIO)===u&&c!==t&&(c.excludeUntil=1/0)}),this.logger_(`excluding audio group ${u} as ${l} does not support codec(s): "${s.audio}"`)}if(Object.keys(o).length){const u=Object.keys(o).reduce((c,d)=>(c&&(c+=", "),c+=`${d} does not support codec(s): "${o[d].join(",")}"`,c),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:u},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const u=[];if(["video","audio"].forEach(c=>{const d=(Hi(this.sourceUpdater_.codecs[c]||"")[0]||{}).type,p=(Hi(s[c]||"")[0]||{}).type;d&&p&&d.toLowerCase()!==p.toLowerCase()&&u.push(`"${this.sourceUpdater_.codecs[c]}" -> "${s[c]}"`)}),u.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${u.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(n=>{const s=e[n];if(t.indexOf(s.id)!==-1)return;t.push(s.id);const r=qo(this.main,s),a=[];r.audio&&!Bd(r.audio)&&!vu(r.audio)&&a.push(`audio codec ${r.audio}`),r.video&&!Bd(r.video)&&!vu(r.video)&&a.push(`video codec ${r.video}`),r.text&&r.text==="stpp.ttml.im1t"&&a.push(`text codec ${r.text}`),a.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],n=this.main().playlists,s=_c(Hi(e)),r=Lv(s),a=s.video&&Hi(s.video)[0]||null,o=s.audio&&Hi(s.audio)[0]||null;Object.keys(n).forEach(l=>{const u=n[l];if(t.indexOf(u.id)!==-1||u.excludeUntil===1/0)return;t.push(u.id);const c=[],d=qo(this.mainPlaylistLoader_.main,u),p=Lv(d);if(!(!d.audio&&!d.video)){if(p!==r&&c.push(`codec count "${p}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const y=d.video&&Hi(d.video)[0]||null,_=d.audio&&Hi(d.audio)[0]||null;y&&a&&y.type.toLowerCase()!==a.type.toLowerCase()&&c.push(`video codec "${y.type}" !== "${a.type}"`),_&&o&&_.type.toLowerCase()!==o.type.toLowerCase()&&c.push(`audio codec "${_.type}" !== "${o.type}"`)}c.length&&(u.excludeUntil=1/0,this.logger_(`excluding ${u.id}: ${c.join(" && ")}`))}})}updateAdCues_(e){let t=0;const n=this.seekable();n.length&&(t=n.start(0)),SP(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=ft.GOAL_BUFFER_LENGTH,n=ft.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,ft.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=ft.BUFFER_LOW_WATER_LINE,n=ft.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,ft.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,ft.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,this.bufferBasedABR?r:s)}bufferHighWaterLine(){return ft.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Bv(this.inbandTextTracks_,"com.apple.streaming",this.tech_),rP({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,n){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Bv(this.inbandTextTracks_,e,this.tech_),iP({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:n})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(!!e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,n=>{this.trigger(Ke({},n))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const r=this.contentSteeringController_.getAvailablePathways(),a=[];for(const o of t.playlists){const l=o.attributes.serviceLocation;if(l&&(a.push(l),!r.has(l)))return!0}return!!(!a.length&&r.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const n=this.main().playlists,s=new Set;let r=!1;Object.keys(n).forEach(a=>{const o=n[a],l=this.pathwayAttribute_(o),u=l&&e!==l;o.excludeUntil===1/0&&o.lastExcludeReason_==="content-steering"&&!u&&(delete o.excludeUntil,delete o.lastExcludeReason_,r=!0);const d=!o.excludeUntil&&o.excludeUntil!==1/0;!(!s.has(o.id)&&u&&d)||(s.add(o.id),o.excludeUntil=1/0,o.lastExcludeReason_="content-steering",this.logger_(`excluding ${o.id} for ${o.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const o=this.mediaTypes_[a];if(o.activePlaylistLoader){const l=o.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,n=this.contentSteeringController_.currentPathwayClones,s=this.contentSteeringController_.nextPathwayClones;if(!!(n&&n.size||s&&s.size)){for(const[a,o]of n.entries())s.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(o),this.contentSteeringController_.excludePathway(a));for(const[a,o]of s.entries()){const l=n.get(a);if(!l){t.filter(c=>c.attributes["PATHWAY-ID"]===o["BASE-ID"]).forEach(c=>{this.mainPlaylistLoader_.addClonePathway(o,c)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(l,o)||(this.mainPlaylistLoader_.updateOrDeleteClone(o,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...s])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const n=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const r in n)if(n[r]!==s[r])return!1;for(const r in s)if(n[r]!==s[r])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(n=>{const s=this.mainPlaylistLoader_.getKeyIdSet(n);!s||!s.size||s.forEach(r=>{const a="usable",o=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===a,l=n.lastExcludeReason_===t&&n.excludeUntil===1/0;o?o&&l&&(delete n.excludeUntil,delete n.lastExcludeReason_,this.logger_(`enabling playlist ${n.id} because key ID ${r} is ${a}`)):(n.excludeUntil!==1/0&&n.lastExcludeReason_!==t&&(n.excludeUntil=1/0,n.lastExcludeReason_=t,this.logger_(`excluding playlist ${n.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(n=>{const s=n&&n.attributes&&n.attributes.RESOLUTION&&n.attributes.RESOLUTION.height<720,r=n.excludeUntil===1/0&&n.lastExcludeReason_===t;s&&r&&(delete n.excludeUntil,B.log.warn(`enabling non-HD playlist ${n.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:TP(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const WP=(i,e,t)=>n=>{const s=i.main.playlists[e],r=fp(s),a=gc(s);if(typeof n>"u")return a;n?delete s.disabled:s.disabled=!0;const o={renditionInfo:{id:e,bandwidth:s.attributes.BANDWIDTH,resolution:s.attributes.RESOLUTION,codecs:s.attributes.CODECS},cause:"fast-quality"};return n!==a&&!r&&(t(s),n?i.trigger({type:"renditionenabled",metadata:o}):i.trigger({type:"renditiondisabled",metadata:o})),n};class XP{constructor(e,t,n){const{playlistController_:s}=e,r=s.fastQualityChange_.bind(s);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=qo(s.main(),t),this.playlist=t,this.id=n,this.enabled=WP(e.playlists,t.id,r)}}const KP=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=jo(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(n=>!fp(n)).map((n,s)=>new XP(i,n,n.id)):[]}},iT=["seeking","seeked","pause","playing","error"];class YP extends B.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Ti("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),n=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],l={};o.forEach(c=>{l[c]={reset:()=>this.resetSegmentDownloads_(c),updateend:()=>this.checkSegmentDownloads_(c)},a[`${c}SegmentLoader_`].on("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].on("playlistupdate",l[c].reset),this.tech_.on(["seeked","seeking"],l[c].reset)});const u=c=>{["main","audio"].forEach(d=>{a[`${d}SegmentLoader_`][c]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=()=>u("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(iT,r),this.tech_.on("canplay",n),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(iT,r),this.tech_.off("canplay",n),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(c=>{a[`${c}SegmentLoader_`].off("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].off("playlistupdate",l[c].reset),this.tech_.off(["seeked","seeking"],l[c].reset)}),this.checkCurrentTimeTimeout_&&P.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&P.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=P.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,n=t[`${e}SegmentLoader_`],s=n.buffered_(),r=j4(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,r){const a={bufferedRanges:s};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:n.playlist_&&n.playlist_.id,buffered:Ms(s)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+tn>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(vt([this.lastRecordedTime,e]));const n={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:n}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),n=this.tech_.currentTime(),s=this.afterSeekableWindow_(t,n,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(s&&(r=t.end(t.length-1)),this.beforeSeekableWindow_(t,n)){const _=t.start(0);r=_+(_===t.end(0)?0:tn)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${n} with seekable range ${G1(t)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const a=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),l=a.audioBuffer?a.audioBuffered():null,u=a.videoBuffer?a.videoBuffered():null,c=this.media(),d=c.partTargetDuration?c.partTargetDuration:(c.targetDuration-en)*2,p=[l,u];for(let _=0;_ ${n.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const o=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${o}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(o),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const n=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=pc(s,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,n,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+tn;const a=!n.endList,o=typeof n.partTargetDuration=="number";return a&&(o||s)&&(r=e.end(e.length-1)+n.targetDuration*3),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null}}const ZP={errorInterval:30,getSource(i){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(t)}},nT=function(i,e){let t=0,n=0;const s=ke(ZP,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const r=function(){n&&i.currentTime(n)},a=function(c){c!=null&&(n=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",r),i.src(c),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},o=function(){if(Date.now()-t{Object.defineProperty(He,i,{get(){return B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),ft[i]},set(e){if(B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){B.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}ft[i]=e}})});const rT="videojs-vhs",aT=function(i,e){const t=e.media();let n=-1;for(let s=0;s{i.addQualityLevel(t)}),aT(i,e.playlists)};He.canPlaySource=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const sL=(i,e,t)=>{if(!i)return i;let n={};e&&e.attributes&&e.attributes.CODECS&&(n=_c(Hi(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(n.audio=t.attributes.CODECS);const s=fo(n.video),r=fo(n.audio),a={};for(const o in i)a[o]={},r&&(a[o].audioContentType=r),s&&(a[o].videoContentType=s),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof i[o]=="string"&&(a[o].url=i[o]);return ke(i,a)},rL=(i,e)=>i.reduce((t,n)=>{if(!n.contentProtection)return t;const s=e.reduce((r,a)=>{const o=n.contentProtection[a];return o&&o.pssh&&(r[a]={pssh:o.pssh}),r},{});return Object.keys(s).length&&t.push(s),t},[]),aL=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:n})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const s=t?n.concat([t]):n,r=rL(s,Object.keys(e)),a=[],o=[];return r.forEach(l=>{o.push(new Promise((u,c)=>{i.tech_.one("keysessioncreated",u)})),a.push(new Promise((u,c)=>{i.eme.initializeMediaKeys({keySystems:l},d=>{if(d){c(d);return}u()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},oL=({player:i,sourceKeySystems:e,media:t,audioMedia:n})=>{const s=sL(e,t,n);return s?(i.currentSource().keySystems=s,s&&!i.eme?(B.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},oT=()=>{if(!P.localStorage)return null;const i=P.localStorage.getItem(rT);if(!i)return null;try{return JSON.parse(i)}catch{return null}},lL=i=>{if(!P.localStorage)return!1;let e=oT();e=e?ke(e,i):i;try{P.localStorage.setItem(rT,JSON.stringify(e))}catch{return!1}return e},uL=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,lT=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},uT=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},cT=(i,e)=>{!i._requestCallbackSet||(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},hT=(i,e)=>{!i._responseCallbackSet||(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};He.supportsNativeHls=function(){if(!H||!H.createElement)return!1;const i=H.createElement("video");return B.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(i.canPlayType(t))}):!1}(),He.supportsNativeDash=function(){return!H||!H.createElement||!B.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(H.createElement("video").canPlayType("application/dash+xml"))}(),He.supportsTypeNatively=i=>i==="hls"?He.supportsNativeHls:i==="dash"?He.supportsNativeDash:!1,He.isSupported=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},He.xhr.onRequest=function(i){lT(He.xhr,i)},He.xhr.onResponse=function(i){uT(He.xhr,i)},He.xhr.offRequest=function(i){cT(He.xhr,i)},He.xhr.offResponse=function(i){hT(He.xhr,i)};const cL=B.getComponent("Component");class dT extends cL{constructor(e,t,n){if(super(t,n.vhs),typeof n.initialBandwidth=="number"&&(this.options_.bandwidth=n.initialBandwidth),this.logger_=Ti("VhsHandler"),t.options_&&t.options_.playerId){const s=B.getPlayer(t.options_.playerId);this.player_=s}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(H,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],s=>{const r=H.fullscreenElement||H.webkitFullscreenElement||H.mozFullScreenElement||H.msFullscreenElement;r&&r.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=ke(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const n=oT();n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),n&&n.throughput&&(this.options_.throughput=n.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=ft.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===ft.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(n=>{typeof this.source_[n]<"u"&&(this.options_[n]=this.source_[n])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=uL(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=He,this.options_.sourceType=F_(t),this.options_.seekTo=r=>{this.tech_.setCurrentTime(r)},this.options_.player_=this.player_,this.playlistController_=new HP(this.options_);const n=ke({liveRangeSafeTimeDelta:tn},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new YP(n),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const r=B.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),r.error(a)});const s=this.options_.bufferBasedABR?He.movingAverageBandwidthSelector(.55):He.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=He.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(r){this.playlistController_.selectPlaylist=r.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(r){this.playlistController_.mainSegmentLoader_.throughput.rate=r,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let r=this.playlistController_.mainSegmentLoader_.bandwidth;const a=P.navigator.connection||P.navigator.mozConnection||P.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=o&&r>=o?r=Math.max(r,l):r=l}return r},set(r){this.playlistController_.mainSegmentLoader_.bandwidth=r,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const r=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(r+a))},set(){B.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Ms(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Ms(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&lL({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{KP(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=P.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),aL({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=oL({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",n=>{this.playlistController_.updatePlaylistByKeyStatus(n.keyId,n.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=B.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{nL(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{aT(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":sT,"mux.js":JP,"mpd-parser":eL,"m3u8-parser":tL,"aes-decrypter":iL}}version(){return this.constructor.version()}canChangeType(){return Hv.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&P.URL.revokeObjectURL&&(P.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return _5({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,n=!0,s=2){return mv({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{lT(this.xhr,e)},this.xhr.onResponse=e=>{uT(this.xhr,e)},this.xhr.offRequest=e=>{cT(this.xhr,e)},this.xhr.offResponse=e=>{hT(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(n=>{this.playlistController_.on(n,s=>{this.player_.trigger(Ke({},s))})}),t.forEach(n=>{this.playbackWatcher_.on(n,s=>{this.player_.trigger(Ke({},s))})})}}const bc={name:"videojs-http-streaming",VERSION:sT,canHandleSource(i,e={}){const t=ke(B.options,e);return bc.canPlayType(i.type,t)},handleSource(i,e,t={}){const n=ke(B.options,t);return e.vhs=new dT(i,e,n),e.vhs.xhr=hv(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=F_(i);if(!t)return"";const n=bc.getOverrideNative(e);return!He.supportsTypeNatively(t)||n?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS),{overrideNative:n=t}=e;return n}};(()=>vu("avc1.4d400d,mp4a.40.2"))()&&B.getTech("Html5").registerSourceHandler(bc,0),B.VhsHandler=dT,B.VhsSourceHandler=bc,B.Vhs=He,B.use||B.registerComponent("Vhs",He),B.options.vhs=B.options.vhs||{},(!B.getPlugin||!B.getPlugin("reloadSourceOnError"))&&B.registerPlugin("reloadSourceOnError",QP);const eF="",hL={Play:"\u64AD\u653E",Pause:"\u6682\u505C","Current Time":"\u5F53\u524D\u65F6\u95F4",Duration:"\u65F6\u957F","Remaining Time":"\u5269\u4F59\u65F6\u95F4","Stream Type":"\u5A92\u4F53\u6D41\u7C7B\u578B",LIVE:"\u76F4\u64AD",Loaded:"\u52A0\u8F7D\u5B8C\u6210",Progress:"\u8FDB\u5EA6",Fullscreen:"\u5168\u5C4F","Exit Fullscreen":"\u9000\u51FA\u5168\u5C4F","Picture-in-Picture":"\u753B\u4E2D\u753B","Exit Picture-in-Picture":"\u9000\u51FA\u753B\u4E2D\u753B",Mute:"\u9759\u97F3",Unmute:"\u5F00\u542F\u97F3\u6548","Playback Rate":"\u64AD\u653E\u901F\u5EA6",Subtitles:"\u5B57\u5E55","subtitles off":"\u5173\u95ED\u5B57\u5E55",Captions:"\u5185\u5D4C\u5B57\u5E55","captions off":"\u5173\u95ED\u5185\u5D4C\u5B57\u5E55",Chapters:"\u8282\u76EE\u6BB5\u843D","Close Modal Dialog":"\u5173\u95ED\u5F39\u7A97",Descriptions:"\u63CF\u8FF0","descriptions off":"\u5173\u95ED\u63CF\u8FF0","Audio Track":"\u97F3\u8F68","You aborted the media playback":"\u89C6\u9891\u64AD\u653E\u88AB\u7EC8\u6B62","A network error caused the media download to fail part-way.":"\u7F51\u7EDC\u9519\u8BEF\u5BFC\u81F4\u89C6\u9891\u4E0B\u8F7D\u4E2D\u9014\u5931\u8D25\u3002","The media could not be loaded, either because the server or network failed or because the format is not supported.":"\u89C6\u9891\u56E0\u683C\u5F0F\u4E0D\u652F\u6301\u6216\u8005\u670D\u52A1\u5668\u6216\u7F51\u7EDC\u7684\u95EE\u9898\u65E0\u6CD5\u52A0\u8F7D\u3002","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"\u7531\u4E8E\u89C6\u9891\u6587\u4EF6\u635F\u574F\u6216\u662F\u8BE5\u89C6\u9891\u4F7F\u7528\u4E86\u4F60\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u7684\u529F\u80FD\uFF0C\u64AD\u653E\u7EC8\u6B62\u3002","No compatible source was found for this media.":"\u65E0\u6CD5\u627E\u5230\u6B64\u89C6\u9891\u517C\u5BB9\u7684\u6E90\u3002","The media is encrypted and we do not have the keys to decrypt it.":"\u89C6\u9891\u5DF2\u52A0\u5BC6\uFF0C\u65E0\u6CD5\u89E3\u5BC6\u3002","Play Video":"\u64AD\u653E\u89C6\u9891",Close:"\u5173\u95ED","Modal Window":"\u5F39\u7A97","This is a modal window":"\u8FD9\u662F\u4E00\u4E2A\u5F39\u7A97","This modal can be closed by pressing the Escape key or activating the close button.":"\u53EF\u4EE5\u6309ESC\u6309\u952E\u6216\u542F\u7528\u5173\u95ED\u6309\u94AE\u6765\u5173\u95ED\u6B64\u5F39\u7A97\u3002",", opens captions settings dialog":", \u5F00\u542F\u6807\u9898\u8BBE\u7F6E\u5F39\u7A97",", opens subtitles settings dialog":", \u5F00\u542F\u5B57\u5E55\u8BBE\u7F6E\u5F39\u7A97",", opens descriptions settings dialog":", \u5F00\u542F\u63CF\u8FF0\u8BBE\u7F6E\u5F39\u7A97",", selected":", \u9009\u62E9","captions settings":"\u5B57\u5E55\u8BBE\u5B9A","Audio Player":"\u97F3\u9891\u64AD\u653E\u5668","Video Player":"\u89C6\u9891\u64AD\u653E\u5668",Replay:"\u91CD\u65B0\u64AD\u653E","Progress Bar":"\u8FDB\u5EA6\u6761","Volume Level":"\u97F3\u91CF","subtitles settings":"\u5B57\u5E55\u8BBE\u5B9A","descriptions settings":"\u63CF\u8FF0\u8BBE\u5B9A",Text:"\u6587\u5B57",White:"\u767D",Black:"\u9ED1",Red:"\u7EA2",Green:"\u7EFF",Blue:"\u84DD",Yellow:"\u9EC4",Magenta:"\u7D2B\u7EA2",Cyan:"\u9752",Background:"\u80CC\u666F",Window:"\u7A97\u53E3",Transparent:"\u900F\u660E","Semi-Transparent":"\u534A\u900F\u660E",Opaque:"\u4E0D\u900F\u660E","Font Size":"\u5B57\u4F53\u5C3A\u5BF8","Text Edge Style":"\u5B57\u4F53\u8FB9\u7F18\u6837\u5F0F",None:"\u65E0",Raised:"\u6D6E\u96D5",Depressed:"\u538B\u4F4E",Uniform:"\u5747\u5300",Dropshadow:"\u4E0B\u9634\u5F71","Font Family":"\u5B57\u4F53\u5E93","Proportional Sans-Serif":"\u6BD4\u4F8B\u65E0\u7EC6\u4F53","Monospace Sans-Serif":"\u5355\u95F4\u9694\u65E0\u7EC6\u4F53","Proportional Serif":"\u6BD4\u4F8B\u7EC6\u4F53","Monospace Serif":"\u5355\u95F4\u9694\u7EC6\u4F53",Casual:"\u8212\u9002",Script:"\u624B\u5199\u4F53","Small Caps":"\u5C0F\u578B\u5927\u5199\u5B57\u4F53",Reset:"\u91CD\u7F6E","restore all settings to the default values":"\u6062\u590D\u5168\u90E8\u8BBE\u5B9A\u81F3\u9884\u8BBE\u503C",Done:"\u5B8C\u6210","Caption Settings Dialog":"\u5B57\u5E55\u8BBE\u5B9A\u7A97\u53E3","Beginning of dialog window. Escape will cancel and close the window.":"\u6253\u5F00\u5BF9\u8BDD\u7A97\u53E3\u3002Escape\u952E\u5C06\u53D6\u6D88\u5E76\u5173\u95ED\u5BF9\u8BDD\u7A97\u53E3","End of dialog window.":"\u7ED3\u675F\u5BF9\u8BDD\u7A97\u53E3","Seek to live, currently behind live":"\u5C1D\u8BD5\u76F4\u64AD\uFF0C\u5F53\u524D\u4E3A\u5EF6\u65F6\u64AD\u653E","Seek to live, currently playing live":"\u5C1D\u8BD5\u76F4\u64AD\uFF0C\u5F53\u524D\u4E3A\u5B9E\u65F6\u64AD\u653E","progress bar timing: currentTime={1} duration={2}":"{1}/{2}","{1} is loading.":"\u6B63\u5728\u52A0\u8F7D {1}\u3002","No content":"\u65E0\u5185\u5BB9",Color:"\u989C\u8272",Opacity:"\u4E0D\u900F\u660E\u5EA6","Text Background":"\u6587\u672C\u80CC\u666F","Caption Area Background":"\u5B57\u5E55\u533A\u57DF\u80CC\u666F","Skip forward {1} seconds":"\u5FEB\u8FDB {1} \u79D2","Skip backward {1} seconds":"\u5FEB\u9000 {1} \u79D2"};function dL(i){return{all:i=i||new Map,on:function(e,t){var n=i.get(e);n?n.push(t):i.set(e,[t])},off:function(e,t){var n=i.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var n=i.get(e);n&&n.slice().map(function(s){s(t)}),(n=i.get("*"))&&n.slice().map(function(s){s(e,t)})}}}const Wo=dL(),fL=["src"],pL=b.defineComponent({__name:"HoskiVideo",props:{source:{},autoPlay:{type:Boolean,default:!1},ratio:{default:"4:3"}},setup(i,{expose:e}){const t=i,n=b.ref();let s;const r=async()=>{B.addLanguage("zh-CN",hL),await b.nextTick();const o={muted:!0,controls:!0,autoplay:!0,loop:!0,language:"zh-CN",techOrder:["html5"]};s=B(n.value,o,()=>{B.log("\u64AD\u653E\u5668\u5DF2\u7ECF\u51C6\u5907\u597D\u4E86!"),t.autoPlay&&t.source.videoSrc&&s.play(),s.on("ended",()=>{B.log("\u64AD\u653E\u7ED3\u675F\u4E86!")}),s.on("error",()=>{B.log("\u64AD\u653E\u5668\u89E3\u6790\u51FA\u9519!")})})};b.onMounted(()=>{r()});const a=o=>{Wo.emit("clickVideo",o)};return b.watch(()=>t.source.videoSrc,()=>{s.pause(),s.src(t.source.videoSrc),s.load(),t.source.videoSrc&&s.play()}),b.onBeforeUnmount(()=>{s==null||s.dispose()}),e({hoskiRef:n}),(o,l)=>(b.openBlock(),b.createElementBlock("div",{class:"videoPlay",style:b.normalizeStyle({"--w":o.ratio=="4:3"?"80%":"100%","--a":o.ratio=="4:3"?"-13%":"0"})},[b.createElementVNode("video",{onContextmenu:l[0]||(l[0]=b.withModifiers(u=>a(o.source),["prevent","stop"])),ref_key:"m3u8_video",ref:n,class:"video-js vjs-default-skin vjs-big-play-centered vjs-matrix",controls:!0},[b.createElementVNode("source",{src:o.source.videoSrc},null,8,fL)],544)],4))}}),$F="",VF="",gL=Ft(pL,[["__scopeId","data-v-5776b27c"]]),jF="",mL={},_L=i=>(b.pushScopeId("data-v-e4fa5b34"),i=i(),b.popScopeId(),i),yL={t:"1720973626999",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"9294",width:"200",height:"200"},vL=[_L(()=>b.createElementVNode("path",{d:"M362.666667 298.666667h85.333333c12.8 0 21.333333 8.533333 21.333333 21.333333v384c0 12.8-8.533333 21.333333-21.333333 21.333333h-85.333333c-12.8 0-21.333333-8.533333-21.333334-21.333333v-384c0-12.8 8.533333-21.333333 21.333334-21.333333zM618.666667 298.666667h85.333333c12.8 0 21.333333 8.533333 21.333333 21.333333v384c0 12.8-8.533333 21.333333-21.333333 21.333333h-85.333333c-12.8 0-21.333333-8.533333-21.333334-21.333333v-384c0-12.8 8.533333-21.333333 21.333334-21.333333z","p-id":"9295"},null,-1))];function TL(i,e){return b.openBlock(),b.createElementBlock("svg",yL,vL)}const xL=Ft(mL,[["render",TL],["__scopeId","data-v-e4fa5b34"]]),qF="",bL={},EL=i=>(b.pushScopeId("data-v-087ed345"),i=i(),b.popScopeId(),i),SL={t:"1720973932277",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"9580",width:"200",height:"200"},CL=[EL(()=>b.createElementVNode("path",{d:"M362.666667 256h302.933333C721.066667 256 768 302.933333 768 362.666667v302.933333c0 59.733333-46.933333 106.666667-106.666667 106.666667h-298.666666C302.933333 768 256 721.066667 256 661.333333v-298.666666C256 302.933333 302.933333 256 362.666667 256z m200.533333 226.133333h98.133333c12.8 0 25.6-12.8 25.6-25.6s-12.8-25.6-25.6-25.6h-38.4L712.533333 341.333333c8.533333-8.533333 8.533333-25.6 0-34.133333-12.8-8.533333-29.866667-8.533333-38.4 0l-89.6 89.6v-38.4c0-4.266667-4.266667-12.8-8.533333-17.066667-4.266667-4.266667-8.533333-8.533333-17.066667-8.533333-12.8 0-25.6 12.8-25.6 25.6v98.133333c4.266667 12.8 17.066667 25.6 29.866667 25.6z m-102.4 55.466667H362.666667c-12.8 0-25.6 12.8-25.6 25.6s12.8 25.6 25.6 25.6h38.4l-89.6 89.6c-8.533333 8.533333-8.533333 25.6 0 34.133333 8.533333 8.533333 25.6 8.533333 34.133333 0l89.6-89.6v38.4c0 4.266667 4.266667 12.8 8.533333 17.066667 4.266667 4.266667 8.533333 8.533333 17.066667 8.533333 12.8 0 25.6-12.8 25.6-25.6v-98.133333c0-17.066667-12.8-25.6-25.6-25.6z","p-id":"9581"},null,-1))];function wL(i,e){return b.openBlock(),b.createElementBlock("svg",SL,CL)}const AL=Ft(bL,[["render",wL],["__scopeId","data-v-087ed345"]]),IL={class:"player"},DL={class:"hoski-video"},kL={class:"player-title"},RL={key:0},PL=b.defineComponent({__name:"VideoCellPlayer",props:{source:{type:Object,default:()=>{}},ratio:{type:String,default:"4:3"}},emits:["video-option"],setup(i,{emit:e}){const t=b.ref(!1),n=b.ref(!0),s=b.ref(),r=b.computed(()=>[{icon:n.value?J3:xL,clickEvent:()=>a(0)},{icon:rI,clickEvent:()=>a(1)},{icon:t.value?hI:AL,clickEvent:()=>a(2)}]),a=l=>{switch(Wo.emit("video-option",l),l){case 0:n.value=!n.value,n.value?s.value.hoskiRef.pause():s.value.hoskiRef.play();break;case 1:s.value.hoskiRef.pause(),n.value=!0;const u=s.value.hoskiRef.currentTime;console.log(`\u5F53\u524D\u64AD\u653E\u7684\u4F4D\u7F6E\u4E3A${u}`);break;case 2:t.value=!t.value,o();break}};function o(){const l=s.value.hoskiRef;l!=null&&l.requestFullscreen?l==null||l.requestFullscreen():l!=null&&l.mozRequestFullScreen?l==null||l.mozRequestFullScreen():l!=null&&l.webkitRequestFullScreen&&(l==null||l.webkitRequestFullScreen())}return b.onMounted(()=>{}),(l,u)=>{const c=b.resolveComponent("el-icon");return b.openBlock(),b.createElementBlock("div",IL,[b.createElementVNode("div",DL,[b.createVNode(gL,{ref_key:"hoskiVideo",ref:s,source:i.source,ratio:i.ratio,autoPlay:""},null,8,["source","ratio"])]),b.createElementVNode("div",kL,b.toDisplayString(i.source.title),1),b.createElementVNode("div",{class:"player-option",style:b.normalizeStyle({"justify-content":i.source.speed===""?"flex-end":"space-between"})},[i.source.speed?(b.openBlock(),b.createElementBlock("span",RL,b.toDisplayString(i.source.speed)+" "+b.toDisplayString(i.source.codeStream),1)):b.createCommentVNode("",!0),b.createElementVNode("div",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(r.value,(d,p)=>(b.openBlock(),b.createBlock(c,{class:"icon",size:"25",key:p},{default:b.withCtx(()=>[(b.openBlock(),b.createBlock(b.resolveDynamicComponent(d.icon),{onClick:d.clickEvent},null,8,["onClick"]))]),_:2},1024))),128))])],4)])}}}),HF="",os=Ft(PL,[["__scopeId","data-v-a07c47e2"]]);var fT;const ga=typeof window<"u",LL=i=>typeof i=="string",OL=()=>{};ga&&((fT=window==null?void 0:window.navigator)==null?void 0:fT.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function kp(i){return typeof i=="function"?i():b.unref(i)}function ML(i){return i}function Rp(i){return b.getCurrentScope()?(b.onScopeDispose(i),!0):!1}function NL(i,e=!0){b.getCurrentInstance()?b.onMounted(i):e?i():b.nextTick(i)}function FL(i,e,t={}){const{immediate:n=!0}=t,s=b.ref(!1);let r=null;function a(){r&&(clearTimeout(r),r=null)}function o(){s.value=!1,a()}function l(...u){a(),s.value=!0,r=setTimeout(()=>{s.value=!1,r=null,i(...u)},kp(e))}return n&&(s.value=!0,ga&&l()),Rp(o),{isPending:b.readonly(s),start:l,stop:o}}function pT(i){var e;const t=kp(i);return(e=t==null?void 0:t.$el)!=null?e:t}const gT=ga?window:void 0;function BL(...i){let e,t,n,s;if(LL(i[0])||Array.isArray(i[0])?([t,n,s]=i,e=gT):[e,t,n,s]=i,!e)return OL;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const r=[],a=()=>{r.forEach(c=>c()),r.length=0},o=(c,d,p,y)=>(c.addEventListener(d,p,y),()=>c.removeEventListener(d,p,y)),l=b.watch(()=>[pT(e),kp(s)],([c,d])=>{a(),c&&r.push(...t.flatMap(p=>n.map(y=>o(c,p,y,d))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Rp(u),u}function UL(i,e=!1){const t=b.ref(),n=()=>t.value=Boolean(i());return n(),NL(n,e),t}const Pp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Lp="__vueuse_ssr_handlers__";Pp[Lp]=Pp[Lp]||{},Pp[Lp];var mT=Object.getOwnPropertySymbols,$L=Object.prototype.hasOwnProperty,VL=Object.prototype.propertyIsEnumerable,jL=(i,e)=>{var t={};for(var n in i)$L.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&mT)for(var n of mT(i))e.indexOf(n)<0&&VL.call(i,n)&&(t[n]=i[n]);return t};function zL(i,e,t={}){const n=t,{window:s=gT}=n,r=jL(n,["window"]);let a;const o=UL(()=>s&&"ResizeObserver"in s),l=()=>{a&&(a.disconnect(),a=void 0)},u=b.watch(()=>pT(i),d=>{l(),o.value&&s&&d&&(a=new ResizeObserver(e),a.observe(d,r))},{immediate:!0,flush:"post"}),c=()=>{l(),u()};return Rp(c),{isSupported:o,stop:c}}var _T;(function(i){i.UP="UP",i.RIGHT="RIGHT",i.DOWN="DOWN",i.LEFT="LEFT",i.NONE="NONE"})(_T||(_T={}));var qL=Object.defineProperty,yT=Object.getOwnPropertySymbols,GL=Object.prototype.hasOwnProperty,HL=Object.prototype.propertyIsEnumerable,vT=(i,e,t)=>e in i?qL(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,WL=(i,e)=>{for(var t in e||(e={}))GL.call(e,t)&&vT(i,t,e[t]);if(yT)for(var t of yT(e))HL.call(e,t)&&vT(i,t,e[t]);return i};WL({linear:ML},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});var XL=typeof global=="object"&&global&&global.Object===Object&&global;const KL=XL;var YL=typeof self=="object"&&self&&self.Object===Object&&self,ZL=KL||YL||Function("return this")();const Op=ZL;var QL=Op.Symbol;const ma=QL;var TT=Object.prototype,JL=TT.hasOwnProperty,e6=TT.toString,Xo=ma?ma.toStringTag:void 0;function t6(i){var e=JL.call(i,Xo),t=i[Xo];try{i[Xo]=void 0;var n=!0}catch{}var s=e6.call(i);return n&&(e?i[Xo]=t:delete i[Xo]),s}var i6=Object.prototype,n6=i6.toString;function s6(i){return n6.call(i)}var r6="[object Null]",a6="[object Undefined]",xT=ma?ma.toStringTag:void 0;function bT(i){return i==null?i===void 0?a6:r6:xT&&xT in Object(i)?t6(i):s6(i)}function o6(i){return i!=null&&typeof i=="object"}var l6="[object Symbol]";function Mp(i){return typeof i=="symbol"||o6(i)&&bT(i)==l6}function u6(i,e){for(var t=-1,n=i==null?0:i.length,s=Array(n);++t-1}function J6(i,e){var t=this.__data__,n=Ec(t,i);return n<0?(++this.size,t.push([i,e])):t[n][1]=e,this}function _a(i){var e=-1,t=i==null?0:i.length;for(this.clear();++ei===void 0,Yo=i=>typeof i=="number",EO=i=>typeof Element>"u"?!1:i instanceof Element,SO=i=>Js(i)?!Number.isNaN(Number(i)):!1,DT=i=>Object.keys(i);class CO extends Error{constructor(e){super(e),this.name="ElementPlusError"}}function Zo(i,e){if(process.env.NODE_ENV!=="production"){const t=Js(i)?new CO(`[${i}] ${e}`):i;console.warn(t)}}const wO="utils/dom/style";function Up(i,e="px"){if(!i)return"";if(Yo(i)||SO(i))return`${i}${e}`;if(Js(i))return i;Zo(wO,"binding value must be a string or number")}const kT="__epPropKey",Ri=i=>i,AO=i=>er(i)&&!!i[kT],RT=(i,e)=>{if(!er(i)||AO(i))return i;const{values:t,required:n,default:s,type:r,validator:a}=i,l={type:r,required:!!n,validator:t||a?u=>{let c=!1,d=[];if(t&&(d=Array.from(t),Qs(i,"default")&&d.push(s),c||(c=d.includes(u))),a&&(c||(c=a(u))),!c&&d.length>0){const p=[...new Set(d)].map(y=>JSON.stringify(y)).join(", ");b.warn(`Invalid prop: validation failed${e?` for prop "${e}"`:""}. Expected one of [${p}], got value ${JSON.stringify(u)}.`)}return c}:void 0,[kT]:!0};return Qs(i,"default")&&(l.default=s),l},Qo=i=>xO(Object.entries(i).map(([e,t])=>[e,RT(t,e)])),IO=Ri([String,Object,Function]),DO={Close:Xx,SuccessFilled:cg,InfoFilled:ug,WarningFilled:hg,CircleCloseFilled:lg},PT={success:cg,warning:hg,error:lg,info:ug},LT=(i,e)=>{if(i.install=t=>{for(const n of[i,...Object.values(e!=null?e:{})])t.component(n.name,n)},e)for(const[t,n]of Object.entries(e))i[t]=n;return i},kO=(i,e)=>(i.install=t=>{i._context=t._context,t.config.globalProperties[e]=i},i),RO={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},PO=["","default","small","large"],LO=i=>i,OT=({from:i,replacement:e,scope:t,version:n,ref:s,type:r="API"},a)=>{b.watch(()=>b.unref(a),o=>{o&&Zo(t,`[${r}] ${i} is about to be deprecated in version ${n}, please use ${e} instead. For more detail, please visit: ${s} `)},{immediate:!0})};var OO={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color."},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tour:{next:"Next",previous:"Previous",finish:"Finish"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"}}};const MO=i=>(e,t)=>NO(e,t,b.unref(i)),NO=(i,e,t)=>TO(t,i,i).replace(/\{(\w+)\}/g,(n,s)=>{var r;return`${(r=e==null?void 0:e[s])!=null?r:`{${s}}`}`}),FO=i=>{const e=b.computed(()=>b.unref(i).name),t=b.isRef(i)?i:b.ref(i);return{lang:e,locale:t,t:MO(i)}},MT=Symbol("localeContextKey"),BO=i=>{const e=i||b.inject(MT,b.ref());return FO(b.computed(()=>e.value||OO))},Cc="el",UO="is-",$s=(i,e,t,n,s)=>{let r=`${i}-${e}`;return t&&(r+=`-${t}`),n&&(r+=`__${n}`),s&&(r+=`--${s}`),r},NT=Symbol("namespaceContextKey"),$O=i=>{const e=i||(b.getCurrentInstance()?b.inject(NT,b.ref(Cc)):b.ref(Cc));return b.computed(()=>b.unref(e)||Cc)},$p=(i,e)=>{const t=$O(e);return{namespace:t,b:(T="")=>$s(t.value,i,T,"",""),e:T=>T?$s(t.value,i,"",T,""):"",m:T=>T?$s(t.value,i,"","",T):"",be:(T,E)=>T&&E?$s(t.value,i,T,E,""):"",em:(T,E)=>T&&E?$s(t.value,i,"",T,E):"",bm:(T,E)=>T&&E?$s(t.value,i,T,"",E):"",bem:(T,E,S)=>T&&E&&S?$s(t.value,i,T,E,S):"",is:(T,...E)=>{const S=E.length>=1?E[0]:!0;return T&&S?`${UO}${T}`:""},cssVar:T=>{const E={};for(const S in T)T[S]&&(E[`--${t.value}-${S}`]=T[S]);return E},cssVarName:T=>`--${t.value}-${T}`,cssVarBlock:T=>{const E={};for(const S in T)T[S]&&(E[`--${t.value}-${i}-${S}`]=T[S]);return E},cssVarBlockName:T=>`--${t.value}-${i}-${T}`}},FT={current:0},BT=b.ref(0),UT=2e3,$T=Symbol("elZIndexContextKey"),VT=Symbol("zIndexContextKey"),VO=i=>{const e=b.getCurrentInstance()?b.inject($T,FT):FT,t=i||(b.getCurrentInstance()?b.inject(VT,void 0):void 0),n=b.computed(()=>{const a=b.unref(t);return Yo(a)?a:UT}),s=b.computed(()=>n.value+BT.value),r=()=>(e.current++,BT.value=e.current,s.value);return!ga&&!b.inject($T)&&Zo("ZIndexInjection",`Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:n,currentZIndex:s,nextZIndex:r}},jO=RT({type:String,values:PO,required:!1}),zO=Symbol("size"),qO=Symbol("emptyValuesContextKey"),GO=Qo({emptyValues:Array,valueOnClear:{type:[String,Number,Boolean,Function],default:void 0,validator:i=>ml(i)?!i():!i}}),jT=Symbol(),wc=b.ref();function zT(i,e=void 0){const t=b.getCurrentInstance()?b.inject(jT,wc):wc;return i?b.computed(()=>{var n,s;return(s=(n=t.value)==null?void 0:n[i])!=null?s:e}):t}function HO(i,e){const t=zT(),n=$p(i,b.computed(()=>{var o;return((o=t.value)==null?void 0:o.namespace)||Cc})),s=BO(b.computed(()=>{var o;return(o=t.value)==null?void 0:o.locale})),r=VO(b.computed(()=>{var o;return((o=t.value)==null?void 0:o.zIndex)||UT})),a=b.computed(()=>{var o;return b.unref(e)||((o=t.value)==null?void 0:o.size)||""});return qT(b.computed(()=>b.unref(t)||{})),{ns:n,locale:s,zIndex:r,size:a}}const qT=(i,e,t=!1)=>{var n;const s=!!b.getCurrentInstance(),r=s?zT():void 0,a=(n=e==null?void 0:e.provide)!=null?n:s?b.provide:void 0;if(!a){Zo("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");return}const o=b.computed(()=>{const l=b.unref(i);return r!=null&&r.value?WO(r.value,l):l});return a(jT,o),a(MT,b.computed(()=>o.value.locale)),a(NT,b.computed(()=>o.value.namespace)),a(VT,b.computed(()=>o.value.zIndex)),a(zO,{size:b.computed(()=>o.value.size||"")}),a(qO,b.computed(()=>({emptyValues:o.value.emptyValues,valueOnClear:o.value.valueOnClear}))),(t||!wc.value)&&(wc.value=o.value),o},WO=(i,e)=>{const t=[...new Set([...DT(i),...DT(e)])],n={};for(const s of t)n[s]=e[s]!==void 0?e[s]:i[s];return n},XO=Qo({a11y:{type:Boolean,default:!0},locale:{type:Ri(Object)},size:jO,button:{type:Ri(Object)},experimentalFeatures:{type:Ri(Object)},keyboardNavigation:{type:Boolean,default:!0},message:{type:Ri(Object)},zIndex:Number,namespace:{type:String,default:"el"},...GO}),Vp={};b.defineComponent({name:"ElConfigProvider",props:XO,setup(i,{slots:e}){b.watch(()=>i.message,n=>{Object.assign(Vp,n!=null?n:{})},{immediate:!0,deep:!0});const t=qT(i);return()=>b.renderSlot(e,"default",{config:t==null?void 0:t.value})}});var jp=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t};const KO=Qo({size:{type:Ri([Number,String])},color:{type:String}}),YO=b.defineComponent({name:"ElIcon",inheritAttrs:!1}),ZO=b.defineComponent({...YO,props:KO,setup(i){const e=i,t=$p("icon"),n=b.computed(()=>{const{size:s,color:r}=e;return!s&&!r?{}:{fontSize:bO(s)?void 0:Up(s),"--color":r}});return(s,r)=>(b.openBlock(),b.createElementBlock("i",b.mergeProps({class:b.unref(t).b(),style:b.unref(n)},s.$attrs),[b.renderSlot(s.$slots,"default")],16))}});var QO=jp(ZO,[["__file","icon.vue"]]);const GT=LT(QO),JO=Qo({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"},showZero:{type:Boolean,default:!0},color:String,dotStyle:{type:Ri([String,Object,Array])},badgeStyle:{type:Ri([String,Object,Array])},offset:{type:Ri(Array),default:[0,0]},dotClass:{type:String},badgeClass:{type:String}}),e8=["textContent"],t8=b.defineComponent({name:"ElBadge"}),i8=b.defineComponent({...t8,props:JO,setup(i,{expose:e}){const t=i,n=$p("badge"),s=b.computed(()=>t.isDot?"":Yo(t.value)&&Yo(t.max)?t.max{var a,o,l,u,c,d;return[{backgroundColor:t.color,marginRight:Up(-((o=(a=t.offset)==null?void 0:a[0])!=null?o:0)),marginTop:Up((u=(l=t.offset)==null?void 0:l[1])!=null?u:0)},(c=t.dotStyle)!=null?c:{},(d=t.badgeStyle)!=null?d:{}]});return OT({from:"dot-style",replacement:"badge-style",version:"2.8.0",scope:"el-badge",ref:"https://element-plus.org/en-US/component/badge.html"},b.computed(()=>!!t.dotStyle)),OT({from:"dot-class",replacement:"badge-class",version:"2.8.0",scope:"el-badge",ref:"https://element-plus.org/en-US/component/badge.html"},b.computed(()=>!!t.dotClass)),e({content:s}),(a,o)=>(b.openBlock(),b.createElementBlock("div",{class:b.normalizeClass(b.unref(n).b())},[b.renderSlot(a.$slots,"default"),b.createVNode(b.Transition,{name:`${b.unref(n).namespace.value}-zoom-in-center`,persisted:""},{default:b.withCtx(()=>[b.withDirectives(b.createElementVNode("sup",{class:b.normalizeClass([b.unref(n).e("content"),b.unref(n).em("content",a.type),b.unref(n).is("fixed",!!a.$slots.default),b.unref(n).is("dot",a.isDot),a.dotClass,a.badgeClass]),style:b.normalizeStyle(b.unref(r)),textContent:b.toDisplayString(b.unref(s))},null,14,e8),[[b.vShow,!a.hidden&&(b.unref(s)||a.isDot)]])]),_:1},8,["name"])],2))}});var n8=jp(i8,[["__file","badge.vue"]]);const s8=LT(n8),HT=["success","info","warning","error"],It=LO({customClass:"",center:!1,dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",plain:!1,offset:16,zIndex:0,grouping:!1,repeatNum:1,appendTo:ga?document.body:void 0}),r8=Qo({customClass:{type:String,default:It.customClass},center:{type:Boolean,default:It.center},dangerouslyUseHTMLString:{type:Boolean,default:It.dangerouslyUseHTMLString},duration:{type:Number,default:It.duration},icon:{type:IO,default:It.icon},id:{type:String,default:It.id},message:{type:Ri([String,Object,Function]),default:It.message},onClose:{type:Ri(Function),default:It.onClose},showClose:{type:Boolean,default:It.showClose},type:{type:String,values:HT,default:It.type},plain:{type:Boolean,default:It.plain},offset:{type:Number,default:It.offset},zIndex:{type:Number,default:It.zIndex},grouping:{type:Boolean,default:It.grouping},repeatNum:{type:Number,default:It.repeatNum}}),a8={destroy:()=>!0},Pi=b.shallowReactive([]),o8=i=>{const e=Pi.findIndex(s=>s.id===i),t=Pi[e];let n;return e>0&&(n=Pi[e-1]),{current:t,prev:n}},l8=i=>{const{prev:e}=o8(i);return e?e.vm.exposed.bottom.value:0},u8=(i,e)=>Pi.findIndex(n=>n.id===i)>0?16:e,c8=["id"],h8=["innerHTML"],d8=b.defineComponent({name:"ElMessage"}),f8=b.defineComponent({...d8,props:r8,emits:a8,setup(i,{expose:e}){const t=i,{Close:n}=DO,{ns:s,zIndex:r}=HO("message"),{currentZIndex:a,nextZIndex:o}=r,l=b.ref(),u=b.ref(!1),c=b.ref(0);let d;const p=b.computed(()=>t.type?t.type==="error"?"danger":t.type:"info"),y=b.computed(()=>{const N=t.type;return{[s.bm("icon",N)]:N&&PT[N]}}),_=b.computed(()=>t.icon||PT[t.type]||""),T=b.computed(()=>l8(t.id)),E=b.computed(()=>u8(t.id,t.offset)+T.value),S=b.computed(()=>c.value+E.value),C=b.computed(()=>({top:`${E.value}px`,zIndex:a.value}));function D(){t.duration!==0&&({stop:d}=FL(()=>{w()},t.duration))}function k(){d==null||d()}function w(){u.value=!1}function O({code:N}){N===RO.esc&&w()}return b.onMounted(()=>{D(),o(),u.value=!0}),b.watch(()=>t.repeatNum,()=>{k(),D()}),BL(document,"keydown",O),zL(l,()=>{c.value=l.value.getBoundingClientRect().height}),e({visible:u,bottom:S,close:w}),(N,F)=>(b.openBlock(),b.createBlock(b.Transition,{name:b.unref(s).b("fade"),onBeforeLeave:N.onClose,onAfterLeave:F[0]||(F[0]=$=>N.$emit("destroy")),persisted:""},{default:b.withCtx(()=>[b.withDirectives(b.createElementVNode("div",{id:N.id,ref_key:"messageRef",ref:l,class:b.normalizeClass([b.unref(s).b(),{[b.unref(s).m(N.type)]:N.type},b.unref(s).is("center",N.center),b.unref(s).is("closable",N.showClose),b.unref(s).is("plain",N.plain),N.customClass]),style:b.normalizeStyle(b.unref(C)),role:"alert",onMouseenter:k,onMouseleave:D},[N.repeatNum>1?(b.openBlock(),b.createBlock(b.unref(s8),{key:0,value:N.repeatNum,type:b.unref(p),class:b.normalizeClass(b.unref(s).e("badge"))},null,8,["value","type","class"])):b.createCommentVNode("v-if",!0),b.unref(_)?(b.openBlock(),b.createBlock(b.unref(GT),{key:1,class:b.normalizeClass([b.unref(s).e("icon"),b.unref(y)])},{default:b.withCtx(()=>[(b.openBlock(),b.createBlock(b.resolveDynamicComponent(b.unref(_))))]),_:1},8,["class"])):b.createCommentVNode("v-if",!0),b.renderSlot(N.$slots,"default",{},()=>[N.dangerouslyUseHTMLString?(b.openBlock(),b.createElementBlock(b.Fragment,{key:1},[b.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),b.createElementVNode("p",{class:b.normalizeClass(b.unref(s).e("content")),innerHTML:N.message},null,10,h8)],2112)):(b.openBlock(),b.createElementBlock("p",{key:0,class:b.normalizeClass(b.unref(s).e("content"))},b.toDisplayString(N.message),3))]),N.showClose?(b.openBlock(),b.createBlock(b.unref(GT),{key:2,class:b.normalizeClass(b.unref(s).e("closeBtn")),onClick:b.withModifiers(w,["stop"])},{default:b.withCtx(()=>[b.createVNode(b.unref(n))]),_:1},8,["class","onClick"])):b.createCommentVNode("v-if",!0)],46,c8),[[b.vShow,u.value]])]),_:3},8,["name","onBeforeLeave"]))}});var p8=jp(f8,[["__file","message.vue"]]);let g8=1;const WT=i=>{const e=!i||Js(i)||b.isVNode(i)||ml(i)?{message:i}:i,t={...It,...e};if(!t.appendTo)t.appendTo=document.body;else if(Js(t.appendTo)){let n=document.querySelector(t.appendTo);EO(n)||(Zo("ElMessage","the appendTo option is not an HTMLElement. Falling back to document.body."),n=document.body),t.appendTo=n}return t},m8=i=>{const e=Pi.indexOf(i);if(e===-1)return;Pi.splice(e,1);const{handler:t}=i;t.close()},_8=({appendTo:i,...e},t)=>{const n=`message_${g8++}`,s=e.onClose,r=document.createElement("div"),a={...e,id:n,onClose:()=>{s==null||s(),m8(c)},onDestroy:()=>{b.render(null,r)}},o=b.createVNode(p8,a,ml(a.message)||b.isVNode(a.message)?{default:ml(a.message)?a.message:()=>a.message}:null);o.appContext=t||ya._context,b.render(o,r),i.appendChild(r.firstElementChild);const l=o.component,c={id:n,vnode:o,vm:l,handler:{close:()=>{l.exposed.visible.value=!1}},props:o.component.props};return c},ya=(i={},e)=>{if(!ga)return{close:()=>{}};if(Yo(Vp.max)&&Pi.length>=Vp.max)return{close:()=>{}};const t=WT(i);if(t.grouping&&Pi.length){const s=Pi.find(({vnode:r})=>{var a;return((a=r.props)==null?void 0:a.message)===t.message});if(s)return s.props.repeatNum+=1,s.props.type=t.type,s.handler}const n=_8(t,e);return Pi.push(n),n.handler};HT.forEach(i=>{ya[i]=(e={},t)=>{const n=WT(e);return ya({...n,type:i},t)}});function y8(i){for(const e of Pi)(!i||i===e.props.type)&&e.handler.close()}ya.closeAll=y8,ya._context=null;const v8=kO(ya,"$message"),T8={class:"cell"},x8={class:"cell-player"},b8={key:2,class:"cell-player-6-2-cell"},E8={key:0,class:"cell-player-8-2-cell"},S8=b.defineComponent({__name:"VideoPlayer",props:{receiveCount:{type:Number,default:4},source:{type:Array,default:()=>[]},ratio:{type:String,default:"4:3"}},setup(i){const e=i,t=b.ref(4);b.watch(()=>e.receiveCount,r=>{t.value=r});const n=b.computed(()=>{const{source:r,receiveCount:a}=e,o=[];if(r.length>a)return v8({message:"\u8BF7\u91CD\u65B0\u9009\u62E9\u5E03\u5C40\uFF01",type:"warning"}),[];for(let l=0;l{switch(t.value){case 1:return["cell-player-1"];case 4:return["cell-player-4"];case 6:return r==0?["cell-player-6-1"]:r==1?["cell-player-6-2"]:r==2?["cell-player-6-none"]:["cell-player-6"];case 8:return r==0?["cell-player-8-1"]:r==1?["cell-player-8-2"]:r==2||r==3?["cell-player-8-none"]:["cell-player-8"];case 9:return["cell-player-9"];case 16:return["cell-player-16"]}};return(r,a)=>(b.openBlock(),b.createElementBlock("div",T8,[b.createElementVNode("div",x8,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(n.value,(o,l)=>(b.openBlock(),b.createElementBlock("div",{class:b.normalizeClass(s(l)),key:l},[t.value!=6&&t.value!=8?(b.openBlock(),b.createBlock(os,{key:0,ratio:i.ratio,source:o},null,8,["ratio","source"])):b.createCommentVNode("",!0),t.value==6&&l!=1&&l!=2?(b.openBlock(),b.createBlock(os,{key:1,ratio:i.ratio,source:o},null,8,["ratio","source"])):b.createCommentVNode("",!0),t.value==6&&l==1?(b.openBlock(),b.createElementBlock("div",b8,[b.createVNode(os,{ratio:i.ratio,source:o},null,8,["ratio","source"]),b.createVNode(os,{ratio:i.ratio,source:n.value[l+1]},null,8,["ratio","source"])])):b.createCommentVNode("",!0),t.value==8&&l!=1&&l!=2&&l!=3?(b.openBlock(),b.createBlock(os,{key:3,ratio:i.ratio,source:o},null,8,["ratio","source"])):b.createCommentVNode("",!0),t.value==8&&l==1?(b.openBlock(),b.createElementBlock(b.Fragment,{key:4},[l==1?(b.openBlock(),b.createElementBlock("div",E8,[b.createVNode(os,{ratio:i.ratio,source:o},null,8,["ratio","source"]),b.createVNode(os,{ratio:i.ratio,source:n.value[l+1]},null,8,["ratio","source"]),b.createVNode(os,{ratio:i.ratio,source:n.value[l+2]},null,8,["ratio","source"])])):b.createCommentVNode("",!0)],64)):b.createCommentVNode("",!0)],2))),128))])]))}}),XF="",C8=Ft(S8,[["__scopeId","data-v-e001cf7e"]]),w8={class:"video"},A8={class:"video-title"},I8={class:"header-box"},D8=["onClick"],k8={key:0,class:"pointer module-title"},R8={class:"dropdown-showcase module-title"},P8={class:"pointer"},L8=b.defineComponent({name:"HoskiVideo",__name:"video",props:{source:{type:Array,default:()=>[]},codeStreamData:{type:Array,default:()=>[]}},emits:["closeAll","selectEvent","videoOption"],setup(i,{emit:e}){const t=i,n=b.ref([]),s=b.ref(!0),r=b.ref("4:3"),a=b.ref("4\u5BAB\u683C"),o=b.ref(4);b.onBeforeMount(()=>{n.value=[...t.source],Wo.on("clickVideo",p=>{var y;if([6,8].includes(o.value)){const _=(y=n.value)==null?void 0:y.findIndex(E=>E.sourceId===p.sourceId),T=n.value[0];n.value[0]=p,n.value[Number(_)]=T}})});const l=()=>{s.value=!1,e("closeAll")},u=b.shallowRef([{name:"CloseAll",icon:k3,isCloseAll:!0,currentValue:"\u5168\u90E8\u5173\u95ED",select:[],onEvent:l},{name:"CodeStream",icon:N3,isCloseAll:!1,currentValue:b.ref("\u5B50\u7801\u6D41"),select:t.codeStreamData},{name:"Layout",icon:j3,isCloseAll:!1,currentValue:b.ref("4\u5BAB\u683C"),select:[{label:"1\u5BAB\u683C",value:"1"},{label:"4\u5BAB\u683C",value:"4"},{label:"1\u59275\u5C0F",value:"6"},{label:"1\u59277\u5C0F",value:"8"},{label:"9\u5BAB\u683C",value:"9"},{label:"16\u5BAB\u683C",value:"16"}]},{name:"Ratio",icon:W3,isCloseAll:!1,currentValue:b.ref("4:3"),select:[{label:"4:3",value:"4:3"},{label:"16:9",value:"16:9"}]}]),c=p=>{e("selectEvent",p);const y=p.split("-")[0],_=p.split("-")[1];u.value.forEach(T=>{T.name===y&&T.select.forEach(E=>{E.value===_&&(T.currentValue.value=E.label,y==="Layout"&&(a.value=E.label,o.value=Number(_)),y==="Ratio"&&(r.value=E.label,Wo.emit("ratio",p)))})})},d=p=>{e("videoOption",p)};return b.onBeforeMount(()=>{s.value=!0,Wo.on("video-option",p=>{d(p)})}),(p,y)=>{const _=b.resolveComponent("el-icon"),T=b.resolveComponent("el-dropdown-item"),E=b.resolveComponent("el-dropdown-menu"),S=b.resolveComponent("el-dropdown"),C=b.resolveComponent("el-header"),D=b.resolveComponent("el-empty"),k=b.resolveComponent("el-main"),w=b.resolveComponent("el-container");return b.openBlock(),b.createElementBlock("div",w8,[b.createElementVNode("div",A8,"\u3010"+b.toDisplayString(a.value)+"\u3011\u3010"+b.toDisplayString(r.value)+"\u3011",1),b.createVNode(w,{class:"video-container"},{default:b.withCtx(()=>[b.createVNode(C,{height:"46px",class:"video-container-header"},{default:b.withCtx(()=>[b.createElementVNode("div",I8,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(u.value,(O,N)=>(b.openBlock(),b.createElementBlock("div",{class:"header-box-item",key:N,onClick:O.onEvent},[b.createVNode(_,{class:"pointer",size:"25",color:"#1D2129"},{default:b.withCtx(()=>[(b.openBlock(),b.createBlock(b.resolveDynamicComponent(O.icon)))]),_:2},1024),O.isCloseAll?(b.openBlock(),b.createElementBlock("span",k8,b.toDisplayString(O.currentValue),1)):(b.openBlock(),b.createBlock(S,{key:1,onCommand:c,"popper-class":"dropdown-showcase"},b.createSlots({default:b.withCtx(()=>[b.createElementVNode("span",R8,[b.createElementVNode("span",P8,b.toDisplayString(O.currentValue.value.replace(/\"/g," ")),1),b.createVNode(_,{class:"el-icon--right"},{default:b.withCtx(()=>[b.createVNode(b.unref(Gx))]),_:1})])]),_:2},[O.isCloseAll?void 0:{name:"dropdown",fn:b.withCtx(()=>[b.createVNode(E,null,{default:b.withCtx(()=>[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(O.select,F=>(b.openBlock(),b.createBlock(T,{key:F.value,command:`${O.name}-${F.value}`},{default:b.withCtx(()=>[b.createTextVNode(b.toDisplayString(F.label),1)]),_:2},1032,["command"]))),128))]),_:2},1024)]),key:"0"}]),1024))],8,D8))),128))])]),_:1}),b.createVNode(k,{class:"video-container-main"},{default:b.withCtx(()=>[s.value?(b.openBlock(),b.createBlock(C8,{key:0,style:{width:"100%"},"receive-count":o.value,source:n.value,ratio:r.value},null,8,["receive-count","source","ratio"])):(b.openBlock(),b.createBlock(D,{key:1,description:"\u6682\u65E0\u5185\u5BB9"}))]),_:1})]),_:1})])}}}),KF="",XT=m_(L8),KT={HoskiMap:__,HoskiVideo:XT},O8=i=>{for(const e in KT)i.component(e,KT[e])},YT=(i,e)=>{O8(i)};typeof window<"u"&&window.Vue&&YT(window.Vue);const M8={install:YT};lt.HoskiMap=__,lt.HoskiVideo=XT,lt.debounce=cs,lt.default=M8,lt.formatNumber=Vx,lt.throttle=$x,Object.defineProperties(lt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});