function Sx(n,a){for(var r=0;rt[e]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var Xv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zu(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function GS(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var a=n.default;if(typeof a=="function"){var r=function t(){return this instanceof t?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};r.prototype=a.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(n).forEach(function(t){var e=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(r,t,e.get?e:{enumerable:!0,get:function(){return n[t]}})}),r}var qv={exports:{}},ic={},Zv={exports:{}},Jt={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var pm;function zS(){if(pm)return Jt;pm=1;var n=Symbol.for("react.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),t=Symbol.for("react.strict_mode"),e=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),b=Symbol.iterator;function A(X){return X===null||typeof X!="object"?null:(X=b&&X[b]||X["@@iterator"],typeof X=="function"?X:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,I={};function O(X,ce,Ae){this.props=X,this.context=ce,this.refs=I,this.updater=Ae||R}O.prototype.isReactComponent={},O.prototype.setState=function(X,ce){if(typeof X!="object"&&typeof X!="function"&&X!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,X,ce,"setState")},O.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};function V(){}V.prototype=O.prototype;function N(X,ce,Ae){this.props=X,this.context=ce,this.refs=I,this.updater=Ae||R}var G=N.prototype=new V;G.constructor=N,D(G,O.prototype),G.isPureReactComponent=!0;var z=Array.isArray,Z=Object.prototype.hasOwnProperty,H={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function te(X,ce,Ae){var _e,it={},nt=null,wt=null;if(ce!=null)for(_e in ce.ref!==void 0&&(wt=ce.ref),ce.key!==void 0&&(nt=""+ce.key),ce)Z.call(ce,_e)&&!ee.hasOwnProperty(_e)&&(it[_e]=ce[_e]);var at=arguments.length-2;if(at===1)it.children=Ae;else if(1>>1,ce=re[X];if(0>>1;Xe(it,ye))nte(wt,it)?(re[X]=wt,re[nt]=ye,X=nt):(re[X]=it,re[_e]=ye,X=_e);else if(nte(wt,ye))re[X]=wt,re[nt]=ye,X=nt;else break e}}return j}function e(re,j){var ye=re.sortIndex-j.sortIndex;return ye!==0?ye:re.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;n.unstable_now=function(){return i.now()}}else{var s=Date,f=s.now();n.unstable_now=function(){return s.now()-f}}var h=[],p=[],S=1,b=null,A=3,R=!1,D=!1,I=!1,O=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(re){for(var j=r(p);j!==null;){if(j.callback===null)t(p);else if(j.startTime<=re)t(p),j.sortIndex=j.expirationTime,a(h,j);else break;j=r(p)}}function z(re){if(I=!1,G(re),!D)if(r(h)!==null)D=!0,ge(Z);else{var j=r(p);j!==null&&ve(z,j.startTime-re)}}function Z(re,j){D=!1,I&&(I=!1,V(te),te=-1),R=!0;var ye=A;try{for(G(j),b=r(h);b!==null&&(!(b.expirationTime>j)||re&&!oe());){var X=b.callback;if(typeof X=="function"){b.callback=null,A=b.priorityLevel;var ce=X(b.expirationTime<=j);j=n.unstable_now(),typeof ce=="function"?b.callback=ce:b===r(h)&&t(h),G(j)}else t(h);b=r(h)}if(b!==null)var Ae=!0;else{var _e=r(p);_e!==null&&ve(z,_e.startTime-j),Ae=!1}return Ae}finally{b=null,A=ye,R=!1}}var H=!1,ee=null,te=-1,fe=5,ne=-1;function oe(){return!(n.unstable_now()-nere||125X?(re.sortIndex=ye,a(p,re),r(h)===null&&re===r(p)&&(I?(V(te),te=-1):I=!0,ve(z,ye-X))):(re.sortIndex=ce,a(h,re),D||R||(D=!0,ge(Z))),re},n.unstable_shouldYield=oe,n.unstable_wrapCallback=function(re){var j=A;return function(){var ye=A;A=j;try{return re.apply(this,arguments)}finally{A=ye}}}}(ep)),ep}var Em;function YS(){return Em||(Em=1,Jv.exports=KS()),Jv.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Sm;function XS(){if(Sm)return vi;Sm=1;var n=pg(),a=YS();function r(o){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+o,y=1;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,S={},b={};function A(o){return h.call(b,o)?!0:h.call(S,o)?!1:p.test(o)?b[o]=!0:(S[o]=!0,!1)}function R(o,c,y,T){if(y!==null&&y.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return T?!1:y!==null?!y.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function D(o,c,y,T){if(c===null||typeof c>"u"||R(o,c,y,T))return!0;if(T)return!1;if(y!==null)switch(y.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function I(o,c,y,T,L,F,W){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=T,this.attributeNamespace=L,this.mustUseProperty=y,this.propertyName=o,this.type=c,this.sanitizeURL=F,this.removeEmptyString=W}var O={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){O[o]=new I(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var c=o[0];O[c]=new I(c,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){O[o]=new I(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){O[o]=new I(o,2,!1,o,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){O[o]=new I(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){O[o]=new I(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){O[o]=new I(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){O[o]=new I(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){O[o]=new I(o,5,!1,o.toLowerCase(),null,!1,!1)});var V=/[\-:]([a-z])/g;function N(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var c=o.replace(V,N);O[c]=new I(c,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var c=o.replace(V,N);O[c]=new I(c,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var c=o.replace(V,N);O[c]=new I(c,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){O[o]=new I(o,1,!1,o.toLowerCase(),null,!1,!1)}),O.xlinkHref=new I("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){O[o]=new I(o,1,!1,o.toLowerCase(),null,!0,!0)});function G(o,c,y,T){var L=O.hasOwnProperty(c)?O[c]:null;(L!==null?L.type!==0:T||!(2le||L[W]!==F[le]){var de=` `+L[W].replace(" at new "," at ");return o.displayName&&de.includes("")&&(de=de.replace("",o.displayName)),de}while(1<=W&&0<=le);break}}}finally{Ae=!1,Error.prepareStackTrace=y}return(o=o?o.displayName||o.name:"")?ce(o):""}function it(o){switch(o.tag){case 5:return ce(o.type);case 16:return ce("Lazy");case 13:return ce("Suspense");case 19:return ce("SuspenseList");case 0:case 2:case 15:return o=_e(o.type,!1),o;case 11:return o=_e(o.type.render,!1),o;case 1:return o=_e(o.type,!0),o;default:return""}}function nt(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case ee:return"Fragment";case H:return"Portal";case fe:return"Profiler";case te:return"StrictMode";case q:return"Suspense";case Q:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case oe:return(o.displayName||"Context")+".Consumer";case ne:return(o._context.displayName||"Context")+".Provider";case Y:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case be:return c=o.displayName||null,c!==null?c:nt(o.type)||"Memo";case ge:c=o._payload,o=o._init;try{return nt(o(c))}catch{}}return null}function wt(o){var c=o.type;switch(o.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=c.render,o=o.displayName||o.name||"",c.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return nt(c);case 8:return c===te?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function at(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function $t(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function gr(o){var c=$t(o)?"checked":"value",y=Object.getOwnPropertyDescriptor(o.constructor.prototype,c),T=""+o[c];if(!o.hasOwnProperty(c)&&typeof y<"u"&&typeof y.get=="function"&&typeof y.set=="function"){var L=y.get,F=y.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return L.call(this)},set:function(W){T=""+W,F.call(this,W)}}),Object.defineProperty(o,c,{enumerable:y.enumerable}),{getValue:function(){return T},setValue:function(W){T=""+W},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function Ar(o){o._valueTracker||(o._valueTracker=gr(o))}function ft(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var y=c.getValue(),T="";return o&&(T=$t(o)?o.checked?"true":"false":o.value),o=T,o!==y?(c.setValue(o),!0):!1}function Br(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function Pr(o,c){var y=c.checked;return ye({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:y??o._wrapperState.initialChecked})}function lr(o,c){var y=c.defaultValue==null?"":c.defaultValue,T=c.checked!=null?c.checked:c.defaultChecked;y=at(c.value!=null?c.value:y),o._wrapperState={initialChecked:T,initialValue:y,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function Er(o,c){c=c.checked,c!=null&&G(o,"checked",c,!1)}function kr(o,c){Er(o,c);var y=at(c.value),T=c.type;if(y!=null)T==="number"?(y===0&&o.value===""||o.value!=y)&&(o.value=""+y):o.value!==""+y&&(o.value=""+y);else if(T==="submit"||T==="reset"){o.removeAttribute("value");return}c.hasOwnProperty("value")?an(o,c.type,y):c.hasOwnProperty("defaultValue")&&an(o,c.type,at(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(o.defaultChecked=!!c.defaultChecked)}function Zt(o,c,y){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var T=c.type;if(!(T!=="submit"&&T!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+o._wrapperState.initialValue,y||c===o.value||(o.value=c),o.defaultValue=c}y=o.name,y!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,y!==""&&(o.name=y)}function an(o,c,y){(c!=="number"||Br(o.ownerDocument)!==o)&&(y==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+y&&(o.defaultValue=""+y))}var Xt=Array.isArray;function Ft(o,c,y,T){if(o=o.options,c){c={};for(var L=0;L"+c.valueOf().toString()+"",c=qn.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;c.firstChild;)o.appendChild(c.firstChild)}});function sn(o,c){if(c){var y=o.firstChild;if(y&&y===o.lastChild&&y.nodeType===3){y.nodeValue=c;return}}o.textContent=c}var Te={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ee=["Webkit","ms","Moz","O"];Object.keys(Te).forEach(function(o){Ee.forEach(function(c){c=c+o.charAt(0).toUpperCase()+o.substring(1),Te[c]=Te[o]})});function xe(o,c,y){return c==null||typeof c=="boolean"||c===""?"":y||typeof c!="number"||c===0||Te.hasOwnProperty(o)&&Te[o]?(""+c).trim():c+"px"}function qe(o,c){o=o.style;for(var y in c)if(c.hasOwnProperty(y)){var T=y.indexOf("--")===0,L=xe(y,c[y],T);y==="float"&&(y="cssFloat"),T?o.setProperty(y,L):o[y]=L}}var ct=ye({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ue(o,c){if(c){if(ct[o]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(r(137,o));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(r(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(r(61))}if(c.style!=null&&typeof c.style!="object")throw Error(r(62))}}function St(o,c){if(o.indexOf("-")===-1)return typeof c.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Se=null;function He(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var ze=null,Ve=null,$e=null;function pe(o){if(o=Bs(o)){if(typeof ze!="function")throw Error(r(280));var c=o.stateNode;c&&(c=ql(c),ze(o.stateNode,o.type,c))}}function we(o){Ve?$e?$e.push(o):$e=[o]:Ve=o}function Fe(){if(Ve){var o=Ve,c=$e;if($e=Ve=null,pe(o),c)for(o=0;o>>=0,o===0?32:31-(J0(o)/bl|0)|0}var ja=64,wo=4194304;function bs(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Ao(o,c){var y=o.pendingLanes;if(y===0)return 0;var T=0,L=o.suspendedLanes,F=o.pingedLanes,W=y&268435455;if(W!==0){var le=W&~L;le!==0?T=bs(le):(F&=W,F!==0&&(T=bs(F)))}else W=y&~L,W!==0?T=bs(W):F!==0&&(T=bs(F));if(T===0)return 0;if(c!==0&&c!==T&&(c&L)===0&&(L=T&-T,F=c&-c,L>=F||L===16&&(F&4194240)!==0))return c;if((T&4)!==0&&(T|=y&16),c=o.entangledLanes,c!==0)for(o=o.entanglements,c&=T;0y;y++)c.push(o);return c}function ko(o,c,y){o.pendingLanes|=c,c!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,c=31-Zn(c),o[c]=y}function Ui(o,c){var y=o.pendingLanes&~c;o.pendingLanes=c,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=c,o.mutableReadLanes&=c,o.entangledLanes&=c,c=o.entanglements;var T=o.eventTimes;for(o=o.expirationTimes;0=Fo),mf=" ",vd=!1;function pd(o,c){switch(o){case"keyup":return hd.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gd(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Wa=!1;function yf(o,c){switch(o){case"compositionend":return gd(c);case"keypress":return c.which!==32?null:(vd=!0,mf);case"textInput":return o=c.data,o===mf&&vd?null:o;default:return null}}function Bl(o,c){if(Wa)return o==="compositionend"||!Ml&&pd(o,c)?(o=Qc(),Ll=df=Rr=null,Wa=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1=c)return{node:y,offset:c-o};o=T}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=Sd(y)}}function bd(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?bd(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function Td(){for(var o=window,c=Br();c instanceof o.HTMLIFrameElement;){try{var y=typeof c.contentWindow.location.href=="string"}catch{y=!1}if(y)o=c.contentWindow;else break;c=Br(o.document)}return c}function Rs(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}function mv(o){var c=Td(),y=o.focusedElem,T=o.selectionRange;if(c!==y&&y&&y.ownerDocument&&bd(y.ownerDocument.documentElement,y)){if(T!==null&&Rs(y)){if(c=T.start,o=T.end,o===void 0&&(o=c),"selectionStart"in y)y.selectionStart=c,y.selectionEnd=Math.min(o,y.value.length);else if(o=(c=y.ownerDocument||document)&&c.defaultView||window,o.getSelection){o=o.getSelection();var L=y.textContent.length,F=Math.min(T.start,L);T=T.end===void 0?F:Math.min(T.end,L),!o.extend&&F>T&&(L=T,T=F,F=L),L=_d(y,F);var W=_d(y,T);L&&W&&(o.rangeCount!==1||o.anchorNode!==L.node||o.anchorOffset!==L.offset||o.focusNode!==W.node||o.focusOffset!==W.offset)&&(c=c.createRange(),c.setStart(L.node,L.offset),o.removeAllRanges(),F>T?(o.addRange(c),o.extend(W.node,W.offset)):(c.setEnd(W.node,W.offset),o.addRange(c)))}}for(c=[],o=y;o=o.parentNode;)o.nodeType===1&&c.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y=document.documentMode,Ya=null,_f=null,Ds=null,On=!1;function wi(o,c,y){var T=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;On||Ya==null||Ya!==Br(T)||(T=Ya,"selectionStart"in T&&Rs(T)?T={start:T.selectionStart,end:T.selectionEnd}:(T=(T.ownerDocument&&T.ownerDocument.defaultView||window).getSelection(),T={anchorNode:T.anchorNode,anchorOffset:T.anchorOffset,focusNode:T.focusNode,focusOffset:T.focusOffset}),Ds&&Mo(Ds,T)||(Ds=T,T=Wl(_f,"onSelect"),0Ja||(o.current=Df[Ja],Df[Ja]=null,Ja--)}function br(o,c){Ja++,Df[Ja]=o.current,o.current=c}var wa={},hn=Cn(wa),Qr=Cn(!1),es=wa;function Ns(o,c){var y=o.type.contextTypes;if(!y)return wa;var T=o.stateNode;if(T&&T.__reactInternalMemoizedUnmaskedChildContext===c)return T.__reactInternalMemoizedMaskedChildContext;var L={},F;for(F in y)L[F]=c[F];return T&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=c,o.__reactInternalMemoizedMaskedChildContext=L),L}function Vn(o){return o=o.childContextTypes,o!=null}function Zl(){Lr(Qr),Lr(hn)}function Pf(o,c,y){if(hn.current!==wa)throw Error(r(168));br(hn,c),br(Qr,y)}function Id(o,c,y){var T=o.stateNode;if(c=c.childContextTypes,typeof T.getChildContext!="function")return y;T=T.getChildContext();for(var L in T)if(!(L in c))throw Error(r(108,wt(o)||"Unknown",L));return ye({},y,T)}function Ql(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||wa,es=hn.current,br(hn,o),br(Qr,Qr.current),!0}function Od(o,c,y){var T=o.stateNode;if(!T)throw Error(r(169));y?(o=Id(o,c,es),T.__reactInternalMemoizedMergedChildContext=o,Lr(Qr),Lr(hn),br(hn,o)):Lr(Qr),br(Qr,y)}var aa=null,Jl=!1,If=!1;function Of(o){aa===null?aa=[o]:aa.push(o)}function Fd(o){Jl=!0,Of(o)}function Aa(){if(!If&&aa!==null){If=!0;var o=0,c=mr;try{var y=aa;for(mr=1;o>=W,L-=W,jn=1<<32-Zn(c)+L|y<Mt?(Dn=Ot,Ot=null):Dn=Ot.sibling;var vr=Ke(ke,Ot,Re[Mt],tt);if(vr===null){Ot===null&&(Ot=Dn);break}o&&Ot&&vr.alternate===null&&c(ke,Ot),he=F(vr,he,Mt),It===null?_t=vr:It.sibling=vr,It=vr,Ot=Dn}if(Mt===Re.length)return y(ke,Ot),Fr&&ka(ke,Mt),_t;if(Ot===null){for(;MtMt?(Dn=Ot,Ot=null):Dn=Ot.sibling;var so=Ke(ke,Ot,vr.value,tt);if(so===null){Ot===null&&(Ot=Dn);break}o&&Ot&&so.alternate===null&&c(ke,Ot),he=F(so,he,Mt),It===null?_t=so:It.sibling=so,It=so,Ot=Dn}if(vr.done)return y(ke,Ot),Fr&&ka(ke,Mt),_t;if(Ot===null){for(;!vr.done;Mt++,vr=Re.next())vr=Qe(ke,vr.value,tt),vr!==null&&(he=F(vr,he,Mt),It===null?_t=vr:It.sibling=vr,It=vr);return Fr&&ka(ke,Mt),_t}for(Ot=T(ke,Ot);!vr.done;Mt++,vr=Re.next())vr=dt(Ot,ke,Mt,vr.value,tt),vr!==null&&(o&&vr.alternate!==null&&Ot.delete(vr.key===null?Mt:vr.key),he=F(vr,he,Mt),It===null?_t=vr:It.sibling=vr,It=vr);return o&&Ot.forEach(function(jS){return c(ke,jS)}),Fr&&ka(ke,Mt),_t}function ln(ke,he,Re,tt){if(typeof Re=="object"&&Re!==null&&Re.type===ee&&Re.key===null&&(Re=Re.props.children),typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case Z:e:{for(var _t=Re.key,It=he;It!==null;){if(It.key===_t){if(_t=Re.type,_t===ee){if(It.tag===7){y(ke,It.sibling),he=L(It,Re.props.children),he.return=ke,ke=he;break e}}else if(It.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===ge&&zs(_t)===It.type){y(ke,It.sibling),he=L(It,Re.props),he.ref=Go(ke,It,Re),he.return=ke,ke=he;break e}y(ke,It);break}else c(ke,It);It=It.sibling}Re.type===ee?(he=el(Re.props.children,ke.mode,tt,Re.key),he.return=ke,ke=he):(tt=rh(Re.type,Re.key,Re.props,null,ke.mode,tt),tt.ref=Go(ke,he,Re),tt.return=ke,ke=tt)}return W(ke);case H:e:{for(It=Re.key;he!==null;){if(he.key===It)if(he.tag===4&&he.stateNode.containerInfo===Re.containerInfo&&he.stateNode.implementation===Re.implementation){y(ke,he.sibling),he=L(he,Re.children||[]),he.return=ke,ke=he;break e}else{y(ke,he);break}else c(ke,he);he=he.sibling}he=zv(Re,ke.mode,tt),he.return=ke,ke=he}return W(ke);case ge:return It=Re._init,ln(ke,he,It(Re._payload),tt)}if(Xt(Re))return mt(ke,he,Re,tt);if(j(Re))return xt(ke,he,Re,tt);zo(ke,Re)}return typeof Re=="string"&&Re!==""||typeof Re=="number"?(Re=""+Re,he!==null&&he.tag===6?(y(ke,he.sibling),he=L(he,Re),he.return=ke,ke=he):(y(ke,he),he=Gv(Re,ke.mode,tt),he.return=ke,ke=he),W(ke)):y(ke,he)}return ln}var sa=ts(!0),Nd=ts(!1),au=Cn(null),su=null,Ws=null,ou=null;function lu(){ou=Ws=su=null}function Nf(o){var c=au.current;Lr(au),o._currentValue=c}function Uf(o,c,y){for(;o!==null;){var T=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,T!==null&&(T.childLanes|=c)):T!==null&&(T.childLanes&c)!==c&&(T.childLanes|=c),o===y)break;o=o.return}}function $s(o,c){su=o,ou=Ws=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&c)!==0&&(Dr=!0),o.firstContext=null)}function ui(o){var c=o._currentValue;if(ou!==o)if(o={context:o,memoizedValue:c,next:null},Ws===null){if(su===null)throw Error(r(308));Ws=o,su.dependencies={lanes:0,firstContext:o}}else Ws=Ws.next=o;return c}var rs=null;function Hf(o){rs===null?rs=[o]:rs.push(o)}function uu(o,c,y,T){var L=c.interleaved;return L===null?(y.next=y,Hf(c)):(y.next=L.next,L.next=y),c.interleaved=y,Wi(o,T)}function Wi(o,c){o.lanes|=c;var y=o.alternate;for(y!==null&&(y.lanes|=c),y=o,o=o.return;o!==null;)o.childLanes|=c,y=o.alternate,y!==null&&(y.childLanes|=c),y=o,o=o.return;return y.tag===3?y.stateNode:null}var Li=!1;function Vf(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ud(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function oa(o,c){return{eventTime:o,lane:c,tag:0,payload:null,callback:null,next:null}}function La(o,c,y){var T=o.updateQueue;if(T===null)return null;if(T=T.shared,(dr&2)!==0){var L=T.pending;return L===null?c.next=c:(c.next=L.next,L.next=c),T.pending=c,Wi(o,y)}return L=T.interleaved,L===null?(c.next=c,Hf(T)):(c.next=L.next,L.next=c),T.interleaved=c,Wi(o,y)}function fu(o,c,y){if(c=c.updateQueue,c!==null&&(c=c.shared,(y&4194240)!==0)){var T=c.lanes;T&=o.pendingLanes,y|=T,c.lanes=y,Tl(o,y)}}function jf(o,c){var y=o.updateQueue,T=o.alternate;if(T!==null&&(T=T.updateQueue,y===T)){var L=null,F=null;if(y=y.firstBaseUpdate,y!==null){do{var W={eventTime:y.eventTime,lane:y.lane,tag:y.tag,payload:y.payload,callback:y.callback,next:null};F===null?L=F=W:F=F.next=W,y=y.next}while(y!==null);F===null?L=F=c:F=F.next=c}else L=F=c;y={baseState:T.baseState,firstBaseUpdate:L,lastBaseUpdate:F,shared:T.shared,effects:T.effects},o.updateQueue=y;return}o=y.lastBaseUpdate,o===null?y.firstBaseUpdate=c:o.next=c,y.lastBaseUpdate=c}function Ks(o,c,y,T){var L=o.updateQueue;Li=!1;var F=L.firstBaseUpdate,W=L.lastBaseUpdate,le=L.shared.pending;if(le!==null){L.shared.pending=null;var de=le,Ie=de.next;de.next=null,W===null?F=Ie:W.next=Ie,W=de;var Ye=o.alternate;Ye!==null&&(Ye=Ye.updateQueue,le=Ye.lastBaseUpdate,le!==W&&(le===null?Ye.firstBaseUpdate=Ie:le.next=Ie,Ye.lastBaseUpdate=de))}if(F!==null){var Qe=L.baseState;W=0,Ye=Ie=de=null,le=F;do{var Ke=le.lane,dt=le.eventTime;if((T&Ke)===Ke){Ye!==null&&(Ye=Ye.next={eventTime:dt,lane:0,tag:le.tag,payload:le.payload,callback:le.callback,next:null});e:{var mt=o,xt=le;switch(Ke=c,dt=y,xt.tag){case 1:if(mt=xt.payload,typeof mt=="function"){Qe=mt.call(dt,Qe,Ke);break e}Qe=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=xt.payload,Ke=typeof mt=="function"?mt.call(dt,Qe,Ke):mt,Ke==null)break e;Qe=ye({},Qe,Ke);break e;case 2:Li=!0}}le.callback!==null&&le.lane!==0&&(o.flags|=64,Ke=L.effects,Ke===null?L.effects=[le]:Ke.push(le))}else dt={eventTime:dt,lane:Ke,tag:le.tag,payload:le.payload,callback:le.callback,next:null},Ye===null?(Ie=Ye=dt,de=Qe):Ye=Ye.next=dt,W|=Ke;if(le=le.next,le===null){if(le=L.shared.pending,le===null)break;Ke=le,le=Ke.next,Ke.next=null,L.lastBaseUpdate=Ke,L.shared.pending=null}}while(!0);if(Ye===null&&(de=Qe),L.baseState=de,L.firstBaseUpdate=Ie,L.lastBaseUpdate=Ye,c=L.shared.interleaved,c!==null){L=c;do W|=L.lane,L=L.next;while(L!==c)}else F===null&&(L.shared.lanes=0);qo|=W,o.lanes=W,o.memoizedState=Qe}}function Hd(o,c,y){if(o=c.effects,c.effects=null,o!==null)for(c=0;cy?y:4,o(!0);var T=vu.transition;vu.transition={};try{o(!1),c()}finally{mr=y,vu.transition=T}}function Ne(){return fi().memoizedState}function Me(o,c,y){var T=no(o);if(y={lane:T,action:y,hasEagerState:!1,eagerState:null,next:null},Be(o))Ge(c,y);else if(y=uu(o,c,y,T),y!==null){var L=Jn();fa(y,o,T,L),ut(y,c,T)}}function Pe(o,c,y){var T=no(o),L={lane:T,action:y,hasEagerState:!1,eagerState:null,next:null};if(Be(o))Ge(c,L);else{var F=o.alternate;if(o.lanes===0&&(F===null||F.lanes===0)&&(F=c.lastRenderedReducer,F!==null))try{var W=c.lastRenderedState,le=F(W,y);if(L.hasEagerState=!0,L.eagerState=le,Ci(le,W)){var de=c.interleaved;de===null?(L.next=L,Hf(c)):(L.next=de.next,de.next=L),c.interleaved=L;return}}catch{}finally{}y=uu(o,c,L,T),y!==null&&(L=Jn(),fa(y,o,T,L),ut(y,c,T))}}function Be(o){var c=o.alternate;return o===Vr||c!==null&&c===Vr}function Ge(o,c){Wo=pu=!0;var y=o.pending;y===null?c.next=c:(c.next=y.next,y.next=c),o.pending=c}function ut(o,c,y){if((y&4194240)!==0){var T=c.lanes;T&=o.pendingLanes,y|=T,c.lanes=y,Tl(o,y)}}var et={readContext:ui,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},Ze={readContext:ui,useCallback:function(o,c){return Yi().memoizedState=[o,c===void 0?null:c],o},useContext:ui,useEffect:M,useImperativeHandle:function(o,c,y){return y=y!=null?y.concat([o]):null,P(4194308,4,ae.bind(null,c,o),y)},useLayoutEffect:function(o,c){return P(4194308,4,o,c)},useInsertionEffect:function(o,c){return P(4,2,o,c)},useMemo:function(o,c){var y=Yi();return c=c===void 0?null:c,o=o(),y.memoizedState=[o,c],o},useReducer:function(o,c,y){var T=Yi();return c=y!==void 0?y(c):c,T.memoizedState=T.baseState=c,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:c},T.queue=o,o=o.dispatch=Me.bind(null,Vr,o),[T.memoizedState,o]},useRef:function(o){var c=Yi();return o={current:o},c.memoizedState=o},useState:C,useDebugValue:ie,useDeferredValue:function(o){return Yi().memoizedState=o},useTransition:function(){var o=C(!1),c=o[0];return o=De.bind(null,o[1]),Yi().memoizedState=o,[c,o]},useMutableSource:function(){},useSyncExternalStore:function(o,c,y){var T=Vr,L=Yi();if(Fr){if(y===void 0)throw Error(r(407));y=y()}else{if(y=c(),Rn===null)throw Error(r(349));(Ra&30)!==0||l(T,c,y)}L.memoizedState=y;var F={value:y,getSnapshot:c};return L.queue=F,M(m.bind(null,T,F,o),[o]),T.flags|=2048,w(9,d.bind(null,T,F,y,c),void 0,null),y},useId:function(){var o=Yi(),c=Rn.identifierPrefix;if(Fr){var y=zi,T=jn;y=(T&~(1<<32-Zn(T)-1)).toString(32)+y,c=":"+c+"R"+y,y=Xs++,0<\/script>",o=o.removeChild(o.firstChild)):typeof T.is=="string"?o=W.createElement(y,{is:T.is}):(o=W.createElement(y),y==="select"&&(W=o,T.multiple?W.multiple=!0:T.size&&(W.size=T.size))):o=W.createElementNS(o,y),o[Vi]=c,o[ji]=T,Gd(o,c,!1,!1),c.stateNode=o;e:{switch(W=St(y,T),y){case"dialog":Ir("cancel",o),Ir("close",o),L=T;break;case"iframe":case"object":case"embed":Ir("load",o),L=T;break;case"video":case"audio":for(L=0;L_u&&(c.flags|=128,T=!0,Da(F,!1),c.lanes=4194304)}else{if(!T)if(o=cu(W),o!==null){if(c.flags|=128,T=!0,y=o.updateQueue,y!==null&&(c.updateQueue=y,c.flags|=4),Da(F,!0),F.tail===null&&F.tailMode==="hidden"&&!W.alternate&&!Fr)return Sn(c),null}else 2*qt()-F.renderingStartTime>_u&&y!==1073741824&&(c.flags|=128,T=!0,Da(F,!1),c.lanes=4194304);F.isBackwards?(W.sibling=c.child,c.child=W):(y=F.last,y!==null?y.sibling=W:c.child=W,F.last=W)}return F.tail!==null?(c=F.tail,F.rendering=c,F.tail=c.sibling,F.renderingStartTime=qt(),c.sibling=null,y=Hr.current,br(Hr,T?y&1|2:y&1),c):(Sn(c),null);case 22:case 23:return Hv(),T=c.memoizedState!==null,o!==null&&o.memoizedState!==null!==T&&(c.flags|=8192),T&&(c.mode&1)!==0?(Di&1073741824)!==0&&(Sn(c),c.subtreeFlags&6&&(c.flags|=8192)):Sn(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function Av(o,c){switch(ru(c),c.tag){case 1:return Vn(c.type)&&Zl(),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Ki(),Lr(Qr),Lr(hn),du(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 5:return zf(c),null;case 13:if(Lr(Hr),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(r(340));Gs()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return Lr(Hr),null;case 4:return Ki(),null;case 10:return Nf(c.type._context),null;case 22:case 23:return Hv(),null;case 24:return null;default:return null}}var $d=!1,zn=!1,bS=typeof WeakSet=="function"?WeakSet:Set,vt=null;function Eu(o,c){var y=o.ref;if(y!==null)if(typeof y=="function")try{y(null)}catch(T){tn(o,c,T)}else y.current=null}function kv(o,c,y){try{y()}catch(T){tn(o,c,T)}}var Gg=!1;function TS(o,c){if(Fs=Al,o=Td(),Rs(o)){if("selectionStart"in o)var y={start:o.selectionStart,end:o.selectionEnd};else e:{y=(y=o.ownerDocument)&&y.defaultView||window;var T=y.getSelection&&y.getSelection();if(T&&T.rangeCount!==0){y=T.anchorNode;var L=T.anchorOffset,F=T.focusNode;T=T.focusOffset;try{y.nodeType,F.nodeType}catch{y=null;break e}var W=0,le=-1,de=-1,Ie=0,Ye=0,Qe=o,Ke=null;t:for(;;){for(var dt;Qe!==y||L!==0&&Qe.nodeType!==3||(le=W+L),Qe!==F||T!==0&&Qe.nodeType!==3||(de=W+T),Qe.nodeType===3&&(W+=Qe.nodeValue.length),(dt=Qe.firstChild)!==null;)Ke=Qe,Qe=dt;for(;;){if(Qe===o)break t;if(Ke===y&&++Ie===L&&(le=W),Ke===F&&++Ye===T&&(de=W),(dt=Qe.nextSibling)!==null)break;Qe=Ke,Ke=Qe.parentNode}Qe=dt}y=le===-1||de===-1?null:{start:le,end:de}}else y=null}y=y||{start:0,end:0}}else y=null;for(Vo={focusedElem:o,selectionRange:y},Al=!1,vt=c;vt!==null;)if(c=vt,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,vt=o;else for(;vt!==null;){c=vt;try{var mt=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(mt!==null){var xt=mt.memoizedProps,ln=mt.memoizedState,ke=c.stateNode,he=ke.getSnapshotBeforeUpdate(c.elementType===c.type?xt:st(c.type,xt),ln);ke.__reactInternalSnapshotBeforeUpdate=he}break;case 3:var Re=c.stateNode.containerInfo;Re.nodeType===1?Re.textContent="":Re.nodeType===9&&Re.documentElement&&Re.removeChild(Re.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(tt){tn(c,c.return,tt)}if(o=c.sibling,o!==null){o.return=c.return,vt=o;break}vt=c.return}return mt=Gg,Gg=!1,mt}function Jf(o,c,y){var T=c.updateQueue;if(T=T!==null?T.lastEffect:null,T!==null){var L=T=T.next;do{if((L.tag&o)===o){var F=L.destroy;L.destroy=void 0,F!==void 0&&kv(c,y,F)}L=L.next}while(L!==T)}}function Kd(o,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var y=c=c.next;do{if((y.tag&o)===o){var T=y.create;y.destroy=T()}y=y.next}while(y!==c)}}function Lv(o){var c=o.ref;if(c!==null){var y=o.stateNode;switch(o.tag){case 5:o=y;break;default:o=y}typeof c=="function"?c(o):c.current=o}}function zg(o){var c=o.alternate;c!==null&&(o.alternate=null,zg(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&(delete c[Vi],delete c[ji],delete c[Xl],delete c[Rf],delete c[ki])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Wg(o){return o.tag===5||o.tag===3||o.tag===4}function $g(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Wg(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Rv(o,c,y){var T=o.tag;if(T===5||T===6)o=o.stateNode,c?y.nodeType===8?y.parentNode.insertBefore(o,c):y.insertBefore(o,c):(y.nodeType===8?(c=y.parentNode,c.insertBefore(o,y)):(c=y,c.appendChild(o)),y=y._reactRootContainer,y!=null||c.onclick!==null||(c.onclick=Yl));else if(T!==4&&(o=o.child,o!==null))for(Rv(o,c,y),o=o.sibling;o!==null;)Rv(o,c,y),o=o.sibling}function Dv(o,c,y){var T=o.tag;if(T===5||T===6)o=o.stateNode,c?y.insertBefore(o,c):y.appendChild(o);else if(T!==4&&(o=o.child,o!==null))for(Dv(o,c,y),o=o.sibling;o!==null;)Dv(o,c,y),o=o.sibling}var Bn=null,la=!1;function eo(o,c,y){for(y=y.child;y!==null;)Kg(o,c,y),y=y.sibling}function Kg(o,c,y){if(_i&&typeof _i.onCommitFiberUnmount=="function")try{_i.onCommitFiberUnmount(_l,y)}catch{}switch(y.tag){case 5:zn||Eu(y,c);case 6:var T=Bn,L=la;Bn=null,eo(o,c,y),Bn=T,la=L,Bn!==null&&(la?(o=Bn,y=y.stateNode,o.nodeType===8?o.parentNode.removeChild(y):o.removeChild(y)):Bn.removeChild(y.stateNode));break;case 18:Bn!==null&&(la?(o=Bn,y=y.stateNode,o.nodeType===8?qa(o.parentNode,y):o.nodeType===1&&qa(o,y),ws(o)):qa(Bn,y.stateNode));break;case 4:T=Bn,L=la,Bn=y.stateNode.containerInfo,la=!0,eo(o,c,y),Bn=T,la=L;break;case 0:case 11:case 14:case 15:if(!zn&&(T=y.updateQueue,T!==null&&(T=T.lastEffect,T!==null))){L=T=T.next;do{var F=L,W=F.destroy;F=F.tag,W!==void 0&&((F&2)!==0||(F&4)!==0)&&kv(y,c,W),L=L.next}while(L!==T)}eo(o,c,y);break;case 1:if(!zn&&(Eu(y,c),T=y.stateNode,typeof T.componentWillUnmount=="function"))try{T.props=y.memoizedProps,T.state=y.memoizedState,T.componentWillUnmount()}catch(le){tn(y,c,le)}eo(o,c,y);break;case 21:eo(o,c,y);break;case 22:y.mode&1?(zn=(T=zn)||y.memoizedState!==null,eo(o,c,y),zn=T):eo(o,c,y);break;default:eo(o,c,y)}}function Yg(o){var c=o.updateQueue;if(c!==null){o.updateQueue=null;var y=o.stateNode;y===null&&(y=o.stateNode=new bS),c.forEach(function(T){var L=IS.bind(null,o,T);y.has(T)||(y.add(T),T.then(L,L))})}}function ua(o,c){var y=c.deletions;if(y!==null)for(var T=0;TL&&(L=W),T&=~F}if(T=L,T=qt()-T,T=(120>T?120:480>T?480:1080>T?1080:1920>T?1920:3e3>T?3e3:4320>T?4320:1960*wS(T/1960))-T,10o?16:o,ro===null)var T=!1;else{if(o=ro,ro=null,Qd=0,(dr&6)!==0)throw Error(r(331));var L=dr;for(dr|=4,vt=o.current;vt!==null;){var F=vt,W=F.child;if((vt.flags&16)!==0){var le=F.deletions;if(le!==null){for(var de=0;deqt()-Ov?Qo(o,0):Iv|=y),hi(o,c)}function om(o,c){c===0&&((o.mode&1)===0?c=1:(c=wo,wo<<=1,(wo&130023424)===0&&(wo=4194304)));var y=Jn();o=Wi(o,c),o!==null&&(ko(o,c,y),hi(o,y))}function PS(o){var c=o.memoizedState,y=0;c!==null&&(y=c.retryLane),om(o,y)}function IS(o,c){var y=0;switch(o.tag){case 13:var T=o.stateNode,L=o.memoizedState;L!==null&&(y=L.retryLane);break;case 19:T=o.stateNode;break;default:throw Error(r(314))}T!==null&&T.delete(c),om(o,y)}var lm;lm=function(o,c,y){if(o!==null)if(o.memoizedProps!==c.pendingProps||Qr.current)Dr=!0;else{if((o.lanes&y)===0&&(c.flags&128)===0)return Dr=!1,Cv(o,c,y);Dr=(o.flags&131072)!==0}else Dr=!1,Fr&&(c.flags&1048576)!==0&&Md(c,eu,c.index);switch(c.lanes=0,c.tag){case 2:var T=c.type;Xo(o,c),o=c.pendingProps;var L=Ns(c,hn.current);$s(c,y),L=Yf(null,c,T,o,L,y);var F=gu();return c.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Vn(T)?(F=!0,Ql(c)):F=!1,c.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,Vf(c),L.updater=ar,c.stateNode=L,L._reactInternals=c,zr(c,T,o,y),c=mu(null,c,T,!0,F,y)):(c.tag=0,Fr&&F&&tu(c),Yt(null,c,L,y),c=c.child),c;case 16:T=c.elementType;e:{switch(Xo(o,c),o=c.pendingProps,L=T._init,T=L(T._payload),c.type=T,L=c.tag=FS(T),o=st(T,o),L){case 0:c=$o(null,c,T,o,y);break e;case 1:c=Vd(null,c,T,o,y);break e;case 11:c=Gn(null,c,T,o,y);break e;case 14:c=en(null,c,T,st(T.type,o),y);break e}throw Error(r(306,T,""))}return c;case 0:return T=c.type,L=c.pendingProps,L=c.elementType===T?L:st(T,L),$o(o,c,T,L,y);case 1:return T=c.type,L=c.pendingProps,L=c.elementType===T?L:st(T,L),Vd(o,c,T,L,y);case 3:e:{if(jd(c),o===null)throw Error(r(387));T=c.pendingProps,F=c.memoizedState,L=F.element,Ud(o,c),Ks(c,T,null,y);var W=c.memoizedState;if(T=W.element,F.isDehydrated)if(F={element:T,isDehydrated:!1,cache:W.cache,pendingSuspenseBoundaries:W.pendingSuspenseBoundaries,transitions:W.transitions},c.updateQueue.baseState=F,c.memoizedState=F,c.flags&256){L=ur(Error(r(423)),c),c=yu(o,c,T,y,L);break e}else if(T!==L){L=ur(Error(r(424)),c),c=yu(o,c,T,y,L);break e}else for(Kr=Ca(c.stateNode.containerInfo.firstChild),Qn=c,Fr=!0,li=null,y=Nd(c,null,T,y),c.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling;else{if(Gs(),T===L){c=Xi(o,c,y);break e}Yt(o,c,T,y)}c=c.child}return c;case 5:return as(c),o===null&&nu(c),T=c.type,L=c.pendingProps,F=o!==null?o.memoizedProps:null,W=L.children,ba(T,L)?W=null:F!==null&&ba(T,F)&&(c.flags|=32),Xf(o,c),Yt(o,c,W,y),c.child;case 6:return o===null&&nu(c),null;case 13:return Ko(o,c,y);case 4:return Gf(c,c.stateNode.containerInfo),T=c.pendingProps,o===null?c.child=sa(c,null,T,y):Yt(o,c,T,y),c.child;case 11:return T=c.type,L=c.pendingProps,L=c.elementType===T?L:st(T,L),Gn(o,c,T,L,y);case 7:return Yt(o,c,c.pendingProps,y),c.child;case 8:return Yt(o,c,c.pendingProps.children,y),c.child;case 12:return Yt(o,c,c.pendingProps.children,y),c.child;case 10:e:{if(T=c.type._context,L=c.pendingProps,F=c.memoizedProps,W=L.value,br(au,T._currentValue),T._currentValue=W,F!==null)if(Ci(F.value,W)){if(F.children===L.children&&!Qr.current){c=Xi(o,c,y);break e}}else for(F=c.child,F!==null&&(F.return=c);F!==null;){var le=F.dependencies;if(le!==null){W=F.child;for(var de=le.firstContext;de!==null;){if(de.context===T){if(F.tag===1){de=oa(-1,y&-y),de.tag=2;var Ie=F.updateQueue;if(Ie!==null){Ie=Ie.shared;var Ye=Ie.pending;Ye===null?de.next=de:(de.next=Ye.next,Ye.next=de),Ie.pending=de}}F.lanes|=y,de=F.alternate,de!==null&&(de.lanes|=y),Uf(F.return,y,c),le.lanes|=y;break}de=de.next}}else if(F.tag===10)W=F.type===c.type?null:F.child;else if(F.tag===18){if(W=F.return,W===null)throw Error(r(341));W.lanes|=y,le=W.alternate,le!==null&&(le.lanes|=y),Uf(W,y,c),W=F.sibling}else W=F.child;if(W!==null)W.return=F;else for(W=F;W!==null;){if(W===c){W=null;break}if(F=W.sibling,F!==null){F.return=W.return,W=F;break}W=W.return}F=W}Yt(o,c,L.children,y),c=c.child}return c;case 9:return L=c.type,T=c.pendingProps.children,$s(c,y),L=ui(L),T=T(L),c.flags|=1,Yt(o,c,T,y),c.child;case 14:return T=c.type,L=st(T,c.pendingProps),L=st(T.type,L),en(o,c,T,L,y);case 15:return Mn(o,c,c.type,c.pendingProps,y);case 17:return T=c.type,L=c.pendingProps,L=c.elementType===T?L:st(T,L),Xo(o,c),c.tag=1,Vn(T)?(o=!0,Ql(c)):o=!1,$s(c,y),xr(c,T,L),zr(c,T,L,y),mu(null,c,T,!0,o,y);case 19:return ci(o,c,y);case 22:return Zs(o,c,y)}throw Error(r(156,c.tag))};function um(o,c){return Ni(o,c)}function OS(o,c,y,T){this.tag=o,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=T,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zi(o,c,y,T){return new OS(o,c,y,T)}function jv(o){return o=o.prototype,!(!o||!o.isReactComponent)}function FS(o){if(typeof o=="function")return jv(o)?1:0;if(o!=null){if(o=o.$$typeof,o===Y)return 11;if(o===be)return 14}return 2}function ao(o,c){var y=o.alternate;return y===null?(y=Zi(o.tag,c,o.key,o.mode),y.elementType=o.elementType,y.type=o.type,y.stateNode=o.stateNode,y.alternate=o,o.alternate=y):(y.pendingProps=c,y.type=o.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=o.flags&14680064,y.childLanes=o.childLanes,y.lanes=o.lanes,y.child=o.child,y.memoizedProps=o.memoizedProps,y.memoizedState=o.memoizedState,y.updateQueue=o.updateQueue,c=o.dependencies,y.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},y.sibling=o.sibling,y.index=o.index,y.ref=o.ref,y}function rh(o,c,y,T,L,F){var W=2;if(T=o,typeof o=="function")jv(o)&&(W=1);else if(typeof o=="string")W=5;else e:switch(o){case ee:return el(y.children,L,F,c);case te:W=8,L|=8;break;case fe:return o=Zi(12,y,c,L|2),o.elementType=fe,o.lanes=F,o;case q:return o=Zi(13,y,c,L),o.elementType=q,o.lanes=F,o;case Q:return o=Zi(19,y,c,L),o.elementType=Q,o.lanes=F,o;case ve:return nh(y,L,F,c);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case ne:W=10;break e;case oe:W=9;break e;case Y:W=11;break e;case be:W=14;break e;case ge:W=16,T=null;break e}throw Error(r(130,o==null?o:typeof o,""))}return c=Zi(W,y,c,L),c.elementType=o,c.type=T,c.lanes=F,c}function el(o,c,y,T){return o=Zi(7,o,T,c),o.lanes=y,o}function nh(o,c,y,T){return o=Zi(22,o,T,c),o.elementType=ve,o.lanes=y,o.stateNode={isHidden:!1},o}function Gv(o,c,y){return o=Zi(6,o,null,c),o.lanes=y,o}function zv(o,c,y){return c=Zi(4,o.children!==null?o.children:[],o.key,c),c.lanes=y,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}function MS(o,c,y,T,L){this.tag=c,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=En(0),this.expirationTimes=En(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=En(0),this.identifierPrefix=T,this.onRecoverableError=L,this.mutableSourceEagerHydrationData=null}function Wv(o,c,y,T,L,F,W,le,de){return o=new MS(o,c,y,le,de),c===1?(c=1,F===!0&&(c|=8)):c=0,F=Zi(3,null,null,c),o.current=F,F.stateNode=o,F.memoizedState={element:T,isDehydrated:y,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vf(F),o}function BS(o,c,y){var T=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),Qv.exports=XS(),Qv.exports}var bm;function cP(){if(bm)return fh;bm=1;var n=_x();return fh.createRoot=n.createRoot,fh.hydrateRoot=n.hydrateRoot,fh}const Ht=n=>typeof n=="string",ac=()=>{let n,a;const r=new Promise((t,e)=>{n=t,a=e});return r.resolve=n,r.reject=a,r},Tm=n=>n==null?"":""+n,qS=(n,a,r)=>{n.forEach(t=>{a[t]&&(r[t]=a[t])})},ZS=/###/g,Cm=n=>n&&n.indexOf("###")>-1?n.replace(ZS,"."):n,wm=n=>!n||Ht(n),yc=(n,a,r)=>{const t=Ht(a)?a.split("."):a;let e=0;for(;e{const{obj:t,k:e}=yc(n,a,Object);if(t!==void 0||a.length===1){t[e]=r;return}let i=a[a.length-1],s=a.slice(0,a.length-1),f=yc(n,s,Object);for(;f.obj===void 0&&s.length;)i=`${s[s.length-1]}.${i}`,s=s.slice(0,s.length-1),f=yc(n,s,Object),f!=null&&f.obj&&typeof f.obj[`${f.k}.${i}`]<"u"&&(f.obj=void 0);f.obj[`${f.k}.${i}`]=r},QS=(n,a,r,t)=>{const{obj:e,k:i}=yc(n,a,Object);e[i]=e[i]||[],e[i].push(r)},h0=(n,a)=>{const{obj:r,k:t}=yc(n,a);if(r&&Object.prototype.hasOwnProperty.call(r,t))return r[t]},JS=(n,a,r)=>{const t=h0(n,r);return t!==void 0?t:h0(a,r)},bx=(n,a,r)=>{for(const t in a)t!=="__proto__"&&t!=="constructor"&&(t in n?Ht(n[t])||n[t]instanceof String||Ht(a[t])||a[t]instanceof String?r&&(n[t]=a[t]):bx(n[t],a[t],r):n[t]=a[t]);return n},Tu=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var e_={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const t_=n=>Ht(n)?n.replace(/[&<>"'\/]/g,a=>e_[a]):n;class r_{constructor(a){this.capacity=a,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(a){const r=this.regExpMap.get(a);if(r!==void 0)return r;const t=new RegExp(a);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(a,t),this.regExpQueue.push(a),t}}const n_=[" ",",","?","!",";"],i_=new r_(20),a_=(n,a,r)=>{a=a||"",r=r||"";const t=n_.filter(s=>a.indexOf(s)<0&&r.indexOf(s)<0);if(t.length===0)return!0;const e=i_.getRegExp(`(${t.map(s=>s==="?"?"\\?":s).join("|")})`);let i=!e.test(n);if(!i){const s=n.indexOf(r);s>0&&!e.test(n.substring(0,s))&&(i=!0)}return i},Pp=function(n,a){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[a])return Object.prototype.hasOwnProperty.call(n,a)?n[a]:void 0;const t=a.split(r);let e=n;for(let i=0;i-1&&hn==null?void 0:n.replace("_","-"),s_={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,a){var r,t;(t=(r=console==null?void 0:console[n])==null?void 0:r.apply)==null||t.call(r,console,a)}};let o_=class Ip{constructor(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(a,r)}init(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=a||s_,this.options=r,this.debug=r.debug}log(){for(var a=arguments.length,r=new Array(a),t=0;t{this.observers[t]||(this.observers[t]=new Map);const e=this.observers[t].get(r)||0;this.observers[t].set(r,e+1)}),this}off(a,r){if(this.observers[a]){if(!r){delete this.observers[a];return}this.observers[a].delete(r)}}emit(a){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e{let[f,h]=s;for(let p=0;p{let[f,h]=s;for(let p=0;p1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=a||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(a){this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}removeNamespaces(a){const r=this.options.ns.indexOf(a);r>-1&&this.options.ns.splice(r,1)}getResource(a,r,t){var p,S;let e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=e.keySeparator!==void 0?e.keySeparator:this.options.keySeparator,s=e.ignoreJSONStructure!==void 0?e.ignoreJSONStructure:this.options.ignoreJSONStructure;let f;a.indexOf(".")>-1?f=a.split("."):(f=[a,r],t&&(Array.isArray(t)?f.push(...t):Ht(t)&&i?f.push(...t.split(i)):f.push(t)));const h=h0(this.data,f);return!h&&!r&&!t&&a.indexOf(".")>-1&&(a=f[0],r=f[1],t=f.slice(2).join(".")),h||!s||!Ht(t)?h:Pp((S=(p=this.data)==null?void 0:p[a])==null?void 0:S[r],t,i)}addResource(a,r,t,e){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let f=[a,r];t&&(f=f.concat(s?t.split(s):t)),a.indexOf(".")>-1&&(f=a.split("."),e=r,r=f[1]),this.addNamespaces(r),Am(this.data,f,e),i.silent||this.emit("added",a,r,t,e)}addResources(a,r,t){let e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in t)(Ht(t[i])||Array.isArray(t[i]))&&this.addResource(a,r,i,t[i],{silent:!0});e.silent||this.emit("added",a,r,t)}addResourceBundle(a,r,t,e,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},f=[a,r];a.indexOf(".")>-1&&(f=a.split("."),e=t,t=r,r=f[1]),this.addNamespaces(r);let h=h0(this.data,f)||{};s.skipCopy||(t=JSON.parse(JSON.stringify(t))),e?bx(h,t,i):h={...h,...t},Am(this.data,f,h),s.silent||this.emit("added",a,r,t)}removeResourceBundle(a,r){this.hasResourceBundle(a,r)&&delete this.data[a][r],this.removeNamespaces(r),this.emit("removed",a,r)}hasResourceBundle(a,r){return this.getResource(a,r)!==void 0}getResourceBundle(a,r){return r||(r=this.options.defaultNS),this.getResource(a,r)}getDataByLanguage(a){return this.data[a]}hasLanguageSomeTranslations(a){const r=this.getDataByLanguage(a);return!!(r&&Object.keys(r)||[]).find(e=>r[e]&&Object.keys(r[e]).length>0)}toJSON(){return this.data}}var Tx={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,a,r,t,e){return n.forEach(i=>{var s;a=((s=this.processors[i])==null?void 0:s.process(a,r,t,e))??a}),a}};const Lm={},Rm=n=>!Ht(n)&&typeof n!="boolean"&&typeof n!="number";class p0 extends N0{constructor(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),qS(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],a,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Va.create("translator")}changeLanguage(a){a&&(this.language=a)}exists(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(a==null)return!1;const t=this.resolve(a,r);return(t==null?void 0:t.res)!==void 0}extractFromKey(a,r){let t=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;t===void 0&&(t=":");const e=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let i=r.ns||this.options.defaultNS||[];const s=t&&a.indexOf(t)>-1,f=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!a_(a,t,e);if(s&&!f){const h=a.match(this.interpolator.nestingRegexp);if(h&&h.length>0)return{key:a,namespaces:Ht(i)?[i]:i};const p=a.split(t);(t!==e||t===e&&this.options.ns.indexOf(p[0])>-1)&&(i=p.shift()),a=p.join(e)}return{key:a,namespaces:Ht(i)?[i]:i}}translate(a,r,t){if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),a==null)return"";Array.isArray(a)||(a=[String(a)]);const e=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:s,namespaces:f}=this.extractFromKey(a[a.length-1],r),h=f[f.length-1],p=r.lng||this.language,S=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((p==null?void 0:p.toLowerCase())==="cimode"){if(S){const oe=r.nsSeparator||this.options.nsSeparator;return e?{res:`${h}${oe}${s}`,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:h,usedParams:this.getUsedParamsDetails(r)}:`${h}${oe}${s}`}return e?{res:s,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:h,usedParams:this.getUsedParamsDetails(r)}:s}const b=this.resolve(a,r);let A=b==null?void 0:b.res;const R=(b==null?void 0:b.usedKey)||s,D=(b==null?void 0:b.exactUsedKey)||s,I=["[object Number]","[object Function]","[object RegExp]"],O=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,V=!this.i18nFormat||this.i18nFormat.handleAsObject,N=r.count!==void 0&&!Ht(r.count),G=p0.hasDefaultValue(r),z=N?this.pluralResolver.getSuffix(p,r.count,r):"",Z=r.ordinal&&N?this.pluralResolver.getSuffix(p,r.count,{ordinal:!1}):"",H=N&&!r.ordinal&&r.count===0,ee=H&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${z}`]||r[`defaultValue${Z}`]||r.defaultValue;let te=A;V&&!A&&G&&(te=ee);const fe=Rm(te),ne=Object.prototype.toString.apply(te);if(V&&te&&fe&&I.indexOf(ne)<0&&!(Ht(O)&&Array.isArray(te))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const oe=this.options.returnedObjectHandler?this.options.returnedObjectHandler(R,te,{...r,ns:f}):`key '${s} (${this.language})' returned an object instead of string.`;return e?(b.res=oe,b.usedParams=this.getUsedParamsDetails(r),b):oe}if(i){const oe=Array.isArray(te),Y=oe?[]:{},q=oe?D:R;for(const Q in te)if(Object.prototype.hasOwnProperty.call(te,Q)){const be=`${q}${i}${Q}`;G&&!A?Y[Q]=this.translate(be,{...r,defaultValue:Rm(ee)?ee[Q]:void 0,joinArrays:!1,ns:f}):Y[Q]=this.translate(be,{...r,joinArrays:!1,ns:f}),Y[Q]===be&&(Y[Q]=te[Q])}A=Y}}else if(V&&Ht(O)&&Array.isArray(A))A=A.join(O),A&&(A=this.extendTranslation(A,a,r,t));else{let oe=!1,Y=!1;!this.isValidLookup(A)&&G&&(oe=!0,A=ee),this.isValidLookup(A)||(Y=!0,A=s);const Q=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Y?void 0:A,be=G&&ee!==A&&this.options.updateMissing;if(Y||oe||be){if(this.logger.log(be?"updateKey":"missingKey",p,h,s,be?ee:A),i){const j=this.resolve(s,{...r,keySeparator:!1});j&&j.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let ge=[];const ve=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ve&&ve[0])for(let j=0;j{var Ae;const ce=G&&X!==A?X:Q;this.options.missingKeyHandler?this.options.missingKeyHandler(j,h,ye,ce,be,r):(Ae=this.backendConnector)!=null&&Ae.saveMissing&&this.backendConnector.saveMissing(j,h,ye,ce,be,r),this.emit("missingKey",j,h,ye,A)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?ge.forEach(j=>{const ye=this.pluralResolver.getSuffixes(j,r);H&&r[`defaultValue${this.options.pluralSeparator}zero`]&&ye.indexOf(`${this.options.pluralSeparator}zero`)<0&&ye.push(`${this.options.pluralSeparator}zero`),ye.forEach(X=>{re([j],s+X,r[`defaultValue${X}`]||ee)})}):re(ge,s,ee))}A=this.extendTranslation(A,a,r,b,t),Y&&A===s&&this.options.appendNamespaceToMissingKey&&(A=`${h}:${s}`),(Y||oe)&&this.options.parseMissingKeyHandler&&(A=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${h}:${s}`:s,oe?A:void 0))}return e?(b.res=A,b.usedParams=this.getUsedParamsDetails(r),b):A}extendTranslation(a,r,t,e,i){var p,S;var s=this;if((p=this.i18nFormat)!=null&&p.parse)a=this.i18nFormat.parse(a,{...this.options.interpolation.defaultVariables,...t},t.lng||this.language||e.usedLng,e.usedNS,e.usedKey,{resolved:e});else if(!t.skipInterpolation){t.interpolation&&this.interpolator.init({...t,interpolation:{...this.options.interpolation,...t.interpolation}});const b=Ht(a)&&(((S=t==null?void 0:t.interpolation)==null?void 0:S.skipOnVariables)!==void 0?t.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let A;if(b){const D=a.match(this.interpolator.nestingRegexp);A=D&&D.length}let R=t.replace&&!Ht(t.replace)?t.replace:t;if(this.options.interpolation.defaultVariables&&(R={...this.options.interpolation.defaultVariables,...R}),a=this.interpolator.interpolate(a,R,t.lng||this.language||e.usedLng,t),b){const D=a.match(this.interpolator.nestingRegexp),I=D&&D.length;A1&&arguments[1]!==void 0?arguments[1]:{},t,e,i,s,f;return Ht(a)&&(a=[a]),a.forEach(h=>{if(this.isValidLookup(t))return;const p=this.extractFromKey(h,r),S=p.key;e=S;let b=p.namespaces;this.options.fallbackNS&&(b=b.concat(this.options.fallbackNS));const A=r.count!==void 0&&!Ht(r.count),R=A&&!r.ordinal&&r.count===0,D=r.context!==void 0&&(Ht(r.context)||typeof r.context=="number")&&r.context!=="",I=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);b.forEach(O=>{var V,N;this.isValidLookup(t)||(f=O,!Lm[`${I[0]}-${O}`]&&((V=this.utils)!=null&&V.hasLoadedNamespace)&&!((N=this.utils)!=null&&N.hasLoadedNamespace(f))&&(Lm[`${I[0]}-${O}`]=!0,this.logger.warn(`key "${e}" for languages "${I.join(", ")}" won't get resolved as namespace "${f}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),I.forEach(G=>{var H;if(this.isValidLookup(t))return;s=G;const z=[S];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(z,S,G,O,r);else{let ee;A&&(ee=this.pluralResolver.getSuffix(G,r.count,r));const te=`${this.options.pluralSeparator}zero`,fe=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(A&&(z.push(S+ee),r.ordinal&&ee.indexOf(fe)===0&&z.push(S+ee.replace(fe,this.options.pluralSeparator)),R&&z.push(S+te)),D){const ne=`${S}${this.options.contextSeparator}${r.context}`;z.push(ne),A&&(z.push(ne+ee),r.ordinal&&ee.indexOf(fe)===0&&z.push(ne+ee.replace(fe,this.options.pluralSeparator)),R&&z.push(ne+te))}}let Z;for(;Z=z.pop();)this.isValidLookup(t)||(i=Z,t=this.getResource(G,O,Z,r))}))})}),{res:t,usedKey:e,exactUsedKey:i,usedLng:s,usedNS:f}}isValidLookup(a){return a!==void 0&&!(!this.options.returnNull&&a===null)&&!(!this.options.returnEmptyString&&a==="")}getResource(a,r,t){var i;let e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(i=this.i18nFormat)!=null&&i.getResource?this.i18nFormat.getResource(a,r,t,e):this.resourceStore.getResource(a,r,t,e)}getUsedParamsDetails(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],t=a.replace&&!Ht(a.replace);let e=t?a.replace:a;if(t&&typeof a.count<"u"&&(e.count=a.count),this.options.interpolation.defaultVariables&&(e={...this.options.interpolation.defaultVariables,...e}),!t){e={...e};for(const i of r)delete e[i]}return e}static hasDefaultValue(a){const r="defaultValue";for(const t in a)if(Object.prototype.hasOwnProperty.call(a,t)&&r===t.substring(0,r.length)&&a[t]!==void 0)return!0;return!1}}class Dm{constructor(a){this.options=a,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Va.create("languageUtils")}getScriptPartFromCode(a){if(a=v0(a),!a||a.indexOf("-")<0)return null;const r=a.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(a){if(a=v0(a),!a||a.indexOf("-")<0)return a;const r=a.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(a){if(Ht(a)&&a.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(a)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?a.toLowerCase():a)}return this.options.cleanCode||this.options.lowerCaseLng?a.toLowerCase():a}isSupportedCode(a){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(a=this.getLanguagePartFromCode(a)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(a)>-1}getBestMatchFromCodes(a){if(!a)return null;let r;return a.forEach(t=>{if(r)return;const e=this.formatLanguageCode(t);(!this.options.supportedLngs||this.isSupportedCode(e))&&(r=e)}),!r&&this.options.supportedLngs&&a.forEach(t=>{if(r)return;const e=this.getLanguagePartFromCode(t);if(this.isSupportedCode(e))return r=e;r=this.options.supportedLngs.find(i=>{if(i===e)return i;if(!(i.indexOf("-")<0&&e.indexOf("-")<0)&&(i.indexOf("-")>0&&e.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===e||i.indexOf(e)===0&&e.length>1))return i})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(a,r){if(!a)return[];if(typeof a=="function"&&(a=a(r)),Ht(a)&&(a=[a]),Array.isArray(a))return a;if(!r)return a.default||[];let t=a[r];return t||(t=a[this.getScriptPartFromCode(r)]),t||(t=a[this.formatLanguageCode(r)]),t||(t=a[this.getLanguagePartFromCode(r)]),t||(t=a.default),t||[]}toResolveHierarchy(a,r){const t=this.getFallbackCodes(r||this.options.fallbackLng||[],a),e=[],i=s=>{s&&(this.isSupportedCode(s)?e.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return Ht(a)&&(a.indexOf("-")>-1||a.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(a)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(a)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(a))):Ht(a)&&i(this.formatLanguageCode(a)),t.forEach(s=>{e.indexOf(s)<0&&i(this.formatLanguageCode(s))}),e}}const Pm={zero:0,one:1,two:2,few:3,many:4,other:5},Im={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class l_{constructor(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=a,this.options=r,this.logger=Va.create("pluralResolver"),this.pluralRulesCache={}}addRule(a,r){this.rules[a]=r}clearCache(){this.pluralRulesCache={}}getRule(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const t=v0(a==="dev"?"en":a),e=r.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:t,type:e});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let s;try{s=new Intl.PluralRules(t,{type:e})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Im;if(!a.match(/-|_/))return Im;const h=this.languageUtils.getLanguagePartFromCode(a);s=this.getRule(h,r)}return this.pluralRulesCache[i]=s,s}needsPlural(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=this.getRule(a,r);return t||(t=this.getRule("dev",r)),(t==null?void 0:t.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(a,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(a,t).map(e=>`${r}${e}`)}getSuffixes(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=this.getRule(a,r);return t||(t=this.getRule("dev",r)),t?t.resolvedOptions().pluralCategories.sort((e,i)=>Pm[e]-Pm[i]).map(e=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(a,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const e=this.getRule(a,t);return e?`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e.select(r)}`:(this.logger.warn(`no plural rule found for: ${a}`),this.getSuffix("dev",r,t))}}const Om=function(n,a,r){let t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=JS(n,a,r);return!i&&e&&Ht(r)&&(i=Pp(n,r,t),i===void 0&&(i=Pp(a,r,t))),i},tp=n=>n.replace(/\$/g,"$$$$");class u_{constructor(){var r;let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Va.create("interpolator"),this.options=a,this.format=((r=a==null?void 0:a.interpolation)==null?void 0:r.format)||(t=>t),this.init(a)}init(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};a.interpolation||(a.interpolation={escapeValue:!0});const{escape:r,escapeValue:t,useRawValueToEscape:e,prefix:i,prefixEscaped:s,suffix:f,suffixEscaped:h,formatSeparator:p,unescapeSuffix:S,unescapePrefix:b,nestingPrefix:A,nestingPrefixEscaped:R,nestingSuffix:D,nestingSuffixEscaped:I,nestingOptionsSeparator:O,maxReplaces:V,alwaysFormat:N}=a.interpolation;this.escape=r!==void 0?r:t_,this.escapeValue=t!==void 0?t:!0,this.useRawValueToEscape=e!==void 0?e:!1,this.prefix=i?Tu(i):s||"{{",this.suffix=f?Tu(f):h||"}}",this.formatSeparator=p||",",this.unescapePrefix=S?"":b||"-",this.unescapeSuffix=this.unescapePrefix?"":S||"",this.nestingPrefix=A?Tu(A):R||Tu("$t("),this.nestingSuffix=D?Tu(D):I||Tu(")"),this.nestingOptionsSeparator=O||",",this.maxReplaces=V||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const a=(r,t)=>(r==null?void 0:r.source)===t?(r.lastIndex=0,r):new RegExp(t,"g");this.regexp=a(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=a(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=a(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(a,r,t,e){var R;let i,s,f;const h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=D=>{if(D.indexOf(this.formatSeparator)<0){const N=Om(r,h,D,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(N,void 0,t,{...e,...r,interpolationkey:D}):N}const I=D.split(this.formatSeparator),O=I.shift().trim(),V=I.join(this.formatSeparator).trim();return this.format(Om(r,h,O,this.options.keySeparator,this.options.ignoreJSONStructure),V,t,{...e,...r,interpolationkey:O})};this.resetRegExp();const S=(e==null?void 0:e.missingInterpolationHandler)||this.options.missingInterpolationHandler,b=((R=e==null?void 0:e.interpolation)==null?void 0:R.skipOnVariables)!==void 0?e.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:D=>tp(D)},{regex:this.regexp,safeValue:D=>this.escapeValue?tp(this.escape(D)):tp(D)}].forEach(D=>{for(f=0;i=D.regex.exec(a);){const I=i[1].trim();if(s=p(I),s===void 0)if(typeof S=="function"){const V=S(a,i,e);s=Ht(V)?V:""}else if(e&&Object.prototype.hasOwnProperty.call(e,I))s="";else if(b){s=i[0];continue}else this.logger.warn(`missed to pass in variable ${I} for interpolating ${a}`),s="";else!Ht(s)&&!this.useRawValueToEscape&&(s=Tm(s));const O=D.safeValue(s);if(a=a.replace(i[0],O),b?(D.regex.lastIndex+=s.length,D.regex.lastIndex-=i[0].length):D.regex.lastIndex=0,f++,f>=this.maxReplaces)break}}),a}nest(a,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},e,i,s;const f=(h,p)=>{const S=this.nestingOptionsSeparator;if(h.indexOf(S)<0)return h;const b=h.split(new RegExp(`${S}[ ]*{`));let A=`{${b[1]}`;h=b[0],A=this.interpolate(A,s);const R=A.match(/'/g),D=A.match(/"/g);(((R==null?void 0:R.length)??0)%2===0&&!D||D.length%2!==0)&&(A=A.replace(/'/g,'"'));try{s=JSON.parse(A),p&&(s={...p,...s})}catch(I){return this.logger.warn(`failed parsing options string in nesting for key ${h}`,I),`${h}${S}${A}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,h};for(;e=this.nestingRegexp.exec(a);){let h=[];s={...t},s=s.replace&&!Ht(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let p=!1;if(e[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(e[1])){const S=e[1].split(this.formatSeparator).map(b=>b.trim());e[1]=S.shift(),h=S,p=!0}if(i=r(f.call(this,e[1].trim(),s),s),i&&e[0]===a&&!Ht(i))return i;Ht(i)||(i=Tm(i)),i||(this.logger.warn(`missed to resolve ${e[1]} for nesting ${a}`),i=""),p&&(i=h.reduce((S,b)=>this.format(S,b,t.lng,{...t,interpolationkey:e[1].trim()}),i.trim())),a=a.replace(e[0],i),this.regexp.lastIndex=0}return a}}const f_=n=>{let a=n.toLowerCase().trim();const r={};if(n.indexOf("(")>-1){const t=n.split("(");a=t[0].toLowerCase().trim();const e=t[1].substring(0,t[1].length-1);a==="currency"&&e.indexOf(":")<0?r.currency||(r.currency=e.trim()):a==="relativetime"&&e.indexOf(":")<0?r.range||(r.range=e.trim()):e.split(";").forEach(s=>{if(s){const[f,...h]=s.split(":"),p=h.join(":").trim().replace(/^'+|'+$/g,""),S=f.trim();r[S]||(r[S]=p),p==="false"&&(r[S]=!1),p==="true"&&(r[S]=!0),isNaN(p)||(r[S]=parseInt(p,10))}})}return{formatName:a,formatOptions:r}},Cu=n=>{const a={};return(r,t,e)=>{let i=e;e&&e.interpolationkey&&e.formatParams&&e.formatParams[e.interpolationkey]&&e[e.interpolationkey]&&(i={...i,[e.interpolationkey]:void 0});const s=t+JSON.stringify(i);let f=a[s];return f||(f=n(v0(t),e),a[s]=f),f(r)}};class c_{constructor(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Va.create("formatter"),this.options=a,this.formats={number:Cu((r,t)=>{const e=new Intl.NumberFormat(r,{...t});return i=>e.format(i)}),currency:Cu((r,t)=>{const e=new Intl.NumberFormat(r,{...t,style:"currency"});return i=>e.format(i)}),datetime:Cu((r,t)=>{const e=new Intl.DateTimeFormat(r,{...t});return i=>e.format(i)}),relativetime:Cu((r,t)=>{const e=new Intl.RelativeTimeFormat(r,{...t});return i=>e.format(i,t.range||"day")}),list:Cu((r,t)=>{const e=new Intl.ListFormat(r,{...t});return i=>e.format(i)})},this.init(a)}init(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=r.interpolation.formatSeparator||","}add(a,r){this.formats[a.toLowerCase().trim()]=r}addCached(a,r){this.formats[a.toLowerCase().trim()]=Cu(r)}format(a,r,t){let e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=r.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(f=>f.indexOf(")")>-1)){const f=i.findIndex(h=>h.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,f)].join(this.formatSeparator)}return i.reduce((f,h)=>{var b;const{formatName:p,formatOptions:S}=f_(h);if(this.formats[p]){let A=f;try{const R=((b=e==null?void 0:e.formatParams)==null?void 0:b[e.interpolationkey])||{},D=R.locale||R.lng||e.locale||e.lng||t;A=this.formats[p](f,D,{...S,...e,...R})}catch(R){this.logger.warn(R)}return A}else this.logger.warn(`there was no format function for ${p}`);return f},a)}}const d_=(n,a)=>{n.pending[a]!==void 0&&(delete n.pending[a],n.pendingCount--)};class h_ extends N0{constructor(a,r,t){var i,s;let e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=a,this.store=r,this.services=t,this.languageUtils=t.languageUtils,this.options=e,this.logger=Va.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=e.maxParallelReads||10,this.readingCalls=0,this.maxRetries=e.maxRetries>=0?e.maxRetries:5,this.retryTimeout=e.retryTimeout>=1?e.retryTimeout:350,this.state={},this.queue=[],(s=(i=this.backend)==null?void 0:i.init)==null||s.call(i,t,e.backend,e)}queueLoad(a,r,t,e){const i={},s={},f={},h={};return a.forEach(p=>{let S=!0;r.forEach(b=>{const A=`${p}|${b}`;!t.reload&&this.store.hasResourceBundle(p,b)?this.state[A]=2:this.state[A]<0||(this.state[A]===1?s[A]===void 0&&(s[A]=!0):(this.state[A]=1,S=!1,s[A]===void 0&&(s[A]=!0),i[A]===void 0&&(i[A]=!0),h[b]===void 0&&(h[b]=!0)))}),S||(f[p]=!0)}),(Object.keys(i).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:e}),{toLoad:Object.keys(i),pending:Object.keys(s),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(h)}}loaded(a,r,t){const e=a.split("|"),i=e[0],s=e[1];r&&this.emit("failedLoading",i,s,r),!r&&t&&this.store.addResourceBundle(i,s,t,void 0,void 0,{skipCopy:!0}),this.state[a]=r?-1:2,r&&t&&(this.state[a]=0);const f={};this.queue.forEach(h=>{QS(h.loaded,[i],s),d_(h,a),r&&h.errors.push(r),h.pendingCount===0&&!h.done&&(Object.keys(h.loaded).forEach(p=>{f[p]||(f[p]={});const S=h.loaded[p];S.length&&S.forEach(b=>{f[p][b]===void 0&&(f[p][b]=!0)})}),h.done=!0,h.errors.length?h.callback(h.errors):h.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(h=>!h.done)}read(a,r,t){let e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!a.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:a,ns:r,fcName:t,tried:e,wait:i,callback:s});return}this.readingCalls++;const f=(p,S)=>{if(this.readingCalls--,this.waitingReads.length>0){const b=this.waitingReads.shift();this.read(b.lng,b.ns,b.fcName,b.tried,b.wait,b.callback)}if(p&&S&&e{this.read.call(this,a,r,t,e+1,i*2,s)},i);return}s(p,S)},h=this.backend[t].bind(this.backend);if(h.length===2){try{const p=h(a,r);p&&typeof p.then=="function"?p.then(S=>f(null,S)).catch(f):f(null,p)}catch(p){f(p)}return}return h(a,r,f)}prepareLoading(a,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},e=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),e&&e();Ht(a)&&(a=this.languageUtils.toResolveHierarchy(a)),Ht(r)&&(r=[r]);const i=this.queueLoad(a,r,t,e);if(!i.toLoad.length)return i.pending.length||e(),null;i.toLoad.forEach(s=>{this.loadOne(s)})}load(a,r,t){this.prepareLoading(a,r,{},t)}reload(a,r,t){this.prepareLoading(a,r,{reload:!0},t)}loadOne(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const t=a.split("|"),e=t[0],i=t[1];this.read(e,i,"read",void 0,void 0,(s,f)=>{s&&this.logger.warn(`${r}loading namespace ${i} for language ${e} failed`,s),!s&&f&&this.logger.log(`${r}loaded namespace ${i} for language ${e}`,f),this.loaded(a,s,f)})}saveMissing(a,r,t,e,i){var h,p,S,b,A;let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},f=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((p=(h=this.services)==null?void 0:h.utils)!=null&&p.hasLoadedNamespace&&!((b=(S=this.services)==null?void 0:S.utils)!=null&&b.hasLoadedNamespace(r))){this.logger.warn(`did not save key "${t}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(t==null||t==="")){if((A=this.backend)!=null&&A.create){const R={...s,isUpdate:i},D=this.backend.create.bind(this.backend);if(D.length<6)try{let I;D.length===5?I=D(a,r,t,e,R):I=D(a,r,t,e),I&&typeof I.then=="function"?I.then(O=>f(null,O)).catch(f):f(null,I)}catch(I){f(I)}else D(a,r,t,e,f,R)}!a||!a[0]||this.store.addResource(a[0],r,t,e)}}}const Fm=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let a={};if(typeof n[1]=="object"&&(a=n[1]),Ht(n[1])&&(a.defaultValue=n[1]),Ht(n[2])&&(a.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const r=n[3]||n[2];Object.keys(r).forEach(t=>{a[t]=r[t]})}return a},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Mm=n=>{var a,r;return Ht(n.ns)&&(n.ns=[n.ns]),Ht(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),Ht(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((r=(a=n.supportedLngs)==null?void 0:a.indexOf)==null?void 0:r.call(a,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},ch=()=>{},v_=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(r=>{typeof n[r]=="function"&&(n[r]=n[r].bind(n))})};class Ec extends N0{constructor(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Mm(a),this.services={},this.logger=Va,this.modules={external:[]},v_(this),r&&!this.isInitialized&&!a.isClone){if(!this.options.initAsync)return this.init(a,r),this;setTimeout(()=>{this.init(a,r)},0)}}init(){var a=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof r=="function"&&(t=r,r={}),r.defaultNS==null&&r.ns&&(Ht(r.ns)?r.defaultNS=r.ns:r.ns.indexOf("translation")<0&&(r.defaultNS=r.ns[0]));const e=Fm();this.options={...e,...this.options,...Mm(r)},this.options.interpolation={...e.interpolation,...this.options.interpolation},r.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=r.keySeparator),r.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=r.nsSeparator);const i=S=>S?typeof S=="function"?new S:S:null;if(!this.options.isClone){this.modules.logger?Va.init(i(this.modules.logger),this.options):Va.init(null,this.options);let S;this.modules.formatter?S=this.modules.formatter:S=c_;const b=new Dm(this.options);this.store=new km(this.options.resources,this.options);const A=this.services;A.logger=Va,A.resourceStore=this.store,A.languageUtils=b,A.pluralResolver=new l_(b,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),S&&(!this.options.interpolation.format||this.options.interpolation.format===e.interpolation.format)&&(A.formatter=i(S),A.formatter.init(A,this.options),this.options.interpolation.format=A.formatter.format.bind(A.formatter)),A.interpolator=new u_(this.options),A.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},A.backendConnector=new h_(i(this.modules.backend),A.resourceStore,A,this.options),A.backendConnector.on("*",function(R){for(var D=arguments.length,I=new Array(D>1?D-1:0),O=1;O1?D-1:0),O=1;O{R.init&&R.init(this)})}if(this.format=this.options.interpolation.format,t||(t=ch),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const S=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);S.length>0&&S[0]!=="dev"&&(this.options.lng=S[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(S=>{this[S]=function(){return a.store[S](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(S=>{this[S]=function(){return a.store[S](...arguments),a}});const h=ac(),p=()=>{const S=(b,A)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),h.resolve(A),t(b,A)};if(this.languages&&!this.isInitialized)return S(null,this.t.bind(this));this.changeLanguage(this.options.lng,S)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),h}loadResources(a){var i,s;let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ch;const e=Ht(a)?a:this.language;if(typeof a=="function"&&(t=a),!this.options.resources||this.options.partialBundledLanguages){if((e==null?void 0:e.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return t();const f=[],h=p=>{if(!p||p==="cimode")return;this.services.languageUtils.toResolveHierarchy(p).forEach(b=>{b!=="cimode"&&f.indexOf(b)<0&&f.push(b)})};e?h(e):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(S=>h(S)),(s=(i=this.options.preload)==null?void 0:i.forEach)==null||s.call(i,p=>h(p)),this.services.backendConnector.load(f,this.options.ns,p=>{!p&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),t(p)})}else t(null)}reloadResources(a,r,t){const e=ac();return typeof a=="function"&&(t=a,a=void 0),typeof r=="function"&&(t=r,r=void 0),a||(a=this.languages),r||(r=this.options.ns),t||(t=ch),this.services.backendConnector.reload(a,r,i=>{e.resolve(),t(i)}),e}use(a){if(!a)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!a.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return a.type==="backend"&&(this.modules.backend=a),(a.type==="logger"||a.log&&a.warn&&a.error)&&(this.modules.logger=a),a.type==="languageDetector"&&(this.modules.languageDetector=a),a.type==="i18nFormat"&&(this.modules.i18nFormat=a),a.type==="postProcessor"&&Tx.addPostProcessor(a),a.type==="formatter"&&(this.modules.formatter=a),a.type==="3rdParty"&&this.modules.external.push(a),this}setResolvedLanguage(a){if(!(!a||!this.languages)&&!(["cimode","dev"].indexOf(a)>-1))for(let r=0;r-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(a,r){var t=this;this.isLanguageChangingTo=a;const e=ac();this.emit("languageChanging",a);const i=h=>{this.language=h,this.languages=this.services.languageUtils.toResolveHierarchy(h),this.resolvedLanguage=void 0,this.setResolvedLanguage(h)},s=(h,p)=>{p?(i(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,e.resolve(function(){return t.t(...arguments)}),r&&r(h,function(){return t.t(...arguments)})},f=h=>{var S,b;!a&&!h&&this.services.languageDetector&&(h=[]);const p=Ht(h)?h:this.services.languageUtils.getBestMatchFromCodes(h);p&&(this.language||i(p),this.translator.language||this.translator.changeLanguage(p),(b=(S=this.services.languageDetector)==null?void 0:S.cacheUserLanguage)==null||b.call(S,p)),this.loadResources(p,A=>{s(A,p)})};return!a&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!a&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(a),e}getFixedT(a,r,t){var e=this;const i=function(s,f){let h;if(typeof f!="object"){for(var p=arguments.length,S=new Array(p>2?p-2:0),b=2;b`${h.keyPrefix}${A}${D}`):R=h.keyPrefix?`${h.keyPrefix}${A}${s}`:s,e.t(R,h)};return Ht(a)?i.lng=a:i.lngs=a,i.ns=r,i.keyPrefix=t,i}t(){var e;for(var a=arguments.length,r=new Array(a),t=0;t1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const t=r.lng||this.resolvedLanguage||this.languages[0],e=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(t.toLowerCase()==="cimode")return!0;const s=(f,h)=>{const p=this.services.backendConnector.state[`${f}|${h}`];return p===-1||p===0||p===2};if(r.precheck){const f=r.precheck(this,s);if(f!==void 0)return f}return!!(this.hasResourceBundle(t,a)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(t,a)&&(!e||s(i,a)))}loadNamespaces(a,r){const t=ac();return this.options.ns?(Ht(a)&&(a=[a]),a.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{t.resolve(),r&&r(e)}),t):(r&&r(),Promise.resolve())}loadLanguages(a,r){const t=ac();Ht(a)&&(a=[a]);const e=this.options.preload||[],i=a.filter(s=>e.indexOf(s)<0&&this.services.languageUtils.isSupportedCode(s));return i.length?(this.options.preload=e.concat(i),this.loadResources(s=>{t.resolve(),r&&r(s)}),t):(r&&r(),Promise.resolve())}dir(a){var e,i;if(a||(a=this.resolvedLanguage||(((e=this.languages)==null?void 0:e.length)>0?this.languages[0]:this.language)),!a)return"rtl";const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],t=((i=this.services)==null?void 0:i.languageUtils)||new Dm(Fm());return r.indexOf(t.getLanguagePartFromCode(a))>-1||a.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new Ec(a,r)}cloneInstance(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ch;const t=a.forkResourceStore;t&&delete a.forkResourceStore;const e={...this.options,...a,isClone:!0},i=new Ec(e);if((a.debug!==void 0||a.prefix!==void 0)&&(i.logger=i.logger.clone(a)),["store","services","language"].forEach(f=>{i[f]=this[f]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},t){const f=Object.keys(this.store.data).reduce((h,p)=>(h[p]={...this.store.data[p]},Object.keys(h[p]).reduce((S,b)=>(S[b]={...h[p][b]},S),{})),{});i.store=new km(f,e),i.services.resourceStore=i.store}return i.translator=new p0(i.services,e),i.translator.on("*",function(f){for(var h=arguments.length,p=new Array(h>1?h-1:0),S=1;S{var i,s,f,h;const e=[r,{code:a,...t||{}}];if((s=(i=n==null?void 0:n.services)==null?void 0:i.logger)!=null&&s.forward)return n.services.logger.forward(e,"warn","react-i18next::",!0);fl(e[0])&&(e[0]=`react-i18next:: ${e[0]}`),(h=(f=n==null?void 0:n.services)==null?void 0:f.logger)!=null&&h.warn?n.services.logger.warn(...e):console!=null&&console.warn&&console.warn(...e)},Bm={},Op=(n,a,r,t)=>{fl(r)&&Bm[r]||(fl(r)&&(Bm[r]=new Date),g_(n,a,r,t))},Cx=(n,a)=>()=>{if(n.isInitialized)a();else{const r=()=>{setTimeout(()=>{n.off("initialized",r)},0),a()};n.on("initialized",r)}},Fp=(n,a,r)=>{n.loadNamespaces(a,Cx(n,r))},Nm=(n,a,r,t)=>{if(fl(r)&&(r=[r]),n.options.preload&&n.options.preload.indexOf(a)>-1)return Fp(n,r,t);r.forEach(e=>{n.options.ns.indexOf(e)<0&&n.options.ns.push(e)}),n.loadLanguages(a,Cx(n,t))},m_=(n,a,r={})=>!a.languages||!a.languages.length?(Op(a,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:a.languages}),!0):a.hasLoadedNamespace(n,{lng:r.lng,precheck:(t,e)=>{var i;if(((i=r.bindI18n)==null?void 0:i.indexOf("languageChanging"))>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!e(t.isLanguageChangingTo,n))return!1}}),fl=n=>typeof n=="string",y_=n=>typeof n=="object"&&n!==null,x_=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,E_={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},S_=n=>E_[n],__=n=>n.replace(x_,S_);let Mp={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:__};const b_=(n={})=>{Mp={...Mp,...n}},T_=()=>Mp;let wx;const C_=n=>{wx=n},w_=()=>wx,hP={type:"3rdParty",init(n){b_(n.options.react),C_(n)}},A_=Ce.createContext();class k_{constructor(){this.usedNamespaces={}}addUsedNamespaces(a){a.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const L_=(n,a)=>{const r=Ce.useRef();return Ce.useEffect(()=>{r.current=n},[n,a]),r.current},Ax=(n,a,r,t)=>n.getFixedT(a,r,t),R_=(n,a,r,t)=>Ce.useCallback(Ax(n,a,r,t),[n,a,r,t]),vP=(n,a={})=>{var z,Z,H,ee;const{i18n:r}=a,{i18n:t,defaultNS:e}=Ce.useContext(A_)||{},i=r||t||w_();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new k_),!i){Op(i,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const te=(ne,oe)=>fl(oe)?oe:y_(oe)&&fl(oe.defaultValue)?oe.defaultValue:Array.isArray(ne)?ne[ne.length-1]:ne,fe=[te,{},!1];return fe.t=te,fe.i18n={},fe.ready=!1,fe}(z=i.options.react)!=null&&z.wait&&Op(i,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...T_(),...i.options.react,...a},{useSuspense:f,keyPrefix:h}=s;let p=e||((Z=i.options)==null?void 0:Z.defaultNS);p=fl(p)?[p]:p||["translation"],(ee=(H=i.reportNamespaces).addUsedNamespaces)==null||ee.call(H,p);const S=(i.isInitialized||i.initializedStoreOnce)&&p.every(te=>m_(te,i,s)),b=R_(i,a.lng||null,s.nsMode==="fallback"?p:p[0],h),A=()=>b,R=()=>Ax(i,a.lng||null,s.nsMode==="fallback"?p:p[0],h),[D,I]=Ce.useState(A);let O=p.join();a.lng&&(O=`${a.lng}${O}`);const V=L_(O),N=Ce.useRef(!0);Ce.useEffect(()=>{const{bindI18n:te,bindI18nStore:fe}=s;N.current=!0,!S&&!f&&(a.lng?Nm(i,a.lng,p,()=>{N.current&&I(R)}):Fp(i,p,()=>{N.current&&I(R)})),S&&V&&V!==O&&N.current&&I(R);const ne=()=>{N.current&&I(R)};return te&&(i==null||i.on(te,ne)),fe&&(i==null||i.store.on(fe,ne)),()=>{N.current=!1,i&&(te==null||te.split(" ").forEach(oe=>i.off(oe,ne))),fe&&i&&fe.split(" ").forEach(oe=>i.store.off(oe,ne))}},[i,O]),Ce.useEffect(()=>{N.current&&S&&I(A)},[i,h,S]);const G=[D,i,S];if(G.t=D,G.i18n=i,G.ready=S,S||!S&&!f)return G;throw new Promise(te=>{a.lng?Nm(i,a.lng,p,()=>te()):Fp(i,p,()=>te())})},{slice:D_,forEach:P_}=[];function I_(n){return P_.call(D_.call(arguments,1),a=>{if(a)for(const r in a)n[r]===void 0&&(n[r]=a[r])}),n}const Um=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,O_=function(n,a){const t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},e=encodeURIComponent(a);let i=`${n}=${e}`;if(t.maxAge>0){const s=t.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(s)}`}if(t.domain){if(!Um.test(t.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${t.domain}`}if(t.path){if(!Um.test(t.path))throw new TypeError("option path is invalid");i+=`; Path=${t.path}`}if(t.expires){if(typeof t.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${t.expires.toUTCString()}`}if(t.httpOnly&&(i+="; HttpOnly"),t.secure&&(i+="; Secure"),t.sameSite)switch(typeof t.sameSite=="string"?t.sameSite.toLowerCase():t.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},Hm={create(n,a,r,t){let e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(e.expires=new Date,e.expires.setTime(e.expires.getTime()+r*60*1e3)),t&&(e.domain=t),document.cookie=O_(n,encodeURIComponent(a),e)},read(n){const a=`${n}=`,r=document.cookie.split(";");for(let t=0;t-1&&(e=window.location.hash.substring(window.location.hash.indexOf("?")));const s=e.substring(1).split("&");for(let f=0;f0&&s[f].substring(0,h)===a&&(r=s[f].substring(h+1))}}return r}};let wu=null;const Vm=()=>{if(wu!==null)return wu;try{if(wu=typeof window<"u"&&window.localStorage!==null,!wu)return!1;const n="i18next.translate.boo";window.localStorage.setItem(n,"foo"),window.localStorage.removeItem(n)}catch{wu=!1}return wu};var B_={name:"localStorage",lookup(n){let{lookupLocalStorage:a}=n;if(a&&Vm())return window.localStorage.getItem(a)||void 0},cacheUserLanguage(n,a){let{lookupLocalStorage:r}=a;r&&Vm()&&window.localStorage.setItem(r,n)}};let Au=null;const jm=()=>{if(Au!==null)return Au;try{if(Au=typeof window<"u"&&window.sessionStorage!==null,!Au)return!1;const n="i18next.translate.boo";window.sessionStorage.setItem(n,"foo"),window.sessionStorage.removeItem(n)}catch{Au=!1}return Au};var N_={name:"sessionStorage",lookup(n){let{lookupSessionStorage:a}=n;if(a&&jm())return window.sessionStorage.getItem(a)||void 0},cacheUserLanguage(n,a){let{lookupSessionStorage:r}=a;r&&jm()&&window.sessionStorage.setItem(r,n)}},U_={name:"navigator",lookup(n){const a=[];if(typeof navigator<"u"){const{languages:r,userLanguage:t,language:e}=navigator;if(r)for(let i=0;i0?a:void 0}},H_={name:"htmlTag",lookup(n){let{htmlTag:a}=n,r;const t=a||(typeof document<"u"?document.documentElement:null);return t&&typeof t.getAttribute=="function"&&(r=t.getAttribute("lang")),r}},V_={name:"path",lookup(n){var e;let{lookupFromPathIndex:a}=n;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?(e=r[typeof a=="number"?a:0])==null?void 0:e.replace("/",""):void 0}},j_={name:"subdomain",lookup(n){var e,i;let{lookupFromSubdomainIndex:a}=n;const r=typeof a=="number"?a+1:1,t=typeof window<"u"&&((i=(e=window.location)==null?void 0:e.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(t)return t[r]}};let kx=!1;try{document.cookie,kx=!0}catch{}const Lx=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];kx||Lx.splice(1,1);const G_=()=>({order:Lx,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:n=>n});class z_{constructor(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(a,r)}init(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=a,this.options=I_(r,this.options||{},G_()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=e=>e.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=t,this.addDetector(F_),this.addDetector(M_),this.addDetector(B_),this.addDetector(N_),this.addDetector(U_),this.addDetector(H_),this.addDetector(V_),this.addDetector(j_)}addDetector(a){return this.detectors[a.name]=a,this}detect(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return a.forEach(t=>{if(this.detectors[t]){let e=this.detectors[t].lookup(this.options);e&&typeof e=="string"&&(e=[e]),e&&(r=r.concat(e))}}),r=r.map(t=>this.options.convertDetectedLanguage(t)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(a)>-1||r.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(a,this.options)}))}}z_.type="languageDetector";function Yu(n,a){if(!n)return a;let r;return typeof n=="function"?r=n():"current"in n?r=n.current:r=n,r}const W_="click";function $_(n,a,r=W_){const t=Ce.useRef(a);t.current=a,Ce.useEffect(()=>{const e=i=>{(Array.isArray(n)?n:[n]).some(f=>{const h=Yu(f);return!h||(h==null?void 0:h.contains(i.target))})||t.current(i)};return document.addEventListener(r,e),()=>{document.removeEventListener(r,e)}},[n,r])}function K_(){}const Y_=Object.assign,U0=typeof window<"u";function po(n){return n!=null}function g0(n){return typeof n=="function"}function X_(n){return Rx(n)&&g0(n.then)&&g0(n.catch)}function Rx(n){return n!==null&&typeof n=="object"}function q_(n,a,r){return a.reduce((t,e)=>(t[e]=n[e],t),{})}function Bp(n,a){return a?typeof a=="string"?` ${n}--${a}`:Array.isArray(a)?a.reduce((r,t)=>r+Bp(n,t),""):Object.keys(a).reduce((r,t)=>r+(a[t]?Bp(n,t):""),""):""}function Z_(n){return(a,r)=>(a&&typeof a!="string"&&(r=a,a=""),a=a?`${n}__${a}`:n,`${a}${Bp(a,r)}`)}function xo(n,a){return n=`rv-${n}`,[Z_(n),n]}function Q_(n){n.stopPropagation()}function J_(n,a){(typeof n.cancelable!="boolean"||n.cancelable)&&n.preventDefault(),Q_(n)}const eb={click:"onClick"};function Dx(n,a){const r=Object.assign({},a.props);for(const t of n){const e=eb[t];r[e]=function(i){var s,f;i.stopPropagation(),(f=(s=a.props)[e])===null||f===void 0||f.call(s,i)}}return Kn.cloneElement(a,r)}function tb(n){return/^\d+(\.\d+)?$/.test(n)}function cs(n){if(po(n))return n=String(n),tb(n)?`${n}px`:n}function Px(n){if(po(n)){const a=cs(n);return{width:a,height:a}}return{}}function rb(n){return n.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,"")}let Ix=!1;if(U0)try{const n={};Object.defineProperty(n,"passive",{get(){Ix=!0}}),window.addEventListener("test-passive",null,n)}catch{}function Ox(n,a,r={}){if(!U0)return;const{target:t=window,passive:e=!1,capture:i=!1,depends:s=[]}=r;let f;const h=()=>{const S=Yu(t);S&&!f&&(S.addEventListener(n,a,Ix?{capture:i,passive:e}:i),f=!0)},p=()=>{const S=Yu(t);S&&f&&(S.removeEventListener(n,a,i),f=!1)};Ce.useEffect(()=>(h(),()=>p()),[t,...s])}function nb(n){const[a,r]=Ce.useState(n),t=Ce.useRef(a),e=Ce.useCallback(i=>{r(s=>t.current=g0(i)?i(s):i)},[a]);return[a,e,t]}const ib=()=>{const n=Ce.useRef(!1);return Ce.useEffect(()=>(n.current=!1,()=>{n.current=!0}),[]),n},ab=(n={})=>{const a=ib(),[r,t,e]=nb(n),i=Ce.useCallback(s=>{a.current||t(f=>Object.assign(Object.assign({},f),g0(s)?s(f):s))},[]);return[r,i,e]};function sb(n){const a=Ce.useRef(n);return a.current=n,a}const ob=n=>{const a=sb(n);Ce.useEffect(()=>()=>{a.current()},[])};function Gm(n,a){if(n===a)return!0;for(let r=0;r(r,t,e)=>{const i=Ce.useRef(!1),s=Ce.useRef([]),f=Ce.useRef([]),h=Ce.useRef();n(()=>{var p;const b=(Array.isArray(e)?e:[e]).map(A=>Yu(A));if(!i.current){i.current=!0,s.current=b,f.current=t,h.current=r();return}(b.length!==s.current.length||!Gm(b,s.current)||!Gm(t,f.current))&&((p=h.current)===null||p===void 0||p.call(h),s.current=b,f.current=t,h.current=r())}),ob(()=>{var p;(p=h.current)===null||p===void 0||p.call(h),i.current=!1})},ub=lb(Ce.useEffect);function fb(n,a){const[r,t]=Ce.useState(),[e,i]=Ce.useState();return ub(()=>{const s=Yu(n);if(!s)return;const f=new IntersectionObserver(h=>{for(const p of h)i(p.intersectionRatio),t(p.isIntersecting)},Object.assign(Object.assign({},a),{root:Yu(a==null?void 0:a.root)}));return f.observe(s),()=>{f.disconnect()}},[],n),[r,e]}const zm=10;function cb(n,a){return n>a&&n>zm?"horizontal":a>n&&a>zm?"vertical":""}function db(){const n=Ce.useRef(0),a=Ce.useRef(0),r=Ce.useRef(0),t=Ce.useRef(0),e=Ce.useRef(0),i=Ce.useRef(0),s=Ce.useRef(""),f=Ce.useRef(null),h=()=>s.current==="vertical",p=()=>s.current==="horizontal",S=()=>{r.current=0,t.current=0,e.current=0,i.current=0,s.current="",f.current=null};return{move:R=>{const D=R.touches[0];r.current=D.clientX<0?0:D.clientX-n.current,t.current=D.clientY-a.current,e.current=Math.abs(r.current),i.current=Math.abs(t.current),f.current===null?f.current=!0:f.current=!1,s.current||(s.current=cb(e.current,i.current))},start:R=>{S(),n.current=R.touches[0].clientX,a.current=R.touches[0].clientY},reset:S,startX:n,startY:a,deltaX:r,deltaY:t,offsetX:e,offsetY:i,direction:s,isVertical:h,isHorizontal:p,firstMove:f}}const Wm=/scroll|auto/i,hb=U0?window:void 0;function vb(n){return n.tagName!=="HTML"&&n.tagName!=="BODY"&&n.nodeType===1}function pb(n,a=hb){a===void 0&&(a=window);let r=n;for(;r&&r!==a&&vb(r);){const{overflowY:t}=window.getComputedStyle(r);if(Wm.test(t)){if(r.tagName!=="BODY")return r;const e=window.getComputedStyle(r.parentNode).overflowY;if(Wm.test(e))return r}r=r.parentNode}return a}const $m=U0?Kn.useLayoutEffect:Kn.useEffect,gb=()=>{const[,n]=Ce.useState({});return Ce.useCallback(()=>n({}),[])};function mb(n){const a=Ce.useRef(n);a.current=Ce.useMemo(()=>n,[n]);const r=Ce.useRef();return r.current||(r.current=function(...t){return a.current.apply(this,t)}),r.current}function yb(n){const{value:a,defaultValue:r,onChange:t}=n,e=gb(),i=Ce.useRef(a!==void 0?a:r);a!==void 0&&(i.current=a);const s=mb((f,h)=>{const p=typeof f=="function"?f(i.current):f;!h&&p===i.current||(i.current=p,e(),t==null||t(p))});return[i.current,s]}var Np=function(){return Np=Object.assign||function(a){for(var r,t=1,e=arguments.length;t0&&i[i.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]Ct.jsx(Ct.Fragment,{children:Array(12).fill(null).map((a,r)=>Ct.jsx("i",{className:hr(n("line",String(r+1)))},r))}),Eb=({bem:n})=>Ct.jsx("svg",Object.assign({className:hr(n("circular")),viewBox:"25 25 50 50"},{children:Ct.jsx("circle",{cx:"50",cy:"50",r:"20",fill:"none"})})),Sb=({bem:n})=>Ct.jsxs("div",Object.assign({className:hr(n("ball"))},{children:[Ct.jsx("div",{}),Ct.jsx("div",{}),Ct.jsx("div",{})]})),_b=n=>({spinner:Ct.jsx(xb,{bem:n}),circular:Ct.jsx(Eb,{bem:n}),ball:Ct.jsx(Sb,{bem:n})}),[dh]=xo("loading"),pP=n=>{const{className:a,type:r="circular",vertical:t,color:e,size:i,textColor:s,children:f,textSize:h}=n,p=Ce.useMemo(()=>Object.assign({color:e},Px(i)),[e,i]),S=()=>f?Ct.jsx("span",Object.assign({className:hr(dh("text")),style:{fontSize:cs(h),color:s??e}},{children:f})):null;return Ct.jsxs("div",Object.assign({className:hr(a,dh([r,{vertical:t}])),style:n.style},{children:[Ct.jsx("span",Object.assign({className:hr(dh("spinner",r)),style:p},{children:_b(dh)[r]})),S()]}))},bb="rv-hairline",Tb=`${bb}--bottom`,Cb="__REACT_VANT_COMPONENT";function Qu(...n){const a=Object.assign({},n[0]);return n.forEach(r=>{for(const t in r){const e=r[t];a[t]=a.hasOwnProperty(t)?a[t]:e}}),a}var wb=function(n,a){var r={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&a.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,t=Object.getOwnPropertySymbols(n);e{const{name:r="",className:t,style:e,spin:i,rotate:s,tabIndex:f,onClick:h,children:p}=n,S=wb(n,["name","className","style","spin","rotate","tabIndex","onClick","children"]),b={};s&&(b.msTransform=`rotate(${s}deg)`,b.transform=`rotate(${s}deg)`);const A=r?Ab(r):void 0;let R=f;R===void 0&&h&&(R=-1);const D=Object.assign({role:"img","aria-label":A,focusable:"false","data-icon":A,"aria-hidden":"true",preserveAspectRatio:"xMidYMid meet",ref:a,tabIndex:R,onClick:h,className:["rv-icon",A?`rv-icon-${A}`:"",i?"rv-icon--spin":"",t].join(" ").trim(),style:Object.assign(Object.assign({},e),b)},S);return Kn.cloneElement(p,D)}),kb=n=>Ce.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"},n),Ce.createElement("path",{d:"M560.149 501.223l255.344 255.344c16.272 16.272 16.272 42.654 0 58.926s-42.654 16.272-58.926 0L501.223 560.149 245.88 815.493c-16.272 16.272-42.654 16.272-58.925 0-16.272-16.272-16.272-42.654 0-58.926l255.344-255.344L186.954 245.88c-16.272-16.272-16.272-42.654 0-58.925 16.271-16.272 42.653-16.272 58.925 0l255.344 255.344 255.344-255.344c16.272-16.272 42.654-16.272 58.926 0 16.272 16.271 16.272 42.653 0 58.925L560.149 501.223z",fillRule:"nonzero"})),Lb=Ce.forwardRef((n,a)=>Ce.createElement(gg,Object.assign({name:"SvgCross"},n,{ref:a}),Ce.createElement(kb,null))),Rb=n=>Ce.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"},n),Ce.createElement("path",{d:"M389.334 167l-18.5 55.556H111.556v388.889l71.833-71.833c20.051-20.052 51.558-21.594 73.372-4.628l5.24 4.628 71.777 71.833 102.89-123.5L556 667l-55.556 166.667h-388.89c-28.476 0-51.97-21.46-55.181-49.08L56 778.112V222.556c0-28.528 21.46-51.978 49.08-55.183l6.476-.373h277.778zm500 0c28.528 0 51.978 21.412 55.183 49.07l.373 6.486v555.556c0 28.476-21.412 51.97-49.07 55.182l-6.486.374H611.556L667.112 667 498.389 413.889l71.112-85.278c20.533-24.681 57.182-26.569 80.135-5.481l4.698 4.87 235 274.167V222.556H481.945l18.5-55.556h388.89zM306.028 278.089c15.508 0 30.03 4.243 42.47 11.63l-14.72 43.948 45.282 67.904c-14.188 25.737-41.585 43.185-73.032 43.185-46 0-83.333-37.333-83.333-83.334 0-46 37.333-83.333 83.333-83.333z",fillRule:"evenodd"})),Db=Ce.forwardRef((n,a)=>Ce.createElement(gg,Object.assign({name:"SvgPhotoFail"},n,{ref:a}),Ce.createElement(Rb,null))),Pb=n=>Ce.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"},n),Ce.createElement("path",{d:"M305.583 277.756c-46 0-83.333 37.333-83.333 83.333s37.333 83.333 83.333 83.333 83.334-37.333 83.334-83.333-37.334-83.333-83.334-83.333m348.306 49.91c-22.333-26.11-62.833-25.833-84.833.612L333.333 611.11l-71.777-71.833c-21.723-21.722-56.89-21.722-78.612 0l-71.833 71.833V222.222H888.89v379.611l-235-274.166zm235-161H111.11c-30.667 0-55.555 24.834-55.555 55.556v555.555c0 30.667 24.888 55.556 55.555 55.556H888.89c30.722 0 55.555-24.889 55.555-55.555V222.222c0-30.722-24.833-55.555-55.555-55.555z",fillRule:"evenodd"})),Bx=Ce.forwardRef((n,a)=>Ce.createElement(gg,Object.assign({name:"SvgPhoto"},n,{ref:a}),Ce.createElement(Pb,null)));function Up(){return Up=Object.assign?Object.assign.bind():function(n){for(var a=1;a{const a=Ce.useRef(null),r=Qu(n,{stopPropagation:["click"],lockScroll:!0,duration:300}),{visible:t,duration:e}=r,i=f=>{r.lockScroll&&J_(f)},s=()=>{const f=Object.assign(Object.assign({zIndex:r.zIndex!==void 0?+r.zIndex:void 0,touchAction:r.lockScroll&&"none"},r.style),r.customStyle);return po(e)&&(f.animationDuration=`${e}ms`),Dx(r.stopPropagation,Ct.jsx("div",Object.assign({ref:a,style:f,onClick:h=>{var p;h.target===h.currentTarget&&((p=r.onClick)===null||p===void 0||p.call(r,h))},className:hr(Nb(),r.className)},{children:r.children})))};return Ox("touchmove",i,{target:a}),Ct.jsx(V0,Object.assign({nodeRef:a,mountOnEnter:!0,unmountOnExit:!0,in:t,timeout:e,classNames:"rv-fade"},{children:s()}))};function Hb(n){const{interceptor:a,args:r,done:t,canceled:e}=n;if(a){const i=a.apply(null,r||[]);X_(i)?i.then(s=>{s?t():e&&e()}).catch(K_):i?t():e&&e()}else t()}function Vb(n){return(typeof n=="function"?n():n)||document.body}function Vx(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function jb(n,a){if(Vx()&&n){const r=Vb(n);return mg.createPortal(a,r)}return a}const Gb=Ce.createContext({});let jx=!1;if(Vx())try{const n={};Object.defineProperty(n,"passive",{get(){jx=!0}}),window.addEventListener("test-passive",null,n)}catch{}let sc=0;const Xm="rv-overflow-hidden";function zb(n,a){const r=db(),t=s=>{r.move(s);const f=r.deltaY.current>0?"10":"01",h=pb(s.target,n.current);if(!h)return;const{scrollHeight:p,offsetHeight:S,scrollTop:b}=h;let A="11";b===0?A=S>=p?"00":"01":b+S>=p&&(A="10"),A!=="11"&&r.isVertical()&&!(parseInt(A,2)&parseInt(f,2))&&s.cancelable&&s.preventDefault()},e=()=>{document.addEventListener("touchstart",r.start),document.addEventListener("touchmove",t,jx?{passive:!1}:!1),sc||document.body.classList.add(Xm),sc++},i=()=>{sc&&(document.removeEventListener("touchstart",r.start),document.removeEventListener("touchmove",t),sc--,sc||document.body.classList.remove(Xm))};Ce.useEffect(()=>{if(a)return e(),()=>{i()}},[a])}let qm=2e3;const[hh]=xo("popup"),Wb=Ce.forwardRef((n,a)=>{var r;const t=Qu(n,{duration:300,overlay:!0,lockScroll:!0,position:"center",closeIcon:Ct.jsx(Lb,{}),closeIconPosition:"top-right",closeOnClickOverlay:!0,stopPropagation:["click"],teleport:()=>document.body}),{round:e,closeable:i,title:s,description:f,children:h,duration:p,closeIcon:S,position:b}=t,A=Ce.useRef(!1),R=Ce.useRef((r=t.zIndex)!==null&&r!==void 0?r:qm),D=Ce.useRef(),[I,O]=Ce.useState(t.visible),[V,N]=Ce.useState(I),G=Ce.useMemo(()=>{const Q=Object.assign({zIndex:R.current},t.style);if(po(t.duration)){const be=t.position==="center"?"animationDuration":"transitionDuration";Q[be]=`${t.duration}ms`}return Q},[R.current,t.position,t.style,t.duration]),z=()=>{var Q;t.zIndex!==void 0?R.current=+t.zIndex:R.current=qm++,A.current=!0,(Q=t.onOpen)===null||Q===void 0||Q.call(t)},Z=()=>{Hb({interceptor:t.beforeClose,args:["close"],done:()=>{var Q;A.current=!1,(Q=t.onClose)===null||Q===void 0||Q.call(t)}})},H=Q=>{var be;(be=t.onClickOverlay)===null||be===void 0||be.call(t,Q),t.closeOnClickOverlay&&Z()},ee=()=>t.overlay?Ct.jsx(Ub,{visible:I,className:t.overlayClass,customStyle:t.overlayStyle,zIndex:R.current,duration:p,onClick:H}):null,te=Q=>{t.onClickCloseIcon&&t.onClickCloseIcon(Q),Z()},fe=()=>{if(i){const{closeIconPosition:Q}=t;return S?Ct.jsx("div",Object.assign({className:hr(hh("close-icon",Q)),onClick:te},{children:S})):null}return null},ne=()=>s?Ct.jsx("div",Object.assign({className:hr(hh("title"))},{children:s})):null,oe=()=>f?Ct.jsx("div",Object.assign({className:hr(hh("description"))},{children:f})):null,Y=()=>{const{safeAreaInsetBottom:Q}=t;return Dx(t.stopPropagation,Ct.jsxs("div",Object.assign({ref:D,style:Object.assign(Object.assign({},G),{display:!I&&!V?"none":void 0}),className:hr(hh({round:e,[b]:b}),{"rv-safe-area-bottom":Q},t.className),onClick:t.onClick},{children:[ne(),oe(),h,fe()]})))},q=()=>{const{transition:Q,destroyOnClose:be,forceRender:ge}=t,ve=b==="center"?"rv-fade":`rv-popup-slide-${b}`;return Ct.jsx(V0,Object.assign({in:I,nodeRef:D,timeout:p,classNames:Q||ve,mountOnEnter:!ge,unmountOnExit:be,onEnter:z,onEntered:t.onOpened,onExited:()=>{var re;N(!1),(re=t.onClosed)===null||re===void 0||re.call(t)}},{children:Y()}))};return Ox("popstate",()=>{t.closeOnPopstate&&Z()}),$m(()=>{I&&N(!0)},[I]),$m(()=>{O(t.visible)},[t.visible]),zb(D,I&&t.lockScroll),Ce.useImperativeHandle(a,()=>({popupRef:D})),jb(t.teleport,Ct.jsxs(Gb.Provider,Object.assign({value:{visible:I}},{children:[ee(),q()]})))});function $b(n,a,r){const t=a[r];po(t)&&(!Object.prototype.hasOwnProperty.call(n,r)||!Rx(t)?n[r]=t:n[r]=Gx(Object(n[r]),a[r]))}function Gx(n,a){return Object.keys(a).forEach(r=>{$b(n,a,r)}),n}const Kb={name:"姓名",tel:"电话",save:"保存",confirm:"确认",cancel:"取消",delete:"删除",loading:"加载中...",noCoupon:"暂无优惠券",nameEmpty:"请填写姓名",telInvalid:"请填写正确的电话",vanCalendar:{end:"结束",start:"开始",title:"日期选择",confirm:"确定",startEnd:"开始/结束",weekdays:["日","一","二","三","四","五","六"],monthTitle:(n,a)=>`${n}年${a}月`,rangePrompt:n=>`最多选择 ${n} 天`},vanPicker:{select:"请选择"},vanContactCard:{addText:"添加联系人"},vanContactList:{addText:"新建联系人"},vanPagination:{prev:"上一页",next:"下一页"},vanPullRefresh:{pulling:"下拉即可刷新...",loosing:"释放即可刷新...",loading:"加载中..."},vanSubmitBar:{label:"合计:"},vanCoupon:{unlimited:"无使用门槛",discount:n=>`${n}折`,condition:n=>`满${n}元可用`},vanCouponCell:{title:"优惠券",count:n=>`${n}张可用`},vanCouponList:{exchange:"兑换",close:"不使用优惠券",enable:"可用",disabled:"不可用",placeholder:"请输入优惠码"},vanAddressEdit:{area:"地区",postal:"邮政编码",areaEmpty:"请选择地区",addressEmpty:"请填写详细地址",postalEmpty:"邮政编码不正确",defaultAddress:"设为默认收货地址"},vanAddressEditDetail:{label:"详细地址",placeholder:"街道门牌信息"},vanAddressList:{add:"新增地址"}},Yb=Gx(Kb,{}),zx={locale:Yb},Xb=Ce.createContext(zx),[Lu]=xo("image"),Zm=n=>{const[a,r]=ab({loading:!0,error:!1}),t=Ce.useRef(null),{fit:e,errorIcon:i,loadingIcon:s,showError:f,showLoading:h,block:p}=n,S=Ce.useMemo(()=>{const V=Object.assign({},n.style);return po(n.width)&&(V.width=cs(n.width)),po(n.height)&&(V.height=cs(n.height)),po(n.radius)&&(V.overflow="hidden",V.borderRadius=cs(n.radius)),V},[n.style,n.width,n.height,n.radius]);Ce.useEffect(()=>{const V={error:!1,loading:!0};t.current&&(t.current.complete?V.loading=!1:V.loading=!0),r(V)},[n.src]);const b=V=>{var N;r({loading:!1}),(N=n.onLoad)===null||N===void 0||N.call(n,V)},A=V=>{var N;r({error:!0,loading:!1}),(N=n.onLoad)===null||N===void 0||N.call(n,V)},R=()=>s?Kn.cloneElement(s,{className:hr(Lu("loading-icon")),fontSize:n.iconSize}):null,D=()=>i?Kn.cloneElement(i,{className:hr(Lu("error-icon")),fontSize:n.iconSize}):null,I=()=>a.loading&&h?Ct.jsx("div",Object.assign({className:hr(Lu("loading")),onClick:n.onClick},{children:R()})):a.error&&f?Ct.jsx("div",Object.assign({className:hr(Lu("error")),onClick:n.onClick},{children:D()})):null,O=()=>{if(a.error||!n.src)return null;const V={className:hr(Lu("img")),style:{objectFit:e}};return Ct.jsx("img",Object.assign({ref:t,alt:n.alt||"img",src:n.src,onLoad:b,onError:A},V))};return Ct.jsxs("div",Object.assign({className:hr(n.className,Lu({block:p,round:n.round})),style:S,onClick:n.onClick},{children:[O(),I(),n.children]}))},Qm="100%",qb="60%",[oc]=xo("skeleton"),Zb=n=>{var{children:a,className:r,style:t}=n,e=H0(n,["children","className","style"]);const i=Qu(e,{loading:!0,animate:!0,round:!0,row:3,avatarShape:"round",rowWidth:Qm}),s=b=>{const{rowWidth:A}=i;return A===Qm&&b===+i.row-1&&b!==0?qb:Array.isArray(A)?A[b]:A},f=b=>{const{rowHeight:A}=i;return Array.isArray(A)?A[b]:A},h=()=>i.avatar?Ct.jsx("div",{className:hr(oc("avatar",i.avatarShape)),style:Px(i.avatarSize)}):null,p=()=>{if(i.title){const b=cs(i.titleWidth),A=cs(f(0));return Ct.jsx("div",{className:hr(oc("title")),style:{width:b,height:A}})}return null},S=()=>Array(i.row).fill("").map((b,A)=>{const R=cs(s(A)),D=cs(f(A));return Ct.jsx("div",{className:hr(oc("row")),style:{width:R,height:D}},A)});return i.loading?Ct.jsxs("div",Object.assign({className:hr(r,oc({animate:i.animate,round:i.round})),style:t},{children:[h(),Ct.jsxs("div",Object.assign({className:hr(oc("content"))},{children:[p(),S()]}))]})):Ct.jsx(Ct.Fragment,{children:a})},[Qb]=xo("lazyload"),Jb=n=>{const a=Qu(n,{placeholder:Ct.jsx(Zb,{title:!0})}),r=Ce.useRef(),[t]=fb(r),{height:e,placeholder:i,children:s,className:f,style:h}=a;return t?Ct.jsx(Ct.Fragment,{children:s}):Ct.jsx("div",Object.assign({ref:r,className:hr(Qb(),f),style:Object.assign({height:e},h)},{children:i}))},Jm=n=>Ct.jsx("div",Object.assign({className:hr(n("loading"))},{children:Ct.jsx(Bx,{className:hr(n("loading-icon"))})})),[np]=xo("image"),eT=n=>{const a=Qu(n,{fit:"fill",errorIcon:Ct.jsx(Db,{}),loadingIcon:Ct.jsx(Bx,{}),showError:!0,showLoading:!0,block:!0}),{lazyload:r}=a,t=H0(a,["lazyload"]),e=()=>typeof r=="boolean"?Jm(np):r.placeholder||Jm(np);if(r){const{className:i,style:s,height:f,width:h}=t,p={className:hr(i,np({block:t.block})),style:Object.assign(Object.assign({},s),{height:f,width:h})};return Ct.jsx(Jb,Object.assign({},p,{placeholder:e()},{children:Ct.jsx(Zm,Object.assign({},t))}))}return Ct.jsx(Zm,Object.assign({},t))},tT=Symbol("image"),gP=Object.assign(eT,{[Cb]:tT});function ga(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var a=n.ownerDocument;return a&&a.defaultView||window}return n}function yg(n){var a=ga(n).Element;return n instanceof a||n instanceof Element}function va(n){var a=ga(n).HTMLElement;return n instanceof a||n instanceof HTMLElement}function Wx(n){if(typeof ShadowRoot>"u")return!1;var a=ga(n).ShadowRoot;return n instanceof a||n instanceof ShadowRoot}var Xu=Math.round;function jp(){var n=navigator.userAgentData;return n!=null&&n.brands?n.brands.map(function(a){return a.brand+"/"+a.version}).join(" "):navigator.userAgent}function rT(){return!/^((?!chrome|android).)*safari/i.test(jp())}function m0(n,a,r){a===void 0&&(a=!1),r===void 0&&(r=!1);var t=n.getBoundingClientRect(),e=1,i=1;a&&va(n)&&(e=n.offsetWidth>0&&Xu(t.width)/n.offsetWidth||1,i=n.offsetHeight>0&&Xu(t.height)/n.offsetHeight||1);var s=yg(n)?ga(n):window,f=s.visualViewport,h=!rT()&&r,p=(t.left+(h&&f?f.offsetLeft:0))/e,S=(t.top+(h&&f?f.offsetTop:0))/i,b=t.width/e,A=t.height/i;return{width:b,height:A,top:S,right:p+b,bottom:S+A,left:p,x:p,y:S}}function $x(n){var a=ga(n),r=a.pageXOffset,t=a.pageYOffset;return{scrollLeft:r,scrollTop:t}}function nT(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function iT(n){return n===ga(n)||!va(n)?$x(n):nT(n)}function ps(n){return n?(n.nodeName||"").toLowerCase():null}function j0(n){return((yg(n)?n.ownerDocument:n.document)||window.document).documentElement}function aT(n){return m0(j0(n)).left+$x(n).scrollLeft}function gs(n){return ga(n).getComputedStyle(n)}function xg(n){var a=gs(n),r=a.overflow,t=a.overflowX,e=a.overflowY;return/auto|scroll|overlay|hidden/.test(r+e+t)}function sT(n){var a=n.getBoundingClientRect(),r=Xu(a.width)/n.offsetWidth||1,t=Xu(a.height)/n.offsetHeight||1;return r!==1||t!==1}function oT(n,a,r){r===void 0&&(r=!1);var t=va(a),e=va(a)&&sT(a),i=j0(a),s=m0(n,e,r),f={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(t||!t&&!r)&&((ps(a)!=="body"||xg(i))&&(f=iT(a)),va(a)?(h=m0(a,!0),h.x+=a.clientLeft,h.y+=a.clientTop):i&&(h.x=aT(i))),{x:s.left+f.scrollLeft-h.x,y:s.top+f.scrollTop-h.y,width:s.width,height:s.height}}function lT(n){var a=m0(n),r=n.offsetWidth,t=n.offsetHeight;return Math.abs(a.width-r)<=1&&(r=a.width),Math.abs(a.height-t)<=1&&(t=a.height),{x:n.offsetLeft,y:n.offsetTop,width:r,height:t}}function Eg(n){return ps(n)==="html"?n:n.assignedSlot||n.parentNode||(Wx(n)?n.host:null)||j0(n)}function Kx(n){return["html","body","#document"].indexOf(ps(n))>=0?n.ownerDocument.body:va(n)&&xg(n)?n:Kx(Eg(n))}function bh(n,a){var r;a===void 0&&(a=[]);var t=Kx(n),e=t===((r=n.ownerDocument)==null?void 0:r.body),i=ga(t),s=e?[i].concat(i.visualViewport||[],xg(t)?t:[]):t,f=a.concat(s);return e?f:f.concat(bh(Eg(s)))}function uT(n){return["table","td","th"].indexOf(ps(n))>=0}function ey(n){return!va(n)||gs(n).position==="fixed"?null:n.offsetParent}function fT(n){var a=/firefox/i.test(jp()),r=/Trident/i.test(jp());if(r&&va(n)){var t=gs(n);if(t.position==="fixed")return null}var e=Eg(n);for(Wx(e)&&(e=e.host);va(e)&&["html","body"].indexOf(ps(e))<0;){var i=gs(e);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||a&&i.willChange==="filter"||a&&i.filter&&i.filter!=="none")return e;e=e.parentNode}return null}function Yx(n){for(var a=ga(n),r=ey(n);r&&uT(r)&&gs(r).position==="static";)r=ey(r);return r&&(ps(r)==="html"||ps(r)==="body"&&gs(r).position==="static")?a:r||fT(n)||a}var Wu="top",y0="bottom",Sc="right",cl="left",Xx="auto",cT=[Wu,y0,Sc,cl],qx="start",x0="end",dT=[].concat(cT,[Xx]).reduce(function(n,a){return n.concat([a,a+"-"+qx,a+"-"+x0])},[]),hT="beforeRead",vT="read",pT="afterRead",gT="beforeMain",mT="main",yT="afterMain",xT="beforeWrite",ET="write",ST="afterWrite",Gp=[hT,vT,pT,gT,mT,yT,xT,ET,ST];function _T(n){var a=new Map,r=new Set,t=[];n.forEach(function(i){a.set(i.name,i)});function e(i){r.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(f){if(!r.has(f)){var h=a.get(f);h&&e(h)}}),t.push(i)}return n.forEach(function(i){r.has(i.name)||e(i)}),t}function bT(n){var a=_T(n);return Gp.reduce(function(r,t){return r.concat(a.filter(function(e){return e.phase===t}))},[])}function TT(n){var a;return function(){return a||(a=new Promise(function(r){Promise.resolve().then(function(){a=void 0,r(n())})})),a}}function oo(n){for(var a=arguments.length,r=new Array(a>1?a-1:0),t=1;t=0?"x":"y"}function RT(n){var a=n.reference,r=n.element,t=n.placement,e=t?G0(t):null,i=t?Zx(t):null,s=a.x+a.width/2-r.width/2,f=a.y+a.height/2-r.height/2,h;switch(e){case Wu:h={x:s,y:a.y-r.height};break;case y0:h={x:s,y:a.y+a.height};break;case Sc:h={x:a.x+a.width,y:f};break;case cl:h={x:a.x-r.width,y:f};break;default:h={x:a.x,y:a.y}}var p=e?LT(e):null;if(p!=null){var S=p==="y"?"height":"width";switch(i){case qx:h[p]=h[p]-(a[S]/2-r[S]/2);break;case x0:h[p]=h[p]+(a[S]/2-r[S]/2);break}}return h}var ry="Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.",DT="Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.",ny={placement:"bottom",modifiers:[],strategy:"absolute"};function iy(){for(var n=arguments.length,a=new Array(n),r=0;r100){console.error(DT);break}if(S.reset===!0){S.reset=!1,Z=-1;continue}var H=S.orderedModifiers[Z],ee=H.fn,te=H.options,fe=te===void 0?{}:te,ne=H.name;typeof ee=="function"&&(S=ee({state:S,options:fe,name:ne,instance:R})||S)}}},update:TT(function(){return new Promise(function(O){R.forceUpdate(),O(S)})}),destroy:function(){I(),A=!0}};if(!iy(f,h))return console.error(ry),R;R.setOptions(p).then(function(O){!A&&p.onFirstUpdate&&p.onFirstUpdate(O)});function D(){S.orderedModifiers.forEach(function(O){var V=O.name,N=O.options,G=N===void 0?{}:N,z=O.effect;if(typeof z=="function"){var Z=z({state:S,name:V,instance:R,options:G}),H=function(){};b.push(Z||H)}})}function I(){b.forEach(function(O){return O()}),b=[]}return R}}var vh={passive:!0};function IT(n){var a=n.state,r=n.instance,t=n.options,e=t.scroll,i=e===void 0?!0:e,s=t.resize,f=s===void 0?!0:s,h=ga(a.elements.popper),p=[].concat(a.scrollParents.reference,a.scrollParents.popper);return i&&p.forEach(function(S){S.addEventListener("scroll",r.update,vh)}),f&&h.addEventListener("resize",r.update,vh),function(){i&&p.forEach(function(S){S.removeEventListener("scroll",r.update,vh)}),f&&h.removeEventListener("resize",r.update,vh)}}var OT={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:IT,data:{}};function FT(n){var a=n.state,r=n.name;a.modifiersData[r]=RT({reference:a.rects.reference,element:a.rects.popper,placement:a.placement})}var MT={name:"popperOffsets",enabled:!0,phase:"read",fn:FT,data:{}},BT={top:"auto",right:"auto",bottom:"auto",left:"auto"};function NT(n){var a=n.x,r=n.y,t=window,e=t.devicePixelRatio||1;return{x:Xu(a*e)/e||0,y:Xu(r*e)/e||0}}function ay(n){var a,r=n.popper,t=n.popperRect,e=n.placement,i=n.variation,s=n.offsets,f=n.position,h=n.gpuAcceleration,p=n.adaptive,S=n.roundOffsets,b=n.isFixed,A=s.x,R=A===void 0?0:A,D=s.y,I=D===void 0?0:D,O=typeof S=="function"?S({x:R,y:I}):{x:R,y:I};R=O.x,I=O.y;var V=s.hasOwnProperty("x"),N=s.hasOwnProperty("y"),G=cl,z=Wu,Z=window;if(p){var H=Yx(r),ee="clientHeight",te="clientWidth";if(H===ga(r)&&(H=j0(r),gs(H).position!=="static"&&f==="absolute"&&(ee="scrollHeight",te="scrollWidth")),H=H,e===Wu||(e===cl||e===Sc)&&i===x0){z=y0;var fe=b&&H===Z&&Z.visualViewport?Z.visualViewport.height:H[ee];I-=fe-t.height,I*=h?1:-1}if(e===cl||(e===Wu||e===y0)&&i===x0){G=Sc;var ne=b&&H===Z&&Z.visualViewport?Z.visualViewport.width:H[te];R-=ne-t.width,R*=h?1:-1}}var oe=Object.assign({position:f},p&&BT),Y=S===!0?NT({x:R,y:I}):{x:R,y:I};if(R=Y.x,I=Y.y,h){var q;return Object.assign({},oe,(q={},q[z]=N?"0":"",q[G]=V?"0":"",q.transform=(Z.devicePixelRatio||1)<=1?"translate("+R+"px, "+I+"px)":"translate3d("+R+"px, "+I+"px, 0)",q))}return Object.assign({},oe,(a={},a[z]=N?I+"px":"",a[G]=V?R+"px":"",a.transform="",a))}function UT(n){var a=n.state,r=n.options,t=r.gpuAcceleration,e=t===void 0?!0:t,i=r.adaptive,s=i===void 0?!0:i,f=r.roundOffsets,h=f===void 0?!0:f;{var p=gs(a.elements.popper).transitionProperty||"";s&&["transform","top","right","bottom","left"].some(function(b){return p.indexOf(b)>=0})&&console.warn(["Popper: Detected CSS transitions on at least one of the following",'CSS properties: "transform", "top", "right", "bottom", "left".',` `,'Disable the "computeStyles" modifier\'s `adaptive` option to allow',"for smooth transitions, or remove these properties from the CSS","transition declaration on the popper element if only transitioning","opacity or background-color for example.",` `,"We recommend using the popper element as a wrapper around an inner","element that can have any CSS property transitioned for animations."].join(" "))}var S={placement:G0(a.placement),variation:Zx(a.placement),popper:a.elements.popper,popperRect:a.rects.popper,gpuAcceleration:e,isFixed:a.options.strategy==="fixed"};a.modifiersData.popperOffsets!=null&&(a.styles.popper=Object.assign({},a.styles.popper,ay(Object.assign({},S,{offsets:a.modifiersData.popperOffsets,position:a.options.strategy,adaptive:s,roundOffsets:h})))),a.modifiersData.arrow!=null&&(a.styles.arrow=Object.assign({},a.styles.arrow,ay(Object.assign({},S,{offsets:a.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:h})))),a.attributes.popper=Object.assign({},a.attributes.popper,{"data-popper-placement":a.placement})}var HT={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:UT,data:{}};function VT(n){var a=n.state;Object.keys(a.elements).forEach(function(r){var t=a.styles[r]||{},e=a.attributes[r]||{},i=a.elements[r];!va(i)||!ps(i)||(Object.assign(i.style,t),Object.keys(e).forEach(function(s){var f=e[s];f===!1?i.removeAttribute(s):i.setAttribute(s,f===!0?"":f)}))})}function jT(n){var a=n.state,r={popper:{position:a.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(a.elements.popper.style,r.popper),a.styles=r,a.elements.arrow&&Object.assign(a.elements.arrow.style,r.arrow),function(){Object.keys(a.elements).forEach(function(t){var e=a.elements[t],i=a.attributes[t]||{},s=Object.keys(a.styles.hasOwnProperty(t)?a.styles[t]:r[t]),f=s.reduce(function(h,p){return h[p]="",h},{});!va(e)||!ps(e)||(Object.assign(e.style,f),Object.keys(i).forEach(function(h){e.removeAttribute(h)}))})}}var GT={name:"applyStyles",enabled:!0,phase:"write",fn:VT,effect:jT,requires:["computeStyles"]},zT=[OT,MT,HT,GT],WT=PT({defaultModifiers:zT});function $T(n,a,r){var t=G0(n),e=[cl,Wu].indexOf(t)>=0?-1:1,i=typeof r=="function"?r(Object.assign({},a,{placement:n})):r,s=i[0],f=i[1];return s=s||0,f=(f||0)*e,[cl,Sc].indexOf(t)>=0?{x:f,y:s}:{x:s,y:f}}function KT(n){var a=n.state,r=n.options,t=n.name,e=r.offset,i=e===void 0?[0,0]:e,s=dT.reduce(function(S,b){return S[b]=$T(b,a.rects,i),S},{}),f=s[a.placement],h=f.x,p=f.y;a.modifiersData.popperOffsets!=null&&(a.modifiersData.popperOffsets.x+=h,a.modifiersData.popperOffsets.y+=p),a.modifiersData[t]=s}var YT={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:KT};const XT=(n,a)=>{const[r,t]=Ce.useState(0);Ce.useEffect(()=>{t(e=>e+1)},a),Ce.useEffect(()=>n(),[r])},qT=["overlay","duration","overlayStyle","overlayClass","closeOnClickOverlay","teleport","onClosed","onOpened","onClickOverlay"],[rl]=xo("popover"),mP=Ce.forwardRef((n,a)=>{var{children:r,className:t}=n,e=H0(n,["children","className"]);const i=Qu(e,{overlay:!1,duration:300,closeOnClickAction:!0,closeOnClickOverlay:!0,closeOnClickOutside:!0,offset:[0,8],theme:"light",trigger:"click",actions:[],placement:"bottom"}),s=Ce.useRef(null),f=Ce.useRef(),h=Ce.useRef(),p=z=>{var Z,H;z?(Z=i.onOpen)===null||Z===void 0||Z.call(i):(H=i.onClose)===null||H===void 0||H.call(i)},[S,b]=yb({value:i.visible,defaultValue:!1,onChange:p}),A=()=>b(!0),R=()=>b(!1),D=()=>WT(f.current,h.current.popupRef.current,{placement:i.placement,modifiers:[{name:"computeStyles",options:{adaptive:!1,gpuAcceleration:!1}},Y_({},YT,{options:{offset:i.offset}})]}),I=()=>{var z;S&&(s.current?(z=s.current)===null||z===void 0||z.setOptions({placement:i.placement}):s.current=D())},O=()=>{i.trigger==="click"&&b(!S)},V=(z,Z)=>{var H;z.disabled||((H=i.onSelect)===null||H===void 0||H.call(i,z,Z),i.closeOnClickAction&&b(!1))},N=()=>{i.closeOnClickOutside&&(!i.overlay||i.closeOnClickOverlay)&&b(!1)},G=(z,Z)=>{const{icon:H,text:ee,color:te,disabled:fe,className:ne}=z;return Ct.jsxs("div",Object.assign({className:hr(rl("action",{disabled:fe,"with-icon":H}),ne),style:{color:te},onClick:()=>V(z,Z)},{children:[H?Kn.cloneElement(H,{className:hr(rl("action-icon"))}):null,Ct.jsx("div",Object.assign({className:hr(rl("action-text"),Tb)},{children:ee}))]}),Z)};return Ce.useEffect(()=>()=>{var z;s.current&&((z=s.current)===null||z===void 0||z.destroy(),s.current=null)},[]),XT(()=>{I()},[S,i.placement]),Ce.useEffect(()=>{let z;const Z=H=>H.stopPropagation();return h.current&&h.current.popupRef.current&&(z=h.current.popupRef.current,z.addEventListener("touchstart",Z)),()=>{z&&z.removeEventListener("touchstart",Z)}},[h.current]),Ce.useImperativeHandle(a,()=>({show:()=>{if(S){b(!1),setTimeout(()=>b(!0),0);return}b(!0)},hide:()=>b(!1)})),$_(f,N,"touchstart"),Ct.jsxs(Ct.Fragment,{children:[Ct.jsx("span",Object.assign({ref:f,className:hr(rl("wrapper")),onClick:O},{children:i.reference})),Ct.jsxs(Wb,Object.assign({ref:h,visible:S,className:hr(t,rl([i.theme])),position:"",transition:"rv-zoom",lockScroll:!1,onOpen:A,onClose:R},q_(i,qT),{children:[Ct.jsx("div",{className:hr(rl("arrow"))}),Ct.jsx("div",Object.assign({role:"menu",className:hr(rl("content"))},{children:r||i.actions.map(G)}))]}))]})});function ZT(n,a){const r={};return Object.keys(n).forEach(t=>{t.toString().startsWith(`--${a}-`)?r[t]=n[t]:r[`--${a}-${rb(t)}`]=n[t]}),r}const yP=n=>{var{className:a,style:r,themeVars:t={},tag:e="div",children:i}=n,s=H0(n,["className","style","themeVars","tag","children"]);const f=e,h=Ce.useMemo(()=>t?Object.assign(Object.assign({},r),ZT(t,"rv")):r,[r,t]);return Ct.jsx(Xb.Provider,Object.assign({value:Object.assign(Object.assign({},zx),s)},{children:Ct.jsx(f,Object.assign({className:a,style:h},{children:i}))}))};/** * @remix-run/router v1.15.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function nn(){return nn=Object.assign?Object.assign.bind():function(n){for(var a=1;a"u")throw new Error(a)}function qu(n,a){if(!n){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function JT(){return Math.random().toString(36).substr(2,8)}function oy(n,a){return{usr:n.state,key:n.key,idx:a}}function _c(n,a,r,t){return r===void 0&&(r=null),nn({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof a=="string"?Eo(a):a,{state:r,key:a&&a.key||t||JT()})}function Ic(n){let{pathname:a="/",search:r="",hash:t=""}=n;return r&&r!=="?"&&(a+=r.charAt(0)==="?"?r:"?"+r),t&&t!=="#"&&(a+=t.charAt(0)==="#"?t:"#"+t),a}function Eo(n){let a={};if(n){let r=n.indexOf("#");r>=0&&(a.hash=n.substr(r),n=n.substr(0,r));let t=n.indexOf("?");t>=0&&(a.search=n.substr(t),n=n.substr(0,t)),n&&(a.pathname=n)}return a}function eC(n,a,r,t){t===void 0&&(t={});let{window:e=document.defaultView,v5Compat:i=!1}=t,s=e.history,f=mn.Pop,h=null,p=S();p==null&&(p=0,s.replaceState(nn({},s.state,{idx:p}),""));function S(){return(s.state||{idx:null}).idx}function b(){f=mn.Pop;let O=S(),V=O==null?null:O-p;p=O,h&&h({action:f,location:I.location,delta:V})}function A(O,V){f=mn.Push;let N=_c(I.location,O,V);p=S()+1;let G=oy(N,p),z=I.createHref(N);try{s.pushState(G,"",z)}catch(Z){if(Z instanceof DOMException&&Z.name==="DataCloneError")throw Z;e.location.assign(z)}i&&h&&h({action:f,location:I.location,delta:1})}function R(O,V){f=mn.Replace;let N=_c(I.location,O,V);p=S();let G=oy(N,p),z=I.createHref(N);s.replaceState(G,"",z),i&&h&&h({action:f,location:I.location,delta:0})}function D(O){let V=e.location.origin!=="null"?e.location.origin:e.location.href,N=typeof O=="string"?O:Ic(O);return N=N.replace(/ $/,"%20"),nr(V,"No window.location.(origin|href) available to create URL for href: "+N),new URL(N,V)}let I={get action(){return f},get location(){return n(e,s)},listen(O){if(h)throw new Error("A history only accepts one active listener");return e.addEventListener(sy,b),h=O,()=>{e.removeEventListener(sy,b),h=null}},createHref(O){return a(e,O)},createURL:D,encodeLocation(O){let V=D(O);return{pathname:V.pathname,search:V.search,hash:V.hash}},push:A,replace:R,go(O){return s.go(O)}};return I}var rn;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(rn||(rn={}));const tC=new Set(["lazy","caseSensitive","path","id","index","children"]);function rC(n){return n.index===!0}function zp(n,a,r,t){return r===void 0&&(r=[]),t===void 0&&(t={}),n.map((e,i)=>{let s=[...r,i],f=typeof e.id=="string"?e.id:s.join("-");if(nr(e.index!==!0||!e.children,"Cannot specify children on an index route"),nr(!t[f],'Found a route id collision on id "'+f+`". Route id's must be globally unique within Data Router usages`),rC(e)){let h=nn({},e,a(e),{id:f});return t[f]=h,h}else{let h=nn({},e,a(e),{id:f,children:void 0});return t[f]=h,e.children&&(h.children=zp(e.children,a,s,t)),h}})}function ju(n,a,r){r===void 0&&(r="/");let t=typeof a=="string"?Eo(a):a,e=Oc(t.pathname||"/",r);if(e==null)return null;let i=Qx(n);iC(i);let s=null;for(let f=0;s==null&&f{let h={relativePath:f===void 0?i.path||"":f,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};h.relativePath.startsWith("/")&&(nr(h.relativePath.startsWith(t),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+t+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(t.length));let p=go([t,h.relativePath]),S=r.concat(h);i.children&&i.children.length>0&&(nr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),Qx(i.children,a,S,p)),!(i.path==null&&!i.index)&&a.push({path:p,score:cC(p,i.index),routesMeta:S})};return n.forEach((i,s)=>{var f;if(i.path===""||!((f=i.path)!=null&&f.includes("?")))e(i,s);else for(let h of Jx(i.path))e(i,s,h)}),a}function Jx(n){let a=n.split("/");if(a.length===0)return[];let[r,...t]=a,e=r.endsWith("?"),i=r.replace(/\?$/,"");if(t.length===0)return e?[i,""]:[i];let s=Jx(t.join("/")),f=[];return f.push(...s.map(h=>h===""?i:[i,h].join("/"))),e&&f.push(...s),f.map(h=>n.startsWith("/")&&h===""?"/":h)}function iC(n){n.sort((a,r)=>a.score!==r.score?r.score-a.score:dC(a.routesMeta.map(t=>t.childrenIndex),r.routesMeta.map(t=>t.childrenIndex)))}const aC=/^:[\w-]+$/,sC=3,oC=2,lC=1,uC=10,fC=-2,ly=n=>n==="*";function cC(n,a){let r=n.split("/"),t=r.length;return r.some(ly)&&(t+=fC),a&&(t+=oC),r.filter(e=>!ly(e)).reduce((e,i)=>e+(aC.test(i)?sC:i===""?lC:uC),t)}function dC(n,a){return n.length===a.length&&n.slice(0,-1).every((t,e)=>t===a[e])?n[n.length-1]-a[a.length-1]:0}function hC(n,a){let{routesMeta:r}=n,t={},e="/",i=[];for(let s=0;s{let{paramName:A,isOptional:R}=S;if(A==="*"){let I=f[b]||"";s=i.slice(0,i.length-I.length).replace(/(.)\/+$/,"$1")}const D=f[b];return R&&!D?p[A]=void 0:p[A]=(D||"").replace(/%2F/g,"/"),p},{}),pathname:i,pathnameBase:s,pattern:n}}function pC(n,a,r){a===void 0&&(a=!1),r===void 0&&(r=!0),qu(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let t=[],e="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,f,h)=>(t.push({paramName:f,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(t.push({paramName:"*"}),e+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?e+="\\/*$":n!==""&&n!=="/"&&(e+="(?:(?=\\/|$))"),[new RegExp(e,a?void 0:"i"),t]}function gC(n){try{return n.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return qu(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),n}}function Oc(n,a){if(a==="/")return n;if(!n.toLowerCase().startsWith(a.toLowerCase()))return null;let r=a.endsWith("/")?a.length-1:a.length,t=n.charAt(r);return t&&t!=="/"?null:n.slice(r)||"/"}function mC(n,a){a===void 0&&(a="/");let{pathname:r,search:t="",hash:e=""}=typeof n=="string"?Eo(n):n;return{pathname:r?r.startsWith("/")?r:yC(r,a):a,search:EC(t),hash:SC(e)}}function yC(n,a){let r=a.replace(/\/+$/,"").split("/");return n.split("/").forEach(e=>{e===".."?r.length>1&&r.pop():e!=="."&&r.push(e)}),r.length>1?r.join("/"):"/"}function ip(n,a,r,t){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(t)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function eE(n){return n.filter((a,r)=>r===0||a.route.path&&a.route.path.length>0)}function Sg(n,a){let r=eE(n);return a?r.map((t,e)=>e===n.length-1?t.pathname:t.pathnameBase):r.map(t=>t.pathnameBase)}function _g(n,a,r,t){t===void 0&&(t=!1);let e;typeof n=="string"?e=Eo(n):(e=nn({},n),nr(!e.pathname||!e.pathname.includes("?"),ip("?","pathname","search",e)),nr(!e.pathname||!e.pathname.includes("#"),ip("#","pathname","hash",e)),nr(!e.search||!e.search.includes("#"),ip("#","search","hash",e)));let i=n===""||e.pathname==="",s=i?"/":e.pathname,f;if(s==null)f=r;else{let b=a.length-1;if(!t&&s.startsWith("..")){let A=s.split("/");for(;A[0]==="..";)A.shift(),b-=1;e.pathname=A.join("/")}f=b>=0?a[b]:"/"}let h=mC(e,f),p=s&&s!=="/"&&s.endsWith("/"),S=(i||s===".")&&r.endsWith("/");return!h.pathname.endsWith("/")&&(p||S)&&(h.pathname+="/"),h}const go=n=>n.join("/").replace(/\/\/+/g,"/"),xC=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),EC=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,SC=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;class bg{constructor(a,r,t,e){e===void 0&&(e=!1),this.status=a,this.statusText=r||"",this.internal=e,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}}function tE(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const rE=["post","put","patch","delete"],_C=new Set(rE),bC=["get",...rE],TC=new Set(bC),CC=new Set([301,302,303,307,308]),wC=new Set([307,308]),ap={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},AC={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},lc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},nE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kC=n=>({hasErrorBoundary:!!n.hasErrorBoundary}),iE="remix-router-transitions";function LC(n){const a=n.window?n.window:typeof window<"u"?window:void 0,r=typeof a<"u"&&typeof a.document<"u"&&typeof a.document.createElement<"u",t=!r;nr(n.routes.length>0,"You must provide a non-empty routes array to createRouter");let e;if(n.mapRouteProperties)e=n.mapRouteProperties;else if(n.detectErrorBoundary){let pe=n.detectErrorBoundary;e=we=>({hasErrorBoundary:pe(we)})}else e=kC;let i={},s=zp(n.routes,e,void 0,i),f,h=n.basename||"/",p=nn({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},n.future),S=null,b=new Set,A=null,R=null,D=null,I=n.hydrationData!=null,O=ju(s,n.history.location,h),V=null;if(O==null){let pe=Ji(404,{pathname:n.history.location.pathname}),{matches:we,route:Fe}=gy(s);O=we,V={[Fe.id]:pe}}let N,G=O.some(pe=>pe.route.lazy),z=O.some(pe=>pe.route.loader);if(G)N=!1;else if(!z)N=!0;else if(p.v7_partialHydration){let pe=n.hydrationData?n.hydrationData.loaderData:null,we=n.hydrationData?n.hydrationData.errors:null,Fe=Xe=>Xe.route.loader?Xe.route.loader.hydrate===!0?!1:pe&&pe[Xe.route.id]!==void 0||we&&we[Xe.route.id]!==void 0:!0;if(we){let Xe=O.findIndex(lt=>we[lt.route.id]!==void 0);N=O.slice(0,Xe+1).every(Fe)}else N=O.every(Fe)}else N=n.hydrationData!=null;let Z,H={historyAction:n.history.action,location:n.history.location,matches:O,initialized:N,navigation:ap,restoreScrollPosition:n.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:n.hydrationData&&n.hydrationData.loaderData||{},actionData:n.hydrationData&&n.hydrationData.actionData||null,errors:n.hydrationData&&n.hydrationData.errors||V,fetchers:new Map,blockers:new Map},ee=mn.Pop,te=!1,fe,ne=!1,oe=new Map,Y=null,q=!1,Q=!1,be=[],ge=[],ve=new Map,re=0,j=-1,ye=new Map,X=new Set,ce=new Map,Ae=new Map,_e=new Set,it=new Map,nt=new Map,wt=!1;function at(){if(S=n.history.listen(pe=>{let{action:we,location:Fe,delta:Xe}=pe;if(wt){wt=!1;return}qu(nt.size===0||Xe!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let lt=Ue({currentLocation:H.location,nextLocation:Fe,historyAction:we});if(lt&&Xe!=null){wt=!0,n.history.go(Xe*-1),ct(lt,{state:"blocked",location:Fe,proceed(){ct(lt,{state:"proceeding",proceed:void 0,reset:void 0,location:Fe}),n.history.go(Xe)},reset(){let Bt=new Map(H.blockers);Bt.set(lt,lc),Ar({blockers:Bt})}});return}return lr(we,Fe)}),r){HC(a,oe);let pe=()=>VC(a,oe);a.addEventListener("pagehide",pe),Y=()=>a.removeEventListener("pagehide",pe)}return H.initialized||lr(mn.Pop,H.location,{initialHydration:!0}),Z}function $t(){S&&S(),Y&&Y(),b.clear(),fe&&fe.abort(),H.fetchers.forEach((pe,we)=>Tn(we)),H.blockers.forEach((pe,we)=>qe(we))}function gr(pe){return b.add(pe),()=>b.delete(pe)}function Ar(pe,we){we===void 0&&(we={}),H=nn({},H,pe);let Fe=[],Xe=[];p.v7_fetcherPersist&&H.fetchers.forEach((lt,Bt)=>{lt.state==="idle"&&(_e.has(Bt)?Xe.push(Bt):Fe.push(Bt))}),[...b].forEach(lt=>lt(H,{deletedFetchers:Xe,unstable_viewTransitionOpts:we.viewTransitionOpts,unstable_flushSync:we.flushSync===!0})),p.v7_fetcherPersist&&(Fe.forEach(lt=>H.fetchers.delete(lt)),Xe.forEach(lt=>Tn(lt)))}function ft(pe,we,Fe){var Xe,lt;let{flushSync:Bt}=Fe===void 0?{}:Fe,Lt=H.actionData!=null&&H.navigation.formMethod!=null&&ha(H.navigation.formMethod)&&H.navigation.state==="loading"&&((Xe=pe.state)==null?void 0:Xe._isRedirect)!==!0,bt;we.actionData?Object.keys(we.actionData).length>0?bt=we.actionData:bt=null:Lt?bt=H.actionData:bt=null;let yt=we.loaderData?py(H.loaderData,we.loaderData,we.matches||[],we.errors):H.loaderData,Tt=H.blockers;Tt.size>0&&(Tt=new Map(Tt),Tt.forEach((tr,Gr)=>Tt.set(Gr,lc)));let Kt=te===!0||H.navigation.formMethod!=null&&ha(H.navigation.formMethod)&&((lt=pe.state)==null?void 0:lt._isRedirect)!==!0;f&&(s=f,f=void 0),q||ee===mn.Pop||(ee===mn.Push?n.history.push(pe,pe.state):ee===mn.Replace&&n.history.replace(pe,pe.state));let Pt;if(ee===mn.Pop){let tr=oe.get(H.location.pathname);tr&&tr.has(pe.pathname)?Pt={currentLocation:H.location,nextLocation:pe}:oe.has(pe.pathname)&&(Pt={currentLocation:pe,nextLocation:H.location})}else if(ne){let tr=oe.get(H.location.pathname);tr?tr.add(pe.pathname):(tr=new Set([pe.pathname]),oe.set(H.location.pathname,tr)),Pt={currentLocation:H.location,nextLocation:pe}}Ar(nn({},we,{actionData:bt,loaderData:yt,historyAction:ee,location:pe,initialized:!0,navigation:ap,revalidation:"idle",restoreScrollPosition:Ve(pe,we.matches||H.matches),preventScrollReset:Kt,blockers:Tt}),{viewTransitionOpts:Pt,flushSync:Bt===!0}),ee=mn.Pop,te=!1,ne=!1,q=!1,Q=!1,be=[],ge=[]}async function Br(pe,we){if(typeof pe=="number"){n.history.go(pe);return}let Fe=Wp(H.location,H.matches,h,p.v7_prependBasename,pe,p.v7_relativeSplatPath,we==null?void 0:we.fromRouteId,we==null?void 0:we.relative),{path:Xe,submission:lt,error:Bt}=uy(p.v7_normalizeFormMethod,!1,Fe,we),Lt=H.location,bt=_c(H.location,Xe,we&&we.state);bt=nn({},bt,n.history.encodeLocation(bt));let yt=we&&we.replace!=null?we.replace:void 0,Tt=mn.Push;yt===!0?Tt=mn.Replace:yt===!1||lt!=null&&ha(lt.formMethod)&<.formAction===H.location.pathname+H.location.search&&(Tt=mn.Replace);let Kt=we&&"preventScrollReset"in we?we.preventScrollReset===!0:void 0,Pt=(we&&we.unstable_flushSync)===!0,tr=Ue({currentLocation:Lt,nextLocation:bt,historyAction:Tt});if(tr){ct(tr,{state:"blocked",location:bt,proceed(){ct(tr,{state:"proceeding",proceed:void 0,reset:void 0,location:bt}),Br(pe,we)},reset(){let Gr=new Map(H.blockers);Gr.set(tr,lc),Ar({blockers:Gr})}});return}return await lr(Tt,bt,{submission:lt,pendingError:Bt,preventScrollReset:Kt,replace:we&&we.replace,enableViewTransition:we&&we.unstable_viewTransition,flushSync:Pt})}function Pr(){if(Sr(),Ar({revalidation:"loading"}),H.navigation.state!=="submitting"){if(H.navigation.state==="idle"){lr(H.historyAction,H.location,{startUninterruptedRevalidation:!0});return}lr(ee||H.historyAction,H.navigation.location,{overrideNavigation:H.navigation})}}async function lr(pe,we,Fe){fe&&fe.abort(),fe=null,ee=pe,q=(Fe&&Fe.startUninterruptedRevalidation)===!0,ze(H.location,H.matches),te=(Fe&&Fe.preventScrollReset)===!0,ne=(Fe&&Fe.enableViewTransition)===!0;let Xe=f||s,lt=Fe&&Fe.overrideNavigation,Bt=ju(Xe,we,h),Lt=(Fe&&Fe.flushSync)===!0;if(!Bt){let Gr=Ji(404,{pathname:we.pathname}),{matches:fn,route:$r}=gy(Xe);St(),ft(we,{matches:fn,loaderData:{},errors:{[$r.id]:Gr}},{flushSync:Lt});return}if(H.initialized&&!Q&&OC(H.location,we)&&!(Fe&&Fe.submission&&ha(Fe.submission.formMethod))){ft(we,{matches:Bt},{flushSync:Lt});return}fe=new AbortController;let bt=fc(n.history,we,fe.signal,Fe&&Fe.submission),yt,Tt;if(Fe&&Fe.pendingError)Tt={[xc(Bt).route.id]:Fe.pendingError};else if(Fe&&Fe.submission&&ha(Fe.submission.formMethod)){let Gr=await Er(bt,we,Fe.submission,Bt,{replace:Fe.replace,flushSync:Lt});if(Gr.shortCircuited)return;yt=Gr.pendingActionData,Tt=Gr.pendingActionError,lt=sp(we,Fe.submission),Lt=!1,bt=new Request(bt.url,{signal:bt.signal})}let{shortCircuited:Kt,loaderData:Pt,errors:tr}=await kr(bt,we,Bt,lt,Fe&&Fe.submission,Fe&&Fe.fetcherSubmission,Fe&&Fe.replace,Fe&&Fe.initialHydration===!0,Lt,yt,Tt);Kt||(fe=null,ft(we,nn({matches:Bt},yt?{actionData:yt}:{},{loaderData:Pt,errors:tr})))}async function Er(pe,we,Fe,Xe,lt){lt===void 0&&(lt={}),Sr();let Bt=NC(we,Fe);Ar({navigation:Bt},{flushSync:lt.flushSync===!0});let Lt,bt=Kp(Xe,we);if(!bt.route.action&&!bt.route.lazy)Lt={type:rn.error,error:Ji(405,{method:pe.method,pathname:we.pathname,routeId:bt.route.id})};else if(Lt=await uc("action",pe,bt,Xe,i,e,h,p.v7_relativeSplatPath),pe.signal.aborted)return{shortCircuited:!0};if(ll(Lt)){let yt;return lt&<.replace!=null?yt=lt.replace:yt=Lt.location===H.location.pathname+H.location.search,await Ft(H,Lt,{submission:Fe,replace:yt}),{shortCircuited:!0}}if(Gu(Lt)){let yt=xc(Xe,bt.route.id);return(lt&<.replace)!==!0&&(ee=mn.Push),{pendingActionData:{},pendingActionError:{[yt.route.id]:Lt.error}}}if(ol(Lt))throw Ji(400,{type:"defer-action"});return{pendingActionData:{[bt.route.id]:Lt.data}}}async function kr(pe,we,Fe,Xe,lt,Bt,Lt,bt,yt,Tt,Kt){let Pt=Xe||sp(we,lt),tr=lt||Bt||xy(Pt),Gr=f||s,[fn,$r]=fy(n.history,H,Fe,tr,we,p.v7_partialHydration&&bt===!0,Q,be,ge,_e,ce,X,Gr,h,Tt,Kt);if(St(rr=>!(Fe&&Fe.some(ir=>ir.route.id===rr))||fn&&fn.some(ir=>ir.route.id===rr)),j=++re,fn.length===0&&$r.length===0){let rr=Te();return ft(we,nn({matches:Fe,loaderData:{},errors:Kt||null},Tt?{actionData:Tt}:{},rr?{fetchers:new Map(H.fetchers)}:{}),{flushSync:yt}),{shortCircuited:!0}}if(!q&&(!p.v7_partialHydration||!bt)){$r.forEach(ir=>{let qt=H.fetchers.get(ir.key),_s=cc(void 0,qt?qt.data:void 0);H.fetchers.set(ir.key,_s)});let rr=Tt||H.actionData;Ar(nn({navigation:Pt},rr?Object.keys(rr).length===0?{actionData:null}:{actionData:rr}:{},$r.length>0?{fetchers:new Map(H.fetchers)}:{}),{flushSync:yt})}$r.forEach(rr=>{ve.has(rr.key)&&xn(rr.key),rr.controller&&ve.set(rr.key,rr.controller)});let ya=()=>$r.forEach(rr=>xn(rr.key));fe&&fe.signal.addEventListener("abort",ya);let{results:si,loaderResults:Hn,fetcherResults:xi}=await jr(H.matches,Fe,fn,$r,pe);if(pe.signal.aborted)return{shortCircuited:!0};fe&&fe.signal.removeEventListener("abort",ya),$r.forEach(rr=>ve.delete(rr.key));let Ei=my(si);if(Ei){if(Ei.idx>=fn.length){let rr=$r[Ei.idx-fn.length].key;X.add(rr)}return await Ft(H,Ei.result,{replace:Lt}),{shortCircuited:!0}}let{loaderData:Bi,errors:ra}=vy(H,Fe,fn,Hn,Kt,$r,xi,it);it.forEach((rr,ir)=>{rr.subscribe(qt=>{(qt||rr.done)&&it.delete(ir)})}),p.v7_partialHydration&&bt&&H.errors&&Object.entries(H.errors).filter(rr=>{let[ir]=rr;return!fn.some(qt=>qt.route.id===ir)}).forEach(rr=>{let[ir,qt]=rr;ra=Object.assign(ra||{},{[ir]:qt})});let xa=Te(),Ni=Ee(j),Si=xa||Ni||$r.length>0;return nn({loaderData:Bi,errors:ra},Si?{fetchers:new Map(H.fetchers)}:{})}function Zt(pe,we,Fe,Xe){if(t)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");ve.has(pe)&&xn(pe);let lt=(Xe&&Xe.unstable_flushSync)===!0,Bt=f||s,Lt=Wp(H.location,H.matches,h,p.v7_prependBasename,Fe,p.v7_relativeSplatPath,we,Xe==null?void 0:Xe.relative),bt=ju(Bt,Lt,h);if(!bt){Xn(pe,we,Ji(404,{pathname:Lt}),{flushSync:lt});return}let{path:yt,submission:Tt,error:Kt}=uy(p.v7_normalizeFormMethod,!0,Lt,Xe);if(Kt){Xn(pe,we,Kt,{flushSync:lt});return}let Pt=Kp(bt,yt);if(te=(Xe&&Xe.preventScrollReset)===!0,Tt&&ha(Tt.formMethod)){an(pe,we,yt,Pt,bt,lt,Tt);return}ce.set(pe,{routeId:we,path:yt}),Xt(pe,we,yt,Pt,bt,lt,Tt)}async function an(pe,we,Fe,Xe,lt,Bt,Lt){if(Sr(),ce.delete(pe),!Xe.route.action&&!Xe.route.lazy){let ir=Ji(405,{method:Lt.formMethod,pathname:Fe,routeId:we});Xn(pe,we,ir,{flushSync:Bt});return}let bt=H.fetchers.get(pe);_r(pe,UC(Lt,bt),{flushSync:Bt});let yt=new AbortController,Tt=fc(n.history,Fe,yt.signal,Lt);ve.set(pe,yt);let Kt=re,Pt=await uc("action",Tt,Xe,lt,i,e,h,p.v7_relativeSplatPath);if(Tt.signal.aborted){ve.get(pe)===yt&&ve.delete(pe);return}if(p.v7_fetcherPersist&&_e.has(pe)){if(ll(Pt)||Gu(Pt)){_r(pe,ho(void 0));return}}else{if(ll(Pt))if(ve.delete(pe),j>Kt){_r(pe,ho(void 0));return}else return X.add(pe),_r(pe,cc(Lt)),Ft(H,Pt,{fetcherSubmission:Lt});if(Gu(Pt)){Xn(pe,we,Pt.error);return}}if(ol(Pt))throw Ji(400,{type:"defer-action"});let tr=H.navigation.location||H.location,Gr=fc(n.history,tr,yt.signal),fn=f||s,$r=H.navigation.state!=="idle"?ju(fn,H.navigation.location,h):H.matches;nr($r,"Didn't find any matches after fetcher action");let ya=++re;ye.set(pe,ya);let si=cc(Lt,Pt.data);H.fetchers.set(pe,si);let[Hn,xi]=fy(n.history,H,$r,Lt,tr,!1,Q,be,ge,_e,ce,X,fn,h,{[Xe.route.id]:Pt.data},void 0);xi.filter(ir=>ir.key!==pe).forEach(ir=>{let qt=ir.key,_s=H.fetchers.get(qt),To=cc(void 0,_s?_s.data:void 0);H.fetchers.set(qt,To),ve.has(qt)&&xn(qt),ir.controller&&ve.set(qt,ir.controller)}),Ar({fetchers:new Map(H.fetchers)});let Ei=()=>xi.forEach(ir=>xn(ir.key));yt.signal.addEventListener("abort",Ei);let{results:Bi,loaderResults:ra,fetcherResults:xa}=await jr(H.matches,$r,Hn,xi,Gr);if(yt.signal.aborted)return;yt.signal.removeEventListener("abort",Ei),ye.delete(pe),ve.delete(pe),xi.forEach(ir=>ve.delete(ir.key));let Ni=my(Bi);if(Ni){if(Ni.idx>=Hn.length){let ir=xi[Ni.idx-Hn.length].key;X.add(ir)}return Ft(H,Ni.result)}let{loaderData:Si,errors:rr}=vy(H,H.matches,Hn,ra,void 0,xi,xa,it);if(H.fetchers.has(pe)){let ir=ho(Pt.data);H.fetchers.set(pe,ir)}Ee(ya),H.navigation.state==="loading"&&ya>j?(nr(ee,"Expected pending action"),fe&&fe.abort(),ft(H.navigation.location,{matches:$r,loaderData:Si,errors:rr,fetchers:new Map(H.fetchers)})):(Ar({errors:rr,loaderData:py(H.loaderData,Si,$r,rr),fetchers:new Map(H.fetchers)}),Q=!1)}async function Xt(pe,we,Fe,Xe,lt,Bt,Lt){let bt=H.fetchers.get(pe);_r(pe,cc(Lt,bt?bt.data:void 0),{flushSync:Bt});let yt=new AbortController,Tt=fc(n.history,Fe,yt.signal);ve.set(pe,yt);let Kt=re,Pt=await uc("loader",Tt,Xe,lt,i,e,h,p.v7_relativeSplatPath);if(ol(Pt)&&(Pt=await oE(Pt,Tt.signal,!0)||Pt),ve.get(pe)===yt&&ve.delete(pe),!Tt.signal.aborted){if(_e.has(pe)){_r(pe,ho(void 0));return}if(ll(Pt))if(j>Kt){_r(pe,ho(void 0));return}else{X.add(pe),await Ft(H,Pt);return}if(Gu(Pt)){Xn(pe,we,Pt.error);return}nr(!ol(Pt),"Unhandled fetcher deferred data"),_r(pe,ho(Pt.data))}}async function Ft(pe,we,Fe){let{submission:Xe,fetcherSubmission:lt,replace:Bt}=Fe===void 0?{}:Fe;we.revalidate&&(Q=!0);let Lt=_c(pe.location,we.location,{_isRedirect:!0});if(nr(Lt,"Expected a location on the redirect navigation"),r){let tr=!1;if(we.reloadDocument)tr=!0;else if(nE.test(we.location)){const Gr=n.history.createURL(we.location);tr=Gr.origin!==a.location.origin||Oc(Gr.pathname,h)==null}if(tr){Bt?a.location.replace(we.location):a.location.assign(we.location);return}}fe=null;let bt=Bt===!0?mn.Replace:mn.Push,{formMethod:yt,formAction:Tt,formEncType:Kt}=pe.navigation;!Xe&&!lt&&yt&&Tt&&Kt&&(Xe=xy(pe.navigation));let Pt=Xe||lt;if(wC.has(we.status)&&Pt&&ha(Pt.formMethod))await lr(bt,Lt,{submission:nn({},Pt,{formAction:we.location}),preventScrollReset:te});else{let tr=sp(Lt,Xe);await lr(bt,Lt,{overrideNavigation:tr,fetcherSubmission:lt,preventScrollReset:te})}}async function jr(pe,we,Fe,Xe,lt){let Bt=await Promise.all([...Fe.map(yt=>uc("loader",lt,yt,we,i,e,h,p.v7_relativeSplatPath)),...Xe.map(yt=>yt.matches&&yt.match&&yt.controller?uc("loader",fc(n.history,yt.path,yt.controller.signal),yt.match,yt.matches,i,e,h,p.v7_relativeSplatPath):{type:rn.error,error:Ji(404,{pathname:yt.path})})]),Lt=Bt.slice(0,Fe.length),bt=Bt.slice(Fe.length);return await Promise.all([yy(pe,Fe,Lt,Lt.map(()=>lt.signal),!1,H.loaderData),yy(pe,Xe.map(yt=>yt.match),bt,Xe.map(yt=>yt.controller?yt.controller.signal:null),!0)]),{results:Bt,loaderResults:Lt,fetcherResults:bt}}function Sr(){Q=!0,be.push(...St()),ce.forEach((pe,we)=>{ve.has(we)&&(ge.push(we),xn(we))})}function _r(pe,we,Fe){Fe===void 0&&(Fe={}),H.fetchers.set(pe,we),Ar({fetchers:new Map(H.fetchers)},{flushSync:(Fe&&Fe.flushSync)===!0})}function Xn(pe,we,Fe,Xe){Xe===void 0&&(Xe={});let lt=xc(H.matches,we);Tn(pe),Ar({errors:{[lt.route.id]:Fe},fetchers:new Map(H.fetchers)},{flushSync:(Xe&&Xe.flushSync)===!0})}function In(pe){return p.v7_fetcherPersist&&(Ae.set(pe,(Ae.get(pe)||0)+1),_e.has(pe)&&_e.delete(pe)),H.fetchers.get(pe)||AC}function Tn(pe){let we=H.fetchers.get(pe);ve.has(pe)&&!(we&&we.state==="loading"&&ye.has(pe))&&xn(pe),ce.delete(pe),ye.delete(pe),X.delete(pe),_e.delete(pe),H.fetchers.delete(pe)}function qn(pe){if(p.v7_fetcherPersist){let we=(Ae.get(pe)||0)-1;we<=0?(Ae.delete(pe),_e.add(pe)):Ae.set(pe,we)}else Tn(pe);Ar({fetchers:new Map(H.fetchers)})}function xn(pe){let we=ve.get(pe);nr(we,"Expected fetch controller: "+pe),we.abort(),ve.delete(pe)}function sn(pe){for(let we of pe){let Fe=In(we),Xe=ho(Fe.data);H.fetchers.set(we,Xe)}}function Te(){let pe=[],we=!1;for(let Fe of X){let Xe=H.fetchers.get(Fe);nr(Xe,"Expected fetcher: "+Fe),Xe.state==="loading"&&(X.delete(Fe),pe.push(Fe),we=!0)}return sn(pe),we}function Ee(pe){let we=[];for(let[Fe,Xe]of ye)if(Xe0}function xe(pe,we){let Fe=H.blockers.get(pe)||lc;return nt.get(pe)!==we&&nt.set(pe,we),Fe}function qe(pe){H.blockers.delete(pe),nt.delete(pe)}function ct(pe,we){let Fe=H.blockers.get(pe)||lc;nr(Fe.state==="unblocked"&&we.state==="blocked"||Fe.state==="blocked"&&we.state==="blocked"||Fe.state==="blocked"&&we.state==="proceeding"||Fe.state==="blocked"&&we.state==="unblocked"||Fe.state==="proceeding"&&we.state==="unblocked","Invalid blocker state transition: "+Fe.state+" -> "+we.state);let Xe=new Map(H.blockers);Xe.set(pe,we),Ar({blockers:Xe})}function Ue(pe){let{currentLocation:we,nextLocation:Fe,historyAction:Xe}=pe;if(nt.size===0)return;nt.size>1&&qu(!1,"A router only supports one blocker at a time");let lt=Array.from(nt.entries()),[Bt,Lt]=lt[lt.length-1],bt=H.blockers.get(Bt);if(!(bt&&bt.state==="proceeding")&&Lt({currentLocation:we,nextLocation:Fe,historyAction:Xe}))return Bt}function St(pe){let we=[];return it.forEach((Fe,Xe)=>{(!pe||pe(Xe))&&(Fe.cancel(),we.push(Xe),it.delete(Xe))}),we}function Se(pe,we,Fe){if(A=pe,D=we,R=Fe||null,!I&&H.navigation===ap){I=!0;let Xe=Ve(H.location,H.matches);Xe!=null&&Ar({restoreScrollPosition:Xe})}return()=>{A=null,D=null,R=null}}function He(pe,we){return R&&R(pe,we.map(Xe=>nC(Xe,H.loaderData)))||pe.key}function ze(pe,we){if(A&&D){let Fe=He(pe,we);A[Fe]=D()}}function Ve(pe,we){if(A){let Fe=He(pe,we),Xe=A[Fe];if(typeof Xe=="number")return Xe}return null}function $e(pe){i={},f=zp(pe,e,void 0,i)}return Z={get basename(){return h},get future(){return p},get state(){return H},get routes(){return s},get window(){return a},initialize:at,subscribe:gr,enableScrollRestoration:Se,navigate:Br,fetch:Zt,revalidate:Pr,createHref:pe=>n.history.createHref(pe),encodeLocation:pe=>n.history.encodeLocation(pe),getFetcher:In,deleteFetcher:qn,dispose:$t,getBlocker:xe,deleteBlocker:qe,_internalFetchControllers:ve,_internalActiveDeferreds:it,_internalSetRoutes:$e},Z}function RC(n){return n!=null&&("formData"in n&&n.formData!=null||"body"in n&&n.body!==void 0)}function Wp(n,a,r,t,e,i,s,f){let h,p;if(s){h=[];for(let b of a)if(h.push(b),b.route.id===s){p=b;break}}else h=a,p=a[a.length-1];let S=_g(e||".",Sg(h,i),Oc(n.pathname,r)||n.pathname,f==="path");return e==null&&(S.search=n.search,S.hash=n.hash),(e==null||e===""||e===".")&&p&&p.route.index&&!Tg(S.search)&&(S.search=S.search?S.search.replace(/^\?/,"?index&"):"?index"),t&&r!=="/"&&(S.pathname=S.pathname==="/"?r:go([r,S.pathname])),Ic(S)}function uy(n,a,r,t){if(!t||!RC(t))return{path:r};if(t.formMethod&&!BC(t.formMethod))return{path:r,error:Ji(405,{method:t.formMethod})};let e=()=>({path:r,error:Ji(400,{type:"invalid-body"})}),i=t.formMethod||"get",s=n?i.toUpperCase():i.toLowerCase(),f=sE(r);if(t.body!==void 0){if(t.formEncType==="text/plain"){if(!ha(s))return e();let A=typeof t.body=="string"?t.body:t.body instanceof FormData||t.body instanceof URLSearchParams?Array.from(t.body.entries()).reduce((R,D)=>{let[I,O]=D;return""+R+I+"="+O+` `},""):String(t.body);return{path:r,submission:{formMethod:s,formAction:f,formEncType:t.formEncType,formData:void 0,json:void 0,text:A}}}else if(t.formEncType==="application/json"){if(!ha(s))return e();try{let A=typeof t.body=="string"?JSON.parse(t.body):t.body;return{path:r,submission:{formMethod:s,formAction:f,formEncType:t.formEncType,formData:void 0,json:A,text:void 0}}}catch{return e()}}}nr(typeof FormData=="function","FormData is not available in this environment");let h,p;if(t.formData)h=$p(t.formData),p=t.formData;else if(t.body instanceof FormData)h=$p(t.body),p=t.body;else if(t.body instanceof URLSearchParams)h=t.body,p=hy(h);else if(t.body==null)h=new URLSearchParams,p=new FormData;else try{h=new URLSearchParams(t.body),p=hy(h)}catch{return e()}let S={formMethod:s,formAction:f,formEncType:t&&t.formEncType||"application/x-www-form-urlencoded",formData:p,json:void 0,text:void 0};if(ha(S.formMethod))return{path:r,submission:S};let b=Eo(r);return a&&b.search&&Tg(b.search)&&h.append("index",""),b.search="?"+h,{path:Ic(b),submission:S}}function DC(n,a){let r=n;if(a){let t=n.findIndex(e=>e.route.id===a);t>=0&&(r=n.slice(0,t))}return r}function fy(n,a,r,t,e,i,s,f,h,p,S,b,A,R,D,I){let O=I?Object.values(I)[0]:D?Object.values(D)[0]:void 0,V=n.createURL(a.location),N=n.createURL(e),G=I?Object.keys(I)[0]:void 0,Z=DC(r,G).filter((ee,te)=>{let{route:fe}=ee;if(fe.lazy)return!0;if(fe.loader==null)return!1;if(i)return fe.loader.hydrate?!0:a.loaderData[fe.id]===void 0&&(!a.errors||a.errors[fe.id]===void 0);if(PC(a.loaderData,a.matches[te],ee)||f.some(Y=>Y===ee.route.id))return!0;let ne=a.matches[te],oe=ee;return cy(ee,nn({currentUrl:V,currentParams:ne.params,nextUrl:N,nextParams:oe.params},t,{actionResult:O,defaultShouldRevalidate:s||V.pathname+V.search===N.pathname+N.search||V.search!==N.search||aE(ne,oe)}))}),H=[];return S.forEach((ee,te)=>{if(i||!r.some(q=>q.route.id===ee.routeId)||p.has(te))return;let fe=ju(A,ee.path,R);if(!fe){H.push({key:te,routeId:ee.routeId,path:ee.path,matches:null,match:null,controller:null});return}let ne=a.fetchers.get(te),oe=Kp(fe,ee.path),Y=!1;b.has(te)?Y=!1:h.includes(te)?Y=!0:ne&&ne.state!=="idle"&&ne.data===void 0?Y=s:Y=cy(oe,nn({currentUrl:V,currentParams:a.matches[a.matches.length-1].params,nextUrl:N,nextParams:r[r.length-1].params},t,{actionResult:O,defaultShouldRevalidate:s})),Y&&H.push({key:te,routeId:ee.routeId,path:ee.path,matches:fe,match:oe,controller:new AbortController})}),[Z,H]}function PC(n,a,r){let t=!a||r.route.id!==a.route.id,e=n[r.route.id]===void 0;return t||e}function aE(n,a){let r=n.route.path;return n.pathname!==a.pathname||r!=null&&r.endsWith("*")&&n.params["*"]!==a.params["*"]}function cy(n,a){if(n.route.shouldRevalidate){let r=n.route.shouldRevalidate(a);if(typeof r=="boolean")return r}return a.defaultShouldRevalidate}async function dy(n,a,r){if(!n.lazy)return;let t=await n.lazy();if(!n.lazy)return;let e=r[n.id];nr(e,"No route found in manifest");let i={};for(let s in t){let h=e[s]!==void 0&&s!=="hasErrorBoundary";qu(!h,'Route "'+e.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+s+'" will be ignored.')),!h&&!tC.has(s)&&(i[s]=t[s])}Object.assign(e,i),Object.assign(e,nn({},a(e),{lazy:void 0}))}async function uc(n,a,r,t,e,i,s,f,h){h===void 0&&(h={});let p,S,b,A=I=>{let O,V=new Promise((N,G)=>O=G);return b=()=>O(),a.signal.addEventListener("abort",b),Promise.race([I({request:a,params:r.params,context:h.requestContext}),V])};try{let I=r.route[n];if(r.route.lazy)if(I){let O,V=await Promise.all([A(I).catch(N=>{O=N}),dy(r.route,i,e)]);if(O)throw O;S=V[0]}else if(await dy(r.route,i,e),I=r.route[n],I)S=await A(I);else if(n==="action"){let O=new URL(a.url),V=O.pathname+O.search;throw Ji(405,{method:a.method,pathname:V,routeId:r.route.id})}else return{type:rn.data,data:void 0};else if(I)S=await A(I);else{let O=new URL(a.url),V=O.pathname+O.search;throw Ji(404,{pathname:V})}nr(S!==void 0,"You defined "+(n==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+n+"` ")+"function. Please return a value or `null`.")}catch(I){p=rn.error,S=I}finally{b&&a.signal.removeEventListener("abort",b)}if(MC(S)){let I=S.status;if(CC.has(I)){let V=S.headers.get("Location");if(nr(V,"Redirects returned/thrown from loaders/actions must have a Location header"),!nE.test(V))V=Wp(new URL(a.url),t.slice(0,t.indexOf(r)+1),s,!0,V,f);else if(!h.isStaticRequest){let N=new URL(a.url),G=V.startsWith("//")?new URL(N.protocol+V):new URL(V),z=Oc(G.pathname,s)!=null;G.origin===N.origin&&z&&(V=G.pathname+G.search+G.hash)}if(h.isStaticRequest)throw S.headers.set("Location",V),S;return{type:rn.redirect,status:I,location:V,revalidate:S.headers.get("X-Remix-Revalidate")!==null,reloadDocument:S.headers.get("X-Remix-Reload-Document")!==null}}if(h.isRouteRequest)throw{type:p===rn.error?rn.error:rn.data,response:S};let O;try{let V=S.headers.get("Content-Type");V&&/\bapplication\/json\b/.test(V)?S.body==null?O=null:O=await S.json():O=await S.text()}catch(V){return{type:rn.error,error:V}}return p===rn.error?{type:p,error:new bg(I,S.statusText,O),headers:S.headers}:{type:rn.data,data:O,statusCode:S.status,headers:S.headers}}if(p===rn.error)return{type:p,error:S};if(FC(S)){var R,D;return{type:rn.deferred,deferredData:S,statusCode:(R=S.init)==null?void 0:R.status,headers:((D=S.init)==null?void 0:D.headers)&&new Headers(S.init.headers)}}return{type:rn.data,data:S}}function fc(n,a,r,t){let e=n.createURL(sE(a)).toString(),i={signal:r};if(t&&ha(t.formMethod)){let{formMethod:s,formEncType:f}=t;i.method=s.toUpperCase(),f==="application/json"?(i.headers=new Headers({"Content-Type":f}),i.body=JSON.stringify(t.json)):f==="text/plain"?i.body=t.text:f==="application/x-www-form-urlencoded"&&t.formData?i.body=$p(t.formData):i.body=t.formData}return new Request(e,i)}function $p(n){let a=new URLSearchParams;for(let[r,t]of n.entries())a.append(r,typeof t=="string"?t:t.name);return a}function hy(n){let a=new FormData;for(let[r,t]of n.entries())a.append(r,t);return a}function IC(n,a,r,t,e){let i={},s=null,f,h=!1,p={};return r.forEach((S,b)=>{let A=a[b].route.id;if(nr(!ll(S),"Cannot handle redirect results in processLoaderData"),Gu(S)){let R=xc(n,A),D=S.error;t&&(D=Object.values(t)[0],t=void 0),s=s||{},s[R.route.id]==null&&(s[R.route.id]=D),i[A]=void 0,h||(h=!0,f=tE(S.error)?S.error.status:500),S.headers&&(p[A]=S.headers)}else ol(S)?(e.set(A,S.deferredData),i[A]=S.deferredData.data):i[A]=S.data,S.statusCode!=null&&S.statusCode!==200&&!h&&(f=S.statusCode),S.headers&&(p[A]=S.headers)}),t&&(s=t,i[Object.keys(t)[0]]=void 0),{loaderData:i,errors:s,statusCode:f||200,loaderHeaders:p}}function vy(n,a,r,t,e,i,s,f){let{loaderData:h,errors:p}=IC(a,r,t,e,f);for(let S=0;St.route.id===a)+1):[...n]).reverse().find(t=>t.route.hasErrorBoundary===!0)||n[0]}function gy(n){let a=n.length===1?n[0]:n.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:a}],route:a}}function Ji(n,a){let{pathname:r,routeId:t,method:e,type:i}=a===void 0?{}:a,s="Unknown Server Error",f="Unknown @remix-run/router error";return n===400?(s="Bad Request",e&&r&&t?f="You made a "+e+' request to "'+r+'" but '+('did not provide a `loader` for route "'+t+'", ')+"so there is no way to handle the request.":i==="defer-action"?f="defer() is not supported in actions":i==="invalid-body"&&(f="Unable to encode submission body")):n===403?(s="Forbidden",f='Route "'+t+'" does not match URL "'+r+'"'):n===404?(s="Not Found",f='No route matches URL "'+r+'"'):n===405&&(s="Method Not Allowed",e&&r&&t?f="You made a "+e.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+t+'", ')+"so there is no way to handle the request.":e&&(f='Invalid request method "'+e.toUpperCase()+'"')),new bg(n||500,s,new Error(f),!0)}function my(n){for(let a=n.length-1;a>=0;a--){let r=n[a];if(ll(r))return{result:r,idx:a}}}function sE(n){let a=typeof n=="string"?Eo(n):n;return Ic(nn({},a,{hash:""}))}function OC(n,a){return n.pathname!==a.pathname||n.search!==a.search?!1:n.hash===""?a.hash!=="":n.hash===a.hash?!0:a.hash!==""}function ol(n){return n.type===rn.deferred}function Gu(n){return n.type===rn.error}function ll(n){return(n&&n.type)===rn.redirect}function FC(n){let a=n;return a&&typeof a=="object"&&typeof a.data=="object"&&typeof a.subscribe=="function"&&typeof a.cancel=="function"&&typeof a.resolveData=="function"}function MC(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.headers=="object"&&typeof n.body<"u"}function BC(n){return TC.has(n.toLowerCase())}function ha(n){return _C.has(n.toLowerCase())}async function yy(n,a,r,t,e,i){for(let s=0;sb.route.id===h.route.id),S=p!=null&&!aE(p,h)&&(i&&i[h.route.id])!==void 0;if(ol(f)&&(e||S)){let b=t[s];nr(b,"Expected an AbortSignal for revalidating fetcher deferred result"),await oE(f,b,e).then(A=>{A&&(r[s]=A||r[s])})}}}async function oE(n,a,r){if(r===void 0&&(r=!1),!await n.deferredData.resolveData(a)){if(r)try{return{type:rn.data,data:n.deferredData.unwrappedData}}catch(e){return{type:rn.error,error:e}}return{type:rn.data,data:n.deferredData.data}}}function Tg(n){return new URLSearchParams(n).getAll("index").some(a=>a==="")}function Kp(n,a){let r=typeof a=="string"?Eo(a).search:a.search;if(n[n.length-1].route.index&&Tg(r||""))return n[n.length-1];let t=eE(n);return t[t.length-1]}function xy(n){let{formMethod:a,formAction:r,formEncType:t,text:e,formData:i,json:s}=n;if(!(!a||!r||!t)){if(e!=null)return{formMethod:a,formAction:r,formEncType:t,formData:void 0,json:void 0,text:e};if(i!=null)return{formMethod:a,formAction:r,formEncType:t,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:a,formAction:r,formEncType:t,formData:void 0,json:s,text:void 0}}}function sp(n,a){return a?{state:"loading",location:n,formMethod:a.formMethod,formAction:a.formAction,formEncType:a.formEncType,formData:a.formData,json:a.json,text:a.text}:{state:"loading",location:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function NC(n,a){return{state:"submitting",location:n,formMethod:a.formMethod,formAction:a.formAction,formEncType:a.formEncType,formData:a.formData,json:a.json,text:a.text}}function cc(n,a){return n?{state:"loading",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text,data:a}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:a}}function UC(n,a){return{state:"submitting",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text,data:a?a.data:void 0}}function ho(n){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:n}}function HC(n,a){try{let r=n.sessionStorage.getItem(iE);if(r){let t=JSON.parse(r);for(let[e,i]of Object.entries(t||{}))i&&Array.isArray(i)&&a.set(e,new Set(i||[]))}}catch{}}function VC(n,a){if(a.size>0){let r={};for(let[t,e]of a)r[t]=[...e];try{n.sessionStorage.setItem(iE,JSON.stringify(r))}catch(t){qu(!1,"Failed to save applied view transitions in sessionStorage ("+t+").")}}}/** * React Router v6.22.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function E0(){return E0=Object.assign?Object.assign.bind():function(n){for(var a=1;a{f.current=!0}),Ce.useCallback(function(p,S){if(S===void 0&&(S={}),!f.current)return;if(typeof p=="number"){t.go(p);return}let b=_g(p,JSON.parse(s),i,S.relative==="path");n==null&&a!=="/"&&(b.pathname=b.pathname==="/"?a:go([a,b.pathname])),(S.replace?t.replace:t.push)(b,S.state,S)},[a,t,s,i,n])}function xP(){let{matches:n}=Ce.useContext(So),a=n[n.length-1];return a?a.params:{}}function GC(n,a,r,t){Mc()||nr(!1);let{navigator:e}=Ce.useContext(Fc),{matches:i}=Ce.useContext(So),s=i[i.length-1],f=s?s.params:{};s&&s.pathname;let h=s?s.pathnameBase:"/";s&&s.route;let p=W0(),S;S=p;let b=S.pathname||"/",A=b;if(h!=="/"){let I=h.replace(/^\//,"").split("/");A="/"+b.replace(/^\//,"").split("/").slice(I.length).join("/")}let R=ju(n,{pathname:A});return YC(R&&R.map(I=>Object.assign({},I,{params:Object.assign({},f,I.params),pathname:go([h,e.encodeLocation?e.encodeLocation(I.pathname).pathname:I.pathname]),pathnameBase:I.pathnameBase==="/"?h:go([h,e.encodeLocation?e.encodeLocation(I.pathnameBase).pathname:I.pathnameBase])})),i,r,t)}function zC(){let n=QC(),a=tE(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),r=n instanceof Error?n.stack:null,e={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return Ce.createElement(Ce.Fragment,null,Ce.createElement("h2",null,"Unexpected Application Error!"),Ce.createElement("h3",{style:{fontStyle:"italic"}},a),r?Ce.createElement("pre",{style:e},r):null,null)}const WC=Ce.createElement(zC,null);class $C extends Ce.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,r){return r.location!==a.location||r.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:r.error,location:r.location,revalidation:a.revalidation||r.revalidation}}componentDidCatch(a,r){console.error("React Router caught the following error during render",a,r)}render(){return this.state.error!==void 0?Ce.createElement(So.Provider,{value:this.props.routeContext},Ce.createElement(uE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function KC(n){let{routeContext:a,match:r,children:t}=n,e=Ce.useContext(z0);return e&&e.static&&e.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(e.staticContext._deepestRenderedBoundaryId=r.route.id),Ce.createElement(So.Provider,{value:a},t)}function YC(n,a,r,t){var e;if(a===void 0&&(a=[]),r===void 0&&(r=null),t===void 0&&(t=null),n==null){var i;if((i=r)!=null&&i.errors)n=r.matches;else return null}let s=n,f=(e=r)==null?void 0:e.errors;if(f!=null){let S=s.findIndex(b=>b.route.id&&(f==null?void 0:f[b.route.id]));S>=0||nr(!1),s=s.slice(0,Math.min(s.length,S+1))}let h=!1,p=-1;if(r&&t&&t.v7_partialHydration)for(let S=0;S=0?s=s.slice(0,p+1):s=[s[0]];break}}}return s.reduceRight((S,b,A)=>{let R,D=!1,I=null,O=null;r&&(R=f&&b.route.id?f[b.route.id]:void 0,I=b.route.errorElement||WC,h&&(p<0&&A===0?(e2("route-fallback"),D=!0,O=null):p===A&&(D=!0,O=b.route.hydrateFallbackElement||null)));let V=a.concat(s.slice(0,A+1)),N=()=>{let G;return R?G=I:D?G=O:b.route.Component?G=Ce.createElement(b.route.Component,null):b.route.element?G=b.route.element:G=S,Ce.createElement(KC,{match:b,routeContext:{outlet:S,matches:V,isDataRoute:r!=null},children:G})};return r&&(b.route.ErrorBoundary||b.route.errorElement||A===0)?Ce.createElement($C,{location:r.location,revalidation:r.revalidation,component:I,error:R,children:N(),routeContext:{outlet:null,matches:V,isDataRoute:!0}}):N()},null)}var dE=function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n}(dE||{}),hE=function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n}(hE||{});function XC(n){let a=Ce.useContext(z0);return a||nr(!1),a}function qC(n){let a=Ce.useContext(lE);return a||nr(!1),a}function ZC(n){let a=Ce.useContext(So);return a||nr(!1),a}function vE(n){let a=ZC(),r=a.matches[a.matches.length-1];return r.route.id||nr(!1),r.route.id}function QC(){var n;let a=Ce.useContext(uE),r=qC(hE.UseRouteError),t=vE();return a!==void 0?a:(n=r.errors)==null?void 0:n[t]}function JC(){let{router:n}=XC(dE.UseNavigateStable),a=vE(),r=Ce.useRef(!1);return fE(()=>{r.current=!0}),Ce.useCallback(function(e,i){i===void 0&&(i={}),r.current&&(typeof e=="number"?n.navigate(e):n.navigate(e,E0({fromRouteId:a},i)))},[n,a])}const Ey={};function e2(n,a,r){Ey[n]||(Ey[n]=!0)}function EP(n){let{to:a,replace:r,state:t,relative:e}=n;Mc()||nr(!1);let{future:i,static:s}=Ce.useContext(Fc),{matches:f}=Ce.useContext(So),{pathname:h}=W0(),p=cE(),S=_g(a,Sg(f,i.v7_relativeSplatPath),h,e==="path"),b=JSON.stringify(S);return Ce.useEffect(()=>p(JSON.parse(b),{replace:r,state:t,relative:e}),[p,b,e,r,t]),null}function t2(n){let{basename:a="/",children:r=null,location:t,navigationType:e=mn.Pop,navigator:i,static:s=!1,future:f}=n;Mc()&&nr(!1);let h=a.replace(/^\/*/,"/"),p=Ce.useMemo(()=>({basename:h,navigator:i,static:s,future:E0({v7_relativeSplatPath:!1},f)}),[h,f,i,s]);typeof t=="string"&&(t=Eo(t));let{pathname:S="/",search:b="",hash:A="",state:R=null,key:D="default"}=t,I=Ce.useMemo(()=>{let O=Oc(S,h);return O==null?null:{location:{pathname:O,search:b,hash:A,state:R,key:D},navigationType:e}},[h,S,b,A,R,D,e]);return I==null?null:Ce.createElement(Fc.Provider,{value:p},Ce.createElement(Cg.Provider,{children:r,value:I}))}new Promise(()=>{});function r2(n){let a={hasErrorBoundary:n.ErrorBoundary!=null||n.errorElement!=null};return n.Component&&Object.assign(a,{element:Ce.createElement(n.Component),Component:void 0}),n.HydrateFallback&&Object.assign(a,{hydrateFallbackElement:Ce.createElement(n.HydrateFallback),HydrateFallback:void 0}),n.ErrorBoundary&&Object.assign(a,{errorElement:Ce.createElement(n.ErrorBoundary),ErrorBoundary:void 0}),a}/** * React Router DOM v6.22.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function S0(){return S0=Object.assign?Object.assign.bind():function(n){for(var a=1;a{let t=n[r];return a.concat(Array.isArray(t)?t.map(e=>[r,e]):[[r,t]])},[]))}function n2(n,a){let r=Yp(n);return a&&a.forEach((t,e)=>{r.has(e)||a.getAll(e).forEach(i=>{r.append(e,i)})}),r}const i2="6";try{window.__reactRouterVersion=i2}catch{}function SP(n,a){return LC({basename:void 0,future:S0({},void 0,{v7_prependBasename:!0}),history:QT({window:void 0}),hydrationData:a2(),routes:n,mapRouteProperties:r2,window:void 0}).initialize()}function a2(){var n;let a=(n=window)==null?void 0:n.__staticRouterHydrationData;return a&&a.errors&&(a=S0({},a,{errors:s2(a.errors)})),a}function s2(n){if(!n)return null;let a=Object.entries(n),r={};for(let[t,e]of a)if(e&&e.__type==="RouteErrorResponse")r[t]=new bg(e.status,e.statusText,e.data,e.internal===!0);else if(e&&e.__type==="Error"){if(e.__subType){let i=window[e.__subType];if(typeof i=="function")try{let s=new i(e.message);s.stack="",r[t]=s}catch{}}if(r[t]==null){let i=new Error(e.message);i.stack="",r[t]=i}}else r[t]=e;return r}const o2=Ce.createContext({isTransitioning:!1}),l2=Ce.createContext(new Map),u2="startTransition",Sy=p_[u2],f2="flushSync",_y=Mb[f2];function c2(n){Sy?Sy(n):n()}function dc(n){_y?_y(n):n()}class d2{constructor(){this.status="pending",this.promise=new Promise((a,r)=>{this.resolve=t=>{this.status==="pending"&&(this.status="resolved",a(t))},this.reject=t=>{this.status==="pending"&&(this.status="rejected",r(t))}})}}function _P(n){let{fallbackElement:a,router:r,future:t}=n,[e,i]=Ce.useState(r.state),[s,f]=Ce.useState(),[h,p]=Ce.useState({isTransitioning:!1}),[S,b]=Ce.useState(),[A,R]=Ce.useState(),[D,I]=Ce.useState(),O=Ce.useRef(new Map),{v7_startTransition:V}=t||{},N=Ce.useCallback(ee=>{V?c2(ee):ee()},[V]),G=Ce.useCallback((ee,te)=>{let{deletedFetchers:fe,unstable_flushSync:ne,unstable_viewTransitionOpts:oe}=te;fe.forEach(q=>O.current.delete(q)),ee.fetchers.forEach((q,Q)=>{q.data!==void 0&&O.current.set(Q,q.data)});let Y=r.window==null||typeof r.window.document.startViewTransition!="function";if(!oe||Y){ne?dc(()=>i(ee)):N(()=>i(ee));return}if(ne){dc(()=>{A&&(S&&S.resolve(),A.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})});let q=r.window.document.startViewTransition(()=>{dc(()=>i(ee))});q.finished.finally(()=>{dc(()=>{b(void 0),R(void 0),f(void 0),p({isTransitioning:!1})})}),dc(()=>R(q));return}A?(S&&S.resolve(),A.skipTransition(),I({state:ee,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})):(f(ee),p({isTransitioning:!0,flushSync:!1,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation}))},[r.window,A,S,O,N]);Ce.useLayoutEffect(()=>r.subscribe(G),[r,G]),Ce.useEffect(()=>{h.isTransitioning&&!h.flushSync&&b(new d2)},[h]),Ce.useEffect(()=>{if(S&&s&&r.window){let ee=s,te=S.promise,fe=r.window.document.startViewTransition(async()=>{N(()=>i(ee)),await te});fe.finished.finally(()=>{b(void 0),R(void 0),f(void 0),p({isTransitioning:!1})}),R(fe)}},[N,s,S,r.window]),Ce.useEffect(()=>{S&&s&&e.location.key===s.location.key&&S.resolve()},[S,A,e.location,s]),Ce.useEffect(()=>{!h.isTransitioning&&D&&(f(D.state),p({isTransitioning:!0,flushSync:!1,currentLocation:D.currentLocation,nextLocation:D.nextLocation}),I(void 0))},[h.isTransitioning,D]),Ce.useEffect(()=>{},[]);let z=Ce.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:ee=>r.navigate(ee),push:(ee,te,fe)=>r.navigate(ee,{state:te,preventScrollReset:fe==null?void 0:fe.preventScrollReset}),replace:(ee,te,fe)=>r.navigate(ee,{replace:!0,state:te,preventScrollReset:fe==null?void 0:fe.preventScrollReset})}),[r]),Z=r.basename||"/",H=Ce.useMemo(()=>({router:r,navigator:z,static:!1,basename:Z}),[r,z,Z]);return Ce.createElement(Ce.Fragment,null,Ce.createElement(z0.Provider,{value:H},Ce.createElement(lE.Provider,{value:e},Ce.createElement(l2.Provider,{value:O.current},Ce.createElement(o2.Provider,{value:h},Ce.createElement(t2,{basename:Z,location:e.location,navigationType:e.historyAction,navigator:z,future:{v7_relativeSplatPath:r.future.v7_relativeSplatPath}},e.initialized||r.future.v7_partialHydration?Ce.createElement(h2,{routes:r.routes,future:r.future,state:e}):a))))),null)}function h2(n){let{routes:a,future:r,state:t}=n;return GC(a,void 0,t,r)}var by;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(by||(by={}));var Ty;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(Ty||(Ty={}));function bP(n){let a=Ce.useRef(Yp(n)),r=Ce.useRef(!1),t=W0(),e=Ce.useMemo(()=>n2(t.search,r.current?null:a.current),[t.search]),i=cE(),s=Ce.useCallback((f,h)=>{const p=Yp(typeof f=="function"?f(e):f);r.current=!0,i("?"+p,h)},[i,e]);return[e,s]}var Th={exports:{}};function v2(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ch={exports:{}};const p2={},g2=Object.freeze(Object.defineProperty({__proto__:null,default:p2},Symbol.toStringTag,{value:"Module"})),m2=GS(g2);var y2=Ch.exports,Cy;function or(){return Cy||(Cy=1,function(n,a){(function(r,t){n.exports=t()})(y2,function(){var r=r||function(t,e){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof Xv<"u"&&Xv.crypto&&(i=Xv.crypto),!i&&typeof v2=="function")try{i=m2}catch{}var s=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},f=Object.create||function(){function N(){}return function(G){var z;return N.prototype=G,z=new N,N.prototype=null,z}}(),h={},p=h.lib={},S=p.Base=function(){return{extend:function(N){var G=f(this);return N&&G.mixIn(N),(!G.hasOwnProperty("init")||this.init===G.init)&&(G.init=function(){G.$super.init.apply(this,arguments)}),G.init.prototype=G,G.$super=this,G},create:function(){var N=this.extend();return N.init.apply(N,arguments),N},init:function(){},mixIn:function(N){for(var G in N)N.hasOwnProperty(G)&&(this[G]=N[G]);N.hasOwnProperty("toString")&&(this.toString=N.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),b=p.WordArray=S.extend({init:function(N,G){N=this.words=N||[],G!=e?this.sigBytes=G:this.sigBytes=N.length*4},toString:function(N){return(N||R).stringify(this)},concat:function(N){var G=this.words,z=N.words,Z=this.sigBytes,H=N.sigBytes;if(this.clamp(),Z%4)for(var ee=0;ee>>2]>>>24-ee%4*8&255;G[Z+ee>>>2]|=te<<24-(Z+ee)%4*8}else for(var fe=0;fe>>2]=z[fe>>>2];return this.sigBytes+=H,this},clamp:function(){var N=this.words,G=this.sigBytes;N[G>>>2]&=4294967295<<32-G%4*8,N.length=t.ceil(G/4)},clone:function(){var N=S.clone.call(this);return N.words=this.words.slice(0),N},random:function(N){for(var G=[],z=0;z>>2]>>>24-H%4*8&255;Z.push((ee>>>4).toString(16)),Z.push((ee&15).toString(16))}return Z.join("")},parse:function(N){for(var G=N.length,z=[],Z=0;Z>>3]|=parseInt(N.substr(Z,2),16)<<24-Z%8*4;return new b.init(z,G/2)}},D=A.Latin1={stringify:function(N){for(var G=N.words,z=N.sigBytes,Z=[],H=0;H>>2]>>>24-H%4*8&255;Z.push(String.fromCharCode(ee))}return Z.join("")},parse:function(N){for(var G=N.length,z=[],Z=0;Z>>2]|=(N.charCodeAt(Z)&255)<<24-Z%4*8;return new b.init(z,G)}},I=A.Utf8={stringify:function(N){try{return decodeURIComponent(escape(D.stringify(N)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(N){return D.parse(unescape(encodeURIComponent(N)))}},O=p.BufferedBlockAlgorithm=S.extend({reset:function(){this._data=new b.init,this._nDataBytes=0},_append:function(N){typeof N=="string"&&(N=I.parse(N)),this._data.concat(N),this._nDataBytes+=N.sigBytes},_process:function(N){var G,z=this._data,Z=z.words,H=z.sigBytes,ee=this.blockSize,te=ee*4,fe=H/te;N?fe=t.ceil(fe):fe=t.max((fe|0)-this._minBufferSize,0);var ne=fe*ee,oe=t.min(ne*4,H);if(ne){for(var Y=0;Y>>2]|=h[b]<<24-b%4*8;s.call(this,S,p)}else s.apply(this,arguments)};f.prototype=i}}(),r.lib.WordArray})}(Ah)),Ah.exports}var kh={exports:{}},_2=kh.exports,ky;function b2(){return ky||(ky=1,function(n,a){(function(r,t){n.exports=t(or())})(_2,function(r){return function(){var t=r,e=t.lib,i=e.WordArray,s=t.enc;s.Utf16=s.Utf16BE={stringify:function(h){for(var p=h.words,S=h.sigBytes,b=[],A=0;A>>2]>>>16-A%4*8&65535;b.push(String.fromCharCode(R))}return b.join("")},parse:function(h){for(var p=h.length,S=[],b=0;b>>1]|=h.charCodeAt(b)<<16-b%2*16;return i.create(S,p*2)}},s.Utf16LE={stringify:function(h){for(var p=h.words,S=h.sigBytes,b=[],A=0;A>>2]>>>16-A%4*8&65535);b.push(String.fromCharCode(R))}return b.join("")},parse:function(h){for(var p=h.length,S=[],b=0;b>>1]|=f(h.charCodeAt(b)<<16-b%2*16);return i.create(S,p*2)}};function f(h){return h<<8&4278255360|h>>>8&16711935}}(),r.enc.Utf16})}(kh)),kh.exports}var Lh={exports:{}},T2=Lh.exports,Ly;function pl(){return Ly||(Ly=1,function(n,a){(function(r,t){n.exports=t(or())})(T2,function(r){return function(){var t=r,e=t.lib,i=e.WordArray,s=t.enc;s.Base64={stringify:function(h){var p=h.words,S=h.sigBytes,b=this._map;h.clamp();for(var A=[],R=0;R>>2]>>>24-R%4*8&255,I=p[R+1>>>2]>>>24-(R+1)%4*8&255,O=p[R+2>>>2]>>>24-(R+2)%4*8&255,V=D<<16|I<<8|O,N=0;N<4&&R+N*.75>>6*(3-N)&63));var G=b.charAt(64);if(G)for(;A.length%4;)A.push(G);return A.join("")},parse:function(h){var p=h.length,S=this._map,b=this._reverseMap;if(!b){b=this._reverseMap=[];for(var A=0;A>>6-R%4*2,O=D|I;b[A>>>2]|=O<<24-A%4*8,A++}return i.create(b,A)}}(),r.enc.Base64})}(Lh)),Lh.exports}var Rh={exports:{}},C2=Rh.exports,Ry;function w2(){return Ry||(Ry=1,function(n,a){(function(r,t){n.exports=t(or())})(C2,function(r){return function(){var t=r,e=t.lib,i=e.WordArray,s=t.enc;s.Base64url={stringify:function(h,p){p===void 0&&(p=!0);var S=h.words,b=h.sigBytes,A=p?this._safe_map:this._map;h.clamp();for(var R=[],D=0;D>>2]>>>24-D%4*8&255,O=S[D+1>>>2]>>>24-(D+1)%4*8&255,V=S[D+2>>>2]>>>24-(D+2)%4*8&255,N=I<<16|O<<8|V,G=0;G<4&&D+G*.75>>6*(3-G)&63));var z=A.charAt(64);if(z)for(;R.length%4;)R.push(z);return R.join("")},parse:function(h,p){p===void 0&&(p=!0);var S=h.length,b=p?this._safe_map:this._map,A=this._reverseMap;if(!A){A=this._reverseMap=[];for(var R=0;R>>6-R%4*2,O=D|I;b[A>>>2]|=O<<24-A%4*8,A++}return i.create(b,A)}}(),r.enc.Base64url})}(Rh)),Rh.exports}var Dh={exports:{}},A2=Dh.exports,Dy;function gl(){return Dy||(Dy=1,function(n,a){(function(r,t){n.exports=t(or())})(A2,function(r){return function(t){var e=r,i=e.lib,s=i.WordArray,f=i.Hasher,h=e.algo,p=[];(function(){for(var I=0;I<64;I++)p[I]=t.abs(t.sin(I+1))*4294967296|0})();var S=h.MD5=f.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(I,O){for(var V=0;V<16;V++){var N=O+V,G=I[N];I[N]=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360}var z=this._hash.words,Z=I[O+0],H=I[O+1],ee=I[O+2],te=I[O+3],fe=I[O+4],ne=I[O+5],oe=I[O+6],Y=I[O+7],q=I[O+8],Q=I[O+9],be=I[O+10],ge=I[O+11],ve=I[O+12],re=I[O+13],j=I[O+14],ye=I[O+15],X=z[0],ce=z[1],Ae=z[2],_e=z[3];X=b(X,ce,Ae,_e,Z,7,p[0]),_e=b(_e,X,ce,Ae,H,12,p[1]),Ae=b(Ae,_e,X,ce,ee,17,p[2]),ce=b(ce,Ae,_e,X,te,22,p[3]),X=b(X,ce,Ae,_e,fe,7,p[4]),_e=b(_e,X,ce,Ae,ne,12,p[5]),Ae=b(Ae,_e,X,ce,oe,17,p[6]),ce=b(ce,Ae,_e,X,Y,22,p[7]),X=b(X,ce,Ae,_e,q,7,p[8]),_e=b(_e,X,ce,Ae,Q,12,p[9]),Ae=b(Ae,_e,X,ce,be,17,p[10]),ce=b(ce,Ae,_e,X,ge,22,p[11]),X=b(X,ce,Ae,_e,ve,7,p[12]),_e=b(_e,X,ce,Ae,re,12,p[13]),Ae=b(Ae,_e,X,ce,j,17,p[14]),ce=b(ce,Ae,_e,X,ye,22,p[15]),X=A(X,ce,Ae,_e,H,5,p[16]),_e=A(_e,X,ce,Ae,oe,9,p[17]),Ae=A(Ae,_e,X,ce,ge,14,p[18]),ce=A(ce,Ae,_e,X,Z,20,p[19]),X=A(X,ce,Ae,_e,ne,5,p[20]),_e=A(_e,X,ce,Ae,be,9,p[21]),Ae=A(Ae,_e,X,ce,ye,14,p[22]),ce=A(ce,Ae,_e,X,fe,20,p[23]),X=A(X,ce,Ae,_e,Q,5,p[24]),_e=A(_e,X,ce,Ae,j,9,p[25]),Ae=A(Ae,_e,X,ce,te,14,p[26]),ce=A(ce,Ae,_e,X,q,20,p[27]),X=A(X,ce,Ae,_e,re,5,p[28]),_e=A(_e,X,ce,Ae,ee,9,p[29]),Ae=A(Ae,_e,X,ce,Y,14,p[30]),ce=A(ce,Ae,_e,X,ve,20,p[31]),X=R(X,ce,Ae,_e,ne,4,p[32]),_e=R(_e,X,ce,Ae,q,11,p[33]),Ae=R(Ae,_e,X,ce,ge,16,p[34]),ce=R(ce,Ae,_e,X,j,23,p[35]),X=R(X,ce,Ae,_e,H,4,p[36]),_e=R(_e,X,ce,Ae,fe,11,p[37]),Ae=R(Ae,_e,X,ce,Y,16,p[38]),ce=R(ce,Ae,_e,X,be,23,p[39]),X=R(X,ce,Ae,_e,re,4,p[40]),_e=R(_e,X,ce,Ae,Z,11,p[41]),Ae=R(Ae,_e,X,ce,te,16,p[42]),ce=R(ce,Ae,_e,X,oe,23,p[43]),X=R(X,ce,Ae,_e,Q,4,p[44]),_e=R(_e,X,ce,Ae,ve,11,p[45]),Ae=R(Ae,_e,X,ce,ye,16,p[46]),ce=R(ce,Ae,_e,X,ee,23,p[47]),X=D(X,ce,Ae,_e,Z,6,p[48]),_e=D(_e,X,ce,Ae,Y,10,p[49]),Ae=D(Ae,_e,X,ce,j,15,p[50]),ce=D(ce,Ae,_e,X,ne,21,p[51]),X=D(X,ce,Ae,_e,ve,6,p[52]),_e=D(_e,X,ce,Ae,te,10,p[53]),Ae=D(Ae,_e,X,ce,be,15,p[54]),ce=D(ce,Ae,_e,X,H,21,p[55]),X=D(X,ce,Ae,_e,q,6,p[56]),_e=D(_e,X,ce,Ae,ye,10,p[57]),Ae=D(Ae,_e,X,ce,oe,15,p[58]),ce=D(ce,Ae,_e,X,re,21,p[59]),X=D(X,ce,Ae,_e,fe,6,p[60]),_e=D(_e,X,ce,Ae,ge,10,p[61]),Ae=D(Ae,_e,X,ce,ee,15,p[62]),ce=D(ce,Ae,_e,X,Q,21,p[63]),z[0]=z[0]+X|0,z[1]=z[1]+ce|0,z[2]=z[2]+Ae|0,z[3]=z[3]+_e|0},_doFinalize:function(){var I=this._data,O=I.words,V=this._nDataBytes*8,N=I.sigBytes*8;O[N>>>5]|=128<<24-N%32;var G=t.floor(V/4294967296),z=V;O[(N+64>>>9<<4)+15]=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360,O[(N+64>>>9<<4)+14]=(z<<8|z>>>24)&16711935|(z<<24|z>>>8)&4278255360,I.sigBytes=(O.length+1)*4,this._process();for(var Z=this._hash,H=Z.words,ee=0;ee<4;ee++){var te=H[ee];H[ee]=(te<<8|te>>>24)&16711935|(te<<24|te>>>8)&4278255360}return Z},clone:function(){var I=f.clone.call(this);return I._hash=this._hash.clone(),I}});function b(I,O,V,N,G,z,Z){var H=I+(O&V|~O&N)+G+Z;return(H<>>32-z)+O}function A(I,O,V,N,G,z,Z){var H=I+(O&N|V&~N)+G+Z;return(H<>>32-z)+O}function R(I,O,V,N,G,z,Z){var H=I+(O^V^N)+G+Z;return(H<>>32-z)+O}function D(I,O,V,N,G,z,Z){var H=I+(V^(O|~N))+G+Z;return(H<>>32-z)+O}e.MD5=f._createHelper(S),e.HmacMD5=f._createHmacHelper(S)}(Math),r.MD5})}(Dh)),Dh.exports}var Ph={exports:{}},k2=Ph.exports,Py;function pE(){return Py||(Py=1,function(n,a){(function(r,t){n.exports=t(or())})(k2,function(r){return function(){var t=r,e=t.lib,i=e.WordArray,s=e.Hasher,f=t.algo,h=[],p=f.SHA1=s.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(S,b){for(var A=this._hash.words,R=A[0],D=A[1],I=A[2],O=A[3],V=A[4],N=0;N<80;N++){if(N<16)h[N]=S[b+N]|0;else{var G=h[N-3]^h[N-8]^h[N-14]^h[N-16];h[N]=G<<1|G>>>31}var z=(R<<5|R>>>27)+V+h[N];N<20?z+=(D&I|~D&O)+1518500249:N<40?z+=(D^I^O)+1859775393:N<60?z+=(D&I|D&O|I&O)-1894007588:z+=(D^I^O)-899497514,V=O,O=I,I=D<<30|D>>>2,D=R,R=z}A[0]=A[0]+R|0,A[1]=A[1]+D|0,A[2]=A[2]+I|0,A[3]=A[3]+O|0,A[4]=A[4]+V|0},_doFinalize:function(){var S=this._data,b=S.words,A=this._nDataBytes*8,R=S.sigBytes*8;return b[R>>>5]|=128<<24-R%32,b[(R+64>>>9<<4)+14]=Math.floor(A/4294967296),b[(R+64>>>9<<4)+15]=A,S.sigBytes=b.length*4,this._process(),this._hash},clone:function(){var S=s.clone.call(this);return S._hash=this._hash.clone(),S}});t.SHA1=s._createHelper(p),t.HmacSHA1=s._createHmacHelper(p)}(),r.SHA1})}(Ph)),Ph.exports}var Ih={exports:{}},L2=Ih.exports,Iy;function wg(){return Iy||(Iy=1,function(n,a){(function(r,t){n.exports=t(or())})(L2,function(r){return function(t){var e=r,i=e.lib,s=i.WordArray,f=i.Hasher,h=e.algo,p=[],S=[];(function(){function R(V){for(var N=t.sqrt(V),G=2;G<=N;G++)if(!(V%G))return!1;return!0}function D(V){return(V-(V|0))*4294967296|0}for(var I=2,O=0;O<64;)R(I)&&(O<8&&(p[O]=D(t.pow(I,1/2))),S[O]=D(t.pow(I,1/3)),O++),I++})();var b=[],A=h.SHA256=f.extend({_doReset:function(){this._hash=new s.init(p.slice(0))},_doProcessBlock:function(R,D){for(var I=this._hash.words,O=I[0],V=I[1],N=I[2],G=I[3],z=I[4],Z=I[5],H=I[6],ee=I[7],te=0;te<64;te++){if(te<16)b[te]=R[D+te]|0;else{var fe=b[te-15],ne=(fe<<25|fe>>>7)^(fe<<14|fe>>>18)^fe>>>3,oe=b[te-2],Y=(oe<<15|oe>>>17)^(oe<<13|oe>>>19)^oe>>>10;b[te]=ne+b[te-7]+Y+b[te-16]}var q=z&Z^~z&H,Q=O&V^O&N^V&N,be=(O<<30|O>>>2)^(O<<19|O>>>13)^(O<<10|O>>>22),ge=(z<<26|z>>>6)^(z<<21|z>>>11)^(z<<7|z>>>25),ve=ee+ge+q+S[te]+b[te],re=be+Q;ee=H,H=Z,Z=z,z=G+ve|0,G=N,N=V,V=O,O=ve+re|0}I[0]=I[0]+O|0,I[1]=I[1]+V|0,I[2]=I[2]+N|0,I[3]=I[3]+G|0,I[4]=I[4]+z|0,I[5]=I[5]+Z|0,I[6]=I[6]+H|0,I[7]=I[7]+ee|0},_doFinalize:function(){var R=this._data,D=R.words,I=this._nDataBytes*8,O=R.sigBytes*8;return D[O>>>5]|=128<<24-O%32,D[(O+64>>>9<<4)+14]=t.floor(I/4294967296),D[(O+64>>>9<<4)+15]=I,R.sigBytes=D.length*4,this._process(),this._hash},clone:function(){var R=f.clone.call(this);return R._hash=this._hash.clone(),R}});e.SHA256=f._createHelper(A),e.HmacSHA256=f._createHmacHelper(A)}(Math),r.SHA256})}(Ih)),Ih.exports}var Oh={exports:{}},R2=Oh.exports,Oy;function D2(){return Oy||(Oy=1,function(n,a){(function(r,t,e){n.exports=t(or(),wg())})(R2,function(r){return function(){var t=r,e=t.lib,i=e.WordArray,s=t.algo,f=s.SHA256,h=s.SHA224=f.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var p=f._doFinalize.call(this);return p.sigBytes-=4,p}});t.SHA224=f._createHelper(h),t.HmacSHA224=f._createHmacHelper(h)}(),r.SHA224})}(Oh)),Oh.exports}var Fh={exports:{}},P2=Fh.exports,Fy;function gE(){return Fy||(Fy=1,function(n,a){(function(r,t,e){n.exports=t(or(),$0())})(P2,function(r){return function(){var t=r,e=t.lib,i=e.Hasher,s=t.x64,f=s.Word,h=s.WordArray,p=t.algo;function S(){return f.create.apply(f,arguments)}var b=[S(1116352408,3609767458),S(1899447441,602891725),S(3049323471,3964484399),S(3921009573,2173295548),S(961987163,4081628472),S(1508970993,3053834265),S(2453635748,2937671579),S(2870763221,3664609560),S(3624381080,2734883394),S(310598401,1164996542),S(607225278,1323610764),S(1426881987,3590304994),S(1925078388,4068182383),S(2162078206,991336113),S(2614888103,633803317),S(3248222580,3479774868),S(3835390401,2666613458),S(4022224774,944711139),S(264347078,2341262773),S(604807628,2007800933),S(770255983,1495990901),S(1249150122,1856431235),S(1555081692,3175218132),S(1996064986,2198950837),S(2554220882,3999719339),S(2821834349,766784016),S(2952996808,2566594879),S(3210313671,3203337956),S(3336571891,1034457026),S(3584528711,2466948901),S(113926993,3758326383),S(338241895,168717936),S(666307205,1188179964),S(773529912,1546045734),S(1294757372,1522805485),S(1396182291,2643833823),S(1695183700,2343527390),S(1986661051,1014477480),S(2177026350,1206759142),S(2456956037,344077627),S(2730485921,1290863460),S(2820302411,3158454273),S(3259730800,3505952657),S(3345764771,106217008),S(3516065817,3606008344),S(3600352804,1432725776),S(4094571909,1467031594),S(275423344,851169720),S(430227734,3100823752),S(506948616,1363258195),S(659060556,3750685593),S(883997877,3785050280),S(958139571,3318307427),S(1322822218,3812723403),S(1537002063,2003034995),S(1747873779,3602036899),S(1955562222,1575990012),S(2024104815,1125592928),S(2227730452,2716904306),S(2361852424,442776044),S(2428436474,593698344),S(2756734187,3733110249),S(3204031479,2999351573),S(3329325298,3815920427),S(3391569614,3928383900),S(3515267271,566280711),S(3940187606,3454069534),S(4118630271,4000239992),S(116418474,1914138554),S(174292421,2731055270),S(289380356,3203993006),S(460393269,320620315),S(685471733,587496836),S(852142971,1086792851),S(1017036298,365543100),S(1126000580,2618297676),S(1288033470,3409855158),S(1501505948,4234509866),S(1607167915,987167468),S(1816402316,1246189591)],A=[];(function(){for(var D=0;D<80;D++)A[D]=S()})();var R=p.SHA512=i.extend({_doReset:function(){this._hash=new h.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(D,I){for(var O=this._hash.words,V=O[0],N=O[1],G=O[2],z=O[3],Z=O[4],H=O[5],ee=O[6],te=O[7],fe=V.high,ne=V.low,oe=N.high,Y=N.low,q=G.high,Q=G.low,be=z.high,ge=z.low,ve=Z.high,re=Z.low,j=H.high,ye=H.low,X=ee.high,ce=ee.low,Ae=te.high,_e=te.low,it=fe,nt=ne,wt=oe,at=Y,$t=q,gr=Q,Ar=be,ft=ge,Br=ve,Pr=re,lr=j,Er=ye,kr=X,Zt=ce,an=Ae,Xt=_e,Ft=0;Ft<80;Ft++){var jr,Sr,_r=A[Ft];if(Ft<16)Sr=_r.high=D[I+Ft*2]|0,jr=_r.low=D[I+Ft*2+1]|0;else{var Xn=A[Ft-15],In=Xn.high,Tn=Xn.low,qn=(In>>>1|Tn<<31)^(In>>>8|Tn<<24)^In>>>7,xn=(Tn>>>1|In<<31)^(Tn>>>8|In<<24)^(Tn>>>7|In<<25),sn=A[Ft-2],Te=sn.high,Ee=sn.low,xe=(Te>>>19|Ee<<13)^(Te<<3|Ee>>>29)^Te>>>6,qe=(Ee>>>19|Te<<13)^(Ee<<3|Te>>>29)^(Ee>>>6|Te<<26),ct=A[Ft-7],Ue=ct.high,St=ct.low,Se=A[Ft-16],He=Se.high,ze=Se.low;jr=xn+St,Sr=qn+Ue+(jr>>>0>>0?1:0),jr=jr+qe,Sr=Sr+xe+(jr>>>0>>0?1:0),jr=jr+ze,Sr=Sr+He+(jr>>>0>>0?1:0),_r.high=Sr,_r.low=jr}var Ve=Br&lr^~Br&kr,$e=Pr&Er^~Pr&Zt,pe=it&wt^it&$t^wt&$t,we=nt&at^nt&gr^at&gr,Fe=(it>>>28|nt<<4)^(it<<30|nt>>>2)^(it<<25|nt>>>7),Xe=(nt>>>28|it<<4)^(nt<<30|it>>>2)^(nt<<25|it>>>7),lt=(Br>>>14|Pr<<18)^(Br>>>18|Pr<<14)^(Br<<23|Pr>>>9),Bt=(Pr>>>14|Br<<18)^(Pr>>>18|Br<<14)^(Pr<<23|Br>>>9),Lt=b[Ft],bt=Lt.high,yt=Lt.low,Tt=Xt+Bt,Kt=an+lt+(Tt>>>0>>0?1:0),Tt=Tt+$e,Kt=Kt+Ve+(Tt>>>0<$e>>>0?1:0),Tt=Tt+yt,Kt=Kt+bt+(Tt>>>0>>0?1:0),Tt=Tt+jr,Kt=Kt+Sr+(Tt>>>0>>0?1:0),Pt=Xe+we,tr=Fe+pe+(Pt>>>0>>0?1:0);an=kr,Xt=Zt,kr=lr,Zt=Er,lr=Br,Er=Pr,Pr=ft+Tt|0,Br=Ar+Kt+(Pr>>>0>>0?1:0)|0,Ar=$t,ft=gr,$t=wt,gr=at,wt=it,at=nt,nt=Tt+Pt|0,it=Kt+tr+(nt>>>0>>0?1:0)|0}ne=V.low=ne+nt,V.high=fe+it+(ne>>>0>>0?1:0),Y=N.low=Y+at,N.high=oe+wt+(Y>>>0>>0?1:0),Q=G.low=Q+gr,G.high=q+$t+(Q>>>0>>0?1:0),ge=z.low=ge+ft,z.high=be+Ar+(ge>>>0>>0?1:0),re=Z.low=re+Pr,Z.high=ve+Br+(re>>>0>>0?1:0),ye=H.low=ye+Er,H.high=j+lr+(ye>>>0>>0?1:0),ce=ee.low=ce+Zt,ee.high=X+kr+(ce>>>0>>0?1:0),_e=te.low=_e+Xt,te.high=Ae+an+(_e>>>0>>0?1:0)},_doFinalize:function(){var D=this._data,I=D.words,O=this._nDataBytes*8,V=D.sigBytes*8;I[V>>>5]|=128<<24-V%32,I[(V+128>>>10<<5)+30]=Math.floor(O/4294967296),I[(V+128>>>10<<5)+31]=O,D.sigBytes=I.length*4,this._process();var N=this._hash.toX32();return N},clone:function(){var D=i.clone.call(this);return D._hash=this._hash.clone(),D},blockSize:1024/32});t.SHA512=i._createHelper(R),t.HmacSHA512=i._createHmacHelper(R)}(),r.SHA512})}(Fh)),Fh.exports}var Mh={exports:{}},I2=Mh.exports,My;function O2(){return My||(My=1,function(n,a){(function(r,t,e){n.exports=t(or(),$0(),gE())})(I2,function(r){return function(){var t=r,e=t.x64,i=e.Word,s=e.WordArray,f=t.algo,h=f.SHA512,p=f.SHA384=h.extend({_doReset:function(){this._hash=new s.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var S=h._doFinalize.call(this);return S.sigBytes-=16,S}});t.SHA384=h._createHelper(p),t.HmacSHA384=h._createHmacHelper(p)}(),r.SHA384})}(Mh)),Mh.exports}var Bh={exports:{}},F2=Bh.exports,By;function M2(){return By||(By=1,function(n,a){(function(r,t,e){n.exports=t(or(),$0())})(F2,function(r){return function(t){var e=r,i=e.lib,s=i.WordArray,f=i.Hasher,h=e.x64,p=h.Word,S=e.algo,b=[],A=[],R=[];(function(){for(var O=1,V=0,N=0;N<24;N++){b[O+5*V]=(N+1)*(N+2)/2%64;var G=V%5,z=(2*O+3*V)%5;O=G,V=z}for(var O=0;O<5;O++)for(var V=0;V<5;V++)A[O+5*V]=V+(2*O+3*V)%5*5;for(var Z=1,H=0;H<24;H++){for(var ee=0,te=0,fe=0;fe<7;fe++){if(Z&1){var ne=(1<>>24)&16711935|(Z<<24|Z>>>8)&4278255360,H=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360;var ee=N[z];ee.high^=H,ee.low^=Z}for(var te=0;te<24;te++){for(var fe=0;fe<5;fe++){for(var ne=0,oe=0,Y=0;Y<5;Y++){var ee=N[fe+5*Y];ne^=ee.high,oe^=ee.low}var q=D[fe];q.high=ne,q.low=oe}for(var fe=0;fe<5;fe++)for(var Q=D[(fe+4)%5],be=D[(fe+1)%5],ge=be.high,ve=be.low,ne=Q.high^(ge<<1|ve>>>31),oe=Q.low^(ve<<1|ge>>>31),Y=0;Y<5;Y++){var ee=N[fe+5*Y];ee.high^=ne,ee.low^=oe}for(var re=1;re<25;re++){var ne,oe,ee=N[re],j=ee.high,ye=ee.low,X=b[re];X<32?(ne=j<>>32-X,oe=ye<>>32-X):(ne=ye<>>64-X,oe=j<>>64-X);var ce=D[A[re]];ce.high=ne,ce.low=oe}var Ae=D[0],_e=N[0];Ae.high=_e.high,Ae.low=_e.low;for(var fe=0;fe<5;fe++)for(var Y=0;Y<5;Y++){var re=fe+5*Y,ee=N[re],it=D[re],nt=D[(fe+1)%5+5*Y],wt=D[(fe+2)%5+5*Y];ee.high=it.high^~nt.high&wt.high,ee.low=it.low^~nt.low&wt.low}var ee=N[0],at=R[te];ee.high^=at.high,ee.low^=at.low}},_doFinalize:function(){var O=this._data,V=O.words;this._nDataBytes*8;var N=O.sigBytes*8,G=this.blockSize*32;V[N>>>5]|=1<<24-N%32,V[(t.ceil((N+1)/G)*G>>>5)-1]|=128,O.sigBytes=V.length*4,this._process();for(var z=this._state,Z=this.cfg.outputLength/8,H=Z/8,ee=[],te=0;te>>24)&16711935|(ne<<24|ne>>>8)&4278255360,oe=(oe<<8|oe>>>24)&16711935|(oe<<24|oe>>>8)&4278255360,ee.push(oe),ee.push(ne)}return new s.init(ee,Z)},clone:function(){for(var O=f.clone.call(this),V=O._state=this._state.slice(0),N=0;N<25;N++)V[N]=V[N].clone();return O}});e.SHA3=f._createHelper(I),e.HmacSHA3=f._createHmacHelper(I)}(Math),r.SHA3})}(Bh)),Bh.exports}var Nh={exports:{}},B2=Nh.exports,Ny;function N2(){return Ny||(Ny=1,function(n,a){(function(r,t){n.exports=t(or())})(B2,function(r){/** @preserve (c) 2012 by Cédric Mesnil. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */return function(t){var e=r,i=e.lib,s=i.WordArray,f=i.Hasher,h=e.algo,p=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),S=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),b=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),R=s.create([0,1518500249,1859775393,2400959708,2840853838]),D=s.create([1352829926,1548603684,1836072691,2053994217,0]),I=h.RIPEMD160=f.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(H,ee){for(var te=0;te<16;te++){var fe=ee+te,ne=H[fe];H[fe]=(ne<<8|ne>>>24)&16711935|(ne<<24|ne>>>8)&4278255360}var oe=this._hash.words,Y=R.words,q=D.words,Q=p.words,be=S.words,ge=b.words,ve=A.words,re,j,ye,X,ce,Ae,_e,it,nt,wt;Ae=re=oe[0],_e=j=oe[1],it=ye=oe[2],nt=X=oe[3],wt=ce=oe[4];for(var at,te=0;te<80;te+=1)at=re+H[ee+Q[te]]|0,te<16?at+=O(j,ye,X)+Y[0]:te<32?at+=V(j,ye,X)+Y[1]:te<48?at+=N(j,ye,X)+Y[2]:te<64?at+=G(j,ye,X)+Y[3]:at+=z(j,ye,X)+Y[4],at=at|0,at=Z(at,ge[te]),at=at+ce|0,re=ce,ce=X,X=Z(ye,10),ye=j,j=at,at=Ae+H[ee+be[te]]|0,te<16?at+=z(_e,it,nt)+q[0]:te<32?at+=G(_e,it,nt)+q[1]:te<48?at+=N(_e,it,nt)+q[2]:te<64?at+=V(_e,it,nt)+q[3]:at+=O(_e,it,nt)+q[4],at=at|0,at=Z(at,ve[te]),at=at+wt|0,Ae=wt,wt=nt,nt=Z(it,10),it=_e,_e=at;at=oe[1]+ye+nt|0,oe[1]=oe[2]+X+wt|0,oe[2]=oe[3]+ce+Ae|0,oe[3]=oe[4]+re+_e|0,oe[4]=oe[0]+j+it|0,oe[0]=at},_doFinalize:function(){var H=this._data,ee=H.words,te=this._nDataBytes*8,fe=H.sigBytes*8;ee[fe>>>5]|=128<<24-fe%32,ee[(fe+64>>>9<<4)+14]=(te<<8|te>>>24)&16711935|(te<<24|te>>>8)&4278255360,H.sigBytes=(ee.length+1)*4,this._process();for(var ne=this._hash,oe=ne.words,Y=0;Y<5;Y++){var q=oe[Y];oe[Y]=(q<<8|q>>>24)&16711935|(q<<24|q>>>8)&4278255360}return ne},clone:function(){var H=f.clone.call(this);return H._hash=this._hash.clone(),H}});function O(H,ee,te){return H^ee^te}function V(H,ee,te){return H&ee|~H&te}function N(H,ee,te){return(H|~ee)^te}function G(H,ee,te){return H&te|ee&~te}function z(H,ee,te){return H^(ee|~te)}function Z(H,ee){return H<>>32-ee}e.RIPEMD160=f._createHelper(I),e.HmacRIPEMD160=f._createHmacHelper(I)}(),r.RIPEMD160})}(Nh)),Nh.exports}var Uh={exports:{}},U2=Uh.exports,Uy;function Ag(){return Uy||(Uy=1,function(n,a){(function(r,t){n.exports=t(or())})(U2,function(r){(function(){var t=r,e=t.lib,i=e.Base,s=t.enc,f=s.Utf8,h=t.algo;h.HMAC=i.extend({init:function(p,S){p=this._hasher=new p.init,typeof S=="string"&&(S=f.parse(S));var b=p.blockSize,A=b*4;S.sigBytes>A&&(S=p.finalize(S)),S.clamp();for(var R=this._oKey=S.clone(),D=this._iKey=S.clone(),I=R.words,O=D.words,V=0;V>>2]&255;ne.sigBytes-=oe}};i.BlockCipher=R.extend({cfg:R.cfg.extend({mode:O,padding:N}),reset:function(){var ne;R.reset.call(this);var oe=this.cfg,Y=oe.iv,q=oe.mode;this._xformMode==this._ENC_XFORM_MODE?ne=q.createEncryptor:(ne=q.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==ne?this._mode.init(this,Y&&Y.words):(this._mode=ne.call(q,this,Y&&Y.words),this._mode.__creator=ne)},_doProcessBlock:function(ne,oe){this._mode.processBlock(ne,oe)},_doFinalize:function(){var ne,oe=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(oe.pad(this._data,this.blockSize),ne=this._process(!0)):(ne=this._process(!0),oe.unpad(ne)),ne},blockSize:128/32});var G=i.CipherParams=s.extend({init:function(ne){this.mixIn(ne)},toString:function(ne){return(ne||this.formatter).stringify(this)}}),z=e.format={},Z=z.OpenSSL={stringify:function(ne){var oe,Y=ne.ciphertext,q=ne.salt;return q?oe=f.create([1398893684,1701076831]).concat(q).concat(Y):oe=Y,oe.toString(S)},parse:function(ne){var oe,Y=S.parse(ne),q=Y.words;return q[0]==1398893684&&q[1]==1701076831&&(oe=f.create(q.slice(2,4)),q.splice(0,4),Y.sigBytes-=16),G.create({ciphertext:Y,salt:oe})}},H=i.SerializableCipher=s.extend({cfg:s.extend({format:Z}),encrypt:function(ne,oe,Y,q){q=this.cfg.extend(q);var Q=ne.createEncryptor(Y,q),be=Q.finalize(oe),ge=Q.cfg;return G.create({ciphertext:be,key:Y,iv:ge.iv,algorithm:ne,mode:ge.mode,padding:ge.padding,blockSize:ne.blockSize,formatter:q.format})},decrypt:function(ne,oe,Y,q){q=this.cfg.extend(q),oe=this._parse(oe,q.format);var Q=ne.createDecryptor(Y,q).finalize(oe.ciphertext);return Q},_parse:function(ne,oe){return typeof ne=="string"?oe.parse(ne,this):ne}}),ee=e.kdf={},te=ee.OpenSSL={execute:function(ne,oe,Y,q,Q){if(q||(q=f.random(64/8)),Q)var be=A.create({keySize:oe+Y,hasher:Q}).compute(ne,q);else var be=A.create({keySize:oe+Y}).compute(ne,q);var ge=f.create(be.words.slice(oe),Y*4);return be.sigBytes=oe*4,G.create({key:be,iv:ge,salt:q})}},fe=i.PasswordBasedCipher=H.extend({cfg:H.cfg.extend({kdf:te}),encrypt:function(ne,oe,Y,q){q=this.cfg.extend(q);var Q=q.kdf.execute(Y,ne.keySize,ne.ivSize,q.salt,q.hasher);q.iv=Q.iv;var be=H.encrypt.call(this,ne,oe,Q.key,q);return be.mixIn(Q),be},decrypt:function(ne,oe,Y,q){q=this.cfg.extend(q),oe=this._parse(oe,q.format);var Q=q.kdf.execute(Y,ne.keySize,ne.ivSize,oe.salt,q.hasher);q.iv=Q.iv;var be=H.decrypt.call(this,ne,oe,Q.key,q);return be}})}()})}(jh)),jh.exports}var Gh={exports:{}},z2=Gh.exports,Gy;function W2(){return Gy||(Gy=1,function(n,a){(function(r,t,e){n.exports=t(or(),Pn())})(z2,function(r){return r.mode.CFB=function(){var t=r.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(i,s){var f=this._cipher,h=f.blockSize;e.call(this,i,s,h,f),this._prevBlock=i.slice(s,s+h)}}),t.Decryptor=t.extend({processBlock:function(i,s){var f=this._cipher,h=f.blockSize,p=i.slice(s,s+h);e.call(this,i,s,h,f),this._prevBlock=p}});function e(i,s,f,h){var p,S=this._iv;S?(p=S.slice(0),this._iv=void 0):p=this._prevBlock,h.encryptBlock(p,0);for(var b=0;b>24&255)===255){var h=f>>16&255,p=f>>8&255,S=f&255;h===255?(h=0,p===255?(p=0,S===255?S=0:++S):++p):++h,f=0,f+=h<<16,f+=p<<8,f+=S}else f+=1<<24;return f}function i(f){return(f[0]=e(f[0]))===0&&(f[1]=e(f[1])),f}var s=t.Encryptor=t.extend({processBlock:function(f,h){var p=this._cipher,S=p.blockSize,b=this._iv,A=this._counter;b&&(A=this._counter=b.slice(0),this._iv=void 0),i(A);var R=A.slice(0);p.encryptBlock(R,0);for(var D=0;D>>2]|=f<<24-h%4*8,t.sigBytes+=f},unpad:function(t){var e=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=e}},r.pad.Ansix923})}(Yh)),Yh.exports}var Xh={exports:{}},rw=Xh.exports,Xy;function nw(){return Xy||(Xy=1,function(n,a){(function(r,t,e){n.exports=t(or(),Pn())})(rw,function(r){return r.pad.Iso10126={pad:function(t,e){var i=e*4,s=i-t.sigBytes%i;t.concat(r.lib.WordArray.random(s-1)).concat(r.lib.WordArray.create([s<<24],1))},unpad:function(t){var e=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=e}},r.pad.Iso10126})}(Xh)),Xh.exports}var qh={exports:{}},iw=qh.exports,qy;function aw(){return qy||(qy=1,function(n,a){(function(r,t,e){n.exports=t(or(),Pn())})(iw,function(r){return r.pad.Iso97971={pad:function(t,e){t.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(t,e)},unpad:function(t){r.pad.ZeroPadding.unpad(t),t.sigBytes--}},r.pad.Iso97971})}(qh)),qh.exports}var Zh={exports:{}},sw=Zh.exports,Zy;function ow(){return Zy||(Zy=1,function(n,a){(function(r,t,e){n.exports=t(or(),Pn())})(sw,function(r){return r.pad.ZeroPadding={pad:function(t,e){var i=e*4;t.clamp(),t.sigBytes+=i-(t.sigBytes%i||i)},unpad:function(t){for(var e=t.words,i=t.sigBytes-1,i=t.sigBytes-1;i>=0;i--)if(e[i>>>2]>>>24-i%4*8&255){t.sigBytes=i+1;break}}},r.pad.ZeroPadding})}(Zh)),Zh.exports}var Qh={exports:{}},lw=Qh.exports,Qy;function uw(){return Qy||(Qy=1,function(n,a){(function(r,t,e){n.exports=t(or(),Pn())})(lw,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})}(Qh)),Qh.exports}var Jh={exports:{}},fw=Jh.exports,Jy;function cw(){return Jy||(Jy=1,function(n,a){(function(r,t,e){n.exports=t(or(),Pn())})(fw,function(r){return function(t){var e=r,i=e.lib,s=i.CipherParams,f=e.enc,h=f.Hex,p=e.format;p.Hex={stringify:function(S){return S.ciphertext.toString(h)},parse:function(S){var b=h.parse(S);return s.create({ciphertext:b})}}}(),r.format.Hex})}(Jh)),Jh.exports}var e0={exports:{}},dw=e0.exports,e1;function hw(){return e1||(e1=1,function(n,a){(function(r,t,e){n.exports=t(or(),pl(),gl(),_o(),Pn())})(dw,function(r){return function(){var t=r,e=t.lib,i=e.BlockCipher,s=t.algo,f=[],h=[],p=[],S=[],b=[],A=[],R=[],D=[],I=[],O=[];(function(){for(var G=[],z=0;z<256;z++)z<128?G[z]=z<<1:G[z]=z<<1^283;for(var Z=0,H=0,z=0;z<256;z++){var ee=H^H<<1^H<<2^H<<3^H<<4;ee=ee>>>8^ee&255^99,f[Z]=ee,h[ee]=Z;var te=G[Z],fe=G[te],ne=G[fe],oe=G[ee]*257^ee*16843008;p[Z]=oe<<24|oe>>>8,S[Z]=oe<<16|oe>>>16,b[Z]=oe<<8|oe>>>24,A[Z]=oe;var oe=ne*16843009^fe*65537^te*257^Z*16843008;R[ee]=oe<<24|oe>>>8,D[ee]=oe<<16|oe>>>16,I[ee]=oe<<8|oe>>>24,O[ee]=oe,Z?(Z=te^G[G[G[ne^te]]],H^=G[G[H]]):Z=H=1}})();var V=[0,1,2,4,8,16,32,64,128,27,54],N=s.AES=i.extend({_doReset:function(){var G;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var z=this._keyPriorReset=this._key,Z=z.words,H=z.sigBytes/4,ee=this._nRounds=H+6,te=(ee+1)*4,fe=this._keySchedule=[],ne=0;ne6&&ne%H==4&&(G=f[G>>>24]<<24|f[G>>>16&255]<<16|f[G>>>8&255]<<8|f[G&255]):(G=G<<8|G>>>24,G=f[G>>>24]<<24|f[G>>>16&255]<<16|f[G>>>8&255]<<8|f[G&255],G^=V[ne/H|0]<<24),fe[ne]=fe[ne-H]^G);for(var oe=this._invKeySchedule=[],Y=0;Y>>24]]^D[f[G>>>16&255]]^I[f[G>>>8&255]]^O[f[G&255]]}}},encryptBlock:function(G,z){this._doCryptBlock(G,z,this._keySchedule,p,S,b,A,f)},decryptBlock:function(G,z){var Z=G[z+1];G[z+1]=G[z+3],G[z+3]=Z,this._doCryptBlock(G,z,this._invKeySchedule,R,D,I,O,h);var Z=G[z+1];G[z+1]=G[z+3],G[z+3]=Z},_doCryptBlock:function(G,z,Z,H,ee,te,fe,ne){for(var oe=this._nRounds,Y=G[z]^Z[0],q=G[z+1]^Z[1],Q=G[z+2]^Z[2],be=G[z+3]^Z[3],ge=4,ve=1;ve>>24]^ee[q>>>16&255]^te[Q>>>8&255]^fe[be&255]^Z[ge++],j=H[q>>>24]^ee[Q>>>16&255]^te[be>>>8&255]^fe[Y&255]^Z[ge++],ye=H[Q>>>24]^ee[be>>>16&255]^te[Y>>>8&255]^fe[q&255]^Z[ge++],X=H[be>>>24]^ee[Y>>>16&255]^te[q>>>8&255]^fe[Q&255]^Z[ge++];Y=re,q=j,Q=ye,be=X}var re=(ne[Y>>>24]<<24|ne[q>>>16&255]<<16|ne[Q>>>8&255]<<8|ne[be&255])^Z[ge++],j=(ne[q>>>24]<<24|ne[Q>>>16&255]<<16|ne[be>>>8&255]<<8|ne[Y&255])^Z[ge++],ye=(ne[Q>>>24]<<24|ne[be>>>16&255]<<16|ne[Y>>>8&255]<<8|ne[q&255])^Z[ge++],X=(ne[be>>>24]<<24|ne[Y>>>16&255]<<16|ne[q>>>8&255]<<8|ne[Q&255])^Z[ge++];G[z]=re,G[z+1]=j,G[z+2]=ye,G[z+3]=X},keySize:256/32});t.AES=i._createHelper(N)}(),r.AES})}(e0)),e0.exports}var t0={exports:{}},vw=t0.exports,t1;function pw(){return t1||(t1=1,function(n,a){(function(r,t,e){n.exports=t(or(),pl(),gl(),_o(),Pn())})(vw,function(r){return function(){var t=r,e=t.lib,i=e.WordArray,s=e.BlockCipher,f=t.algo,h=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],p=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],S=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],b=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],A=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],R=f.DES=s.extend({_doReset:function(){for(var V=this._key,N=V.words,G=[],z=0;z<56;z++){var Z=h[z]-1;G[z]=N[Z>>>5]>>>31-Z%32&1}for(var H=this._subKeys=[],ee=0;ee<16;ee++){for(var te=H[ee]=[],fe=S[ee],z=0;z<24;z++)te[z/6|0]|=G[(p[z]-1+fe)%28]<<31-z%6,te[4+(z/6|0)]|=G[28+(p[z+24]-1+fe)%28]<<31-z%6;te[0]=te[0]<<1|te[0]>>>31;for(var z=1;z<7;z++)te[z]=te[z]>>>(z-1)*4+3;te[7]=te[7]<<5|te[7]>>>27}for(var ne=this._invSubKeys=[],z=0;z<16;z++)ne[z]=H[15-z]},encryptBlock:function(V,N){this._doCryptBlock(V,N,this._subKeys)},decryptBlock:function(V,N){this._doCryptBlock(V,N,this._invSubKeys)},_doCryptBlock:function(V,N,G){this._lBlock=V[N],this._rBlock=V[N+1],D.call(this,4,252645135),D.call(this,16,65535),I.call(this,2,858993459),I.call(this,8,16711935),D.call(this,1,1431655765);for(var z=0;z<16;z++){for(var Z=G[z],H=this._lBlock,ee=this._rBlock,te=0,fe=0;fe<8;fe++)te|=b[fe][((ee^Z[fe])&A[fe])>>>0];this._lBlock=ee,this._rBlock=H^te}var ne=this._lBlock;this._lBlock=this._rBlock,this._rBlock=ne,D.call(this,1,1431655765),I.call(this,8,16711935),I.call(this,2,858993459),D.call(this,16,65535),D.call(this,4,252645135),V[N]=this._lBlock,V[N+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function D(V,N){var G=(this._lBlock>>>V^this._rBlock)&N;this._rBlock^=G,this._lBlock^=G<>>V^this._lBlock)&N;this._lBlock^=G,this._rBlock^=G<192.");var G=N.slice(0,2),z=N.length<4?N.slice(0,2):N.slice(2,4),Z=N.length<6?N.slice(0,2):N.slice(4,6);this._des1=R.createEncryptor(i.create(G)),this._des2=R.createEncryptor(i.create(z)),this._des3=R.createEncryptor(i.create(Z))},encryptBlock:function(V,N){this._des1.encryptBlock(V,N),this._des2.decryptBlock(V,N),this._des3.encryptBlock(V,N)},decryptBlock:function(V,N){this._des3.decryptBlock(V,N),this._des2.encryptBlock(V,N),this._des1.decryptBlock(V,N)},keySize:192/32,ivSize:64/32,blockSize:64/32});t.TripleDES=s._createHelper(O)}(),r.TripleDES})}(t0)),t0.exports}var r0={exports:{}},gw=r0.exports,r1;function mw(){return r1||(r1=1,function(n,a){(function(r,t,e){n.exports=t(or(),pl(),gl(),_o(),Pn())})(gw,function(r){return function(){var t=r,e=t.lib,i=e.StreamCipher,s=t.algo,f=s.RC4=i.extend({_doReset:function(){for(var S=this._key,b=S.words,A=S.sigBytes,R=this._S=[],D=0;D<256;D++)R[D]=D;for(var D=0,I=0;D<256;D++){var O=D%A,V=b[O>>>2]>>>24-O%4*8&255;I=(I+R[D]+V)%256;var N=R[D];R[D]=R[I],R[I]=N}this._i=this._j=0},_doProcessBlock:function(S,b){S[b]^=h.call(this)},keySize:256/32,ivSize:0});function h(){for(var S=this._S,b=this._i,A=this._j,R=0,D=0;D<4;D++){b=(b+1)%256,A=(A+S[b])%256;var I=S[b];S[b]=S[A],S[A]=I,R|=S[(S[b]+S[A])%256]<<24-D*8}return this._i=b,this._j=A,R}t.RC4=i._createHelper(f);var p=s.RC4Drop=f.extend({cfg:f.cfg.extend({drop:192}),_doReset:function(){f._doReset.call(this);for(var S=this.cfg.drop;S>0;S--)h.call(this)}});t.RC4Drop=i._createHelper(p)}(),r.RC4})}(r0)),r0.exports}var n0={exports:{}},yw=n0.exports,n1;function xw(){return n1||(n1=1,function(n,a){(function(r,t,e){n.exports=t(or(),pl(),gl(),_o(),Pn())})(yw,function(r){return function(){var t=r,e=t.lib,i=e.StreamCipher,s=t.algo,f=[],h=[],p=[],S=s.Rabbit=i.extend({_doReset:function(){for(var A=this._key.words,R=this.cfg.iv,D=0;D<4;D++)A[D]=(A[D]<<8|A[D]>>>24)&16711935|(A[D]<<24|A[D]>>>8)&4278255360;var I=this._X=[A[0],A[3]<<16|A[2]>>>16,A[1],A[0]<<16|A[3]>>>16,A[2],A[1]<<16|A[0]>>>16,A[3],A[2]<<16|A[1]>>>16],O=this._C=[A[2]<<16|A[2]>>>16,A[0]&4294901760|A[1]&65535,A[3]<<16|A[3]>>>16,A[1]&4294901760|A[2]&65535,A[0]<<16|A[0]>>>16,A[2]&4294901760|A[3]&65535,A[1]<<16|A[1]>>>16,A[3]&4294901760|A[0]&65535];this._b=0;for(var D=0;D<4;D++)b.call(this);for(var D=0;D<8;D++)O[D]^=I[D+4&7];if(R){var V=R.words,N=V[0],G=V[1],z=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,Z=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360,H=z>>>16|Z&4294901760,ee=Z<<16|z&65535;O[0]^=z,O[1]^=H,O[2]^=Z,O[3]^=ee,O[4]^=z,O[5]^=H,O[6]^=Z,O[7]^=ee;for(var D=0;D<4;D++)b.call(this)}},_doProcessBlock:function(A,R){var D=this._X;b.call(this),f[0]=D[0]^D[5]>>>16^D[3]<<16,f[1]=D[2]^D[7]>>>16^D[5]<<16,f[2]=D[4]^D[1]>>>16^D[7]<<16,f[3]=D[6]^D[3]>>>16^D[1]<<16;for(var I=0;I<4;I++)f[I]=(f[I]<<8|f[I]>>>24)&16711935|(f[I]<<24|f[I]>>>8)&4278255360,A[R+I]^=f[I]},blockSize:128/32,ivSize:64/32});function b(){for(var A=this._X,R=this._C,D=0;D<8;D++)h[D]=R[D];R[0]=R[0]+1295307597+this._b|0,R[1]=R[1]+3545052371+(R[0]>>>0>>0?1:0)|0,R[2]=R[2]+886263092+(R[1]>>>0>>0?1:0)|0,R[3]=R[3]+1295307597+(R[2]>>>0>>0?1:0)|0,R[4]=R[4]+3545052371+(R[3]>>>0>>0?1:0)|0,R[5]=R[5]+886263092+(R[4]>>>0>>0?1:0)|0,R[6]=R[6]+1295307597+(R[5]>>>0>>0?1:0)|0,R[7]=R[7]+3545052371+(R[6]>>>0>>0?1:0)|0,this._b=R[7]>>>0>>0?1:0;for(var D=0;D<8;D++){var I=A[D]+R[D],O=I&65535,V=I>>>16,N=((O*O>>>17)+O*V>>>15)+V*V,G=((I&4294901760)*I|0)+((I&65535)*I|0);p[D]=N^G}A[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,A[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,A[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,A[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,A[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,A[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,A[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,A[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}t.Rabbit=i._createHelper(S)}(),r.Rabbit})}(n0)),n0.exports}var i0={exports:{}},Ew=i0.exports,i1;function Sw(){return i1||(i1=1,function(n,a){(function(r,t,e){n.exports=t(or(),pl(),gl(),_o(),Pn())})(Ew,function(r){return function(){var t=r,e=t.lib,i=e.StreamCipher,s=t.algo,f=[],h=[],p=[],S=s.RabbitLegacy=i.extend({_doReset:function(){var A=this._key.words,R=this.cfg.iv,D=this._X=[A[0],A[3]<<16|A[2]>>>16,A[1],A[0]<<16|A[3]>>>16,A[2],A[1]<<16|A[0]>>>16,A[3],A[2]<<16|A[1]>>>16],I=this._C=[A[2]<<16|A[2]>>>16,A[0]&4294901760|A[1]&65535,A[3]<<16|A[3]>>>16,A[1]&4294901760|A[2]&65535,A[0]<<16|A[0]>>>16,A[2]&4294901760|A[3]&65535,A[1]<<16|A[1]>>>16,A[3]&4294901760|A[0]&65535];this._b=0;for(var O=0;O<4;O++)b.call(this);for(var O=0;O<8;O++)I[O]^=D[O+4&7];if(R){var V=R.words,N=V[0],G=V[1],z=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,Z=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360,H=z>>>16|Z&4294901760,ee=Z<<16|z&65535;I[0]^=z,I[1]^=H,I[2]^=Z,I[3]^=ee,I[4]^=z,I[5]^=H,I[6]^=Z,I[7]^=ee;for(var O=0;O<4;O++)b.call(this)}},_doProcessBlock:function(A,R){var D=this._X;b.call(this),f[0]=D[0]^D[5]>>>16^D[3]<<16,f[1]=D[2]^D[7]>>>16^D[5]<<16,f[2]=D[4]^D[1]>>>16^D[7]<<16,f[3]=D[6]^D[3]>>>16^D[1]<<16;for(var I=0;I<4;I++)f[I]=(f[I]<<8|f[I]>>>24)&16711935|(f[I]<<24|f[I]>>>8)&4278255360,A[R+I]^=f[I]},blockSize:128/32,ivSize:64/32});function b(){for(var A=this._X,R=this._C,D=0;D<8;D++)h[D]=R[D];R[0]=R[0]+1295307597+this._b|0,R[1]=R[1]+3545052371+(R[0]>>>0>>0?1:0)|0,R[2]=R[2]+886263092+(R[1]>>>0>>0?1:0)|0,R[3]=R[3]+1295307597+(R[2]>>>0>>0?1:0)|0,R[4]=R[4]+3545052371+(R[3]>>>0>>0?1:0)|0,R[5]=R[5]+886263092+(R[4]>>>0>>0?1:0)|0,R[6]=R[6]+1295307597+(R[5]>>>0>>0?1:0)|0,R[7]=R[7]+3545052371+(R[6]>>>0>>0?1:0)|0,this._b=R[7]>>>0>>0?1:0;for(var D=0;D<8;D++){var I=A[D]+R[D],O=I&65535,V=I>>>16,N=((O*O>>>17)+O*V>>>15)+V*V,G=((I&4294901760)*I|0)+((I&65535)*I|0);p[D]=N^G}A[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,A[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,A[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,A[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,A[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,A[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,A[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,A[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}t.RabbitLegacy=i._createHelper(S)}(),r.RabbitLegacy})}(i0)),i0.exports}var a0={exports:{}},_w=a0.exports,a1;function bw(){return a1||(a1=1,function(n,a){(function(r,t,e){n.exports=t(or(),pl(),gl(),_o(),Pn())})(_w,function(r){return function(){var t=r,e=t.lib,i=e.BlockCipher,s=t.algo;const f=16,h=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],p=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var S={pbox:[],sbox:[]};function b(O,V){let N=V>>24&255,G=V>>16&255,z=V>>8&255,Z=V&255,H=O.sbox[0][N]+O.sbox[1][G];return H=H^O.sbox[2][z],H=H+O.sbox[3][Z],H}function A(O,V,N){let G=V,z=N,Z;for(let H=0;H1;--H)G=G^O.pbox[H],z=b(O,G)^z,Z=G,G=z,z=Z;return Z=G,G=z,z=Z,z=z^O.pbox[1],G=G^O.pbox[0],{left:G,right:z}}function D(O,V,N){for(let ee=0;ee<4;ee++){O.sbox[ee]=[];for(let te=0;te<256;te++)O.sbox[ee][te]=p[ee][te]}let G=0;for(let ee=0;ee=N&&(G=0);let z=0,Z=0,H=0;for(let ee=0;ee=e+r?(e=s,[4,bc(0)]):[3,3]):[3,4];case 2:f.sent(),f.label=3;case 3:return++i,[3,1];case 4:return[2,t]}})})}function Tc(n){n.then(void 0,function(){})}function lo(n,a){n=[n[0]>>>16,n[0]&65535,n[1]>>>16,n[1]&65535],a=[a[0]>>>16,a[0]&65535,a[1]>>>16,a[1]&65535];var r=[0,0,0,0];return r[3]+=n[3]+a[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=n[2]+a[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=n[1]+a[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=n[0]+a[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function Qi(n,a){n=[n[0]>>>16,n[0]&65535,n[1]>>>16,n[1]&65535],a=[a[0]>>>16,a[0]&65535,a[1]>>>16,a[1]&65535];var r=[0,0,0,0];return r[3]+=n[3]*a[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=n[2]*a[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=n[3]*a[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=n[1]*a[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=n[2]*a[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=n[3]*a[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=n[0]*a[3]+n[1]*a[2]+n[2]*a[1]+n[3]*a[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function Ru(n,a){return a%=64,a===32?[n[1],n[0]]:a<32?[n[0]<>>32-a,n[1]<>>32-a]:(a-=32,[n[1]<>>32-a,n[0]<>>32-a])}function Pi(n,a){return a%=64,a===0?n:a<32?[n[0]<>>32-a,n[1]<>>1]),n=Qi(n,[4283543511,3981806797]),n=Wr(n,[0,n[0]>>>1]),n=Qi(n,[3301882366,444984403]),n=Wr(n,[0,n[0]>>>1]),n}function ww(n,a){n=n||"",a=a||0;var r=n.length%16,t=n.length-r,e=[0,a],i=[0,a],s=[0,0],f=[0,0],h=[2277735313,289559509],p=[1291169091,658871167],S;for(S=0;S>>0).toString(16)).slice(-8)+("00000000"+(e[1]>>>0).toString(16)).slice(-8)+("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)}function Aw(n){var a;return Np({name:n.name,message:n.message,stack:(a=n.stack)===null||a===void 0?void 0:a.split(` `)},n)}function kw(n,a){for(var r=0,t=n.length;r=1)return Math.round(n/a)*a;var r=1/a;return Math.round(n*r)/r}function Rw(n){for(var a,r,t="Unexpected syntax '".concat(n,"'"),e=/^\s*([a-z-]*)(.*)$/i.exec(n),i=e[1]||void 0,s={},f=/([.:#][\w-]+|\[.+?\])/gi,h=function(A,R){s[A]=s[A]||[],s[A].push(R)};;){var p=f.exec(e[2]);if(!p)break;var S=p[0];switch(S[0]){case".":h("class",S.slice(1));break;case"#":h("id",S.slice(1));break;case"[":{var b=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(S);if(b)h(b[1],(r=(a=b[4])!==null&&a!==void 0?a:b[5])!==null&&r!==void 0?r:"");else throw new Error(t);break}default:throw new Error(t)}}return[i,s]}function f1(n){return n&&typeof n=="object"&&"message"in n?n:{message:n}}function Dw(n){return typeof n!="function"}function Pw(n,a){var r=new Promise(function(t){var e=Date.now();o1(n.bind(null,a),function(){for(var i=[],s=0;s=4}function Ow(){var n=window,a=navigator;return ma(["msWriteProfilerMark"in n,"MSStream"in n,"msLaunchUri"in a,"msSaveBlob"in a])>=3&&!EE()}function Lg(){var n=window,a=navigator;return ma(["webkitPersistentStorage"in a,"webkitTemporaryStorage"in a,a.vendor.indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in n,"BatteryManager"in n,"webkitMediaStream"in n,"webkitSpeechGrammar"in n])>=5}function Bc(){var n=window,a=navigator;return ma(["ApplePayError"in n,"CSSPrimitiveValue"in n,"Counter"in n,a.vendor.indexOf("Apple")===0,"getStorageUpdates"in a,"WebKitMediaKeys"in n])>=4}function Rg(){var n=window;return ma(["safari"in n,!("DeviceMotionEvent"in n),!("ongestureend"in n),!("standalone"in navigator)])>=3}function Fw(){var n,a,r=window;return ma(["buildID"in navigator,"MozAppearance"in((a=(n=document.documentElement)===null||n===void 0?void 0:n.style)!==null&&a!==void 0?a:{}),"onmozfullscreenchange"in r,"mozInnerScreenX"in r,"CSSMozDocumentRule"in r,"CanvasCaptureMediaStream"in r])>=4}function Mw(){var n=window;return ma([!("MediaSettingsRange"in n),"RTCEncodedAudioFrame"in n,""+n.Intl=="[object Intl]",""+n.Reflect=="[object Reflect]"])>=3}function Bw(){var n=window;return ma(["DOMRectList"in n,"RTCPeerConnectionIceEvent"in n,"SVGGeometryElement"in n,"ontransitioncancel"in n])>=3}function Nw(){if(navigator.platform==="iPad")return!0;var n=screen,a=n.width/n.height;return ma(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,a>.65&&a<1.53])>=2}function Uw(){var n=document;return n.fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement||null}function Hw(){var n=document;return(n.exitFullscreen||n.msExitFullscreen||n.mozCancelFullScreen||n.webkitExitFullscreen).call(n)}function SE(){var n=Lg(),a=Fw();if(!n&&!a)return!1;var r=window;return ma(["onorientationchange"in r,"orientation"in r,n&&!("SharedWorker"in r),a&&/android/i.test(navigator.appVersion)])>=2}function Vw(){var n=window,a=n.OfflineAudioContext||n.webkitOfflineAudioContext;if(!a)return-2;if(jw())return-1;var r=4500,t=5e3,e=new a(1,t,44100),i=e.createOscillator();i.type="triangle",i.frequency.value=1e4;var s=e.createDynamicsCompressor();s.threshold.value=-50,s.knee.value=40,s.ratio.value=12,s.attack.value=0,s.release.value=.25,i.connect(s),s.connect(e.destination),i.start(0);var f=Gw(e),h=f[0],p=f[1],S=h.then(function(b){return zw(b.getChannelData(0).subarray(r))},function(b){if(b.name==="timeout"||b.name==="suspended")return-3;throw b});return Tc(S),function(){return p(),S}}function jw(){return Bc()&&!Rg()&&!Bw()}function Gw(n){var a=3,r=500,t=500,e=5e3,i=function(){},s=new Promise(function(f,h){var p=!1,S=0,b=0;n.oncomplete=function(D){return f(D.renderedBuffer)};var A=function(){setTimeout(function(){return h(c1("timeout"))},Math.min(t,b+e-Date.now()))},R=function(){try{var D=n.startRendering();switch(yE(D)&&Tc(D),n.state){case"running":b=Date.now(),p&&A();break;case"suspended":document.hidden||S++,p&&S>=a?h(c1("suspended")):setTimeout(R,r);break}}catch(I){h(I)}};R(),i=function(){p||(p=!0,b>0&&A())}});return[s,i]}function zw(n){for(var a=0,r=0;r=0?"+":"").concat(Math.abs(t))}function gA(){var n=new Date().getFullYear();return Math.max(da(new Date(n,0,1).getTimezoneOffset()),da(new Date(n,6,1).getTimezoneOffset()))}function mA(){try{return!!window.sessionStorage}catch{return!0}}function yA(){try{return!!window.localStorage}catch{return!0}}function xA(){if(!(EE()||Ow()))try{return!!window.indexedDB}catch{return!0}}function EA(){return!!window.openDatabase}function SA(){return navigator.cpuClass}function _A(){var n=navigator.platform;return n==="MacIntel"&&Bc()&&!Rg()?Nw()?"iPad":"iPhone":n}function bA(){return navigator.vendor||""}function TA(){for(var n=[],a=0,r=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];ab.length*.6}),f.sort(),[2,f]}})})}function kA(){return Bc()||SE()}function LA(n){var a;return ys(this,void 0,void 0,function(){var r,t,e,i,h,s,f,h;return xs(this,function(p){switch(p.label){case 0:for(r=document,t=r.createElement("div"),e=new Array(n.length),i={},h1(t),h=0;h')}function GA(){var n,a=document.createElement("canvas"),r=(n=a.getContext("webgl"))!==null&&n!==void 0?n:a.getContext("experimental-webgl");if(r&&"getExtension"in r){var t=r.getExtension("WEBGL_debug_renderer_info");if(t)return{vendor:(r.getParameter(t.UNMASKED_VENDOR_WEBGL)||"").toString(),renderer:(r.getParameter(t.UNMASKED_RENDERER_WEBGL)||"").toString()}}}function zA(){return navigator.pdfViewerEnabled}function WA(){var n=new Float32Array(1),a=new Uint8Array(n.buffer);return n[0]=1/0,n[0]=n[0]-n[0],a[3]}var $A={fonts:Xw,domBlockers:AA,fontPreferences:VA,audio:Vw,screenFrame:hA,osCpu:iA,languages:aA,colorDepth:sA,deviceMemory:oA,screenResolution:lA,hardwareConcurrency:vA,timezone:pA,sessionStorage:mA,localStorage:yA,indexedDB:xA,openDatabase:EA,cpuClass:SA,platform:_A,plugins:qw,canvas:Zw,touchSupport:nA,vendor:bA,vendorFlavors:TA,cookiesEnabled:CA,colorGamut:DA,invertedColors:PA,forcedColors:IA,monochrome:FA,contrast:MA,reducedMotion:BA,hdr:NA,math:UA,videoCard:GA,pdfViewerEnabled:zA,architecture:WA};function KA(n){return Iw($A,n,[])}var YA="$ if upgrade to Pro: https://fpjs.dev/pro";function XA(n){var a=qA(n),r=ZA(a);return{score:a,comment:YA.replace(/\$/g,"".concat(r))}}function qA(n){if(SE())return .4;if(Bc())return Rg()?.5:.3;var a=n.platform.value||"";return/^Win/.test(a)?.6:/^Mac/.test(a)?.5:.7}function ZA(n){return xE(.99+.01*n,1e-4)}function QA(n){for(var a="",r=0,t=Object.keys(n).sort();r=.001))try{var n=new XMLHttpRequest;n.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(mE,"/npm-monitoring"),!0),n.send()}catch(a){console.error(a)}}function nk(n){var a=n===void 0?{}:n,r=a.delayFallback,t=a.debug,e=a.monitoring,i=e===void 0?!0:e;return ys(this,void 0,void 0,function(){var s;return xs(this,function(f){switch(f.label){case 0:return i&&rk(),[4,ek(r)];case 1:return f.sent(),s=KA({debug:t}),[2,tk(s,t)]}})})}var CP={load:nk,hashComponents:TE,componentsToDebugString:bE};function y1(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);a&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)}return r}function un(n){for(var a=1;a"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Oe(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Dg(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oe(n)}function Ut(n){var a=ik();return function(){var t=Vt(n),e;if(a){var i=Vt(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return Dg(this,e)}}function ak(n,a){for(;!Object.prototype.hasOwnProperty.call(n,a)&&(n=Vt(n),n!==null););return n}function zt(){return typeof Reflect<"u"&&Reflect.get?zt=Reflect.get.bind():zt=function(a,r,t){var e=ak(a,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?a:t):i.value}},zt.apply(this,arguments)}function pa(n){return sk(n)||ok(n)||lk(n)||uk()}function sk(n){if(Array.isArray(n))return Qp(n)}function ok(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function lk(n,a){if(n){if(typeof n=="string")return Qp(n,a);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set")return Array.from(n);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qp(n,a)}}function Qp(n,a){(a==null||a>n.length)&&(a=n.length);for(var r=0,t=new Array(a);r-1,cp={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},dp="%c[xgplayer]",fr={config:{debug:dk?3:0},logInfo:function(a){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i=3&&(r=console).log.apply(r,[dp,cp.info,a].concat(e))},logWarn:function(a){for(var r,t=arguments.length,e=new Array(t>1?t-1:0),i=1;i=1&&(r=console).warn.apply(r,[dp,cp.warn,a].concat(e))},logError:function(a){var r;if(!(this.config.debug<1)){for(var t=this.config.debug>=2?"trace":"error",e=arguments.length,i=new Array(e>1?e-1:0),s=1;s0&&arguments[0]!==void 0?arguments[0]:"div",a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"",e=document.createElement(n);return e.className=t,e.innerHTML=a,Object.keys(r).forEach(function(i){var s=i,f=r[i];n==="video"||n==="audio"||n==="live-video"?f&&e.setAttribute(s,f):e.setAttribute(s,f)}),e};$.createDomFromHtml=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";try{var t=document.createElement("div");t.innerHTML=n;var e=t.children;return t=null,e.length>0?(e=e[0],r&&$.addClass(e,r),a&&Object.keys(a).forEach(function(i){e.setAttribute(i,a[i])}),e):null}catch(i){return fr.logError("util.createDomFromHtml",i),null}};$.hasClass=function(n,a){if(!n||!a)return!1;try{return Array.prototype.some.call(n.classList,function(t){return t===a})}catch{var r=n.className&&ii(n.className)==="object"?n.getAttribute("class"):n.className;return r&&!!r.match(new RegExp("(\\s|^)"+a+"(\\s|$)"))}};$.addClass=function(n,a){if(!(!n||!a))try{a.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&n.classList.add(r)})}catch{$.hasClass(n,a)||(n.className&&ii(n.className)==="object"?n.setAttribute("class",n.getAttribute("class")+" "+a):n.className+=" "+a)}};$.removeClass=function(n,a){if(!(!n||!a))try{a.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(r){r&&n.classList.remove(r)})}catch{$.hasClass(n,a)&&a.split(/\s+/g).forEach(function(t){var e=new RegExp("(\\s|^)"+t+"(\\s|$)");n.className&&ii(n.className)==="object"?n.setAttribute("class",n.getAttribute("class").replace(e," ")):n.className=n.className.replace(e," ")})}};$.toggleClass=function(n,a){n&&a.split(/\s+/g).forEach(function(r){$.hasClass(n,r)?$.removeClass(n,r):$.addClass(n,r)})};$.classNames=function(){for(var n=arguments,a=[],r=function(i){$.typeOf(n[i])==="String"?a.push(n[i]):$.typeOf(n[i])==="Object"&&Object.keys(n[i]).map(function(s){n[i][s]&&a.push(s)})},t=0;t0&&arguments[0]!==void 0?arguments[0]:document,a=arguments.length>1?arguments[1]:void 0,r;try{r=n.querySelector(a)}catch(t){fr.logError("util.findDom",t),a.indexOf("#")===0&&(r=n.getElementById(a.slice(1)))}return r};$.getCss=function(n,a){return n.currentStyle?n.currentStyle[a]:document.defaultView.getComputedStyle(n,!1)[a]};$.padStart=function(n,a,r){for(var t=String(r),e=a>>0,i=Math.ceil(e/t.length),s=[],f=String(n);i--;)s.push(t);return s.join("").substring(0,e-f.length)+f};$.format=function(n){if(window.isNaN(n))return"";n=Math.round(n);var a=$.padStart(Math.floor(n/3600),2,0),r=$.padStart(Math.floor((n-a*3600)/60),2,0),t=$.padStart(Math.floor(n-a*3600-r*60),2,0);return(a==="00"?[r,t]:[a,r,t]).join(":")};$.event=function(n){if(n.touches){var a=n.touches[0]||n.changedTouches[0];n.clientX=a.clientX||0,n.clientY=a.clientY||0,n.offsetX=a.pageX-a.target.offsetLeft,n.offsetY=a.pageY-a.target.offsetTop}n._target=n.target||n.srcElement};$.typeOf=function(n){return Object.prototype.toString.call(n).match(/([^\s.*]+)(?=]$)/g)[0]};$.deepCopy=function(n,a){if($.typeOf(a)==="Object"&&$.typeOf(n)==="Object")return Object.keys(a).forEach(function(r){$.typeOf(a[r])==="Object"&&!(a[r]instanceof Node)?n[r]===void 0||n[r]===void 0?n[r]=a[r]:$.deepCopy(n[r],a[r]):$.typeOf(a[r])==="Array"?n[r]=$.typeOf(n[r])==="Array"?n[r].concat(a[r]):a[r]:n[r]=a[r]}),n};$.deepMerge=function(n,a){return Object.keys(a).map(function(r){if($.typeOf(a[r])==="Array"&&$.typeOf(n[r])==="Array"){if($.typeOf(n[r])==="Array"){var t;(t=n[r]).push.apply(t,pa(a[r]))}}else $.typeOf(n[r])===$.typeOf(a[r])&&n[r]!==null&&$.typeOf(n[r])==="Object"&&!(a[r]instanceof window.Node)?$.deepMerge(n[r],a[r]):a[r]!==null&&(n[r]=a[r])}),n};$.getBgImage=function(n){var a=(n.currentStyle||window.getComputedStyle(n,null)).backgroundImage;if(!a||a==="none")return"";var r=document.createElement("a");return r.href=a.replace(/url\("|"\)/g,""),r.href};$.copyDom=function(n){if(n&&n.nodeType===1){var a=document.createElement(n.tagName);return Array.prototype.forEach.call(n.attributes,function(r){a.setAttribute(r.name,r.value)}),n.innerHTML&&(a.innerHTML=n.innerHTML),a}else return""};$.setInterval=function(n,a,r,t){n._interval[a]||(n._interval[a]=window.setInterval(r.bind(n),t))};$.clearInterval=function(n,a){clearInterval(n._interval[a]),n._interval[a]=null};$.setTimeout=function(n,a,r){n._timers||(n._timers=[]);var t=setTimeout(function(){a(),$.clearTimeout(n,t)},r);return n._timers.push(t),t};$.clearTimeout=function(n,a){var r=n._timers;if($.typeOf(r)==="Array"){for(var t=0;t-1&&t.indexOf(h)>-1?(i=parseFloat(r.slice(0,r.indexOf(h)).trim()),s=parseFloat(t.slice(0,t.indexOf(h)).trim()),f=h,!1):!0}),e.style.width="".concat(i).concat(f),e.style.height="".concat(s).concat(f),e.style.backgroundSize="".concat(i).concat(f," ").concat(s).concat(f),n==="start"?e.style.margin="-".concat(s/2).concat(f," auto auto -").concat(i/2).concat(f):e.style.margin="auto 5px auto 5px"}return e};$.Hex2RGBA=function(n,a){var r=[];if(/^\#[0-9A-F]{3}$/i.test(n)){var t="#";n.replace(/[0-9A-F]/ig,function(e){t+=e+e}),n=t}return/^#[0-9A-F]{6}$/i.test(n)?(n.replace(/[0-9A-F]{2}/ig,function(e){r.push(parseInt(e,16))}),"rgba(".concat(r.join(","),", ").concat(a,")")):"rgba(255, 255, 255, 0.1)"};$.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement};$.checkIsFunction=function(n){return n&&typeof n=="function"};$.checkIsObject=function(n){return n!==null&&ii(n)==="object"};$.hide=function(n){n.style.display="none"};$.show=function(n,a){n.style.display=a||"block"};$.isUndefined=function(n){if(typeof n>"u"||n===null)return!0};$.isNotNull=function(n){return n!=null};$.setStyleFromCsstext=function(n,a){if(a)if($.typeOf(a)==="String"){var r=a.replace(/\s+/g,"").split(";");r.map(function(t){if(t){var e=t.split(":");e.length>1&&(n.style[e[0]]=e[1])}})}else Object.keys(a).map(function(t){n.style[t]=a[t]})};function pk(n,a){for(var r=0,t=a.length;r-1)return!0;return!1}$.filterStyleFromText=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],r=n.style.cssText;if(!r)return{};var t=r.replace(/\s+/g,"").split(";"),e={},i={};return t.map(function(s){if(s){var f=s.split(":");f.length>1&&(pk(f[0],a)?e[f[0]]=f[1]:i[f[0]]=f[1])}}),n.setAttribute("style",""),Object.keys(i).map(function(s){n.style[s]=i[s]}),e};$.getStyleFromCsstext=function(n){var a=n.style.cssText;if(!a)return{};var r=a.replace(/\s+/g,"").split(";"),t={};return r.map(function(e){if(e){var i=e.split(":");i.length>1&&(t[i[0]]=i[1])}}),t};$.preloadImg=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(n){var t=new window.Image;t.onload=function(e){t=null,a&&a(e)},t.onerror=function(e){t=null,r&&r(e)},t.src=n}};$.stopPropagation=function(n){n&&n.stopPropagation()};$.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0};$.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0};$.checkTouchSupport=function(){return"ontouchstart"in window};$.getBuffered2=function(n){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.5,r=[],t=0;tf&&(e[s-1].end=r[i].end):e.push(r[i])}else e.push(r[i])}else e=r;return new vk(e)};$.getEventPos=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return n.touches&&n.touches.length>0&&(n=n.touches[0]),{x:n.x/a,y:n.y/a,clientX:n.clientX/a,clientY:n.clientY/a,offsetX:n.offsetX/a,offsetY:n.offsetY/a,pageX:n.pageX/a,pageY:n.pageY/a}};$.requestAnimationFrame=function(n){var a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(a)return a(n)};$.getHostFromUrl=function(n){if($.typeOf(n)!=="String")return"";var a=n.split("/"),r="";return a.length>3&&a[2]&&(r=a[2]),r};$.cancelAnimationFrame=function(n){var a=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;a&&a(n)};$.isMSE=function(n){return n.media&&(n=n.media),!n||!(n instanceof HTMLMediaElement)?!1:/^blob/.test(n.currentSrc)||/^blob/.test(n.src)};$.isBlob=function(n){return typeof n=="string"&&/^blob/.test(n)};$.generateSessionId=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=new Date().getTime();try{n=parseInt(n)}catch{n=0}a+=n,window.performance&&typeof window.performance.now=="function"&&(a+=parseInt(window.performance.now()));var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(a+Math.random()*16)%16|0;return a=Math.floor(a/16),(t==="x"?e:e&3|8).toString(16)});return r};$.createEvent=function(n){var a;return typeof window.Event=="function"?a=new Event(n):(a=document.createEvent("Event"),a.initEvent(n,!0,!0)),a};$.adjustTimeByDuration=function(n,a,r){return!a||!n?n:n>a||r&&n0&&arguments[0]!==void 0?arguments[0]:{x:0,y:0,scale:1,rotate:0},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={scale:"".concat(n.scale||1),translate:"".concat(n.x||0,"%, ").concat(n.y||0,"%"),rotate:"".concat(n.rotate||0,"deg")},t=Object.keys(r);return t.forEach(function(e){var i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),s="".concat(e,"(").concat(r[e],")");i.test(a)?(i.lastIndex=-1,a=a.replace(i,s)):a+="".concat(s," ")}),a};$.convertDeg=function(n){return Math.abs(n)<=1?n*360:n%360};$.getIndexByTime=function(n,a){var r=a.length,t=-1;if(r<1)return t;if(n<=a[0].end||r<2)t=0;else if(n>a[r-1].end)t=r-1;else for(var e=1;ea[e-1].end&&n<=a[e].end){t=e;break}return t};$.getOffsetCurrentTime=function(n,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1,t=-1;if(r>=0&&r=s&&n<=f?n-p:n>f&&t>=e-1?f:-1};$.getCurrentTimeByOffset=function(n,a){var r=-1;if(!a||a.length<0)return n;for(var t=0;t=a||oe<0||b&&Y>=i}function z(){var ne=Date.now();if(G(ne))return Z(ne);f=I(z,N(ne))}function Z(ne){return f=void 0,A&&t?D(ne):(t=e=void 0,s)}function H(){f!==void 0&&O(f),p=0,t=h=e=f=void 0}function ee(){return f===void 0?s:Z(Date.now())}function te(){return f!==void 0}function fe(){for(var ne=Date.now(),oe=G(ne),Y=arguments.length,q=new Array(Y),Q=0;Q"u")return"";var n=navigator.userAgent.toLowerCase(),a={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(a).filter(function(r){return a[r].test(n)}))[0]},get os(){if(typeof navigator>"u")return{};var n=navigator.userAgent,a=/(?:Windows Phone)/.test(n),r=/(?:SymbianOS)/.test(n)||a,t=/(?:Tizen)/ig.test(n),e=/(?:Web0S)/ig.test(n),i=/(?:Android)/.test(n),s=/(?:Firefox)/.test(n),f=/(?:iPad|PlayBook)/.test(n)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,h=f||i&&!/(?:Mobile)/.test(n)||s&&/(?:Tablet)/.test(n),p=/(?:iPhone)/.test(n)&&!h,S=!p&&!i&&!r&&!h;return{isTablet:h,isPhone:p,isIpad:f,isIos:p||f,isAndroid:i,isPc:S,isSymbian:r,isWindowsPhone:a,isFireFox:s,isTizen:t,isWebOS:e}},get osVersion(){if(typeof navigator>"u")return 0;var n=navigator.userAgent,a="";/(?:iPhone)|(?:iPad|PlayBook)/.test(n)?a=S1.ios:a=S1.android;var r=a?a.exec(n):[];if(r&&r.length>=3){var t=r[2].split(".");return t.length>0?parseInt(t[0]):0}return 0},get isWeixin(){if(typeof navigator>"u")return!1;var n=/(micromessenger)\/([\d.]+)/,a=n.exec(navigator.userAgent.toLocaleLowerCase());return!!a},isSupportMP4:function(){var a={isSupport:!1,mime:""};if(typeof document>"u")return a;if(this.supportResult)return this.supportResult;var r=document.createElement("video");return typeof r.canPlayType=="function"&&Ek.map(function(t){r.canPlayType('video/mp4; codecs="'.concat(t,'"'))==="probably"&&(a.isSupport=!0,a.mime+="||".concat(t))}),this.supportResult=a,r=null,a},isMSESupport:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(typeof MediaSource>"u"||!MediaSource)return!1;try{return MediaSource.isTypeSupported(a)}catch(r){return this._logger.error(a,r),!1}},isHevcSupported:function(){return typeof MediaSource>"u"||!MediaSource.isTypeSupported?!1:MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')},probeConfigSupported:function(a){var r={supported:!1,smooth:!1,powerEfficient:!1};if(!a||typeof navigator>"u")return Promise.resolve(r);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(a);var t=a.video||{},e=a.audio||{};try{var i=MediaSource.isTypeSupported(t.contentType),s=MediaSource.isTypeSupported(e.contentType);return Promise.resolve({supported:i&&s,smooth:!1,powerEfficient:!1})}catch{return Promise.resolve(r)}}},Jp="3.0.22",_1={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},b1={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Cc=kt(function n(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};At(this,n);var t=a&&a.i18n?a.i18n.ERROR_TYPES:null;if(a.media){var e=r.mediaError?r.mediaError:a.media.error||{},i=a.duration,s=a.currentTime,f=a.ended,h=a.src,p=a.currentSrc,S=a.media,b=S.readyState,A=S.networkState,R=r.errorCode||e.code;b1[R]&&(R=b1[R]);var D={playerVersion:Jp,currentTime:s,duration:i,ended:f,readyState:b,networkState:A,src:h||p,errorType:r.errorType,errorCode:R,message:r.errorMessage||e.message,mediaError:e,originError:r.originError?r.originError.stack:"",host:$.getHostFromUrl(h||p)};return r.ext&&Object.keys(r.ext).map(function(N){D[N]=r.ext[N]}),D}else if(arguments.length>1){for(var I={playerVersion:Jp,domain:document.domain},O=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],V=0;V0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers||(this._evHandlers=jE.map(function(s){var f="on".concat(s.charAt(0).toUpperCase()).concat(s.slice(1));return typeof e[f]=="function"&&e.on(s,e[f]),je({},s,Pk(s,e))})),this._evHandlers.forEach(function(s){var f=Object.keys(s)[0];i.addEventListener(f,s[f],!1)})}},{key:"detachVideoEvents",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.media;this._evHandlers.forEach(function(s){var f=Object.keys(s)[0];i.removeEventListener(f,s[f],!1)}),this._evHandlers.forEach(function(s){var f=Object.keys(s)[0],h="on".concat(f.charAt(0).toUpperCase()).concat(f.slice(1));typeof e[h]=="function"&&e.off(f,e[h])}),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,i){var s=this;e.removeAttribute("src"),e.load(),i.forEach(function(b,A){s.media.appendChild($.createDom("source","",{src:"".concat(b.src),type:"".concat(b.type||""),"data-index":A+1}))});var f=e.children;if(f){this._videoSourceCount=f.length,this._videoSourceIndex=f.length,this._vLoadeddata=function(b){s.emit(VE,{src:b.target.currentSrc,host:$.getHostFromUrl(b.target.currentSrc)})};for(var h=null,p=0;p=s._videoSourceCount){var R={code:4,message:"sources_load_error"};h?h.error(b,R):s.errorHandler("error",R)}var D=_1[4];s.emit(HE,new Cc(s,{errorType:D,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:b.target.src}))});for(var S=0;S0;)e.removeChild(i[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.media&&(this.media.error||i)){var s=this.media.error||i,f=s.code?_1[s.code]:"other",h=s.message;this.media.currentSrc||this.media.srcObject||(h="empty_src",s={code:6,message:h}),this.emit(e,new Cc(this,{errorType:f,errorCode:s.code,errorMessage:s.message||"",mediaError:s}))}}},{key:"destroy",value:function(){this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null;for(var e in this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){var e=this.media?this.media.play():null;return e}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return this.media?this.media.canPlayType(e):!1}},{key:"getBufferedRange",value:function(e){var i=[0,0];if(!this.media)return i;e||(e=this.media.buffered);var s=this.media.currentTime;if(e)for(var f=0,h=e.length;f=this.currentTime)return{start:i.start(s),end:i.end(s)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?this.media.currentTime!==void 0?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return this.media?this.media.defaultMuted:!1},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return this.media?this.media.ended:!1}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){var e=this.media.error;if(!e)return"";var i=["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"];return i[this.media.error.code-1]}},{key:"loop",get:function(){return this.media?this.media.loop:!1},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return this.media?this.media.muted:!1},set:function(e){!this.media||this.media.muted===e||(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return this.media?this.media.paused:!0}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){!this.media||e===1/0||(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return this.media?this.media.preload:!1},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return this.media?this.media.seekable:!1}},{key:"seeking",get:function(){return this.media?this.media.seeking:!1}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){if(this.media){if(this.emit(rf,e),this.emit(Nc),this._currentTime=0,this._duration=0,$.isMSE(this.media)){this.onWaiting();return}this._detachSourceEvents(this.media),$.typeOf(e)==="Array"?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()}}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e===1/0||!this.media||(this.media.volume=e)}},{key:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,i){for(var s,f=arguments.length,h=new Array(f>2?f-2:0),p=2;p2?f-2:0),p=2;p2?f-2:0),p=2;p2?f-2:0),p=2;p0&&arguments[0]!==void 0?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};At(this,n),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=a}return kt(n,[{key:"openDB",value:function(r){var t=this,e=this,i=this.myDB.version||1,s=e.indexedDB.open(e.myDB.name,i);s.onerror=function(f){},s.onsuccess=function(f){t.myDB.db=f.target.result,r.call(e)},s.onupgradeneeded=function(f){var h=f.target.result;f.target.transaction,h.objectStoreNames.contains(e.myDB.ojstore.name)||h.createObjectStore(e.myDB.ojstore.name,{keyPath:e.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){var r=this;r.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(r,t){for(var e=this.myDB.db.transaction(r,"readwrite").objectStore(r),i,s=0;s3?t-3:0),i=3;i2&&arguments[2]!==void 0?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[n]&&(this.__hooks[n]=null),(function(){var t=arguments,e=this;if(r.pre)try{var i;(i=r.pre).call.apply(i,[this].concat(Array.prototype.slice.call(arguments)))}catch(f){throw f.message="[pluginName: ".concat(this.pluginName,":").concat(n,":pre error] >> ").concat(f.message),f}if(this.__hooks&&this.__hooks[n])try{var s=Ua(this,n,a);s?s.then?s.then(function(f){f!==!1&&ph.apply(void 0,[e,a,r.next].concat(pa(t)))}).catch(function(f){throw f}):ph.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments))):s===void 0&&ph.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments)))}catch(f){throw f.message="[pluginName: ".concat(this.pluginName,":").concat(n,"] >> ").concat(f.message),f}else ph.apply(void 0,[this,a,r.next].concat(Array.prototype.slice.call(arguments)))}).bind(this)}function WE(n,a){var r=this.__hooks;if(!r||!Array.isArray(r[n]))return-1;for(var t=r[n],e=0;e1?r-1:0),e=1;e1?r-1:0),e=1;e1&&arguments[1]!==void 0?arguments[1]:[];n.__hooks={},a&&a.map(function(r){n.__hooks[r]=null}),Object.defineProperty(n,"hooks",{get:function(){return n.__hooks&&Object.keys(n.__hooks).map(function(t){if(n.__hooks[t])return t})}})}function KE(n){n.__hooks=null}function Ua(n,a,r){for(var t=arguments.length,e=new Array(t>3?t-3:0),i=3;i3?R-3:0),I=3;I1?e-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:{};if(this.player){var i=un(un({},e),{},{pluginName:this.pluginName});this.player.emitUserAction(r,t,i)}}},{key:"hook",value:function(r,t){return A0.call.apply(A0,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(r,t){for(var e=arguments.length,i=new Array(e>2?e-2:0),s=2;s2?e-2:0),s=2;s1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";if(this.player)return e&&(t.pluginName=e),this.player.registerPlugin({plugin:r,options:t})}},{key:"getPlugin",value:function(r){return this.player?this.player.getPlugin(r):null}},{key:"__destroy",value:function(){var r=this,t=this.player,e=this.pluginName;this.offAll(),$.clearAllTimers(this),$.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map(function(i){r[i]=null}),t.unRegisterPlugin(e),KE(this)}}],[{key:"defineGetterOrSetter",value:function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&Object.defineProperty(r,e,t[e])}},{key:"defineMethod",value:function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&typeof t[e]=="function"&&Object.defineProperty(r,e,{configurable:!0,value:t[e]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),n}(),pp,L1;function Fk(){if(L1)return pp;L1=1;var n=9;if(typeof Element<"u"&&!Element.prototype.matches){var a=Element.prototype;a.matches=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector}function r(t,e){for(;t&&t.nodeType!==n;){if(typeof t.matches=="function"&&t.matches(e))return t;t=t.parentNode}}return pp=r,pp}var gp,R1;function Mk(){if(R1)return gp;R1=1;var n=Fk();function a(e,i,s,f,h){var p=t.apply(this,arguments);return e.addEventListener(s,p,h),{destroy:function(){e.removeEventListener(s,p,h)}}}function r(e,i,s,f,h){return typeof e.addEventListener=="function"?a.apply(null,arguments):typeof s=="function"?a.bind(null,document).apply(null,arguments):(typeof e=="string"&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,function(p){return a(p,i,s,f,h)}))}function t(e,i,s,f){return function(h){h.delegateTarget=n(h.target,i),h.delegateTarget&&f.call(e,h)}}return gp=r,gp}var Bk=Mk();const D1=Zu(Bk);var Nk={CONTROLS:"controls",ROOT:"root"},Ur={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"},P1={ICON_DISABLE:"xg-icon-disable"};function mp(n){return n?n.indexOf&&/^(?:http|data:|\/)/.test(n):!1}function Uk(n,a){return ii(n)==="object"&&n.class&&typeof n.class=="string"?"".concat(a," ").concat(n.class):a}function Hk(n,a){return ii(n)==="object"&&n.attr&&ii(n.attr)==="object"&&Object.keys(n.attr).map(function(r){a[r]=n.attr[r]}),a}function I1(n,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",i=null;if(n instanceof window.Element)return $.addClass(n,r),Object.keys(t).map(function(s){n.setAttribute(s,t[s])}),n;if(mp(n)||mp(n.url))return t.src=mp(n)?n:n.url||"",i=$.createDom(n.tag||"img","",t,"xg-img ".concat(r)),i;if(typeof n=="function")try{return i=n(),i instanceof window.Element?($.addClass(i,r),Object.keys(t).map(function(s){i.setAttribute(s,t[s])}),i):(fr.logWarn("warn>>icons.".concat(a," in config of plugin named [").concat(e,"] is a function mast return an Element Object")),null)}catch(s){return fr.logError("Plugin named [".concat(e,"]:createIcon"),s),null}return typeof n=="string"?$.createDomFromHtml(n,t,r):(fr.logWarn("warn>>icons.".concat(a," in config of plugin named [").concat(e,"] is invalid")),null)}function Vk(n,a){var r=a.config.icons||a.playerConfig.icons;Object.keys(n).map(function(t){var e=n[t],i=e&&e.class?e.class:"",s=e&&e.attr?e.attr:{},f=null;r&&r[t]&&(i=Uk(r[t],i),s=Hk(r[t],s),f=I1(r[t],t,i,s,a.pluginName)),!f&&e&&(f=I1(e.icon?e.icon:e,s,i,{},a.pluginName)),a.icons[t]=f})}function jk(n,a){Object.keys(n).map(function(r){Object.defineProperty(a.langText,r,{get:function(){var e=a.lang,i=a.i18n;return i[r]?i[r]:n[r]&&n[r][e]||""}})})}var wr=function(n){Nt(r,n);var a=Ut(r);function r(){var t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return At(this,r),t=a.call(this,e),t.__delegates=[],t}return kt(r,[{key:"__init",value:function(e){if(zt(Vt(r.prototype),"__init",this).call(this,e),!!e.root){var i=e.root,s=null;this.icons={},this.root=null,this.parent=null;var f=this.registerIcons()||{};Vk(f,this),this.langText={};var h=this.registerLanguageTexts()||{};jk(h,this);var p="";try{p=this.render()}catch(A){throw fr.logError("Plugin:".concat(this.pluginName,":render"),A),new Error("Plugin:".concat(this.pluginName,":render:").concat(A.message))}if(p)s=r.insert(p,i,e.index),s.setAttribute("data-index",e.index);else if(e.tag)s=$.createDom(e.tag,"",e.attr,e.name),s.setAttribute("data-index",e.index),i.appendChild(s);else return;this.root=s,this.parent=i;var S=this.config.attr||{},b=this.config.style||{};this.setAttr(S),this.setStyle(b),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var i=this.children();i&&ii(i)==="object"&&Object.keys(i).length>0&&Object.keys(i).map(function(s){var f=s,h=i[f],p={root:e.root},S,b;typeof h=="function"?(S=e.config[f]||{},b=h):ii(h)==="object"&&typeof h.plugin=="function"&&(S=h.options?$.deepCopy(e.config[f]||{},h.options):e.config[f]||{},b=h.plugin),p.config=S,S.index!==void 0&&(p.index=S.index),S.root&&(p.root=S.root),e.registerPlugin(b,p,f)})}}},{key:"updateLang",value:function(e){e||(e=this.lang);function i(p,S){for(var b=0;b0?i(p.children[b],S):S(p.children[b])}var s=this.root,f=this.i18n,h=this.langText;s&&i(s,function(p){var S=p.getAttribute&&p.getAttribute("lang-key");if(S){var b=f[S.toUpperCase()]||h[S];b&&(p.innerHTML=typeof b=="function"?b(e):b)}})}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=this.i18n||{},f=this.langText;e.setAttribute&&e.setAttribute("lang-key",i);var h=s[i]||f[i]||"";h&&(e.innerHTML=h)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,$.addClass(this.find(".xgplayer-icon"),P1.ICON_DISABLE)}},{key:"enable",value:function(){this.config.disable=!1,$.removeClass(this.find(".xgplayer-icon"),P1.ICON_DISABLE)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";i.root=i.root||this.root;var f=zt(Vt(r.prototype),"registerPlugin",this).call(this,e,i,s);return this._children.push(f),f}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,i,s){var f=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(p){f.bindEL(p,i)}):this.bindEL(e,i);else{var h=r.delegate.call(this,this.root,e,i,s);this.__delegates=this.__delegates.concat(h)}}},{key:"unbind",value:function(e,i){var s=this;if(arguments.length<3&&typeof i=="function")Array.isArray(e)?e.forEach(function(p){s.unbindEL(p,i)}):this.unbindEL(e,i);else for(var f="".concat(e,"_").concat(i),h=0;h2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.addEventListener(e,i,s)}},{key:"unbindEL",value:function(e,i){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.root&&"on".concat(e)in this.root&&typeof i=="function"&&this.root.removeEventListener(e,i,s)}},{key:"show",value:function(e){if(this.root){this.root.style.display=e!==void 0?e:"block";var i=window.getComputedStyle(this.root,null),s=i.getPropertyValue("display");if(s==="none")return this.root.style.display="block"}}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,i){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!i||!(i instanceof window.Element))return null;try{return typeof e=="string"?this.find(e).appendChild(i):e.appendChild(i)}catch(s){return fr.logError("Plugin:appendChild",s),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,i=this.player;this.__delegates.map(function(s){s.destroy()}),this.__delegates=[],this._children instanceof Array&&(this._children.map(function(s){i.unRegisterPlugin(s.pluginName)}),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),zt(Vt(r.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map(function(s){e[s]=null})}}],[{key:"insert",value:function(e,i){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,f=i.children.length,h=Number(s),p=e instanceof window.Node;if(f){for(var S=0,b=null,A="";S=h){A="beforebegin";break}else R4&&arguments[4]!==void 0?arguments[4]:!1,p=[];if(e instanceof window.Node&&typeof f=="function")if(Array.isArray(s))s.forEach(function(b){var A=D1(e,i,b,f,h);A.key="".concat(i,"_").concat(b),p.push(A)});else{var S=D1(e,i,s,f,h);S.key="".concat(i,"_").concat(s),p.push(S)}return p}},{key:"ROOT_TYPES",get:function(){return Nk}},{key:"POSITIONS",get:function(){return Ur}}]),r}(Fi),Gk=function(){function n(){var a=this;if(At(this,n),je(this,"__trigger",function(r){var t=new Date().getTime();a.timeStamp=t;for(var e=0;e-1?this.__handlers[s].handler=t:this.__handlers.push({target:r,handler:t,playerId:e})}}},{key:"unObserver",value:function(r){var t=-1;this.__handlers.map(function(i,s){r===i.target&&(t=s)});try{var e;(e=this.observer)===null||e===void 0||e.unobserve(r)}catch{}t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){var r;(r=this.observer)===null||r===void 0||r.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(r){for(var t=this.__handlers,e=0;e2&&arguments[2]!==void 0?arguments[2]:{};if(!(!a||!r||typeof r!="function"||r.prototype===void 0)){var e=a._pluginInfoId;if(!(!e||!this.pluginGroup[e])){this.pluginGroup[e]._plugins||(this.pluginGroup[e]._plugins={});var i=this.pluginGroup[e]._plugins,s=this.pluginGroup[e]._originalOptions;t.player=a;var f=t.pluginName||r.pluginName;if(!f)throw new Error("The property pluginName is necessary");if(r.isSupported&&!r.isSupported(a.config.mediaType,a.config.codecType)){console.warn("not supported plugin [".concat(f,"]"));return}t.config||(t.config={});for(var h=Object.keys(s),p=0;p"u"&&(t.config[A]=r.defaultConfig[A])}),t.root?typeof t.root=="string"&&(t.root=a[t.root]):t.root=a.root,t.index=t.config.index||0;try{i[f.toLowerCase()]&&(this.unRegister(e,f.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(f,"] exist, destroy the old instance")));var b=new r(t);return i[f.toLowerCase()]=b,i[f.toLowerCase()].func=r,b&&typeof b.afterCreate=="function"&&b.afterCreate(),b}catch(A){throw console.error(A),A}}}},unRegister:function(a,r){a._pluginInfoId&&(a=a._pluginInfoId),r=r.toLowerCase();try{var t=this.pluginGroup[a]._plugins[r];t&&(t.pluginName&&t.__destroy(),delete this.pluginGroup[a]._plugins[r])}catch(e){console.error("[unRegister:".concat(r,"] cgid:[").concat(a,"] error"),e)}},deletePlugin:function(a,r){var t=a._pluginInfoId;t&&this.pluginGroup[t]&&this.pluginGroup[t]._plugins&&delete this.pluginGroup[t]._plugins[r]},getPlugins:function(a){var r=a._pluginInfoId;return r&&this.pluginGroup[r]?this.pluginGroup[r]._plugins:{}},findPlugin:function(a,r){var t=a._pluginInfoId;if(!t||!this.pluginGroup[t])return null;var e=r.toLowerCase();return this.pluginGroup[t]._plugins[e]},beforeInit:function(a){var r=this;function t(e){return!e||!e.then?new Promise(function(i){i()}):e}return new Promise(function(e){if(r.pluginGroup){var i;return a._loadingPlugins&&a._loadingPlugins.length?i=Promise.all(a._loadingPlugins):i=Promise.resolve(),i.then(function(){var s=a._pluginInfoId;if(!r.pluginGroup[s]){e();return}var f=r.pluginGroup[s]._plugins,h=[];Object.keys(f).forEach(function(p){if(f[p]&&f[p].beforePlayerInit)try{var S=f[p].beforePlayerInit();h.push(t(S))}catch(b){throw h.push(t(null)),b}}),Promise.all([].concat(h)).then(function(){e()}).catch(function(p){console.error(p),e()})})}})},afterInit:function(a){var r=a._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins;Object.keys(t).forEach(function(e){t[e]&&t[e].afterPlayerInit&&t[e].afterPlayerInit()})}},setLang:function(a,r){var t=r._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=this.pluginGroup[t]._plugins;Object.keys(e).forEach(function(i){if(e[i].updateLang)e[i].updateLang(a);else try{e[i].lang=a}catch{console.warn("".concat(i," setLang"))}})}},reRender:function(a){var r=this,t=a._pluginInfoId;if(!(!t||!this.pluginGroup[t])){var e=[],i=this.pluginGroup[t]._plugins;Object.keys(i).forEach(function(s){s!=="controls"&&i[s]&&(e.push({plugin:i[s].func,options:i[s].__args}),r.unRegister(t,s))}),e.forEach(function(s){r.register(a,s.plugin,s.options)})}},onPluginsReady:function(a){var r=a._pluginInfoId;if(!(!r||!this.pluginGroup[r])){var t=this.pluginGroup[r]._plugins||{};Object.keys(t).forEach(function(e){t[e].onPluginsReady&&typeof t[e].onPluginsReady=="function"&&t[e].onPluginsReady()})}},destroy:function(a){var r=a._pluginInfoId;if(this.pluginGroup[r]){Wk(a.root);for(var t=this.pluginGroup[r]._plugins,e=0,i=Object.keys(t);e1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(this.root){var f=e.defaultConfig||{};if(!i.root){var h=i.position?i.position:i.config&&i.config.position?i.config.position:f.position;switch(h){case Ur.CONTROLS_LEFT:i.root=this.left;break;case Ur.CONTROLS_RIGHT:i.root=this.right;break;case Ur.CONTROLS_CENTER:i.root=this.center;break;case Ur.CONTROLS:i.root=this.root;break;default:i.root=this.left}return zt(Vt(r.prototype),"registerPlugin",this).call(this,e,i,s)}}}},{key:"destroy",value:function(){er.device!=="mobile"&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave)),this.left=null,this.center=null,this.right=null,this.innerRoot=null}},{key:"render",value:function(){var e=this.config,i=e.mode,s=e.autoHide,f=e.initShow,h=e.disable;if(!h){var p=$.classNames({"xgplayer-controls":!0},{"flex-controls":i==="flex"},{"bottom-controls":i==="bottom"},je({},rt.CONTROLS_AUTOHIDE,s),{"xgplayer-controls-initshow":f||!s});return' `)}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),r}(wr),Yk={LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}},Ii={lang:{},langKeys:[],textKeys:[]};function wc(n,a){return Object.keys(a).forEach(function(r){var t=$.typeOf(a[r]),e=$.typeOf(n[r]);if(t==="Array"){var i;e!=="Array"&&(n[r]=[]),(i=n[r]).push.apply(i,pa(a[r]))}else t==="Object"?(e!=="Object"&&(n[r]={}),wc(n[r],a[r])):n[r]=a[r]}),n}function YE(){Object.keys(Ii.lang.en).map(function(n){Ii.textKeys[n]=n})}function Xk(n,a){var r=[];if(a||(a=Ii),!!a.lang){$.typeOf(n)!=="Array"?r=Object.keys(n).map(function(i){var s=i==="zh"?"zh-cn":i;return{LANG:s,TEXT:n[i]}}):r=n;var t=a,e=t.lang;r.map(function(i){i.LANG==="zh"&&(i.LANG="zh-cn"),e[i.LANG]?wc(e[i.LANG]||{},i.TEXT||{}):Ng(i,a)}),YE()}}function Ng(n,a){var r=n.LANG;if(a||(a=Ii),!!a.lang){var t=n.TEXT||{};r==="zh"&&(r="zh-cn"),a.lang[r]?wc(a.lang[r],t):(a.langKeys.push(r),a.lang[r]=t),YE()}}function qk(n){var a,r={lang:{},langKeys:[],textKeys:{},pId:n};return wc(r.lang,Ii.lang),(a=r.langKeys).push.apply(a,pa(Ii.langKeys)),wc(r.textKeys,Ii.textKeys),r}Ng(Yk);var zu={get textKeys(){return Ii.textKeys},get langKeys(){return Ii.langKeys},get lang(){var n={};return Ii.langKeys.map(function(a){n[a]=Ii.lang[a]}),Ii.lang["zh-cn"]&&(n.zh=Ii.lang["zh-cn"]||{}),n},extend:Xk,use:Ng,init:qk},pr={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7},F1=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],gi={},yp=null,XE=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"add",value:function(e){e&&(gi[e.playerId]=e,Object.keys(gi).length===1&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete gi[e.playerId])}},{key:"_iterate",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(var s in gi)if(Object.prototype.hasOwnProperty.call(gi,s)){var f=gi[s];if(i){if(e(f))break}else e(f)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var i=null;return this._iterate(function(s){var f=e(s);return f&&(i=s),f},!0),i}},{key:"findAll",value:function(e){var i=[];return this._iterate(function(s){e(s)&&i.push(s)}),i}},{key:"setActive",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(gi[e])return i?this.forEach(function(s){e===s.playerId?(s.isUserActive=!0,s.isInstNext=!1):s.isUserActive=!1}):gi[e].isUserActive=i,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(gi),i=0;i1&&arguments[1]!==void 0?arguments[1]:!0;if(gi[e])return i?this.forEach(function(s){e===s.playerId?(s.isUserActive=!1,s.isInstNext=!0):s.isInstNext=!1}):gi[e].isInstNext=i,e}}],[{key:"getInstance",value:function(){return yp||(yp=new r),yp}}]),r}(wE.EventEmitter);function Zk(n){for(var a=Object.keys(gi),r=0;r=0&&s&&(e.config.presets[f]=s)}else s&&e.config.presets.push(s);e.userTimer=null,e.waitTimer=null,e.handleSource=!0,e._state=pr.INITIAL,e.isAd=!1,e.isError=!1,e._hasStart=!1,e.isSeeking=!1,e.isCanplay=!1,e._useAutoplay=!1,e.__startTime=-1,e.rotateDeg=0,e.isActive=!1,e.fullscreen=!1,e.cssfullscreen=!1,e.isRotateFullscreen=!1,e._fullscreenEl=null,e.timeSegments=[],e._cssfullscreenEl=null,e.curDefinition=null,e._orgCss="",e._fullScreenOffset=null,e._videoHeight=0,e._videoWidth=0,e.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},e.sizeInfo={width:0,height:0,left:0,top:0},e._accPlayed={t:0,acc:0,loopAcc:0},e._offsetInfo={currentTime:-1,duration:0},e.innerContainer=null,e.controls=null,e.topBar=null,e.root=null,e.__i18n=zu.init(e._pluginInfoId),er.os.isAndroid&&er.osVersion>0&&er.osVersion<6&&(e.config.autoplay=!1),e.database=new Ok,e.isUserActive=!1,e._onceSeekCanplay=null,e._isPauseBeforeSeek=0,e.innerStates={isActiveLocked:!1},e.instManager=uo;var h=e._initDOM();if(!h)return console.error(new Error("can't find the dom which id is ".concat(e.config.id," or this.config.el does not exist"))),Dg(e);var p=e.config,S=p.definition,b=S===void 0?{}:S,A=p.url;if(!A&&b.list&&b.list.length>0){var R=b.list.find(function(D){return D.definition&&D.definition===b.defaultDefinition});R||(b.defaultDefinition=b.list[0].definition,R=b.list[0]),e.config.url=R.url,e.curDefinition=R}return e._bindEvents(),e._registerPresets(),e._registerPlugins(),Wn.onPluginsReady(Oe(e)),e.getInitDefinition(),e.setState(pr.READY),$.setTimeout(Oe(e),function(){e.emit(Fg)},0),e.onReady&&e.onReady(),(e.config.videoInit||e.config.autoplay)&&(!e.hasStart||e.state0?this._attachSourceEvents(this.media,e):!this.media.src||this.media.src!==e?this.media.src=e:e||this.media.removeAttribute("src")),$.typeOf(this.config.volume)==="Number"&&(this.volume=this.config.volume);var s=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!s.contains(this.media)&&s.insertBefore(this.media,s.firstChild);var f=this.media.readyState;fr.logInfo("_startInit readyState",f),this.config.autoplay&&(!$.isMSE(this.media)&&this.load(),(er.os.isIpad||er.os.isPhone)&&this.mediaPlay());var h=this.config.startTime;this.__startTime=h>0?h:-1,this.config.startTime=0,f>=2&&this.duration>0?this.canPlayFunc():this.on(ds,this.canPlayFunc),(!this.hasStart||this.state0&&arguments[0]!==void 0?arguments[0]:!0;this._loadingPlugins=[];var s=this.config.ignores||[],f=this.config.plugins||[],h=this.config.i18n||[];i&&zu.extend(h,this.__i18n);var p=s.join("||").toLowerCase().split("||"),S=this.plugins;f.forEach(function(b){try{var A=b.plugin?b.plugin.pluginName:b.pluginName;if(A&&p.indexOf(A.toLowerCase())>-1)return null;if(!i&&S[A.toLowerCase()])return;if(b.lazy&&b.loader){var R=Wn.lazyRegister(e,b);b.forceBeforeInit&&(R.then(function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(R),1)}).catch(function(D){fr.logError("_registerPlugins:loadingPlugin",D),e._loadingPlugins.splice(e._loadingPlugins.indexOf(R),1)}),e._loadingPlugins.push(R));return}return e.registerPlugin(b)}catch(D){fr.logError("_registerPlugins:",D)}})}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach(function(i){$k(e,i)})}},{key:"_getRootByPosition",value:function(e){var i=null;switch(e){case Ur.ROOT_RIGHT:this.rightBar||(this.rightBar=$.createPositionBar("xg-right-bar",this.root)),i=this.rightBar;break;case Ur.ROOT_LEFT:this.leftBar||(this.leftBar=$.createPositionBar("xg-left-bar",this.root)),i=this.leftBar;break;case Ur.ROOT_TOP:this.topBar||(this.topBar=$.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&$.addClass(this.topBar,rt.TOP_BAR_AUTOHIDE)),i=this.topBar;break;default:i=this.innerContainer||this.root;break}return i}},{key:"registerPlugin",value:function(e,i){var s=Wn.formatPluginInfo(e,i),f=s.PLUFGIN,h=s.options,p=this.config.plugins,S=Wn.checkPluginIfExits(f.pluginName,p);!S&&p.push(f);var b=Wn.getRootByConfig(f.pluginName,this.config);b.root&&(h.root=b.root),b.position&&(h.position=b.position);var A=h.position?h.position:h.config&&h.config.position||f.defaultConfig&&f.defaultConfig.position;if(!h.root&&typeof A=="string"&&A.indexOf("controls")>-1){var R;return(R=this.controls)===null||R===void 0?void 0:R.registerPlugin(f,h,f.pluginName)}return h.root||(h.root=this._getRootByPosition(A)),Wn.register(this,f,h)}},{key:"deregister",value:function(e){typeof e=="string"?Wn.unRegister(this,e):e instanceof Fi&&Wn.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.deregister(e),i&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var i;if(typeof e=="string"?i=e:e instanceof Fi&&(i=e.pluginName),!!i)for(var s=this.config.plugins.length-1;s>-1;s--){var f=this.config.plugins[s];if(f.pluginName.toLowerCase()===i.toLowerCase()){this.config.plugins.splice(s,1);break}}}},{key:"plugins",get:function(){return Wn.getPlugins(this)}},{key:"getPlugin",value:function(e){var i=Wn.findPlugin(this,e);return i&&i.pluginName?i:null}},{key:"addClass",value:function(e){this.root&&($.hasClass(this.root,e)||$.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&$.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return $.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,i){this.root&&this.root.setAttribute(e,i)}},{key:"removeAttribute",value:function(e,i){this.root&&this.root.removeAttribute(e,i)}},{key:"start",value:function(e){var i=this;if(!(this.state>pr.ATTACHING))return!e&&!this.config.url&&this.getInitDefinition(),this.hasStart=!0,this.setState(pr.ATTACHING),this._registerPlugins(!1),Wn.beforeInit(this).then(function(){if(i.config){e||(e=i.url||i.config.url);var s=i.preProcessUrl(e),f=i._startInit(s.url);return f}}).catch(function(s){throw s.fileName="player",s.lineNumber="236",fr.logError("start:beforeInit:",s),s})}},{key:"switchURL",value:function(e,i){var s=this,f=e;$.typeOf(e)==="Object"&&(f=e.url),f=this.preProcessUrl(f).url;var h=this.currentTime;this.__startTime=h;var p=this.paused&&!this.isError;return this.src=f,new Promise(function(S,b){var A=function(I){s.off("timeupdate",R),s.off("canplay",R),b(I)},R=function(){s._seekToStartTime(),p&&s.pause(),s.off("error",A),S(!0)};if(s.once("error",A),!f){s.errorHandler("error",{code:6,message:"empty_src"});return}er.os.isAndroid?s.once("timeupdate",R):s.once("canplay",R),s.play()})}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state>>>playPromise.then"),e.setState(pr.RUNNING),e.emit(dl))}).catch(function(s){if(fr.logWarn(">>>>playPromise.catch",s.name),e.media&&e.media.error){e.onError(),e.removeClass(rt.ENTER);return}s.name==="NotAllowedError"&&(e._errorTimer=$.setTimeout(e,function(){e._errorTimer=null,e.emit(Mg),e.addClass(rt.NOT_ALLOW_AUTOPLAY),e.removeClass(rt.ENTER),e.pause(),e.setState(pr.NOTALLOW)},0))}):(fr.logWarn("video.play not return promise"),this.statethis.duration?parseInt(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(hs,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(s.removeClass(rt.ENTER),s.isSeeking=!1,S){case"play":s.play();break;case"pause":s.pause();break;default:s._isPauseBeforeSeek>1||s.paused?s.pause():s.play()}s._isPauseBeforeSeek=0,s._onceSeekCanplay=null},this.once(hs,this._onceSeekCanplay),this.state0&&s.defaultDefinition&&s.list.map(function(h){h.definition===s.defaultDefinition&&(e.config.url=h.url,e.curDefinition=h)})}},{key:"changeDefinition",value:function(e,i){var s=this,f=this.config.definition;if(Array.isArray(f==null?void 0:f.list)&&f.list.forEach(function(p){(e==null?void 0:e.definition)===p.definition&&(s.curDefinition=p)}),e!=null&&e.bitrate&&typeof e.bitrate!="number"&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(Bg,{from:i,to:e}),!this.hasStart){this.config.url=e.url;return}var h=this.switchURL(e.url,un({seamless:f.seamless!==!1&&typeof MediaSource<"u"&&typeof MediaSource.isTypeSupported=="function"},e));h&&h.then?h.then(function(){s.emit(tg,{from:i,to:e})}):this.emit(tg,{from:i,to:e})}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(ms,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,i=rt.NOT_ALLOW_AUTOPLAY,s=rt.PLAYING,f=rt.NO_START,h=rt.PAUSED,p=rt.REPLAY,S=rt.ENTER,b=rt.ENDED,A=rt.ERROR,R=rt.LOADING,D=[i,s,f,h,p,S,b,A,R];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,D.forEach(function(I){e.removeClass(I)}),this.addClass(rt.NO_START),this.emit(q0)}},{key:"reset",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],s=arguments.length>1?arguments[1]:void 0;this.resetState();var f=this.plugins;if(f&&(i.map(function(p){e.deregister(p)}),s)){var h=O1();Object.keys(this.config).keys(function(p){e.config[p]!=="undefined"&&(p==="plugins"||p==="presets"||p==="el"||p==="id")&&(e.config[p]=h[p])})}}},{key:"destroy",value:function(){var e,i=this,s=this.innerContainer,f=this.root,h=this.media;if(!(!f||!h)){if(this.hasStart=!1,this._useAutoplay=!1,f.removeAttribute(vo),h.removeAttribute(vo),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),$.clearAllTimers(this),this.emit(X0),(e=uo)===null||e===void 0||e.remove(this),Wn.destroy(this),KE(this),zt(Vt(r.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),s)for(var p=s.children,S=0;S0?f.className=b.filter(function(A){return A.indexOf("xgplayer")<0}).join(" "):f.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach(function(A){i[A]=!1})}}},{key:"replay",value:function(){var e=this;this.removeClass(rt.ENDED),this.currentTime=0,this.isSeeking=!1,Ua(this,"replay",function(){e.once(hs,function(){var i=e.mediaPlay();i&&i.catch&&i.catch(function(s){console.log(s)})}),e.emit(_0),e.onPlay()})}},{key:"retry",value:function(){var e=this;this.removeClass(rt.ERROR),this.addClass(rt.LOADING),Ua(this,"retry",function(){var i=e.currentTime,s=e.config.url,f=$.isMSE(e.media)?{url:s}:e.preProcessUrl(s);e.src=f.url,!e.config.isLive&&(e.currentTime=i),e.once(ds,function(){e.mediaPlay()})})}},{key:"changeFullStyle",value:function(e,i,s,f){e&&(f||(f=rt.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=$.filterStyleFromText(e)),$.addClass(e,s),i&&i!==e&&!this._orgPCss&&(this._orgPCss=$.filterStyleFromText(i),$.addClass(i,f),i.setAttribute(vo,this.playerId)))}},{key:"recoverFullStyle",value:function(e,i,s,f){f||(f=rt.PARENT_FULLSCREEN),this._orgCss&&($.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),$.removeClass(e,s),i&&i!==e&&this._orgPCss&&($.setStyleFromCsstext(i,this._orgPCss),this._orgPCss="",$.removeClass(i,f),i.removeAttribute(vo))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget,i=this.root,s=this.media;(e==="video"||e==="media")&&(e=this[e]),e||(e=i),this._fullScreenOffset={top:$.scrollTop(),left:$.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get";var f=$.getFullScreenEl();if(f===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var h=0;h0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var i=e?"".concat(rt.INNER_FULLSCREEN," ").concat(rt.CSS_FULLSCREEN):rt.CSS_FULLSCREEN;this.changeFullStyle(this.root,e,i);var s=this.config.fullscreen,f=s===void 0?{}:s,h=f.useCssFullscreen===!0||typeof f.useCssFullscreen=="function"&&f.useCssFullscreen();h&&(this.fullscreen=!0,this.emit(fs,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(b0,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(rt.INNER_FULLSCREEN," ").concat(rt.CSS_FULLSCREEN):rt.CSS_FULLSCREEN;if(!this.fullscreen)this.recoverFullStyle(this.root,this._cssfullscreenEl,e);else{var i=this.config.fullscreen,s=i===void 0?{}:i,f=s.useCssFullscreen===!0||typeof s.useCssFullscreen=="function"&&s.useCssFullscreen();f?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(fs,!1)):this.removeClass(e)}this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(b0,!1)}},{key:"getRotateFullscreen",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(e);var i=e?"".concat(rt.INNER_FULLSCREEN," ").concat(rt.ROTATE_FULLSCREEN):rt.ROTATE_FULLSCREEN;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,i,rt.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(fs,!0)}},{key:"exitRotateFullscreen",value:function(e){var i=this._fullscreenEl!==this.root?"".concat(rt.INNER_FULLSCREEN," ").concat(rt.ROTATE_FULLSCREEN):rt.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,i,rt.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(fs,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){window.orientation===90||window.orientation===-90?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};if(this.isActive){this.onFocus(e);return}this.emit(Og,un({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{ignorePaused:!1};if(!this.isActive){this.onBlur(e);return}this._clearUserTimer(),this.emit(DE,un({paused:this.paused,ended:this.ended},e))}},{key:"onFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{autoHide:!0,delay:3e3},s=this.innerStates;if(this.isActive=!0,this.removeClass(rt.INACTIVE),this._clearUserTimer(),i.isLock!==void 0&&(s.isActiveLocked=i.isLock),i.autoHide===!1||i.isLock===!0||s.isActiveLocked){this._clearUserTimer();return}var f=i&&i.delay?i.delay:this.config.inactive;this.userTimer=$.setTimeout(this,function(){e.userTimer=null,e.blur()},f)}},{key:"onBlur",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=e.ignorePaused,s=i===void 0?!1:i;if(!this.innerStates.isActiveLocked){var f=this.config.closePauseVideoFocus;this.isActive=!1,(s||f||!this.paused&&!this.ended)&&this.addClass(rt.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(rt.ENTER),this.removeClass(rt.ERROR),this.removeClass(rt.LOADING),this.isCanplay=!0,this.waitTimer&&$.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){var e=this;this.isError=!1,this.isSeeking=!1,this.__startTime>0&&(this.duration>0?this._seekToStartTime():this.once(Ss,function(){e._seekToStartTime()}))}},{key:"onLoadstart",value:function(){this.removeClass(rt.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===pr.ENDED&&this.setState(pr.RUNNING),this.removeClass(rt.PAUSED),this.ended&&this.removeClass(rt.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(rt.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(rt.ENDED),this.setState(pr.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(rt.NOT_ALLOW_AUTOPLAY),this.removeClass(rt.NO_START),this.removeClass(rt.ENTER),this.removeClass(rt.LOADING),this.addClass(rt.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(rt.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&$.clearTimeout(this,this.waitTimer),this.removeClass(rt.LOADING),this.removeClass(rt.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&$.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=$.setTimeout(this,function(){e.addClass(rt.LOADING),e.emit(FE),$.clearTimeout(e,e.waitTimer),e.waitTimer=null},this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1;var i=rt.NO_START,s=rt.PAUSED,f=rt.ENDED,h=rt.ERROR,p=rt.REPLAY,S=rt.LOADING,b=[i,s,f,h,p,S];b.forEach(function(A){e.removeClass(A)}),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(rt.LOADING))&&this.media.readyState>2&&(this.removeClass(rt.LOADING),$.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===pr.NOTALLOW&&this.duration&&(this.setState(pr.RUNNING),this.emit(dl)),!this._accPlayed.t&&!this.paused&&!this.ended&&(this._accPlayed.t=new Date().getTime())}},{key:"onVolumechange",value:function(){$.typeOf(this.config.volume)==="Number"&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,i,s){if(!(!this.media||!i||!e)){var f=$.typeOf(e)==="String"?e:e.type||"";s.props&&$.typeOf(s.props)!=="Array"&&(s.props=[s.props]),this.emit(w0,un({eventType:f,action:i,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},s))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var i=new Date().getTime()-this._accPlayed.t;this._accPlayed.acc+=i,this._accPlayed.t=0,(e==="ended"||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{startDiff:0,endDiff:0},s=i||{},f=s.startDiff,h=f===void 0?0:f,p=s.endDiff,S=p===void 0?0:p,b=this.media.buffered;if(!b||b.length===0||!this.duration)return!0;for(var A=e||this.media.currentTime||.2,R=b.length,D=0;DA)return!0;return!1}},{key:"resizePosition",value:function(){var e=this,i=this.videoPos,s=i.vy,f=i.vx,h=i.h,p=i.w,S=this.videoPos.rotate;if(!(S<0&&h<0&&p<0)){var b=this.videoPos._pi;if(!b&&this.media.videoHeight&&(b=this.media.videoWidth/this.media.videoHeight*100),!!b){this.videoPos.pi=b,S=S<0?0:S;var A={rotate:S},R=0,D=0,I=1,O=Math.abs(S/90),V=this.root,N=this.innerContainer,G=V.offsetWidth,z=N?N.offsetHeight:V.offsetHeight,Z={},H=z,ee=G;if(O%2===0)I=h>0?100/h:p>0?100/p:1,A.scale=I,R=s>0?(100-h)/2-s:0,A.y=O===2?0-R:R,D=f>0?(100-p)/2-f:0,A.x=O===2?0-D:D,Z.width="".concat(ee,"px"),Z.height="".concat(H,"px"),Z.maxWidth="",Z.maxHeight="";else if(O%2===1){ee=z,H=G;var te=z-G;D=-te/2/ee*100,A.x=O===3?D+s/2:D-s/2,R=te/2/H*100,A.y=O===3?R+f/2:R-f/2,A.scale=I,Z.width="".concat(ee,"px"),Z.maxWidth="".concat(ee,"px"),Z.height="".concat(H,"px"),Z.maxHeight="".concat(H,"px")}var fe=$.getTransformStyle(A,this.media.style.transform||this.media.style.webkitTransform);Z.transform=fe,Z.webkitTransform=fe,Object.keys(Z).map(function(ne){e.media.style[ne]=Z[ne]})}}}},{key:"position",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{h:0,y:0,x:0,w:0};if(!(!this.media||!e||!e.h)){var i=this.videoPos;i.h=e.h*100||0,i.w=e.w*100||0,i.vx=e.x*100||0,i.vy=e.y*100||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(s){if(s!=="plugins"){i.config[s]=e[s];var f=i.plugins[s.toLowerCase()];f&&$.typeOf(f.setConfig)==="Function"&&f.setConfig(e[s])}})}},{key:"playNext",value:function(e){var i=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,Ua(this,"playnext",function(){i.start(),i.emit(C0,e)})}},{key:"resize",value:function(){var e=this;if(this.media){var i=this.root.getBoundingClientRect();this.sizeInfo.width=i.width,this.sizeInfo.height=i.height,this.sizeInfo.left=i.left,this.sizeInfo.top=i.top;var s=this.media,f=s.videoWidth,h=s.videoHeight,p=this.config,S=p.fitVideoSize,b=p.videoFillMode;if((b==="fill"||b==="cover"||b==="contain")&&this.setAttribute("data-xgfill",b),!(!h||!f)){this._videoHeight=h,this._videoWidth=f;var A=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,R=i.width,D=i.height-A,I=parseInt(f/h*1e3,10),O=parseInt(R/D*1e3,10),V=R,N=D,G={};S==="auto"&&O>I||S==="fixWidth"?(N=R/I*1e3,this.config.fluid?G.paddingTop="".concat(N*100/V,"%"):G.height="".concat(N+A,"px")):(S==="auto"&&OI)&&this.setAttribute("data-xgfill","cover");var z={videoScale:I,vWidth:V,vHeight:N,cWidth:V,cHeight:N+A};this.resizePosition(),this.emit(mo,z)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(this.media.updateObjectPosition){this.media.updateObjectPosition(e,i);return}this.media.style.objectPosition="".concat(e*100,"% ").concat(i*100,"%")}},{key:"setState",value:function(e){fr.logInfo("setState","state from:".concat(F1[this.state]," to:").concat(F1[e])),this._state=e}},{key:"preProcessUrl",value:function(e,i){var s=this.config,f=s.preProcessUrl,h=s.preProcessUrlOptions,p=Object.assign({},h,i);return!$.isBlob(e)&&typeof f=="function"?f(e,p):{url:e}}},{key:"_seekToStartTime",value:function(){this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime>this.duration?this.duration:this.__startTime,this.__startTime=-1)}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){typeof e=="boolean"&&(this._hasStart=e,e===!1&&this.setState(pr.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===pr.RUNNING||this._state===pr.ENDED},set:function(e){e?this.setState(pr.RUNNING):this._state>=pr.RUNNING&&this.setState(pr.ATTACHED)}},{key:"definitionList",get:function(){return!this.config||!this.config.definition?[]:this.config.definition.list||[]},set:function(e){var i=this,s=this.config.definition,f=null,h=null;s.list=e,this.emit("resourceReady",e),e.forEach(function(p){var S;((S=i.curDefinition)===null||S===void 0?void 0:S.definition)===p.definition&&(f=p),s.defaultDefinition===p.definition&&(h=p)}),!h&&e.length>0&&(h=e[0]),f?this.changeDefinition(f):h&&this.changeDefinition(h)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var i=this.media.getVideoPlaybackQuality();return e.dropped=i.droppedVideoFrames||0,e.total=i.totalVideoFrames||0,e.corrupted=i.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){var i=zu.langKeys.filter(function(s){return s===e});if(i.length===0&&e!=="zh"){console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(zu.langKeys.join(),"] "));return}this.config.lang=e,Wn.setLang(e,this)}},{key:"i18n",get:function(){var e=this.config.lang;return e==="zh"&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return Jp}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return zt(Vt(r.prototype),"readyState",this)}},{key:"error",get:function(){var e=zt(Vt(r.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return zt(Vt(r.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return this._fullScreenOffset!==null}},{key:"cumulateTime",get:function(){var e=this._accPlayed,i=e.acc,s=e.t;return s?new Date().getTime()-s+i:i}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){e=$.convertDeg(e),!(e%90!==0||e===this.videoPos.rotate)&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return B1},set:function(e){B1=e}},{key:"realTimeSpeed",get:function(){return M1},set:function(e){M1=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,i){return A0.call.apply(A0,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,i){return k0.call.apply(k0,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,i){return L0.call.apply(L0,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,i,s){for(var f=arguments.length,h=new Array(f>3?f-3:0),p=3;p3?f-3:0),p=3;p `).concat(n.i18n[a],` `)}catch{return'
'}}var xl=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s `,"image/svg+xml").firstChild}function eL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var ng=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.cssFullscreen=="boolean"&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e=this;zt(Vt(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(b0,function(i){e.animate(i)}),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(s){s.preventDefault(),s.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,i=this.find(".xgplayer-icon");i.appendChild(e.cssFullscreen),i.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var i=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:i}),i?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var i=this.i18nKeys,s=this.find(".xg-tips");s&&this.changeLangTextKey(s,e?i.EXITCSSFULLSCREEN_TIPS:i.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:Jk,class:"xg-get-cssfull"},exitCssFullscreen:{icon:eL,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){zt(Vt(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return`
`.concat(bo(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),`
`)}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),r}(xl);function tL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var rL=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(i){i.preventDefault(),i.stopPropagation(),e.config.onClick(i)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:tL,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){$.addClass(this.root,"show")}},{key:"hide",value:function(){$.removeClass(this.root,"show")}},{key:"render",value:function(){return` `}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:Ur.ROOT_TOP,index:0}}}]),r}(wr);function nL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function iL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var qE=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s1&&this.lockScreen(s.lockOrientationType))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"render",value:function(){if(!this.config.disable){var e="FULLSCREEN_TIPS";return`
`.concat(bo(this,e,this.playerConfig.isHideTips),`
`)}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch(function(i){})}catch{}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch(function(e){})}catch{}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),r}(xl);function Ug(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function Hg(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var ZE=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s
`.concat(bo(this,"PLAY_TIPS",this.playerConfig.isHideTips),` `)}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_LEFT,index:0,disable:!1}}}]),r}(xl),aL=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],sL=function(){function n(a){At(this,n),this.fragments=a.fragments||[],this.fragments.length===0&&this.fragments.push({percent:1}),this._callBack=a.actionCallback,this.fragConfig={fragFocusClass:a.fragFocusClass||"inner-focus-point",fragAutoFocus:!!a.fragAutoFocus,fragClass:a.fragClass||""},this.style=a.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return kt(n,[{key:"updateDuration",value:function(r){var t=this;this.duration=r;var e=0,i=this.fragments;this.fragments=i.map(function(s){return s.start=parseInt(e,10),s.end=parseInt(e+s.percent*t.duration,10),s.duration=parseInt(s.percent*t.duration,10),e+=s.percent*t.duration,s})}},{key:"updateProgress",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"played",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},e=this.progressList,i=this.fragments;if(!(e.length<1)){var s=t.newIndex,f=t.curIndex,h=t.millisecond;s!==f&&e.map(function(b,A){As&&(b[r].style.width=0)});var p=i[s],S=h===0?0:(h-p.start)/p.duration;e[s][r].style.width=S<0?0:"".concat(S*100,"%")}}},{key:"updateFocus",value:function(r){if(!(!this.fragConfig.fragAutoFocus||this.fragments.length<2)){if(!r){if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var t={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(t),this.focusIndex=-1}return}var e=this.findIndex(r.currentTime*1e3,this.focusIndex);if(e>=0&&e!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(e);var i={index:e,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=e,this._callBack&&this._callBack(i)}}}},{key:"update",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(t*1e3,10)!==this.duration){if(!t&&t!==0)return;this.updateDuration(parseInt(t*1e3,10))}var e=this.playedIndex,i=this.cachedIndex;if($.typeOf(r.played)!=="Undefined"){var s=this.findIndex(r.played*1e3,e);if(s<0)return;this.updateProgress("played",{newIndex:s,curIndex:e,millisecond:parseInt(r.played*1e3,10)}),this.playedIndex=s}if($.typeOf(r.cached)!=="Undefined"){var f=this.findIndex(r.cached*1e3,i);if(f<0)return;this.updateProgress("cached",{newIndex:f,curIndex:i,millisecond:parseInt(r.cached*1e3,10)}),this.cachedIndex=f}}},{key:"findIndex",value:function(r,t){var e=this.fragments;if(!e||e.length===0)return-1;if(e.length===1)return 0;if(t>-1&&te[t].start&&re[e.length-1].start)return e.length-1;for(var i=0;ie[i].start&&r<=e[i].end){t=i;break}return t}},{key:"findHightLight",value:function(){for(var r=this.root.children,t=0;t=t.length?null:{dom:t[r],pos:t[r].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var r=this.root.children,t=0;t0;)this.root.removeChild(e[0]);this.render()}}},{key:"render",value:function(){var r=this,t=this.style.progressColor;if(this.root||(this.root=$.createDom("xg-inners","",{},"progress-list")),this.fragments){var e=this.fragConfig,i=e.fragClass,s=e.fragFocusClass;this.progressList=this.fragments.map(function(f){var h=$.createDom("xg-inner","",{style:t?"background:".concat(t,"; flex: ").concat(f.percent):"flex: ".concat(f.percent)},"".concat(f.isFocus?s:""," xgplayer-progress-inner ").concat(i));return r.root.appendChild(h),aL.forEach(function(p){h.appendChild($.createDom(p.tag,"",{style:p.styleKey?"background: ".concat(r.style[p.styleKey],"; width:0;"):"width:0;"},p.className))}),{cached:h.children[0],played:h.children[1]}})}return this.root}}]),n}(),N1={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},QE=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),je(Oe(e),"onMoveOnly",function(i,s){var f=Oe(e),h=f.pos,p=f.config,S=f.player,b=s;if(i){$.event(i);var A=$.getEventPos(i,S.zoom),R=S.rotateDeg===90?A.clientY:A.clientX;if(h.moving&&Math.abs(h.x-R)=0?i:s+this.timeOffset}},{key:"changeState",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.useable=e}},{key:"show",value:function(e){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!i||i.length===0)&&(i=[{percent:1}]);var f=un(un({fragments:i},s),{},{actionCallback:function(p){e.emitUserAction("fragment_focus","fragment_focus",p)}});this.innerList?this.innerList.reset(f):(this.innerList=new sL(f),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map(function(h){e[h]=e.innerList[h].bind(e.innerList)}))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){if(!(this.config.disable||this.playerConfig.isLive)){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=this.find("xg-outer");var e=this.config,i=e.fragFocusClass,s=e.fragAutoFocus,f=e.fragClass;this._initInner(this.config.fragments,{fragFocusClass:i,fragAutoFocus:s,fragClass:f,style:this.playerConfig.commonStyle||{}}),er.device==="mobile"&&(this.config.isDraggingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.listenEvents(),this.bindDomEvents(),this.initCustomStyle()}}},{key:"listenEvents",value:function(){var e=this;this.on(Ss,function(){e.onMouseLeave()}),this.on(Oi,function(){e.onTimeupdate()}),this.on(hs,function(){e.onTimeupdate(),e.onCacheUpdate()}),this.on(RE,function(){e.onCacheUpdate()}),this.on(ml,function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0}),this.on(yl,function(){e.onReset()}),this.on(mo,function(){e.onVideoResize()})}},{key:"setConfig",value:function(e){var i=this,s=null;Object.keys(e).forEach(function(f){i.config[f]=e[f],f==="fragments"&&(s=e[f])}),s&&this._initInner(s,e)}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,s=i.sliderBtnStyle,f=this.progressBtn;s&&(typeof s=="string"?f.style.boxShadow=s:ii(s)==="object"&&Object.keys(s).map(function(h){f.style[h]=s[h]}))}},{key:"triggerCallbacks",value:function(e,i,s){this.__dragCallBacks.length>0&&this.__dragCallBacks.map(function(f){if(f&&f.handler&&f.type===e)try{f.handler(i,s)}catch(h){console.error("[XGPLAYER][triggerCallbacks] ".concat(f," error"),h)}})}},{key:"addCallBack",value:function(e,i){i&&typeof i=="function"&&this.__dragCallBacks.push({type:e,handler:i})}},{key:"removeCallBack",value:function(e,i){var s=this.__dragCallBacks,f=-1;s.map(function(h,p){h&&h.type===e&&h.handler===i&&(f=p)}),f>-1&&s.splice(f,1)}},{key:"unlock",value:function(){var e=this.player,i=this.pos;if(i.isEnter=!1,i.isLocked=!1,!e.isMini){if(this.unbind("mousemove",this.onMoveOnly),i.isDown){this.unbind("mouseleave",this.onMouseLeave);return}this.blur()}}},{key:"bindDomEvents",value:function(){var e=this.player.config;this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),(this.domEventType==="touch"||this.domEventType==="compatible")&&this.root.addEventListener("touchstart",this.onMouseDown),(this.domEventType==="mouse"||this.domEventType==="compatible")&&(this.bind("mousedown",this.onMouseDown),e.isMobileSimulateMode!=="mobile"&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),$.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),$.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,i,s,f){var h=this.config,p=this.player;if(!(h.isCloseClickSeek&&f===0)){var S=i=i>=p.duration?p.duration-h.endedDiff:Number(i).toFixed(1);this.updatePercent(s),this.updateTime(e),!(f===1&&(!h.isDraggingSeek||p.config.mediaType==="audio"))&&(this._state.now=S,this._state.direc=S>p.currentTime?0:1,p.seek(S))}}},{key:"computeTime",value:function(e,i){var s=this.player,f=this.root.getBoundingClientRect(),h=f.width,p=f.height,S=f.top,b=f.left,A,R,D=i;s.rotateDeg===90?(A=p,R=S):(A=h,R=b);var I=D-R;I=I>A?A:I<0?0:I;var O=I/A;O=O<0?0:O>1?1:O,Number.isNaN(O)&&(O=this.player.currentTime/this.offsetDuration);var V=parseInt(O*this.offsetDuration*1e3,10)/1e3,N=$.getCurrentTimeByOffset(V,s.timeSegments);return{percent:O,currentTime:V,seekTime:N,offset:I,width:A,left:R,e}}},{key:"updateTime",value:function(e){var i=this.player,s=this.duration;e>s?e=s:e<0&&(e=0);var f=i.plugins.time;f&&f.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,i){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(e*100,"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration);var s=this.player.plugins.miniprogress;s&&s.update({played:e*this.offsetDuration},this.offsetDuration)}}},{key:"onTimeupdate",value:function(e){var i=this.player,s=this._state,f=this.offsetDuration;if(!(i.isSeeking&&i.media.seeking||this.isProgressMoving||!i.hasStart)){if(s.now>-1){var h=parseInt(s.now*1e3,10)-parseInt(i.currentTime*1e3,10);if(s.direc===0&&h>300||s.direc===1&&h>-300){s.now=-1;return}else s.now=-1}var p=this.currentTime;p=$.adjustTimeByDuration(p,f,e),this.innerList.update({played:p},f),this.progressBtn.style.left="".concat(p/f*100,"%")}}},{key:"onCacheUpdate",value:function(e){var i=this.player,s=this.duration;if(i){var f=i.bufferedPoint.end;f=$.adjustTimeByDuration(f,s,e),this.innerList.update({cached:f},s)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0),this.progressBtn.style.left="0%"}},{key:"destroy",value:function(){var e=this.player;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var i=this.domEventType;(i==="touch"||i==="compatible")&&(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),this.root.removeEventListener("touchcancel",this.onMouseUp)),(i==="mouse"||i==="compatible")&&(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){if(!(this.config.disable||this.playerConfig.isLive)){var e=this.player.controls?this.player.controls.config.mode:"",i=e==="bottom"?"xgplayer-progress-bottom":"";return` `)}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_CENTER,index:0,disable:!1,isDraggingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:N1.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return N1}}]),r}(wr),JE=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),e.isActiving=!1,e}return kt(r,[{key:"duration",get:function(){var e=this.player,i=e.offsetDuration,s=e.duration;return this.playerConfig.customDuration||i||s}},{key:"currentTime",get:function(){var e=this.player,i=e.offsetCurrentTime,s=e.currentTime;return i>=0?i:s}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this.player.controls.config.mode;this.mode=e==="flex"?"flex":"normal",!this.config.disable&&(this.mode==="flex"&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.listenEvents())}},{key:"listenEvents",value:function(){var e=this;this.on([Ss,hs,Oi],function(i){i.eventName==="durationchange"&&(e.isActiving=!1),e.onTimeUpdate()}),this.on(ml,function(){e.onTimeUpdate(!0)}),this.on(yl,function(){e.onReset()})}},{key:"show",value:function(e){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="block"),this.centerDurDom&&(this.centerDurDom.style.display="block");return}this.root.style.display="block"}},{key:"hide",value:function(){if(this.mode==="flex"){this.centerCurDom&&(this.centerCurDom.style.display="none"),this.centerDurDom&&(this.centerDurDom.style.display="none");return}this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var i=this.player,s=this.config,f=this.duration;if(!(s.disable||this.isActiving||!i.hasStart)){var h=this.currentTime+this.timeOffset;h=$.adjustTimeByDuration(h,f,e),this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime($.format(h)),f!==1/0&&f>0&&(this.centerDurDom.innerHTML=$.format(f))):(this.timeDom.innerHTML=this.minWidthTime($.format(h)),f!==1/0&&f>0&&(this.durationDom.innerHTML=$.format(f)))}}},{key:"onReset",value:function(){this.mode==="flex"?(this.centerCurDom.innerHTML=this.minWidthTime($.format(0)),this.centerDurDom.innerHTML=$.format(0)):(this.timeDom.innerHTML=this.minWidthTime($.format(0)),this.durationDom.innerHTML=$.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(!(!e.controls||!e.controls.center)){var i=e.controls.center;this.centerCurDom=$.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=$.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),i.children.length>0?i.insertBefore(this.centerCurDom,i.children[0]):i.appendChild(this.centerCurDom),i.appendChild(this.centerDurDom)}}},{key:"afterPlayerInit",value:function(){var e=this.config;if(this.duration===1/0||this.playerConfig.isLive?($.hide(this.durationDom),$.hide(this.timeDom),$.hide(this.find(".time-separator")),$.show(this.find(".time-live-tag"))):$.hide(this.find(".time-live-tag")),e.hide){this.hide();return}this.show()}},{key:"changeLiveState",value:function(e){e?($.hide(this.durationDom),$.hide(this.timeDom),$.hide(this.find(".time-separator")),$.show(this.find(".time-live-tag"))):($.hide(this.find(".time-live-tag")),$.show(this.find(".time-separator")),$.show(this.durationDom),$.show(this.timeDom))}},{key:"updateTime",value:function(e){if(this.isActiving=!0,!(!e&&e!==0||e>this.duration)){if(this.mode==="flex"){this.centerCurDom.innerHTML=this.minWidthTime($.format(e));return}this.timeDom.innerHTML=this.minWidthTime($.format(e))}}},{key:"minWidthTime",value:function(e){return e.split(":").map(function(i){return''.concat(i,"")}).join(":")}},{key:"resetActive",value:function(){var e=this,i=this.player,s=function(){e.isActiving=!1};this.off(hs,s),i.isSeeking&&i.media.seeking?this.once(hs,s):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return` 00:00 / 00:00 `.concat(this.i18n.LIVE_TIP,` `)}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_LEFT,index:2,disable:!1}}}]),r}(wr);function oL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function lL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function uL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var eS=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;sb.barH||t.updateVolumePos(D,f)}}),je(Oe(t),"onBarMouseUp",function(f){$.event(f),document.removeEventListener("mouseup",t.onBarMouseUp);var h=Oe(t),p=h._d;p.isStart=!1,p.isMoving=!1}),je(Oe(t),"onMouseenter",function(f){t._d.isActive=!0,t.focus(),t.emit("icon_mouseenter",{pluginName:t.pluginName})}),je(Oe(t),"onMouseleave",function(f){t._d.isActive=!1,t.unFocus(100,!1,f),t.emit("icon_mouseleave",{pluginName:t.pluginName})}),je(Oe(t),"onVolumeChange",function(f){if(t.player){var h=t.player,p=h.muted,S=h.volume;t._d.isMoving||(t.find(".xgplayer-drag").style.height=p||S===0?"4px":"".concat(S*100,"%"),t.config.showValueLabel&&t.updateVolumeValue()),t.animate(p,S)}}),t}return kt(r,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:lL,class:"xg-volume-small"},volumeLarge:{icon:oL,class:"xg-volume"},volumeMuted:{icon:uL,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var i=this.playerConfig,s=i.commonStyle,f=i.volume;s.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=s.volumeColor),this.changeMutedHandler=this.hook("mutedChange",function(h){e.changeMuted(h)},{pre:function(p){p.preventDefault(),p.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),er.device!=="mobile"&&this.playerConfig.isMobileSimulateMode!=="mobile"&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider","mousedown",this.onBarMousedown),this.bind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.bind(".xgplayer-slider","mouseup",this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(kE,this.onVolumeChange),this.once(ms,this.onVolumeChange),$.typeOf(f)!=="Number"&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,i){var s=this.player,f=this.find(".xgplayer-drag"),h=this.find(".xgplayer-bar");if(!(!h||!f)){var p=parseInt(e/h.getBoundingClientRect().height*1e3,10);f.style.height="".concat(e,"px");var S=Math.max(Math.min(p/1e3,1),0),b={volume:{from:s.volume,to:S}};s.muted&&(b.muted={from:!0,to:!1}),this.emitUserAction(i,"change_volume",{muted:s.muted,volume:s.volume,props:b}),s.volume=Math.max(Math.min(p/1e3,1),0),s.muted&&(s.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,i=e.volume,s=e.muted,f=this.find(".xgplayer-value-label"),h=Math.max(Math.min(i,1),0);f.innerText=s?0:Math.round(h*100)}},{key:"focus",value:function(){var e=this.player;e.focus({autoHide:!1}),this._timerId&&($.clearTimeout(this,this._timerId),this._timerId=null),$.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,f=arguments.length>2?arguments[2]:void 0,h=this._d,p=this.player;h.isActive||(this._timerId&&($.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=$.setTimeout(this,function(){h.isActive||(s?p.blur():p.focus(),$.removeClass(e.root,"slide-show"),h.isStart&&e.onBarMouseUp(f)),e._timerId=null},i))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var i=this.player,s=this._d;s.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:i.muted,volume:i.volume,props:{muted:{from:i.muted,to:!i.muted}}}),i.volume>0&&(i.muted=!i.muted),i.volume<.01&&(i.volume=this.config.miniVolume)}},{key:"animate",value:function(e,i){e||i===0?this.setAttr("data-state","mute"):i<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&($.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon",er.device==="mobile"?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){if(!this.config.disable){var e=this.config.default||this.player.volume,i=this.config.showValueLabel;return`
`.concat(i?'
'.concat(e*100,"
"):"",`
`)}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),r}(wr);function ti(){return new Date().getTime()}var fo={LOAD_START:"loadstart",LOADED_DATA:"loadeddata",FIRST_FRAME:"firstFrame",WAIT_START:"waitingStart",WAIT_END:"waitingEnd",SEEK_START:"seekStart",SEEK_END:"seekEnd"},fL=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s0&&s&&!f&&(fr.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(fo.FIRST_FRAME,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&$.clearTimeout(this,this._waittTimer),this._waittTimer=$.setTimeout(this,function(){e.suspendWaitingStatus("timeout"),$.clearTimeout(e,e._waittTimer),e._waittTimer=null},this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){if(this.seekingStart){var i=ti(),s=i-this.seekingStart;this.seekingStart=0,this.emitLog(fo.SEEK_END,{end:i,costTime:s,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&($.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&($.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,!!this.waitingStart){var i=ti(),s=i-this.waitingStart,f=i-this.fixedWaitingStart,h=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(fo.WAIT_END,{fixedCostTime:f>h?h:f,costTime:s>h?h:s,type:e==="loadeddata"?1:this._waitType,endType:this._waitType===2?"seek":e})}}},{key:"emitLog",value:function(e,i){var s=this.player;this.emit(UE,un({t:ti(),host:$.getHostFromUrl(s.currentSrc),vtype:s.vtype,eventType:e,currentTime:this.player.currentTime,readyState:s.video.readyState,networkState:s.video.networkState},i))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),r}(wr);function cL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var dL=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"registerIcons",value:function(){return{replay:cL}}},{key:"afterCreate",value:function(){var e=this;wr.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",function(){e.player.replay()},{pre:function(s){s.preventDefault(),s.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(ml,function(){if(e.playerConfig.loop||$.addClass(e.player.root,"replay"),!e.config.disable){e.show();var i=e.root.querySelector("path");if(i){var s=window.getComputedStyle(i).getPropertyValue("transform");if(typeof s=="string"&&s.indexOf("none")>-1)return null;i.setAttribute("transform",s)}}}),this.on(Mi,function(){e.hide()})}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),$.removeClass(this.player.root,"replay")}},{key:"show",value:function(e){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){return` ').concat(this.i18n.REPLAY,` `)}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),r}(wr),hL=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){$.addClass(this.root,"hide")}},{key:"show",value:function(e){$.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){typeof e.player.config.poster=="string"&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(ml,function(){e.isEndedShow&&$.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once(Oi,function(){e.onTimeUpdate()}),this.on(rf,function(){$.removeClass(e.root,"hide"),$.addClass(e.root,"xg-showplay"),e.once(Oi,function(){e.onTimeUpdate()})})):this.on(Mi,function(){$.addClass(e.root,"hide")})}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(f){i.config[f]=e[f]});var s=this.config.poster;this.update(s)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?$.removeClass(this.root,"xg-showplay"):this.once(Oi,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"getBgSize",value:function(e){var i="";switch(e){case"cover":i="cover";break;case"contain":i="contain";break;case"fixHeight":i="auto 100%";break;default:i=""}return i?"background-size: ".concat(i,";"):""}},{key:"render",value:function(){var e=this.config,i=e.poster,s=e.hideCanplay,f=e.fillMode,h=e.notHidden,p=this.getBgSize(f),S=i?"background-image:url(".concat(i,");").concat(p):p,b=h?"xg-not-hidden":s?"xg-showplay":"";return' `)}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),r}(wr),Ba={};function vL(n,a){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{start:null,end:null};return Ba[n]&&window.clearTimeout(Ba[n].id),Ba[n]={},r.start&&r.start(),Ba[n].id=window.setTimeout(function(){r.end&&r.end(),window.clearTimeout(Ba[n].id),delete Ba[n]},a),Ba[n].id}function U1(n){if(n){window.clearTimeout(n);return}Object.keys(Ba).map(function(a){window.clearTimeout(Ba[a].id),delete Ba[a]})}var pL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),je(Oe(e),"onPlayerReset",function(){e.autoPlayStart=!1;var i=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),$.removeClass(e.root,i),e.show()}),je(Oe(e),"onAutoplayStart",function(){if(!e.autoPlayStart){var i=e.config.mode==="auto"?"auto-hide":"hide";$.addClass(e.root,i),e.autoPlayStart=!0,e.toggleTo("play")}}),e.autoPlayStart=!1,e}return kt(r,[{key:"afterCreate",value:function(){var e=this.playerConfig;this.initIcons(),this.listenEvents(),this.bindClickEvents(),e.autoplay||this.show()}},{key:"listenEvents",value:function(){var e=this,i=this.player,s=this.playerConfig;this.once(Fg,function(){s&&(s.lang&&s.lang==="en"?$.addClass(i.root,"lang-is-en"):s.lang==="jp"&&$.addClass(i.root,"lang-is-jp"))}),this.on(dl,this.onAutoplayStart),this.on(Mg,function(){var f=e.config.mode==="auto"?"auto-hide":"hide";e.setAttr("data-state","play"),$.removeClass(e.root,f),e.show()}),this.on(Mi,function(){e.toggleTo("play")}),this.on(ef,function(){e.toggleTo("pause")}),this.on(q0,function(){e.onPlayerReset()})}},{key:"bindClickEvents",value:function(){var e=this;this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(s){s.cancelable&&s.preventDefault(),s.stopPropagation();var f=e.player.paused;e.emitUserAction(s,"switch_play_pause",{props:"paused",from:f,to:!f})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:Ug,class:"xg-icon-play"},startPause:{icon:Hg,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){$.addClass(this.root,"hide")}},{key:"show",value:function(e){$.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){$.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){$.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var i=this;this._animateId=vL("pauseplay",400,{start:function(){$.addClass(i.root,"interact"),i.show(),i.switchStatus(!0)},end:function(){$.removeClass(i.root,"interact"),!e&&i.hide(),i._animateId=null}})}},{key:"endAnimate",value:function(){$.removeClass(this.root,"interact"),U1(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var i=this.player;if(e.cancelable&&e.preventDefault(),e.stopPropagation(),!(i.state `)}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),r}(wr),gL=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"render",value:function(){var e=this.config.innerHtml,i=$.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)i.appendChild(e);else if(e&&typeof e=="string")i.innerHTML=e;else{for(var s="",f=1;f<=12;f++)s+='
');i.innerHTML='
'.concat(s,"
")}return i}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),r}(wr),H1=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"afterCreate",value:function(){this.getMini=this.getMini.bind(this),this.exitMini=this.exitMini.bind(this),this.bind("click",this.getMini)}},{key:"getMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"exitMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){var e="MINISCREEN";return`
').concat(this.i18n[e],`
`)}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:10}}}]),r}(wr);function V1(n){var a=parseFloat(n),r=n.indexOf("%")===-1&&!Number.isNaN(a);return r&&a}var Vg=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],tS=Vg.length;function mL(){for(var n={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},a=0;a1&&arguments[1]!==void 0?arguments[1]:{};return At(this,r),e=a.call(this),e.isEnabled=!0,e.isDragging=!1,e.isDown=!1,e.position={},e.downPoint={},e.dragPoint={x:0,y:0},e.startPos={x:0,y:0},e._root=t instanceof Element?t:document.querySelector(t),e._handlerDom=i.handle instanceof Element?i.handle:document.querySelector(i.handle),!e._root||!e._handlerDom?Dg(e):(e._bindStartEvent(),e)}return kt(r,[{key:"_bindStartEvent",value:function(){var e=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),G1[this._startKey].map(function(i){e["on".concat(i)]=e["on".concat(i)].bind(e)})}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var i=this;if(e){var s=G1[this._startKey];s.map(function(f){window.addEventListener(f,i["on".concat(f)])}),this._boundPointerEvents=s}}},{key:"_unbindPostStartEvents",value:function(){var e=this;this._boundPointerEvents&&(this._boundPointerEvents.map(function(i){window.removeEventListener(i,e["on".concat(i)])}),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame(function(){e.animate()}))}},{key:"positionDrag",value:function(){var e="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=e,this._root.style.webKitTransform=e}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var i=e.changedTouches[0];this.dragStart(e,i),this.touchIdentifier=i.pointerId!==void 0?i.pointerId:i.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var i=xp(e.changedTouches,this.touchIdentifier);i&&this.dragMove(e,i)}},{key:"ontouchend",value:function(e){var i=xp(e.changedTouches,this.touchIdentifier);i&&this.dragEnd(e,i),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var i=xp(e.changedTouches,this.touchIdentifier);i&&this.dragCancel(e,i)}},{key:"dragStart",value:function(e,i){if(!(!this._root||this.isDown||!this.isEnabled)){this.downPoint=i,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var s=j1(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-s.height,this.startPos.maxX=window.innerWidth-s.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,i){this.isDragging=!0,this.animate(),this.emit(Ep.START,this.startPos)}},{key:"dragEnd",value:function(e,i){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(Ep.ENDED)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,i){var s={x:i.pageX-this.downPoint.pageX,y:i.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(s)&&this.dragRealStart(e,i),s}},{key:"dragMove",value:function(e,i){if(e=e||window.event,!!this.isDown){var s=this.startPos,f=s.x,h=s.y,p=this._dragPointerMove(e,i),S=p.x,b=p.y;S=this.checkContain("x",S,f),b=this.checkContain("y",b,h),this.position.x=f+S,this.position.y=h+b,this.dragPoint.x=S,this.dragPoint.y=b,this.emit(Ep.MOVE,this.position)}}},{key:"dragCancel",value:function(e,i){this.dragEnd(e,i)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,i,s){return i+s<0?0-s:e==="x"&&i+s>this.startPos.maxX?this.startPos.maxX-s:e==="y"&&i+s>this.startPos.maxY?this.startPos.maxY-s:i}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),i=this._getPositionCoord(e.left,"width"),s=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(i)?0:i,this.position.y=Number.isNaN(s)?0:s,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var i=e.transform;if(i.indexOf("matrix")===0){var s=i.split(","),f=i.indexOf("matrix3d")===0?12:4,h=parseInt(s[f],10),p=parseInt(s[f+1],10);this.position.x+=h,this.position.y+=p}}},{key:"_getPositionCoord",value:function(e,i){if(e.indexOf("%")!==-1){var s=j1(this._root.parentNode);return s?parseFloat(e)/100*s[i]:0}return parseInt(e,10)}}]),r}(Ju),EL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;At(this,r),e=a.call(this,t),je(Oe(e),"onCancelClick",function(f){e.exitMini(),e.isClose=!0}),je(Oe(e),"onCenterClick",function(f){var h=Oe(e),p=h.player;p.paused?p.play():p.pause()}),je(Oe(e),"onScroll",function(f){if(!(!window.scrollY&&window.scrollY!==0||Math.abs(window.scrollY-e.pos.scrollY)<50)){var h=parseInt($.getCss(e.player.root,"height"));h+=e.config.scrollTop,e.pos.scrollY=window.scrollY,window.scrollY>h+5?!e.isMini&&!e.isClose&&e.getMini():window.scrollY<=h&&(e.isMini&&e.exitMini(),e.isClose=!1)}}),e.isMini=!1,e.isClose=!1;var i=Oe(e),s=i.config;return e.pos={left:s.left<0?window.innerWidth-s.width-20:s.left,top:s.top<0?window.innerHeight-s.height-20:s.top,height:e.config.height,width:e.config.width,scrollY:window.scrollY||0},e.lastStyle=null,e}return kt(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.mini=="boolean"&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(ef,function(){e.setAttr("data-state","pause")}),this.on(Mi,function(){e.setAttr("data-state","play")})}},{key:"onPluginsReady",value:function(){var e=this,i=this.player,s=this.config;if(!s.disable){if(this.config.isShowIcon){var f={config:{onClick:function(){e.getMini()}}};i.controls.registerPlugin(H1,f,H1.pluginName)}var h=$.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",h,this.onCancelClick),this.bind(".play-icon",h,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new xL(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:Ug,class:"xg-icon-play"},pause:{icon:Hg,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e=this;if(!this.isMini){var i=this.player,s=this.playerConfig,f=this.config.target||this.player.root;this.lastStyle={},$.addClass(i.root,"xgplayer-mini"),["width","height","top","left"].map(function(h){e.lastStyle[h]=f.style[h],f.style[h]="".concat(e.pos[h],"px")}),s.fluid&&(f.style["padding-top"]=""),this.emit(T0,!0),i.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var i=this.player,s=this.playerConfig,f=this.config.target||this.player.root;$.removeClass(i.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map(function(h){f.style[h]=e.lastStyle[h]}),this.lastStyle=null,s.fluid&&(i.root.style.width="100%",i.root.style.height="0",i.root.style["padding-top"]="".concat(s.height*100/s.width,"%")),this.emit(T0,!1),this.isMini=i.isMini=!1}},{key:"updatePos",value:function(e){this.pos=Object.assign(this.pos,e),this.isMini&&(this.player.root.style.left="".concat(this.pos.left,"px"),this.player.root.style.top="".concat(this.pos.top,"px"),this.player.root.style.width="".concat(this.pos.width,"px"),this.player.root.style.height="".concat(this.pos.height,"px"))}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=$.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return` `.concat(bo(this,"MINI_DRAG",this.playerConfig.isHideTips),`
`)}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),r}(wr),gh={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},Sp=["videoClick","videoDbClick"],_p=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s0&&i.replay():i.paused?i.play():i.pause()}},{key:"onContextmenu",value:function(e){e=e||window.event,e.preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,i=this.player,s=i.video,f=i.root;this.clickTimer&&clearTimeout(this.clickTimer),f.removeEventListener("click",this.onVideoClick,!1),f.removeEventListener("dblclick",this.onVideoDblClick,!1),s.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(gh).map(function(h){f.removeEventListener(h,e[gh[h]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),r}(Fi),co={PRESS:"press",PRESS_END:"pressend",DOUBlE_CLICK:"doubleclick",CLICK:"click",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend"},SL={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},_L={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function z1(n){return n&&n.length>0?n[n.length-1]:null}function bL(){return{pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0}}var TL=function(){function n(a){var r=this,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{eventType:"touch"};At(this,n),je(this,"onTouchStart",function(e){var i=r._pos,s=r.root,f=z1(e.touches);i.x=f?parseInt(f.pageX,10):e.pageX,i.y=f?parseInt(f.pageX,10):e.pageX,i.start=!0,r.__setPress(e),s.addEventListener(r.events.end,r.onTouchEnd),s.addEventListener(r.events.cancel,r.onTouchCancel),s.addEventListener(r.events.move,r.onTouchMove),r.trigger(co.TOUCH_START,e)}),je(this,"onTouchCancel",function(e){r.onTouchEnd(e)}),je(this,"onTouchEnd",function(e){var i=r._pos,s=r.root;r.__clearPress(),s.removeEventListener(r.events.cancel,r.onTouchCancel),s.removeEventListener(r.events.end,r.onTouchEnd),s.removeEventListener(r.events.move,r.onTouchMove),e.moving=i.moving,e.press=i.press,i.press&&r.trigger(co.PRESS_END,e),r.trigger(co.TOUCH_END,e),!i.press&&!i.moving&&r.__setDb(e),i.press=!1,i.start=!1,i.moving=!1}),je(this,"onTouchMove",function(e){var i=r._pos,s=r.config,f=z1(e.touches),h=f?parseInt(f.pageX,10):e.pageX,p=f?parseInt(f.pageY,10):e.pageX,S=h-i.x,b=p-i.y;Math.abs(b)=0&&this.__handlers[r].splice(i,1)}}},{key:"trigger",value:function(r,t){this.__handlers[r]&&this.__handlers[r].map(function(e){try{e(t)}catch(i){console.error("trigger>>:".concat(r),i)}})}},{key:"destroy",value:function(){var r=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(t).forEach(function(e){r.root.removeEventListener(e,r[t[e]])})}}]),n}();function CL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var Iu={AUTO:"auto",SEEKING:"seeking",PLAYBACK:"playbackrate"},bp=["videoClick","videoDbClick"],wL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),je(Oe(e),"onTouchStart",function(i){var s=Oe(e),f=s.player,h=s.config,p=s.pos,S=s.playerConfig,b=e.getTouche(i);if(b&&!h.disableGesture&&e.duration>0&&!f.ended){p.isStart=!0,e.timer&&clearTimeout(e.timer),$.checkIsFunction(S.disableSwipeHandler)&&S.disableSwipeHandler(),e.find(".xg-dur").innerHTML=$.format(e.duration);var A=e.root.getBoundingClientRect();f.rotateDeg===90?(p.top=A.left,p.left=A.top,p.width=A.height,p.height=A.width):(p.top=A.top,p.left=A.left,p.width=A.width,p.height=A.height);var R=parseInt(b.pageX-p.left,10),D=parseInt(b.pageY-p.top,10);p.x=f.rotateDeg===90?D:R,p.y=f.rotateDeg===90?R:D,p.scopeL=h.scopeL*p.width,p.scopeR=(1-h.scopeR)*p.width,p.scopeM1=p.width*(1-h.scopeM)/2,p.scopeM2=p.width-p.scopeM1}}),je(Oe(e),"onTouchMove",function(i){var s=e.getTouche(i),f=Oe(e),h=f.pos,p=f.config,S=f.player;if(!(!s||p.disableGesture||!e.duration||!h.isStart)){var b=p.miniMoveStep,A=p.hideControlsActive,R=parseInt(s.pageX-h.left,10),D=parseInt(s.pageY-h.top,10),I=S.rotateDeg===90?D:R,O=S.rotateDeg===90?R:D;if(Math.abs(I-h.x)>b||Math.abs(O-h.y)>b){var V=I-h.x,N=O-h.y,G=h.scope;if(G===-1&&(G=e.checkScope(I,O,V,N,h),G===0&&(A?S.blur():S.focus({autoHide:!1}),!h.time&&(h.time=parseInt(S.currentTime*1e3,10)+e.timeOffset*1e3)),h.scope=G),G===-1||G>0&&!p.gestureY||G===0&&!p.gestureX)return;e.executeMove(V,N,G,h.width,h.height),h.x=I,h.y=O}}}),je(Oe(e),"onTouchEnd",function(i){var s=Oe(e),f=s.player,h=s.pos,p=s.playerConfig;if(setTimeout(function(){f.getPlugin("progress")&&f.getPlugin("progress").resetSeekState()},10),!!h.isStart){h.scope>-1&&i.cancelable&&i.preventDefault();var S=e.config,b=S.disableGesture,A=S.gestureX;!b&&A?e.endLastMove(h.scope):h.time=0,h.scope=-1,e.resetPos(),$.checkIsFunction(p.enableSwipeHandler)&&p.enableSwipeHandler(),e.changeAction(Iu.AUTO)}}),je(Oe(e),"onRootTouchMove",function(i){e.config.disableGesture||!e.config.gestureX||e.checkIsRootTarget(i)&&(i.stopPropagation(),e.pos.isStart?e.onTouchMove(i):e.onTouchStart(i))}),je(Oe(e),"onRootTouchEnd",function(i){e.pos.scope>-1&&e.onTouchEnd(i)}),e.pos={isStart:!1,x:0,y:0,time:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1},e.timer=null,e}return kt(r,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"registerIcons",value:function(){return{seekTipIcon:{icon:CL,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this;bp.map(function(A){e.__hooks[A]=null});var i=this.playerConfig,s=this.config,f=this.player;i.closeVideoDblclick===!0&&(s.closedbClick=!0),this.resetPos(),$.isUndefined(i.disableGesture)||(s.disableGesture=!!i.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=$.createDom("xg-mask","",{},"xgmask"),f.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var h=this.domEventType==="mouse"?"mouse":"touch";this.touch=new TL(this.root,{eventType:h,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",function(A){A.preventDefault()}),f.root.addEventListener("touchmove",this.onRootTouchMove,!0),f.root.addEventListener("touchend",this.onRootTouchEnd,!0),f.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var p=this.player.controls;p&&p.center&&(p.center.addEventListener("touchmove",this.onRootTouchMove,!0),p.center.addEventListener("touchend",this.onRootTouchEnd,!0),p.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(Ss,function(){var A=e.player,R=e.config;A.duration>0&&A.duration*1e30&&(e.pos.time=0)});var S={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(S).map(function(A){e.touch.on(A,function(R){e[S[A]](R)})}),!s.disableActive){var b=f.plugins.progress;b&&(b.addCallBack("dragmove",function(A){e.activeSeekNote(A.currentTime,A.forward)}),["dragend","click"].forEach(function(A){b.addCallBack(A,function(){e.changeAction(Iu.AUTO)})}))}}},{key:"registerThumbnail",value:function(){var e=this.player,i=e.plugins.thumbnail;if(i&&i.usable){this.thumbnail=i.createThumbnail(null,"mobile-thumbnail");var s=this.find(".time-preview");s.insertBefore(this.thumbnail,s.children[0])}}},{key:"initCustomStyle",value:function(){var e=this.playerConfig||{},i=e.commonStyle,s=i.playedColor,f=i.progressColor,h=i.timePreviewStyle,p=i.curTimeColor,S=i.durationColor;if(s&&(this.find(".xg-curbar").style.backgroundColor=s),f&&(this.find(".xg-bar").style.backgroundColor=f),h){var b=this.find(".time-preview");Object.keys(h).forEach(function(D){b.style[D]=h[D]})}var A=p||s,R=S;A&&(this.find(".xg-cur").style.color=A),R&&(this.find(".xg-dur").style.color=R),this.config.disableTimeProgress&&$.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map(function(i){e.pos[i]=0})):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var i=this.player,s=this.root;s.setAttribute("data-xg-action",e);var f=i.plugins.start;f&&f.recover()}},{key:"getTouche",value:function(e){var i=this.player.rotateDeg,s=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return i===0?{pageX:s.pageX,pageY:s.pageY}:{pageX:s.pageX,pageY:s.pageY}}},{key:"checkScope",value:function(e,i,s,f,h){var p=h.width,S=-1;if(e<0||e>p)return S;var b=Math.abs(f===0?s:s/f);return Math.abs(s)>0&&b>=1.73&&e>h.scopeM1&&eh.scopeR?2:3),S}},{key:"executeMove",value:function(e,i,s,f,h){switch(s){case 0:this.updateTime(e/f*this.config.scopeM);break;case 1:this.updateBrightness(i/h);break;case 2:er.os.isIos||this.updateVolume(i/h);break}}},{key:"endLastMove",value:function(e){var i=this,s=this.pos,f=this.player,h=this.config,p=(s.time-this.timeOffset)/1e3;switch(e){case 0:f.seek(Number(p).toFixed(1)),h.hideControlsEnd?f.blur():f.focus(),this.timer=setTimeout(function(){i.pos.time=0},500);break}this.changeAction(Iu.AUTO)}},{key:"checkIsRootTarget",value:function(e){var i=this.player.plugins||{};return i.progress&&i.progress.root.contains(e.target)?!1:i.start&&i.start.root.contains(e.target)||i.controls&&i.controls.root.contains(e.target)}},{key:"sendUseAction",value:function(e){var i=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:i,to:!i})}},{key:"clickHandler",value:function(e){var i=this.player,s=this.config,f=this.playerConfig;if(i.state=pr.RUNNING&&(this.sendUseAction($.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var i=this,s=this.player;Ua(this,bp[0],function(f,h){i.clickHandler(h.e)},{e,paused:s.paused})}},{key:"onDbClick",value:function(e){var i=this,s=this.player;Ua(this,bp[1],function(f,h){i.dbClickHandler(h.e)},{e,paused:s.paused})}},{key:"onPress",value:function(e){var i=this.pos,s=this.config,f=this.player;s.disablePress||(i.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:f.playbackRate,to:s.pressRate}),f.playbackRate=s.pressRate,this.changeAction(Iu.PLAYBACK))}},{key:"onPressEnd",value:function(e){var i=this.pos,s=this.config,f=this.player;s.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:f.playbackRate,to:i.rate}),f.playbackRate=i.rate,i.rate=1,this.changeAction(Iu.AUTO))}},{key:"updateTime",value:function(e){var i=this.player,s=this.config,f=this.player.duration;e=Number(e.toFixed(4));var h=parseInt(e*s.moveDuration,10)+this.timeOffset;h+=this.pos.time,h=h<0?0:h>f*1e3?f*1e3-200:h,i.getPlugin("time")&&i.getPlugin("time").updateTime(h/1e3),i.getPlugin("progress")&&i.getPlugin("progress").updatePercent(h/1e3/this.duration,!0),this.activeSeekNote(h/1e3,e>0),s.isTouchingSeek&&i.seek(Number((h-this.timeOffset)/1e3).toFixed(1)),this.pos.time=h}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var i=this.player,s=this.pos;if(e=parseInt(e*100,10),s.volume+=e,!(Math.abs(s.volume)<10)){var f=parseInt(i.volume*10,10)-parseInt(s.volume/10,10);f=f>10?10:f<1?0:f,i.volume=f/10,s.volume=0}}},{key:"updateBrightness",value:function(e){var i=this.pos,s=this.config,f=this.xgMask;if(s.darkness){this.player.rotateDeg&&(e=-e);var h=i.light+.8*e;h=h>s.maxDarkness?s.maxDarkness:h<0?0:h,f&&(f.style.backgroundColor="rgba(0,0,0,".concat(h,")")),i.light=h}}},{key:"activeSeekNote",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=this.player,f=this.config,h=!(this.duration!==1/0&&this.duration>0);if(!(!e||typeof e!="number"||h||f.disableActive)){e<0?e=0:e>s.duration&&(e=s.duration-.2),this.changeAction(Iu.SEEKING);var p=s.plugins.start;p&&p.focusHide(),this.find(".xg-dur").innerHTML=$.format(this.duration),this.find(".xg-cur").innerHTML=$.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),i?$.removeClass(this.find(".xg-seek-show"),"xg-back"):$.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var i=this.player,s=i.plugins.thumbnail;s&&s.usable&&this.thumbnail&&s.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state
00:00 / 00:00
`).concat(this.config.pressRate,"X").concat(this.i18n.FORWARD,`
`)}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:60*6*1e3,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),r}(wr);function AL(n){n.preventDefault(),n.returnValue=!1}function W1(n){var a=n.tagName;return!!(a==="INPUT"||a==="TEXTAREA"||n.isContentEditable)}var $1=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s0&&f-h>i*.9)}},{key:"checkCode",value:function(e,i){var s=this,f=!1;return Object.keys(this.keyCodeMap).map(function(h){s.keyCodeMap[h]&&e===s.keyCodeMap[h].keyCode&&!s.keyCodeMap[h].disable&&(f=!i||i&&!s.keyCodeMap[h].noBodyTarget)}),f}},{key:"downVolume",value:function(e){var i=this.player;if(!(i.volume<=0)){var s=parseFloat((i.volume-.1).toFixed(1)),f={volume:{from:i.volume,to:s}};this.emitUserAction(e,"change_volume",{props:f}),s>=0?i.volume=s:i.volume=0}}},{key:"upVolume",value:function(e){var i=this.player;if(!(i.volume>=1)){var s=parseFloat((i.volume+.1).toFixed(1)),f={volume:{from:i.volume,to:s}};this.emitUserAction(e,"change_volume",{props:f}),s<=1?i.volume=s:i.volume=1}}},{key:"seek",value:function(e){var i=this.player,s=i.currentTime,f=i.offsetCurrentTime,h=i.duration,p=i.offsetDuration,S=i.timeSegments,b=f>-1?f:s,A=p||h,R=e.repeat&&this.seekStep>=4?parseInt(this.seekStep/2,10):this.seekStep;b+R<=A?b=b+R:b=A;var D=$.getCurrentTimeByOffset(b,S),I={currentTime:{from:s,to:D}};this.emitUserAction(e,"seek",{props:I}),this.player.currentTime=D}},{key:"seekBack",value:function(e){var i=this.player,s=i.currentTime,f=i.offsetCurrentTime,h=i.timeSegments,p=e.repeat?parseInt(this.seekStep/2,10):this.seekStep,S=f>-1?f:s,b=S-p;b<0&&(b=0),b=$.getCurrentTimeByOffset(b,h);var A={currentTime:{from:s,to:b}};this.emitUserAction(e,"seek",{props:A}),this.player.currentTime=b}},{key:"changePlaybackRate",value:function(e){var i=this._keyState,s=this.config,f=this.player;i.playbackRate===0&&(i.playbackRate=f.playbackRate,f.playbackRate=s.playbackRate)}},{key:"playPause",value:function(e){var i=this.player;i&&(this.emitUserAction(e,"switch_play_pause"),i.paused?i.play():i.pause())}},{key:"exitFullscreen",value:function(e){var i=this.player,s=i.fullscreen,f=i.cssfullscreen;s&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:s,to:!s}),i.exitFullscreen()),f&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:f,to:!f}),i.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var i=this._keyState;if(e.repeat){i.isPress=!0;var s=Date.now();if(s-i.tt<200)return;i.tt=s}this.handleKeyCode(e.keyCode,e,i.isPress)}},{key:"handleKeyUp",value:function(e){var i=this._keyState;i.playbackRate>0&&(this.player.playbackRate=i.playbackRate,i.playbackRate=0),i.isKeyDown=!1,i.isPress=!1,i.tt=0}},{key:"handleKeyCode",value:function(e,i,s){for(var f=Object.keys(this.keyCodeMap),h=0;h `,"image/svg+xml").firstChild}var LL=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"registerIcons",value:function(){return{loadingIcon:kL}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return` `}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:Ur.ROOT}}}]),r}(wr),RL=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s0&&(t.player.currentTime=t.curPos.start)}}),je(Oe(t),"_onTimeupdate",function(){var f=t.player,h=f.currentTime,p=f.timeSegments;if(t._checkIfEnabled(p)){var S=p.length;t.lastCurrentTime=h;var b=$.getIndexByTime(h,p);b!==t.curIndex&&t.changeIndex(b,p);var A=$.getOffsetCurrentTime(h,p,b);if(t.player.offsetCurrentTime=A,!!t.curPos){var R=t.curPos,D=R.start,I=R.end;hI&&b>=S-1&&t.player.pause()}}}),je(Oe(t),"_onSeeking",function(){var f=t.player,h=f.currentTime,p=f.timeSegments;if(t._checkIfEnabled(p))if(hp[p.length-1].end)t.player.currentTime=p[p.length-1].end;else{var S=$.getIndexByTime(h,p);if(S>=0){var b=t.getSeekTime(h,t.lastCurrentTime,S,p);b>=0&&(t.player.currentTime=b)}}}),je(Oe(t),"_onPlay",function(){var f=t.player,h=f.currentTime,p=f.timeSegments;t._checkIfEnabled(p)&&h>=p[p.length-1].end&&(t.player.currentTime=p[0].start)}),t}return kt(r,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(Ss,this._onDurationChange),this.on(ms,this._onLoadedData),this.on(Oi,this._onTimeupdate),this.on(K0,this._onSeeking),this.on(Mi,this._onPlay)}},{key:"setConfig",value:function(e){var i=this;if(e){var s=Object.keys(e);s.length<1||(s.forEach(function(f){i.config[f]=e[f]}),this.updateSegments())}}},{key:"updateSegments",value:function(){var e=this.config,i=e.disable,s=e.segments,f=this.player;if(i||!s||s.length===0)f.timeSegments=[],f.offsetDuration=0,f.offsetCurrentTime=-1;else{var h=this.formatTimeSegments(s,f.duration);f.timeSegments=h,f.offsetDuration=h.length>0?h[h.length-1].duration:0}}},{key:"formatTimeSegments",value:function(e,i){var s=[];return e?(e.sort(function(f,h){return f.start-h.start}),e.forEach(function(f,h){var p={};if(p.start=f.start<0?0:f.start,p.end=i>0&&f.end>i?i:f.end,!(i>0&&p.start>i)){s.push(p);var S=p.end-p.start;if(h===0)p.offset=f.start,p.cTime=0,p.segDuration=S,p.duration=S;else{var b=s[h-1];p.offset=b.offset+(p.start-b.end),p.cTime=b.duration+b.cTime,p.segDuration=S,p.duration=b.duration+S}}}),s):[]}},{key:"getSeekTime",value:function(e,i,s,f){var h=-1,p=f[s],S=p.start,b=p.end;if(e>=S&&e<=b)return h;var A=e-i;if(A<0&&eS?i-S:0;return h=s-1>=0?f[s-1].end+A+R:0,h}return-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,i){this.curIndex=e,e>=0&&i.length>0?this.curPos=i[e]:this.curPos=null}}],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),r}(Fi);function DL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var PL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),e.rotateDeg=e.config.rotateDeg||0,e}return kt(r,[{key:"afterCreate",value:function(){var e=this;if(!this.config.disable){zt(Vt(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(mo,function(){e.rotateDeg&&e.config.innerRotate&&$.setTimeout(e,function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)},100)});var i=this.player.root;this.rootWidth=i.style.width||i.offsetWidth||i.clientWidth,this.rootHeight=i.style.height||i.offsetHeight||i.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){zt(Vt(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,i){if(e||(e=0),i){this.player.videoRotateDeg=e;return}var s=this.player,f=this.rootWidth,h=this.rootHeight,p=s.root,S=s.innerContainer,b=s.media,A=p.offsetWidth,R=S&&i?S.offsetHeight:p.offsetHeight,D=f,I=h,O=0,V=0;(e===.75||e===.25)&&(D="".concat(R,"px"),I="".concat(A,"px"),O=-(R-A)/2,V=-(A-R)/2);var N="translate(".concat(O,"px,").concat(V,"px) rotate(").concat(e,"turn)"),G={transformOrigin:"center center",transform:N,webKitTransform:N,height:I,width:D},z=i?b:p,Z=i?s.getPlugin("poster"):null;Object.keys(G).map(function(H){z.style[H]=G[H],Z&&Z.root&&(Z.root.style[H]=G[H])})}},{key:"rotate",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,f=this.player;this.rotateDeg||(this.rotateDeg=0);var h=e?1:-1;this.rotateDeg=(this.rotateDeg+1+h*.25*s)%1,this.updateRotateDeg(this.rotateDeg,i),f.emit(ME,this.rotateDeg*360)}},{key:"registerIcons",value:function(){return{rotate:DL}}},{key:"render",value:function(){if(!this.config.disable)return`
`.concat(bo(this,"ROTATE_TIPS",this.playerConfig.isHideTips),`
`)}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),r}(xl);function IL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}function OL(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var Ou={PIP:"picture-in-picture",INLINE:"inline",FULLSCREEN:"fullscreen"},FL=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s
`.concat(bo(this,"PIP",this.playerConfig.isHideTips),` `)}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return typeof e.webkitSetPresentationMode=="function"}}]),r}(xl);function ML(){return new DOMParser().parseFromString(` `,"image/svg+xml").firstChild}var BL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),je(Oe(e),"playNext",function(i){var s=Oe(e),f=s.player;i.preventDefault(),i.stopPropagation(),e.idx+1
`.concat(bo(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),` `)}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),r}(wr),o0={exports:{}},NL=o0.exports,K1;function UL(){return K1||(K1=1,function(n,a){(function(r,t){n.exports=t()})(NL,function(){return function r(t,e,i){var s=window,f="application/octet-stream",h=i||f,p=t,S=!e&&!i&&p,b=document.createElement("a"),A=function(ee){return String(ee)},R=s.Blob||s.MozBlob||s.WebKitBlob||A,D=e||"download",I,O;if(R=R.call?R.bind(s):Blob,String(this)==="true"&&(p=[p,h],h=p[0],p=p[1]),S&&S.length<2048&&(D=S.split("/").pop().split("?")[0],b.href=S,b.href.indexOf(S)!==-1)){var V=new XMLHttpRequest;return V.open("GET",S,!0),V.responseType="blob",V.onload=function(ee){r(ee.target.response,D,f)},setTimeout(function(){V.send()},0),V}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(p))if(p.length>1024*1024*1.999&&R!==A)p=Z(p),h=p.type||f;else return navigator.msSaveBlob?navigator.msSaveBlob(Z(p),D):H(p);else if(/([\x80-\xff])/.test(p)){var N=0,G=new Uint8Array(p.length),z=G.length;for(N;N `,"image/svg+xml").firstChild}var GL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),je(Oe(e),"download",function(i){if(!e.isLock){e.emitUserAction(i,"download");var s=e.playerConfig.url,f="";$.typeOf(s)==="String"?f=s:$.typeOf(s)==="Array"&&s.length>0&&(f=s[0].src);var h=e.getAbsoluteURL(f);VL(h),e.isLock=!0,e.timer=window.setTimeout(function(){e.isLock=!1,window.clearTimeout(e.timer),e.timer=null},300)}}),e.timer=null,e.isLock=!1,e}return kt(r,[{key:"afterCreate",value:function(){zt(Vt(r.prototype),"afterCreate",this).call(this),!this.config.disable&&(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(i){i.preventDefault(),i.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:jL}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var i=document.createElement("div");i.innerHTML='x'),e=i.firstChild.href}return e}},{key:"destroy",value:function(){zt(Vt(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return`
`.concat(bo(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),`
`)}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:3,disable:!0}}}]),r}(xl),zL=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"beforeCreate",value:function(e){typeof e.player.config.screenShot=="boolean"&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){zt(Vt(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(i){e.fitVideo&&(e.width=i.vWidth,e.height=i.vHeight)},this.once(mo,this.initSize)}},{key:"onPluginsReady",value:function(){this.show(),this.onClickBtn=this.onClickBtn.bind(this),this.bind(["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,i){var s=document.createElement("a");s.href=e,s.download=i;var f;try{typeof MouseEvent<"u"?f=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}):(f=document.createEvent("MouseEvents"),f.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null))}catch(h){console.error("MouseEvent unsupported",h)}f&&s.dispatchEvent(f)}},{key:"createCanvas",value:function(e,i){var s=document.createElement("canvas"),f=s.getContext("2d");this.canvasCtx=f,this.canvas=s,s.width=e||this.config.width,s.height=i||this.config.height,f.imageSmoothingEnabled=!0,f.imageSmoothingEnabled&&(f.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var i=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot");var s=this.config;this.shot(s.width,s.height).then(function(f){i.emit(BE,f),s.saveImg&&i.saveScreenShot(f,s.name+s.format)})}},{key:"shot",value:function(e,i){var s=this,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{quality:.92,type:"image/png"},h=this.config,p=this.player,S=f.quality||h.quality,b=f.type||h.type;return new Promise(function(A,R){var D=null,I;if(p.media.canvas)D=p.media.canvas;else{s.canvas?(s.canvas.width=e||h.width,s.canvas.height=i||h.height):s.createCanvas(e,i),D=s.canvas,I=s.canvasCtx;var O=p.media.videoWidth/p.media.videoHeight,V=D.width/D.height,N=0,G=0,z=p.media.videoWidth,Z=p.media.videoHeight,H,ee,te,fe;O>V?(te=D.width,fe=D.width/O,H=0,ee=Math.round((D.height-fe)/2)):O===V?(te=D.width,fe=D.height,H=0,ee=0):O
`).concat(this.icons.screenshotIcon?"":'').concat(this.i18n[i],""),`
`)}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,saveImg:!0,fitVideo:!0,disable:!1,name:"screenshot"}}}]),r}(xl),WL=function(){function n(a){At(this,n),this.config=a.config,this.parent=a.root,this.root=$.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),a.root.appendChild(this.root);var r=this.config.maxHeight;r&&this.setStyle({maxHeight:r}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var t=this.config.domEventType==="touch"?"touchend":"click";this._delegates=wr.delegate.call(this,this.root,"li",t,this.onItemClick)}return kt(n,[{key:"renderItemList",value:function(r){var t=this,e=this.config,i=this.root;r?e.data=r:r=e.data,e.style&&Object.keys(e.style).map(function(s){i.style[s]=e[s]}),r.length>0&&(this.attrKeys=Object.keys(r[0])),this.root.innerHTML="",r.map(function(s,f){var h=s.selected?"option-item selected":"option-item";s["data-index"]=f,t.root.appendChild($.createDom("li","".concat(s.showText,""),s,h))})}},{key:"onItemClick",value:function(r){r.delegateTarget||(r.delegateTarget=r.target);var t=r.delegateTarget;if(t&&$.hasClass(t,"selected"))return!1;var e=typeof this.config.onItemClick=="function"?this.config.onItemClick:null,i=this.root.querySelector(".selected");$.addClass(t,"selected"),i&&$.removeClass(i,"selected"),e(r,{from:i?this.getAttrObj(i,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(r,t){if(!r||!t)return{};var e={};t.map(function(s){e[s]=r.getAttribute(s)});var i=r.getAttribute("data-index");return i&&(e.index=Number(i)),e}},{key:"show",value:function(){$.removeClass(this.root,"hide"),$.addClass(this.root,"active")}},{key:"hide",value:function(){$.removeClass(this.root,"active"),$.addClass(this.root,"hide")}},{key:"setStyle",value:function(r){var t=this;Object.keys(r).forEach(function(e){t.root.style[e]=r[e]})}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map(function(r){r.destroy&&r.destroy()}),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),n}(),Fa={SIDE:"side",MIDDLE:"middle",DEFAULT:"default"},Fu={CLICK:"click",HOVER:"hover"};function $L(n,a){return n===Fa.SIDE?a===Ur.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":""}var nl=er.device==="mobile",R0=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),je(Oe(e),"onEnter",function(i){i.stopPropagation(),e.emit("icon_mouseenter",{pluginName:e.pluginName}),e.switchActiveState(i)}),je(Oe(e),"switchActiveState",function(i){i.stopPropagation();var s=e.config.toggleMode;s===Fu.CLICK?e.toggle(!e.isActive):e.toggle(!0)}),je(Oe(e),"onLeave",function(i){i.stopPropagation(),e.emit("icon_mouseleave",{pluginName:e.pluginName}),e.config.listType!==Fa.SIDE&&e.isActive&&e.toggle(!1)}),je(Oe(e),"onListEnter",function(i){e.enterType=2}),je(Oe(e),"onListLeave",function(i){e.enterType=0,e.isActive&&e.toggle(!1)}),e.isIcons=!1,e.isActive=!1,e.curValue=null,e.curIndex=0,e}return kt(r,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,i=this.config;this.initIcons(),nl=nl||this.domEventType==="touch",nl&&er.device==="mobile"&&i.listType===Fa.DEFAULT&&(i.listType=Fa.SIDE),i.hidePortrait&&$.addClass(this.root,"portrait"),this.on([mo,fs],function(){e._resizeList()}),this.once(ds,function(){i.list&&i.list.length>0&&(e.renderItemList(i.list),e.show())}),nl&&this.on(Og,function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)}),nl?(i.toggleMode=Fu.CLICK,this.activeEvent="touchend"):this.activeEvent=i.toggleMode===Fu.CLICK?"click":"mouseenter",i.toggleMode===Fu.CLICK?this.bind(this.activeEvent,this.switchActiveState):(this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)),this.isIcons&&this.bind("click",this.onIconClick)}},{key:"initIcons",value:function(){var e=this,i=this.icons,s=Object.keys(i),f=!1;s.length>0&&(s.forEach(function(h){e.appendChild(".xgplayer-icon",i[h]),!f&&(f=i[h])}),this.isIcons=f),!f&&(this.appendChild(".xgplayer-icon",$.createDom("span","",{},"icon-text")),$.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||$.addClass(this.root,"show")}},{key:"hide",value:function(){$.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,i,s){if(e===void 0)return"";var f=this.config.list;!s&&(s=this.player.lang),i=!i||$.isUndefined(e[i])?"text":i,typeof e=="number"&&(e=f[e]);try{return ii(e[i])==="object"?e[i][s]||e[i].en:e[i]}catch(h){return console.warn(h),""}}},{key:"toggle",value:function(e){if(!(e===this.isActive||this.config.disable)){var i=this.player.controls,s=this.config.listType;e?(s===Fa.SIDE?i.blur():i.focus(),this.optionsList&&this.optionsList.show()):(s===Fa.SIDE?i.focus():i.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,i){e.stopPropagation();var s=this.config,f=s.listType,h=s.list;this.curIndex=i.to.index,this.curItem=h[this.curIndex],this.changeCurrentText();var p=this.config.isItemClickHide;(p||nl||f===Fa.SIDE)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,i=this.curIndex
`)}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:Ur.CONTROLS_RIGHT,index:100,list:[],listType:"default",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:Fu.HOVER,heightLimit:!0}}}]),r}(wr),KL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),e.curTime=0,e.isPaused=!0,e}return kt(r,[{key:"beforeCreate",value:function(e){var i=e.config.list;Array.isArray(i)&&i.length>0&&(e.config.list=i.map(function(s){return!s.text&&s.name&&(s.text=s.name),s.text||(s.text=s.definition),s}))}},{key:"afterCreate",value:function(){var e=this;zt(Vt(r.prototype),"afterCreate",this).call(this),this.on("resourceReady",function(i){e.changeDefinitionList(i)}),this.on(Bg,function(i){e.renderItemList(e.config.list,i.to)}),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||$.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,i=e.list,s=e.defaultDefinition;if(i.length>0){var f=null;i.map(function(h){h.definition===s&&(f=h)}),f||(f=i[0]),this.changeDefinition(f)}}},{key:"renderItemList",value:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.config.list||[],s=arguments.length>1?arguments[1]:void 0,f=s&&s.definition?s.definition:this.config.defaultDefinition;s&&i.forEach(function(S){S.selected=!1});var h=0,p=i.map(function(S,b){var A=un(un({},S),{},{showText:e.getTextByLang(S)||S.definition,selected:!1});return(S.selected||S.definition&&S.definition==f)&&(A.selected=!0,h=b),A});zt(Vt(r.prototype),"renderItemList",this).call(this,p,h)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map(function(i){return!i.text&&i.name&&(i.text=i.name),i.text||(i.text=i.definition),i}),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,i){this.player.changeDefinition(e,i)}},{key:"onItemClick",value:function(e,i){var s=this.player.definitionList;zt(Vt(r.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:i.from,to:i.to});for(var f=0;f0&&arguments[0]!==void 0?arguments[0]:{},i=this.player,s=e.errorType,f=i.errorNote?this.i18n[i.errorNote]:"";if(!f)switch(s){case"decoder":f=this.i18n.MEDIA_ERR_DECODE;break;case"network":f=this.i18n.MEDIA_ERR_NETWORK;break;default:f=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=f,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'').concat(this.i18n.REFRESH,"")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return`
`}}],[{key:"pluginName",get:function(){return"error"}}]),r}(wr),qL=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],function(i){(e.config.onClick||e.customOnClick)&&(i.preventDefault(),i.stopPropagation(),e.customOnClick?e.customOnClick(i):e.config.onClick(i))}),this.player.showPrompt=function(){e.showPrompt.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var i=this;Object.keys(e).map(function(s){i.root.style[s]=e[s]})}},{key:"showPrompt",value:function(e){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){};if(e){this.customOnClick=f;var h=this.config.interval;this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),$.addClass(this.root,"show"),s.mode==="arrow"&&$.addClass(this.root,"arrow"),typeof e=="string"?this.find(".xgplayer-prompt-detail").innerHTML=e:this.find(".xgplayer-prompt-detail").innerHTML="".concat(e.text||"")+"".concat(e.highlight?''.concat(e.highlight,""):""),s.style&&this.setStyle(s.style);var p=typeof s.autoHide=="boolean"?s.autoHide:this.config.autoHide;if(p){var S=s.interval||h;this.intervalId=setTimeout(function(){i.hide()},S)}}}},{key:"hide",value:function(){$.removeClass(this.root,"show"),$.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return' `)}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),r}(wr),Y1={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function rS(n){Object.keys(Y1).map(function(a){n[a]===void 0&&(n[a]=Y1[a])})}var X1={_updateDotDom:function(a,r){if(r){var t=this.calcuPosition(a.time,a.duration),e=a.style||{};e.left="".concat(t.left,"%"),e.width="".concat(t.width,"%"),r.setAttribute("data-text",a.text),r.setAttribute("data-time",a.time),t.isMini?$.addClass(r,"mini"):$.removeClass(r,"mini"),Object.keys(e).map(function(i){r.style[i]=e[i]})}},initDots:function(){var a=this;this._ispots.map(function(r){a.createDot(r,!1)}),this.ispotsInit=!0},createDot:function(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this.player.plugins.progress;if(t&&(r&&(rS(a),this._ispots.push(a)),!(!this.ispotsInit&&r))){var e=this.calcuPosition(a.time,a.duration),i=a.style||{};i.left="".concat(e.left,"%"),i.width="".concat(e.width,"%");var s="xgspot_".concat(a.id," xgplayer-spot");e.isMini&&(s+=" mini");var f=a.template?'
'.concat(a.template,"
"):"",h=$.createDom("xg-spot",f,{"data-text":a.text,"data-time":a.time,"data-id":a.id},s);Object.keys(i).map(function(p){h.style[p]=i[p]}),t.outer&&t.outer.appendChild(h),this.positionDot(h,a.id)}},findDot:function(a){if(this.player.plugins.progress){var r=this._ispots.filter(function(t,e){return t.id===a});return r.length>0?r[0]:null}},updateDot:function(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=this.player.plugins.progress;if(t){var e=this.findDot(a.id);if(e&&Object.keys(a).map(function(s){e[s]=a[s]}),!!this.ispotsInit){var i=t.find('xg-spot[data-id="'.concat(a.id,'"]'));i&&(this._updateDotDom(a,i),r&&this.showDot(a.id))}}},deleteDot:function(a){var r=this._ispots,t=this.player.plugins.progress;if(t){for(var e=[],i=0;i=0;f--)if(r.splice(e[f],1),this.ispotsInit){var h=t.find('xg-spot[data-id="'.concat(a,'"]'));h&&h.parentElement.removeChild(h)}}},deleteAllDots:function(){var a=this.player.plugins.progress;if(a){if(!this.ispotsInit){this._ispots=[];return}for(var r=a.root.getElementsByTagName("xg-spot"),t=r.length-1;t>=0;t--)a.outer.removeChild(r[t]);this._ispots=[]}},updateAllDots:function(){var a=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=this.player.plugins.progress;if(t){if(!this.ispotsInit){this._ispots=r;return}this._ispots=[];var e=t.root.getElementsByTagName("xg-spot"),i=e.length;if(i>r.length)for(var s=i-1;s>r.length-1;s--)t.outer.removeChild(e[s]);r.forEach(function(f,h){h0&&e.hide();var f=e.player.plugins.progress;f&&f.disableBlur(),e._curDot.addEventListener("mouseleave",e.onDotMouseLeave)}}),e._ispots=[],e.videoPreview=null,e.videothumbnail=null,e.thumbnail=null,e.timeStr="",e._state={now:0,f:!1},e}return kt(r,[{key:"beforeCreate",value:function(e){var i=e.player.plugins.progress;i&&(e.root=i.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",function(i,s){s.seekTime&&e.player.seek(s.seekTime)}),this.transformTimeHook=this.hook("transformTime",function(i){e.setTimeContent($.format(i))}),ZL(this),this.on(Ss,function(){e.show()}),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var i=this;e&&Object.keys(e).map(function(s){i.config[s]=e[s]})}},{key:"onPluginsReady",value:function(){var e=this.player;e.plugins.progress&&(this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var e=this,i=this.player.plugins.progress;if(i&&(Object.keys(Mu).map(function(f){e[Mu[f]]=e[Mu[f]].bind(e),i.addCallBack(f,e[Mu[f]])}),er.device!=="mobile")){this.bind(".xg-spot-info","mousemove",this.onMousemove),this.bind(".xg-spot-info","mousedown",this.onMousedown),this.bind(".xg-spot-info","mouseup",this.onMouseup);var s=this.hook("previewClick",function(){});this.handlerPreviewClick=function(f){f.stopPropagation(),s(parseInt(e._state.now*1e3,10)/1e3,f),i&&i.onMouseUp(f)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,i){this.config.disable||!this.player.duration||this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){this.config.disable||!this.player.duration||(this.isDrag=!0,this.videoPreview&&$.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){this.config.disable||!this.player.duration||(this.isDrag=!1,this.videoPreview&&$.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,i){this.config.disable||$.hasClass(i.target,"xgplayer-spot")&&(i.stopPropagation(),i.preventDefault(),["time","id","text"].map(function(s){e[s]=i.target.getAttribute("data-".concat(s))}),e.time&&(e.time=Number(e.time)),this.handlerSpotClick(i,e))}},{key:"updateLinePos",value:function(e,i){var s=this.root,f=this.previewLine,h=this.player,p=this.config,S=h.controls.mode,b=S==="flex",A=s.getBoundingClientRect().width;if(!(!A&&this._hasThumnail)){A=this._hasThumnail&&Ai-A&&!b?(D=R-(i-A),R=i-A):D=0,D!==void 0&&(f.style.transform="translateX(".concat(D.toFixed(2),"px)")),s.style.transform="translateX(".concat(R.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var i=this.timeText,s=this.timePoint;i.innerHTML=e,!this.thumbnail&&(s.innerHTML=e)}},{key:"updatePosition",value:function(e,i,s,f){var h=this.root,p=this.config,S=this._state;if(h){S.now=s,this.transformTimeHook(s);var b=this.timeStr;f&&f.target&&$.hasClass(f.target,"xgplayer-spot")?(this.showTips(f.target.getAttribute("data-text"),!1,b),this.focusDot(f.target),S.f=!0,p.isFocusDots&&S.f&&(S.now=parseInt(f.target.getAttribute("data-time"),10))):p.defaultText?(S.f=!1,this.showTips(p.defaultText,!0,b)):(S.f=!1,this.hideTips("")),this.updateTimeText(b),this.updateThumbnails(S.now),this.updateLinePos(e,i)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var i=this.player,s=this.videoPreview,f=this.config,h=i.plugins.thumbnail;if(h&&h.usable){this.thumbnail&&h.update(this.thumbnail,e,f.width,f.height);var p=s&&s.getBoundingClientRect();this.videothumbnail&&h.update(this.videothumbnail,e,p.width,p.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(er.device!=="mobile"){var i=this.player,s=this.config,f=i.getPlugin("thumbnail");if(f&&f.setConfig(e),!f||!f.usable||!s.isShowThumbnail){$.addClass(this.root,"short-line no-thumbnail");return}else $.removeClass(this.root,"short-line no-thumbnail");s.mode==="short"&&$.addClass(this.root,"short-line"),this._hasThumnail=!0;var h=this.find(".xg-spot-thumbnail");this.thumbnail=f.createThumbnail(h,"progress-thumbnail"),s.isShowCoverPreview&&(this.videoPreview=$.createDom("xg-video-preview","",{},"xgvideo-preview"),i.root.appendChild(this.videoPreview),this.videothumbnail=f.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}}},{key:"calcuPosition",value:function(e,i){var s=this.player.plugins.progress,f=this.player,h=s.root.getBoundingClientRect().width,p=f.duration/h*6;return e+i>f.duration&&(i=f.duration-e),e/f.duration*100,i/f.duration,{left:e/f.duration*100,width:i/f.duration*100,isMini:i2&&arguments[2]!==void 0?arguments[2]:"";$.addClass(this.root,"no-timepoint"),e&&($.addClass(this.find(".xg-spot-content"),"show-text"),i&&this.config.mode==="production"?($.addClass(this.root,"product"),this.tipText.textContent=e):($.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(s," ").concat(e)))}},{key:"hideTips",value:function(){$.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",$.removeClass(this.find(".xg-spot-content"),"show-text"),$.removeClass(this.root,"product")}},{key:"hide",value:function(){$.addClass(this.root,"hide")}},{key:"show",value:function(e){$.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,i=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(i.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e=this,i=this.player.plugins.progress;i&&Object.keys(Mu).map(function(s){i.removeCallBack(s,e[Mu[s]])}),this.videothumbnail=null,this.thumbnail=null,this.videoPreview&&this.player.root.removeChild(this.videoPreview),this.unbind(".xg-spot-info","mousemove",this.onMousemove),this.unbind(".xg-spot-info","mousedown",this.onMousedown),this.unbind(".xg-spot-info","mouseup",this.onMouseup),this.unbind(".xg-spot-content","mouseup",this.handlerPreviewClick)}},{key:"render",value:function(){return er.device==="mobile"||this.playerConfig.isMobileSimulateMode==="mobile"?"":'
00:00
`)}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),r}(wr),JL=function(n){Nt(r,n);var a=Ut(r);function r(t){var e;return At(this,r),e=a.call(this,t),e.ratio=1,e.interval=null,e._preloadMark={},e}return kt(r,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([Ss],function(){var i=e.config,s=i.pic_num,f=i.interval;e.usable&&(e.interval=f>0?f:Math.round(e.player.duration*1e3/s)/1e3)})}},{key:"setConfig",value:function(e){var i=this;if(e){var s=Object.keys(e);s.length<1||(s.forEach(function(f){i.config[f]=e[f]}),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,i=e.urls,s=e.pic_num;return i&&i.length>0&&s>0}},{key:"initThumbnail",value:function(){var e=this.config,i=e.width,s=e.height,f=e.pic_num,h=e.interval;this.ratio=i/s*100,this.interval=h||Math.round(this.player.duration/f),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e0&&h.push(e-1),h.push(e),e>0&&e=0&&p1&&arguments[1]!==void 0?arguments[1]:0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,f=this.config,h=f.pic_num,p=f.row,S=f.col,b=f.width,A=f.height;this.interval=Math.round(this.player.duration/h);var R=Math.ceil(e/this.interval);R=R>h?h:R;var D=R0?Math.ceil(I/S)-1:0,V=I>0?I-O*S-1:0,N=0,G=0;if(i&&s){var z=i/s;z2&&arguments[2]!==void 0?arguments[2]:0,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"",p=this.config,S=p.pic_num,b=p.urls;if(!(S<=0||!b||b.length===0)){var A=this.getPosition(i,s,f);this.preload(A.urlIndex),Object.keys(A.style).map(function(R){e.style[R]=A.style[R]}),Object.keys(h).map(function(R){e.style[R]=h[R]})}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,i){var s=$.createDom("xg-thumbnail","",{},"thumbnail ".concat(i));return e&&e.appendChild(s),s}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),r}(wr);function Tp(n){return n?"background:".concat(n,";"):""}var eR=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s=0?i:s}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on(Oi,this.onTimeupdate),this.on(yl,function(){e.reset()}))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cached:0,played:0},i=arguments.length>1?arguments[1]:void 0;!i||!this.root||(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/i*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/i*100,"%")))}},{key:"render",value:function(){var e=this.playerConfig,i=e.commonStyle,s=e.miniprogress;if(s){var f=this.config,h=f.mode,p=f.height,S={cached:Tp(i.cachedColor),played:Tp(i.playedColor),progress:Tp(i.progressColor),height:p>0&&p!==2?"height: ".concat(p,"px;"):""},b=h==="show"?"xg-mini-progress-show":"";return' `)}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),r}(wr),Bu={REAL_TIME:"realtime",FIRST_FRAME:"firstframe",POSTER:"poster"};function tR(){try{return parseInt(window.performance.now(),10)}catch{return new Date().getTime()}}function rR(){try{var n=document.createElement("canvas").getContext;return!!n}catch{return!1}}var mh=null,nR=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s0)t.renderOnce(),t._frameCount--;else{t._isLoaded=!0,t.off(Oi,t.renderOnTimeupdate);var h=t.config.startInterval;!t.player.paused&&t._checkIfCanStart()&&t.start(0,h)}}),je(Oe(t),"start",function(f,h){var p=t.player.video,S=tR(),b=t.checkVideoIsSupport(p);!b||!t.canvasCtx||(h||(h=t.interval),t.stop(),p.videoWidth&&p.videoHeight&&(t.videoPI=p.videoHeight>0?parseInt(p.videoWidth/p.videoHeight*100,10):0,(t.config.mode===Bu.REAL_TIME||S-t.preTime>=h)&&(p&&p.videoWidth&&t.update(b,t.videoPI),t.preTime=S)),t.frameId=t._loopType==="timer"?$.setTimeout(Oe(t),t.start,h):$.requestAnimationFrame(t.start))}),je(Oe(t),"stop",function(){t.frameId&&(t._loopType==="timer"?$.clearTimeout(Oe(t),t.frameId):$.cancelAnimationFrame(t.frameId),t.frameId=null)}),t}return kt(r,[{key:"afterCreate",value:function(){var e=this;this.playerConfig.dynamicBg===!0&&(this.config.disable=!1),r.isSupport||(this.config.disable=!0);var i=this.config,s=i.disable,f=i.mode,h=i.frameRate;s||(this._pos={width:0,height:0,rwidth:0,rheight:0,x:0,y:0,pi:0},this.isStart=!1,this._isLoaded=!1,this.videoPI=0,this.preTime=0,this.interval=parseInt(1e3/h,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this._loopType=this.config.mode!==Bu.REAL_TIME&&this.interval>=1e3?"timer":"animation",this.once(Y0,function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())}),f!==Bu.POSTER&&(f!==Bu.FIRST_FRAME&&(this.on(yl,function(){e.stop()}),this.on(Mi,function(){var p=e.config.startInterval;e._checkIfCanStart()&&e.start(0,p)}),this.on(ef,function(){e.stop()})),this.on(ms,this.onLoadedData),this.on(Ig,function(){e._isLoaded=!1,e.stop()}),document.addEventListener("visibilitychange",this.onVisibilitychange)))}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(s){s==="root"&&e[s]!==i.config[s]?i.reRender(e[s]):s==="frameRate"?i.interval=parseInt(1e3/e[s],10):s==="disable"&&e[s]&&i.stop(),i.config[s]=e[s]})}},{key:"init",value:function(e){var i=this.player,s=this.config;this.canvasFilter=r.supportCanvasFilter();try{var f=e||s.root;f||(f=s.isInnerRender&&i.innerContainer||i.root),f.insertAdjacentHTML("afterbegin",'
`)),this.root=f.children[0],this.canvas=this.find("canvas"),this.canvasFilter||(this.canvas.style.filter=s.filter,this.canvas.style.webkitFilter=s.filter),this.mask=this.find("xgmask"),s.addMask&&(this.mask.style.background=s.maskBg),this.canvasCtx=this.canvas.getContext("2d")}catch(h){fr.logError("plugin:DynamicBg",h)}}},{key:"reRender",value:function(e){var i=this.config.disable;if(!(!i&&!this.root)){this.stop();var s=this.root?this.root.parentElement:null;if(s!==e&&s.removeChild(this.root),!e){this.root=null;return}this.init(e),this.renderOnce();var f=this.config.startInterval;this._checkIfCanStart()&&this.start(0,f)}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var i=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(i&&!(er.browser==="safari"&&$.isMSE(i)))return i;var s=i?i.tagName.toLowerCase():"";return s==="canvas"||s==="img"?i:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var i=$.typeOf(e)==="String"?e:$.typeOf(e.poster)==="String"?e.poster:null;this.updateImg(i)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&!this.player.paused&&e!==Bu.FIRST_FRAME&&e!==Bu.POSTER}},{key:"renderOnce",value:function(){var e=this.player.video;if(!(!e.videoWidth||!e.videoHeight)){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var i=this.checkVideoIsSupport(e);i&&this.update(i,this.videoPI)}}},{key:"updateImg",value:function(e){var i=this;if(e){var s=this.canvas.getBoundingClientRect(),f=s.width,h=s.height,p=new window.Image;p.onload=function(){if(!(!i.canvas||i.frameId||i.isStart)){i.canvas.height=h,i.canvas.width=f;var S=parseInt(f/h*100,10);i.update(p,S),p=null}},p.src=e}}},{key:"update",value:function(e,i){if(!(!this.canvas||!this.canvasCtx||!i))try{var s=this._pos,f=this.config,h=this.canvas.getBoundingClientRect(),p=h.width,S=h.height;if(p!==s.width||S!==s.height||s.pi!==i){var b=parseInt(p/S*100,10);s.pi=i,s.width!==p&&(s.width=this.canvas.width=p),s.height!==S&&(s.height=this.canvas.height=S);var A=S,R=p;bi&&(A=parseInt(p*100/i,10)),s.rwidth=R*f.multiple,s.rheight=A*f.multiple,s.x=(p-s.rwidth)/2,s.y=(S-s.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=f.filter),this.canvasCtx.drawImage(e,s.x,s.y,s.rwidth,s.rheight)}catch(D){fr.logError("plugin:DynamicBg",D)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return typeof mh=="boolean"||(mh=rR()),mh}},{key:"supportCanvasFilter",value:function(){return!(er.browser==="safari"||er.browser==="firefox")}}]),r}(wr),iR={LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"解码错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}},hc="info",Cp=GE,aR=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;sO)){var V=I-R,N=V<=b;Vi&&(p===0||f[p-1].end-i<=s)){h=p;break}}return h}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var i=[],s=0;sh.jumpCntMax||t.timer||h.useWaitingTimeoutJump===!1||(t.timer=setTimeout(t.onJump,h.waitingTime*1e3))}),je(Oe(t),"onJump",function(){var f=Oe(t),h=f.player,p=f.config;if(clearTimeout(t.timer),t.timer=null,!(t.jumpCnt>p.jumpCntMax||p.useWaitingTimeoutJump===!1)&&!(h.media.paused&&h.media.currentTime!==0&&t.hasPlayed)){t.jumpSize=p.jumpSize*(t.jumpCnt+1),t.jumpCnt===p.jumpSize&&t.jumpSize<6&&(t.jumpSize=6);var S=h.currentTime+t.jumpSize,b=h.media.duration;S>b||(t.jumpCnt++,h.currentTime=S)}}),t}return kt(r,[{key:"afterCreate",value:function(){var e=this,i=this.config,s=i.useWaitingTimeoutJump,f=i.jumpSize;s!==!1&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=f,this.on(Nc,this.onWaiting),this.on([Pg,ds],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on(Mi,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(wr),Nu="cdn",yh=["cdn"],oR=function(n){Nt(r,n);var a=Ut(r);function r(){var t;At(this,r);for(var e=arguments.length,i=new Array(e),s=0;s0&&arguments[0]!==void 0?arguments[0]:Nu;if(!t.speedListCache||!t.speedListCache[f]||t.speedListCache[f].length<=0)return 0;var h=0;return t.speedListCache[f].map(function(p){h+=p}),Math.floor(h/t.speedListCache[f].length)}),je(Oe(t),"startTimer",function(){$.isMSE(t.player.video)||(t.initSpeedList(),t.cnt=0,t.timer=setTimeout(t.testSpeed,t.config.testTimeStep))}),je(Oe(t),"initSpeedList",function(){t.speedListCache={},yh.forEach(function(f){t.speedListCache[f]=[]})}),je(Oe(t),"_onRealSpeedChange",function(f){f.speed&&t.appendList(f.speed,f.type||Nu)}),je(Oe(t),"testSpeed",function(){if(clearTimeout(t.timer),t.timer=null,!(!t.player||!t.config.openSpeed)){var f=t.config,h=f.url,p=f.loadSize,S=f.testCnt,b=f.testTimeStep,A=h+(h.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(t.cnt>=S)){t.cnt++;try{var R=new Date().getTime(),D=null,I=new XMLHttpRequest;t.xhr=I,I.open("GET",A);var O={},V=Math.floor(Math.random()*10);O.Range="bytes="+V+"-"+(p+V),O&&Object.keys(O).forEach(function(N){I.setRequestHeader(N,O[N])}),I.onreadystatechange=function(){if(I.readyState===4){t.xhr=null,D=new Date().getTime();var N=I.getResponseHeader("Content-Length")/1024*8,G=Math.round(N*1e3/(D-R));t.appendList(G),t.timer=setTimeout(t.testSpeed,b)}},I.send()}catch(N){console.error(N)}}}}),je(Oe(t),"appendList",function(f){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nu;if(!(!t.speedListCache||!t.speedListCache[h])){var p=t.config.saveSpeedMax;t.speedListCache[h].length>=p&&t.speedListCache[h].shift(),t.speedListCache[h].push(f);var S=Oe(t),b=S.player;b&&(h===Nu?b.realTimeSpeed=f:b[t.getSpeedName("realTime",h)]=f),t.updateSpeed(h)}}),je(Oe(t),"updateSpeed",function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nu,h=t.getSpeed(f),p=Oe(t),S=p.player;if(S)if(f===Nu)(!S.avgSpeed||h!==S.avgSpeed)&&(S.avgSpeed=h,S.emit(eg,{speed:h,realTimeSpeed:S.realTimeSpeed}));else{var b=t.getSpeedName("avg",f);(!S[b]||h!==S[b])&&(S[b]=h,S.emit(eg,{speed:h,realTimeSpeed:S.realTimeSpeed}))}}),t}return kt(r,[{key:"afterCreate",value:function(){var e=this.config,i=e.openSpeed,s=e.addSpeedTypeList;(s==null?void 0:s.length)>0&&yh.push.apply(yh,pa(s)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,i&&this.on([ms,_0],this.startTimer)}},{key:"getSpeedName",value:function(e,i){return e+"Speed"+i.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer){clearTimeout(this.timer),this.timer=null;return}if(this.config.openSpeed){if(this.timer)return;this.timer=setTimeout(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){var e=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([ms,_0],this.startTimer),yh.forEach(function(i){e.speedListCache&&e.speedListCache[i]&&(e.speedListCache[i]=[])}),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&this.xhr.readyState!==4&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:200*1024,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),r}(wr),lR=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,s=this.config,f=i.media||i.video;if(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],!s.disabled){var h=f.getVideoPlaybackQuality;h&&(this.on(Mi,function(){e._startTick()}),this.on(ef,function(){e._stopTick()}),this.on(ml,function(){e._stopTick()}),this.on(yl,function(){e._stopTick()}))}}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout(function(){e._checkDecodeFPS(),e._startTick()},this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkBuffer",value:function(e,i){for(var s=!1,f=[],h=0;h=this.config.stuckCount&&(this.emit(zE,this._payload),this._reset())):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e=this.player.media||this.player.video;if(e){var i=e.getVideoPlaybackQuality(),s=i.totalVideoFrames,f=i.droppedVideoFrames,h=performance.now();if(s&&this._lastCheckPoint){var p=s-this._lastDecodedFrames,S=h-this._lastCheckPoint;this._checkStuck(p,s,f,S)}this._lastDecodedFrames=s,this._lastCheckPoint=h}}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),r}(wr);zu.use(iR);var uR=kt(function n(a,r){var t,e,i;At(this,n);var s=r&&r.isMobileSimulateMode==="mobile",f=r.isLive,h=f?[]:[RL,QE,eR,QL,JE],p=[].concat(h,[ZE,qE,PL,BL,KL,YL,GL,zL,eS,FL]),S=[dL,hL,pL,LL,gL,XL,qL,JL,EL];this.plugins=[aR,fL].concat(pa(p),S,[nS,sR]);var b=s?"mobile":er.device;switch(b){case"pc":(t=this.plugins).push.apply(t,[$1,_p,ng,oR,lR]);break;case"mobile":(e=this.plugins).push.apply(e,[wL]);break;default:(i=this.plugins).push.apply(i,[$1,_p,ng])}(er.os.isIpad||b==="pc")&&this.plugins.push(nR),er.os.isIpad&&this.plugins.push(_p),this.ignores=[],this.i18n=[]}),Yn=function(n){Nt(r,n);var a=Ut(r);function r(){return At(this,r),a.apply(this,arguments)}return kt(r)}(Z0);je(Yn,"defaultPreset",uR);je(Yn,"Util",$);je(Yn,"Sniffer",er);je(Yn,"Errors",Cc);je(Yn,"Events",Dk);je(Yn,"Plugin",wr);je(Yn,"BasePlugin",Fi);je(Yn,"I18N",zu);je(Yn,"STATE_CLASS",rt);je(Yn,"InstManager",XE);je(Yn,"PlayIcon",ZE);je(Yn,"TimeIcon",JE);je(Yn,"Progress",QE);je(Yn,"FullscreenIcon",qE);je(Yn,"CssFullscreenIcon",ng);je(Yn,"VolumeIcon",eS);function fR(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function q1(n,a){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vR(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function pR(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vR(n)}function gR(n){var a=hR();return function(){var t=D0(n),e;if(a){var i=D0(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return pR(this,e)}}function mR(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var t=r.call(n,a);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function yR(n){var a=mR(n,"string");return typeof a=="symbol"?a:String(a)}var wp={exports:{}},Z1;function xR(){return Z1||(Z1=1,function(n,a){(function r(t){(function(e,i){n.exports=i()})(this,function(){function e(g,x,v){if(A())return Reflect.construct.apply(null,arguments);var u=[null];u.push.apply(u,x);var l=new(g.bind.apply(g,u));return v&&I(l,v.prototype),l}function i(g,x){for(var v=0;v=this.minWeight_},x.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},x.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},x.destroy=function(){},s(g,[{key:"defaultEstimate",get:function(){return this.defaultEstimate_}}])}(),_e=function(x,v){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;var u="["+x+"]:";this.trace=it,this.debug=v.debug.bind(null,u),this.log=v.log.bind(null,u),this.warn=v.warn.bind(null,u),this.info=v.info.bind(null,u),this.error=v.error.bind(null,u)},it=function(){},nt={trace:it,debug:it,log:it,warn:it,info:it,error:it};function wt(){return h({},nt)}function at(g,x){var v=self.console[g];return v?v.bind(self.console,(x?"["+x+"] ":"")+"["+g+"] >"):it}function $t(g,x,v){return x[g]?x[g].bind(x):at(g,v)}var gr=wt();function Ar(g,x,v){var u=wt();if(typeof console=="object"&&g===!0||typeof g=="object"){var l=["debug","log","info","warn","error"];l.forEach(function(d){u[d]=$t(d,g,v)});try{u.log('Debug logs enabled for "'+x+'" in hls.js version 1.6.2')}catch{return wt()}l.forEach(function(d){gr[d]=$t(d,g)})}else h(gr,u);return u}var ft=gr,Br,Pr;function lr(){return Pr||(Pr=1,Br=void 0),Br}var Er=lr(),kr=z(Er);function Zt(g,x){if(x===void 0&&(x=!1),typeof TextDecoder<"u"){var v=new TextDecoder("utf-8"),u=v.decode(g);if(x){var l=u.indexOf("\0");return l!==-1?u.substring(0,l):u}return u.replace(/\0/g,"")}for(var d=g.length,m,E,_,C="",w=0;w>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:C+=String.fromCharCode(m);break;case 12:case 13:E=g[w++],C+=String.fromCharCode((m&31)<<6|E&63);break;case 14:E=g[w++],_=g[w++],C+=String.fromCharCode((m&15)<<12|(E&63)<<6|(_&63)<<0);break}}return C}var an={hexDump:function(x){for(var v="",u=0;u1||m===1&&this.levelkeys[d[0]].encrypted)return!0}return!1}},{key:"programDateTime",get:function(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime},set:function(l){if(!Q(l)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=l}},{key:"ref",get:function(){return Sr(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}}])}(jr),Xn=function(g){function x(v,u,l,d,m){var E;E=g.call(this,l)||this,E.fragOffset=0,E.duration=0,E.gap=!1,E.independent=!1,E.relurl=void 0,E.fragment=void 0,E.index=void 0,E.duration=v.decimalFloatingPoint("DURATION"),E.gap=v.bool("GAP"),E.independent=v.bool("INDEPENDENT"),E.relurl=v.enumeratedString("URI"),E.fragment=u,E.index=d;var _=v.enumeratedString("BYTERANGE");return _&&E.setByteRange(_,m),m&&(E.fragOffset=m.fragOffset+m.duration),E}return S(x,g),s(x,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var u=this.elementaryStreams;return!!(u.audio||u.video||u.audiovideo)}}])}(jr);function In(g,x){var v=Object.getPrototypeOf(g);if(v){var u=Object.getOwnPropertyDescriptor(v,x);return u||In(v,x)}}function Tn(g,x){var v=In(g,x);v&&(v.enumerable=!0,Object.defineProperty(g,x,v))}var qn=Math.pow(2,32)-1,xn=[].push,sn={video:1,audio:2,id3:3,text:4};function Te(g){return String.fromCharCode.apply(null,g)}function Ee(g,x){var v=g[x]<<8|g[x+1];return v<0?65536+v:v}function xe(g,x){var v=ct(g,x);return v<0?4294967296+v:v}function qe(g,x){var v=xe(g,x);return v*=Math.pow(2,32),v+=xe(g,x+4),v}function ct(g,x){return g[x]<<24|g[x+1]<<16|g[x+2]<<8|g[x+3]}function Ue(g,x,v){g[x]=v>>24,g[x+1]=v>>16&255,g[x+2]=v>>8&255,g[x+3]=v&255}function St(g){for(var x=g.byteLength,v=0;v8&&g[v+4]===109&&g[v+5]===111&&g[v+6]===111&&g[v+7]===102)return!0;v=u>1?v+u:x}return!1}function Se(g,x){var v=[];if(!x.length)return v;for(var u=g.byteLength,l=0;l1?l+d:u;if(m===x[0])if(x.length===1)v.push(g.subarray(l+8,E));else{var _=Se(g.subarray(l+8,E),x.slice(1));_.length&&xn.apply(v,_)}l=E}return v}function He(g){var x=[],v=g[0],u=8,l=xe(g,u);u+=4;var d=0,m=0;v===0?(d=xe(g,u),m=xe(g,u+4),u+=8):(d=qe(g,u),m=qe(g,u+8),u+=16),u+=2;var E=g.length+m,_=Ee(g,u);u+=2;for(var C=0;C<_;C++){var w=u,k=xe(g,w);w+=4;var P=k&2147483647,B=(k&2147483648)>>>31;if(B===1)return ft.warn("SIDX has hierarchical references (not supported)"),null;var M=xe(g,w);w+=4,x.push({referenceSize:P,subsegmentDuration:M,info:{duration:M/l,start:E,end:E+P-1}}),E+=P,w+=4,u=w}return{earliestPresentationTime:d,timescale:l,version:v,referencesCount:_,references:x}}function ze(g){for(var x=[],v=Se(g,["moov","trak"]),u=0;u3&&(l+="."+we(k[1])+we(k[2])+we(k[3]),d=$e(w==="avc1"?"dva1":"dvav",v));break}case"mp4a":{var P=Se(x,[u])[0],B=Se(P.subarray(28),["esds"])[0];if(B&&B.length>7){var M=4;if(B[M++]!==3)break;M=pe(B,M),M+=2;var U=B[M++];if(U&128&&(M+=2),U&64&&(M+=B[M++]),B[M++]!==4)break;M=pe(B,M);var K=B[M++];if(K===64)l+="."+we(K);else break;if(M+=12,B[M++]!==5)break;M=pe(B,M);var J=B[M++],ae=(J&248)>>3;ae===31&&(ae+=1+((J&7)<<3)+((B[M]&224)>>5)),l+="."+ae}break}case"hvc1":case"hev1":{var se=Se(v,["hvcC"])[0];if(se&&se.length>12){var ie=se[1],ue=["","A","B","C"][ie>>6],Le=ie&31,me=xe(se,2),De=(ie&32)>>5?"H":"L",Ne=se[12],Me=se.subarray(6,12);l+="."+ue+Le,l+="."+me.toString(16).toUpperCase(),l+="."+De+Ne;for(var Pe="",Be=Me.length;Be--;){var Ge=Me[Be];if(Ge||Pe){var ut=Ge.toString(16).toUpperCase();Pe="."+ut+Pe}}l+=Pe}d=$e(w=="hev1"?"dvhe":"dvh1",v);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{l=$e(l,v)||l;break}case"vp09":{var et=Se(v,["vpcC"])[0];if(et&&et.length>6){var Ze=et[4],ht=et[5],gt=et[6]>>4&15;l+="."+Fe(Ze)+"."+Fe(ht)+"."+Fe(gt)}break}case"av01":{var st=Se(v,["av1C"])[0];if(st&&st.length>2){var Dt=st[1]>>>5,ar=st[1]&31,Gt=st[2]>>>7?"H":"M",xr=(st[2]&64)>>6,Qt=(st[2]&32)>>5,zr=Dt===2&&xr?Qt?12:10:xr?10:8,ur=(st[2]&16)>>4,Nr=(st[2]&8)>>3,An=(st[2]&4)>>2,pn=st[2]&3,Tr=1,Fn=1,Jr=1,Mr=0;l+="."+Dt+"."+Fe(ar)+Gt+"."+Fe(zr)+"."+ur+"."+Nr+An+pn+"."+Fe(Tr)+"."+Fe(Fn)+"."+Fe(Jr)+"."+Mr,d=$e("dav1",v)}break}}return{codec:l,encrypted:m,supplemental:d}}function $e(g,x){var v=Se(x,["dvvC"]),u=v.length?v[0]:Se(x,["dvcC"])[0];if(u){var l=u[2]>>1&127,d=u[2]<<5&32|u[3]>>3&31;return g+"."+Fe(l)+"."+Fe(d)}}function pe(g,x){for(var v=x+5;g[x++]&128&&x0;_||(E=Se(m,["encv"])),E.forEach(function(C){var w=_?C.subarray(28):C.subarray(78),k=Se(w,["sinf"]);k.forEach(function(P){var B=lt(P);if(B){var M=B.subarray(8,24);M.some(function(U){return U!==0})||(ft.log("[eme] Patching keyId in 'enc"+(_?"a":"v")+">sinf>>tenc' box: "+an.hexDump(M)+" -> "+an.hexDump(v)),B.set(v,8))}})})})}return g}function lt(g){var x=Se(g,["schm"])[0];if(x){var v=Te(x.subarray(4,8));if(v==="cbcs"||v==="cenc")return Se(g,["schi","tenc"])[0]}return null}function Bt(g,x){return Se(x,["moof","traf"]).reduce(function(v,u){var l=Se(u,["tfdt"])[0],d=l[0],m=Se(u,["tfhd"]).reduce(function(E,_){var C=xe(_,4),w=g[C];if(w){var k=xe(l,4);if(d===1){if(k===qn)return ft.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),E;k*=qn+1,k+=xe(l,8)}var P=w.timescale||9e4,B=k/P;if(Q(B)&&(E===null||B>1&63;return v===39||v===40}else{var u=x&31;return u===6}}function fn(g,x,v,u){var l=$r(g),d=0;d+=x;for(var m=0,E=0,_=0;d=l.length)break;_=l[d++],m+=_}while(_===255);E=0;do{if(d>=l.length)break;_=l[d++],E+=_}while(_===255);var C=l.length-d,w=d;if(EC){ft.error("Malformed SEI payload. "+E+" is too small, only "+C+" bytes left to parse.");break}if(m===4){var k=l[w++];if(k===181){var P=Ee(l,w);if(w+=2,P===49){var B=xe(l,w);if(w+=4,B===1195456820){var M=l[w++];if(M===3){var U=l[w++],K=31&U,J=64&U,ae=J?2+K*3:0,se=new Uint8Array(ae);if(J){se[0]=U;for(var ie=1;ie16){for(var ue=[],Le=0;Le<16;Le++){var me=l[w++].toString(16);ue.push(me.length==1?"0"+me:me),(Le===3||Le===5||Le===7||Le===9)&&ue.push("-")}for(var De=E-16,Ne=new Uint8Array(De),Me=0;Me"u")){var x=(g||!self.MediaSource)&&self.ManagedMediaSource;return x||self.MediaSource||self.WebKitMediaSource}}function Hn(g){return typeof self<"u"&&g===self.ManagedMediaSource}function xi(g,x){var v=Object.keys(g),u=Object.keys(x),l=v.length,d=u.length;return!l||!d||l===d&&!v.some(function(m){return u.indexOf(m)===-1})}var Ei=function(){return/\(Windows.+Firefox\//i.test(navigator.userAgent)},Bi={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function ra(g,x){var v=Bi[x];return!!v&&!!v[g.slice(0,4)]}function xa(g,x,v){return v===void 0&&(v=!0),!g.split(",").some(function(u){return!Ni(u,x,v)})}function Ni(g,x,v){var u;v===void 0&&(v=!0);var l=si(v);return(u=l==null?void 0:l.isTypeSupported(Si(g,x)))!=null?u:!1}function Si(g,x){return x+"/mp4;codecs="+g}function rr(g){if(g){var x=g.substring(0,4);return Bi.video[x]}return 2}function ir(g){var x=Ei();return g.split(",").reduce(function(v,u){var l=x&&tr(u),d=l?9:Bi.video[u];return d?(d*2+v)/(v?3:2):(Bi.audio[u]+v)/(v?2:1)},0)}var qt={};function _s(g,x){if(x===void 0&&(x=!0),qt[g])return qt[g];for(var v={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[g],u=0;u4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(g)!==-1))return g;if(x){var v=x.split(",");if(v.length>1){if(g){for(var u=v.length;u--;)if(v[u].substring(0,4)===g.substring(0,4))return v[u]}return v[0]}}return x||g}function Gc(g){for(var x=g.split(","),v=0;v2){var l=u.shift()+".";l+=parseInt(u.shift()).toString(16),l+=("000"+parseInt(u.shift()).toString(16)).slice(-4),x[v]=l}}return x.join(",")}function _l(g){if(g.startsWith("av01.")){for(var x=g.split("."),v=["0","111","01","01","01","0"],u=x.length;u>4&&u<10;u++)x[u]=v[u-4];return x.join(".")}return g}function _i(g){var x=si(g)||{isTypeSupported:function(){return!1}};return{mpeg:x.isTypeSupported("audio/mpeg"),mp3:x.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:!1}}function zc(g){return g.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}var Zn=["NONE","TYPE-0","TYPE-1",null];function J0(g){return Zn.indexOf(g)>-1}var bl=["SDR","PQ","HLG"];function ev(g){return!!g&&bl.indexOf(g)>-1}var ja={No:"",Yes:"YES",v2:"v2"};function wo(g){var x=g.canSkipUntil,v=g.canSkipDateRanges,u=g.age,l=u0),P=Math.min(P,Be.minHeight),B=Math.min(B,Be.minFramerate),M=Math.min(M,Be.minBitrate);var Ge=ie.filter(function(ut){return Be.videoRanges[ut]>0});Ge.length>0&&(k=!0)},Le=d.length;Le--;)ue();P=Q(P)?P:0,B=Q(B)?B:0;var me=Math.max(1080,P),De=Math.max(30,B);M=Q(M)?M:v,v=Math.max(M,v),k||(x=void 0);var Ne=d.length>1,Me=d.reduce(function(Pe,Be){var Ge=g[Be];if(Be===Pe)return Pe;if(J=k?ie.filter(function(ut){return Ge.videoRanges[ut]>0}):[],Ne){if(Ge.minBitrate>v)return Ui(Be,"min bitrate of "+Ge.minBitrate+" > current estimate of "+v),Pe;if(!Ge.hasDefaultAudio)return Ui(Be,"no renditions with default or auto-select sound found"),Pe;if(E&&Be.indexOf(E.substring(0,4))%5!==0)return Ui(Be,'audio codec preference "'+E+'" not found'),Pe;if(m&&!C){if(!Ge.channels[m])return Ui(Be,"no renditions with "+m+" channel sound found (channels options: "+Object.keys(Ge.channels)+")"),Pe}else if((!E||C)&&w&&Ge.channels[2]===0)return Ui(Be,"no renditions with stereo sound found"),Pe;if(Ge.minHeight>me)return Ui(Be,"min resolution of "+Ge.minHeight+" > maximum of "+me),Pe;if(Ge.minFramerate>De)return Ui(Be,"min framerate of "+Ge.minFramerate+" > maximum of "+De),Pe;if(!J.some(function(ut){return Ge.videoRanges[ut]>0}))return Ui(Be,"no variants with VIDEO-RANGE of "+En(J)+" found"),Pe;if(_&&Be.indexOf(_.substring(0,4))%5!==0)return Ui(Be,'video codec preference "'+_+'" not found'),Pe;if(Ge.maxScore=ir(Pe)||Ge.fragmentError>g[Pe].fragmentError)?Pe:(U=Ge.minIndex,K=Ge.maxScore,Be)},void 0);return{codecSet:Me,videoRanges:J,preferHDR:se,minFramerate:B,minBitrate:M,minIndex:U}}function Ui(g,x){ft.log('[abr] start candidates with "'+g+'" ignored because '+x)}function Tl(g){return g.reduce(function(x,v){var u=x.groups[v.groupId];u||(u=x.groups[v.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),u.tracks.push(v);var l=v.channels||"2";return u.channels[l]=(u.channels[l]||0)+1,u.hasDefault=u.hasDefault||v.default,u.hasAutoSelect=u.hasAutoSelect||v.autoselect,u.hasDefault&&(x.hasDefaultAudio=!0),u.hasAutoSelect&&(x.hasAutoSelectAudio=!0),x},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function mr(g,x,v,u){return g.slice(v,u+1).reduce(function(l,d,m){if(!d.codecSet)return l;var E=d.audioGroups,_=l[d.codecSet];_||(l[d.codecSet]=_={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:m,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!E,fragmentError:0}),_.minBitrate=Math.min(_.minBitrate,d.bitrate);var C=Math.min(d.height,d.width);return _.minHeight=Math.min(_.minHeight,C),_.minFramerate=Math.min(_.minFramerate,d.frameRate),_.minIndex=Math.min(_.minIndex,m),_.maxScore=Math.max(_.maxScore,d.score),_.fragmentError+=d.fragmentError,_.videoRanges[d.videoRange]=(_.videoRanges[d.videoRange]||0)+1,l},{})}function af(g,x){var v;return!!g&&g!==((v=x.loadLevelObj)==null?void 0:v.uri)}var Kc=function(g){function x(u){var l;return l=g.call(this,"abr",u.logger)||this,l.hls=void 0,l.lastLevelLoadSec=0,l.lastLoadedFragLevel=-1,l.firstSelection=-1,l._nextAutoLevel=-1,l.nextAutoLevelKey="",l.audioTracksByGroup=null,l.codecTiers=null,l.timer=-1,l.fragCurrent=null,l.partCurrent=null,l.bitrateTestDelay=0,l.rebufferNotice=-1,l.bwEstimator=void 0,l._abandonRulesCheck=function(d){var m,E=l,_=E.fragCurrent,C=E.partCurrent,w=E.hls,k=w.autoLevelEnabled,P=w.media;if(!(!_||!P)){var B=performance.now(),M=C?C.stats:_.stats,U=C?C.duration:_.duration,K=B-M.loading.start,J=w.minAutoLevel,ae=_.level,se=l._nextAutoLevel;if(M.aborted||M.loaded&&M.loaded===M.total||ae<=J){l.clearTimer(),l._nextAutoLevel=-1;return}if(k){var ie=se>-1&&se!==ae,ue=!!d||ie;if(!(!ue&&(P.paused||!P.playbackRate||!P.readyState))){var Le=w.mainForwardBufferInfo;if(!(!ue&&Le===null)){var me=l.bwEstimator.getEstimateTTFB(),De=Math.abs(P.playbackRate);if(!(K<=Math.max(me,1e3*(U/(De*2))))){var Ne=Le?Le.len/De:0,Me=M.loading.first?M.loading.first-M.loading.start:-1,Pe=M.loaded&&Me>-1,Be=l.getBwEstimate(),Ge=w.levels,ut=Ge[ae],et=Math.max(M.loaded,Math.round(U*(_.bitrate||ut.averageBitrate)/8)),Ze=Pe?K-Me:K;Ze<1&&Pe&&(Ze=Math.min(K,M.loaded*8/Be));var ht=Pe?M.loaded*1e3/Ze:0,gt=me/1e3,st=ht?(et-M.loaded)/ht:et*8/Be+gt;if(!(st<=Ne)){var Dt=ht?ht*8:Be,ar=((m=(d==null?void 0:d.details)||l.hls.latestLevelDetails)==null?void 0:m.live)===!0,Gt=l.hls.config.abrBandWidthUpFactor,xr=Number.POSITIVE_INFINITY,Qt;for(Qt=ae-1;Qt>J;Qt--){var zr=Ge[Qt].maxBitrate,ur=!Ge[Qt].details||ar;if(xr=l.getTimeToLoadFrag(gt,Dt,U*zr,ur),xr=st)&&!(xr>U*10)){Pe?l.bwEstimator.sample(K-Math.min(me,Me),M.loaded):l.bwEstimator.sampleTTFB(K);var Nr=Ge[Qt].maxBitrate;l.getBwEstimate()*Gt>Nr&&l.resetEstimator(Nr);var An=l.findBestLevel(Nr,J,Qt,0,Ne,1,1);An>-1&&(Qt=An),l.warn("Fragment "+_.sn+(C?" part "+C.index:"")+" of level "+ae+` is loading too slowly; Fragment duration: `+_.duration.toFixed(3)+` Time to underbuffer: `+Ne.toFixed(3)+` s Estimated load time for current fragment: `+st.toFixed(3)+` s Estimated load time for down switch fragment: `+xr.toFixed(3)+` s TTFB estimate: `+(Me|0)+` ms Current BW estimate: `+(Q(Be)?Be|0:"Unknown")+` bps New BW estimate: `+(l.getBwEstimate()|0)+` bps Switching to level `+Qt+" @ "+(Nr|0)+" bps"),w.nextLoadLevel=w.nextAutoLevel=Qt,l.clearTimer();var pn=function(){if(l.clearTimer(),l.fragCurrent===_&&l.hls.loadLevel===Qt&&Qt>0){var Fn=l.getStarvationDelay();if(l.warn("Aborting inflight request "+(Qt>0?"and switching down":"")+` Fragment duration: `+_.duration.toFixed(3)+` s Time to underbuffer: `+Fn.toFixed(3)+" s"),_.abortRequests(),l.fragCurrent=l.partCurrent=null,Qt>J){var Jr=l.findBestLevel(l.hls.levels[J].bitrate,J,Qt,0,Fn,1,1);Jr===-1&&(Jr=J),l.hls.nextLoadLevel=l.hls.nextAutoLevel=Jr,l.resetEstimator(l.hls.levels[Jr].bitrate)}}};ie||st>xr*2?pn():l.timer=self.setInterval(pn,xr*1e3),w.trigger(j.FRAG_LOAD_EMERGENCY_ABORTED,{frag:_,part:C,stats:M})}}}}}}}},l.hls=u,l.bwEstimator=l.initEstimator(),l.registerListeners(),l}S(x,g);var v=x.prototype;return v.resetEstimator=function(l){l&&(this.log("setting initial bwe to "+l),this.hls.config.abrEwmaDefaultEstimate=l),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},v.initEstimator=function(){var l=this.hls.config;return new Ae(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate)},v.registerListeners=function(){var l=this.hls;l.on(j.MANIFEST_LOADING,this.onManifestLoading,this),l.on(j.FRAG_LOADING,this.onFragLoading,this),l.on(j.FRAG_LOADED,this.onFragLoaded,this),l.on(j.FRAG_BUFFERED,this.onFragBuffered,this),l.on(j.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(j.LEVEL_LOADED,this.onLevelLoaded,this),l.on(j.LEVELS_UPDATED,this.onLevelsUpdated,this),l.on(j.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),l.on(j.ERROR,this.onError,this)},v.unregisterListeners=function(){var l=this.hls;l&&(l.off(j.MANIFEST_LOADING,this.onManifestLoading,this),l.off(j.FRAG_LOADING,this.onFragLoading,this),l.off(j.FRAG_LOADED,this.onFragLoaded,this),l.off(j.FRAG_BUFFERED,this.onFragBuffered,this),l.off(j.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(j.LEVEL_LOADED,this.onLevelLoaded,this),l.off(j.LEVELS_UPDATED,this.onLevelsUpdated,this),l.off(j.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),l.off(j.ERROR,this.onError,this))},v.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null},v.onManifestLoading=function(l,d){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},v.onLevelsUpdated=function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},v.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},v.onFragLoading=function(l,d){var m=d.frag;if(!this.ignoreFragment(m)){if(!m.bitrateTest){var E;this.fragCurrent=m,this.partCurrent=(E=d.part)!=null?E:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}},v.onLevelSwitching=function(l,d){this.clearTimer()},v.onError=function(l,d){if(!d.fatal)switch(d.details){case re.BUFFER_ADD_CODEC_ERROR:case re.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case re.FRAG_LOAD_TIMEOUT:{var m=d.frag,E=this.fragCurrent,_=this.partCurrent;if(m&&E&&m.sn===E.sn&&m.level===E.level){var C=performance.now(),w=_?_.stats:m.stats,k=C-w.loading.start,P=w.loading.first?w.loading.first-w.loading.start:-1,B=w.loaded&&P>-1;if(B){var M=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(k-Math.min(M,P),w.loaded)}else this.bwEstimator.sampleTTFB(k)}break}}},v.getTimeToLoadFrag=function(l,d,m,E){var _=l+m/d,C=E?l+this.lastLevelLoadSec:0;return _+C},v.onLevelLoaded=function(l,d){var m=this.hls.config,E=d.stats.loading,_=E.end-E.first;Q(_)&&(this.lastLevelLoadSec=_/1e3),d.details.live?this.bwEstimator.update(m.abrEwmaSlowLive,m.abrEwmaFastLive):this.bwEstimator.update(m.abrEwmaSlowVoD,m.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(d.levelInfo)},v.onFragLoaded=function(l,d){var m=d.frag,E=d.part,_=E?E.stats:m.stats;if(m.type===X.MAIN&&this.bwEstimator.sampleTTFB(_.loading.first-_.loading.start),!this.ignoreFragment(m)){if(this.clearTimer(),m.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var C=E?E.duration:m.duration,w=this.hls.levels[m.level],k=(w.loaded?w.loaded.bytes:0)+_.loaded,P=(w.loaded?w.loaded.duration:0)+C;w.loaded={bytes:k,duration:P},w.realBitrate=Math.round(8*k/P)}if(m.bitrateTest){var B={stats:_,frag:m,part:E,id:m.type};this.onFragBuffered(j.FRAG_BUFFERED,B),m.bitrateTest=!1}else this.lastLoadedFragLevel=m.level}},v.onFragBuffered=function(l,d){var m=d.frag,E=d.part,_=E!=null&&E.stats.loaded?E.stats:m.stats;if(!_.aborted&&!this.ignoreFragment(m)){var C=_.parsing.end-_.loading.start-Math.min(_.loading.first-_.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(C,_.loaded),_.bwEstimate=this.getBwEstimate(),m.bitrateTest?this.bitrateTestDelay=C/1e3:this.bitrateTestDelay=0}},v.ignoreFragment=function(l){return l.type!==X.MAIN||l.sn==="initSegment"},v.clearTimer=function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)},v.getAutoLevelKey=function(){return this.getBwEstimate()+"_"+this.getStarvationDelay().toFixed(2)},v.getNextABRAutoLevel=function(){var l=this.fragCurrent,d=this.partCurrent,m=this.hls;if(m.levels.length<=1)return m.loadLevel;var E=m.maxAutoLevel,_=m.config,C=m.minAutoLevel,w=d?d.duration:l?l.duration:0,k=this.getBwEstimate(),P=this.getStarvationDelay(),B=_.abrBandWidthFactor,M=_.abrBandWidthUpFactor;if(P){var U=this.findBestLevel(k,C,E,P,0,B,M);if(U>=0)return this.rebufferNotice=-1,U}var K=w?Math.min(w,_.maxStarvationDelay):_.maxStarvationDelay;if(!P){var J=this.bitrateTestDelay;if(J){var ae=w?Math.min(w,_.maxLoadingDelay):_.maxLoadingDelay;K=ae-J,this.info("bitrate test took "+Math.round(1e3*J)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*K)+" ms"),B=M=1}}var se=this.findBestLevel(k,C,E,P,K,B,M);if(this.rebufferNotice!==se&&(this.rebufferNotice=se,this.info((P?"rebuffering expected":"buffer is empty")+", optimal quality level "+se)),se>-1)return se;var ie=m.levels[C],ue=m.loadLevelObj;return ue&&(ie==null?void 0:ie.bitrate)U;if(!Mr)return 0;if((Me&&Mr.codecSet!==Me||Pe&&Mr.videoRange!==Pe||kn&&Be>Mr.frameRate||!kn&&Be>0&&Be=zr*2&&_===0?Mr.averageBitrate:Mr.maxBitrate,en=P.getTimeToLoadFrag(ur,Yt,Gn*Dr,Ln===void 0),Mn=Yt>=Gn&&(Tr===M||Mr.loadError===0&&Mr.fragmentError===0)&&(en<=ur||!Q(en)||De&&!P.bitrateTestDelay||en"+Tr+" adjustedbw("+Math.round(Yt)+")-bitrate="+Math.round(Yt-Gn)+" ttfb:"+ur.toFixed(1)+" avgDuration:"+Dr.toFixed(1)+" maxFetchDuration:"+B.toFixed(1)+" fetchDuration:"+en.toFixed(1)+" firstSelection:"+Ne+" codecSet:"+Mr.codecSet+" videoRange:"+Mr.videoRange+" hls.loadLevel:"+ue)),Ne&&(P.firstSelection=Tr),{v:Tr}}},pn,Tr=m;Tr>=d;Tr--)if(pn=An(),pn!==0&&pn)return pn.v;return-1},v.deriveNextAutoLevel=function(l){var d=this.hls,m=d.maxAutoLevel,E=d.minAutoLevel;return Math.min(Math.max(l,E),m)},s(x,[{key:"firstAutoLevel",get:function(){var l=this.hls,d=l.maxAutoLevel,m=l.minAutoLevel,E=this.getBwEstimate(),_=this.hls.config.maxStarvationDelay,C=this.findBestLevel(E,m,d,0,_,1,1);if(C>-1)return C;var w=this.hls.firstLevel,k=Math.min(Math.max(w,m),d);return this.warn("Could not find best starting auto level. Defaulting to first in playlist "+w+" clamped to "+k),k}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var l=this.forcedAutoLevel,d=this.bwEstimator,m=d.canEstimate(),E=this.lastLoadedFragLevel>-1;if(l!==-1&&(!m||!E||this.nextAutoLevelKey===this.getAutoLevelKey()))return l;var _=m&&E?this.getNextABRAutoLevel():this.firstAutoLevel;if(l!==-1){var C=this.hls.levels;if(C.length>Math.max(l,_)&&C[l].loadError<=C[_].loadError)return l}return this._nextAutoLevel=_,this.nextAutoLevelKey=this.getAutoLevelKey(),_},set:function(l){var d=this.deriveNextAutoLevel(l);this._nextAutoLevel!==d&&(this.nextAutoLevelKey="",this._nextAutoLevel=d)}}])}(_e),sf=function(){function g(v){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=v}var x=g.prototype;return x.destroy=function(){this.tracks=this.queues=null},x.append=function(u,l,d){if(!(this.queues===null||this.tracks===null)){var m=this.queues[l];m.push(u),m.length===1&&!d&&this.executeNext(l)}},x.appendBlocker=function(u){var l=this;return new Promise(function(d){var m={label:"async-blocker",execute:d,onStart:function(){},onComplete:function(){},onError:function(){}};l.append(m,u)})},x.prependBlocker=function(u){var l=this;return new Promise(function(d){if(l.queues){var m={label:"async-blocker-prepend",execute:d,onStart:function(){},onComplete:function(){},onError:function(){}};l.queues[u].unshift(m)}})},x.removeBlockers=function(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(function(u){var l,d=(l=u[0])==null?void 0:l.label;(d==="async-blocker"||d==="async-blocker-prepend")&&(u[0].execute(),u.splice(0,1))})},x.unblockAudio=function(u){if(this.queues!==null){var l=this.queues.audio;l[0]===u&&this.shiftAndExecuteNext("audio")}},x.executeNext=function(u){if(!(this.queues===null||this.tracks===null)){var l=this.queues[u];if(l.length){var d=l[0];try{d.execute()}catch(_){var m;if(d.onError(_),this.queues===null||this.tracks===null)return;var E=(m=this.tracks[u])==null?void 0:m.buffer;E!=null&&E.updating||this.shiftAndExecuteNext(u)}}}},x.shiftAndExecuteNext=function(u){this.queues!==null&&(this.queues[u].shift(),this.executeNext(u))},x.current=function(u){var l;return((l=this.queues)==null?void 0:l[u][0])||null},x.toString=function(){var u=this.queues,l=this.tracks;return u===null||l===null?"":` `+this.list("video")+` `+this.list("audio")+` `+this.list("audiovideo")+"}"},x.list=function(u){var l,d;return(l=this.queues)!=null&&l[u]||(d=this.tracks)!=null&&d[u]?u+": ("+this.listSbInfo(u)+") "+this.listOps(u):""},x.listSbInfo=function(u){var l,d=(l=this.tracks)==null?void 0:l[u],m=d==null?void 0:d.buffer;return m?"SourceBuffer"+(m.updating?" updating":"")+(d.ended?" ended":"")+(d.ending?" ending":""):"none"},x.listOps=function(u){var l;return((l=this.queues)==null?void 0:l[u].map(function(d){return d.label}).join(", "))||""},g}(),of={search:function(x,v){for(var u=0,l=x.length-1,d=null,m=null;u<=l;){d=(u+l)/2|0,m=x[d];var E=v(m);if(E>0)u=d+1;else if(E<0)l=d-1;else return m}return null}};function Yc(g,x,v){if(x===null||!Array.isArray(g)||!g.length||!Q(x))return null;var u=g[0].programDateTime;if(x<(u||0))return null;var l=g[g.length-1].endProgramDateTime;if(x>=(l||0))return null;v=v||0;for(var d=0;d0&&m<15e-7&&(v+=15e-7),d&&g.level!==d.level&&d.end<=g.end&&(d=x[2+g.sn-x[0].sn]||null)}else v===0&&x[0].start===0&&(d=x[0]);if(d&&((!g||g.level===d.level)&&Lo(v,u,d)===0||lf(d,g,Math.min(l,u))))return d;var E=of.search(x,Lo.bind(null,v,u));return E&&(E!==g||!d)?E:d}function lf(g,x,v){if(x&&x.start===0&&x.level0){var u=x.tagList.reduce(function(l,d){return d[0]==="INF"&&(l+=parseFloat(d[1])),l},v);return g.start<=u}return!1}function Lo(g,x,v){if(g===void 0&&(g=0),x===void 0&&(x=0),v.start<=g&&v.start+v.duration>g)return 0;var u=Math.min(x,v.duration+(v.deltaPTS?v.deltaPTS:0));return v.start+v.duration-u<=g?1:v.start-u>g&&v.start?-1:0}function Ea(g,x,v){var u=Math.min(x,v.duration+(v.deltaPTS?v.deltaPTS:0))*1e3,l=v.endProgramDateTime||0;return l-u>g}function Sa(g,x){return of.search(g,function(v){return v.ccx?-1:0})}function bi(g){switch(g.details){case re.FRAG_LOAD_TIMEOUT:case re.KEY_LOAD_TIMEOUT:case re.LEVEL_LOAD_TIMEOUT:case re.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ts(g,x){var v=bi(x);return g.default[(v?"timeout":"error")+"Retry"]}function Ga(g,x){var v=g.backoff==="linear"?1:Math.pow(2,x);return Math.min(v*g.retryDelayMs,g.maxRetryDelayMs)}function na(g){return D(D({},g),{errorRetry:null,timeoutRetry:null})}function wl(g,x,v,u){if(!g)return!1;var l=u==null?void 0:u.code,d=x499)}var qr={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Ti={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2},qc=function(g){function x(u){var l;return l=g.call(this,"error-controller",u.logger)||this,l.hls=void 0,l.playlistError=0,l.penalizedRenditions={},l.hls=u,l.registerListeners(),l}S(x,g);var v=x.prototype;return v.registerListeners=function(){var l=this.hls;l.on(j.ERROR,this.onError,this),l.on(j.MANIFEST_LOADING,this.onManifestLoading,this),l.on(j.LEVEL_UPDATED,this.onLevelUpdated,this)},v.unregisterListeners=function(){var l=this.hls;l&&(l.off(j.ERROR,this.onError,this),l.off(j.ERROR,this.onErrorOut,this),l.off(j.MANIFEST_LOADING,this.onManifestLoading,this),l.off(j.LEVEL_UPDATED,this.onLevelUpdated,this))},v.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},v.startLoad=function(l){},v.stopLoad=function(){this.playlistError=0},v.getVariantLevelIndex=function(l){return(l==null?void 0:l.type)===X.MAIN?l.level:this.hls.loadLevel},v.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},v.onLevelUpdated=function(){this.playlistError=0},v.onError=function(l,d){var m;if(!d.fatal){var E=this.hls,_=d.context;switch(d.details){case re.FRAG_LOAD_ERROR:case re.FRAG_LOAD_TIMEOUT:case re.KEY_LOAD_ERROR:case re.KEY_LOAD_TIMEOUT:d.errorAction=this.getFragRetryOrSwitchAction(d);return;case re.FRAG_PARSING_ERROR:if((m=d.frag)!=null&&m.gap){d.errorAction=za();return}case re.FRAG_GAP:case re.FRAG_DECRYPT_ERROR:{d.errorAction=this.getFragRetryOrSwitchAction(d),d.errorAction.action=qr.SendAlternateToPenaltyBox;return}case re.LEVEL_EMPTY_ERROR:case re.LEVEL_PARSING_ERROR:{var C,w,k=d.parent===X.MAIN?d.level:E.loadLevel;d.details===re.LEVEL_EMPTY_ERROR&&((C=d.context)!=null&&(w=C.levelDetails)!=null&&w.live)?d.errorAction=this.getPlaylistRetryOrSwitchAction(d,k):(d.levelRetry=!1,d.errorAction=this.getLevelSwitchAction(d,k))}return;case re.LEVEL_LOAD_ERROR:case re.LEVEL_LOAD_TIMEOUT:typeof(_==null?void 0:_.level)=="number"&&(d.errorAction=this.getPlaylistRetryOrSwitchAction(d,_.level));return;case re.AUDIO_TRACK_LOAD_ERROR:case re.AUDIO_TRACK_LOAD_TIMEOUT:case re.SUBTITLE_LOAD_ERROR:case re.SUBTITLE_TRACK_LOAD_TIMEOUT:if(_){var P=E.loadLevelObj;if(P&&(_.type===ye.AUDIO_TRACK&&P.hasAudioGroup(_.groupId)||_.type===ye.SUBTITLE_TRACK&&P.hasSubtitleGroup(_.groupId))){d.errorAction=this.getPlaylistRetryOrSwitchAction(d,E.loadLevel),d.errorAction.action=qr.SendAlternateToPenaltyBox,d.errorAction.flags=Ti.MoveAllAlternatesMatchingHost;return}}return;case re.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{var B=E.loadLevelObj,M=B==null?void 0:B.attrs["HDCP-LEVEL"];M?d.errorAction={action:qr.SendAlternateToPenaltyBox,flags:Ti.MoveAllAlternatesMatchingHDCP,hdcpLevel:M}:this.keySystemError(d)}return;case re.BUFFER_ADD_CODEC_ERROR:case re.REMUX_ALLOC_ERROR:case re.BUFFER_APPEND_ERROR:if(!d.errorAction){var U;d.errorAction=this.getLevelSwitchAction(d,(U=d.level)!=null?U:E.loadLevel)}return;case re.INTERNAL_EXCEPTION:case re.BUFFER_APPENDING_ERROR:case re.BUFFER_FULL_ERROR:case re.LEVEL_SWITCH_ERROR:case re.BUFFER_STALLED_ERROR:case re.BUFFER_SEEK_OVER_HOLE:case re.BUFFER_NUDGE_ON_STALL:d.errorAction=za();return}d.type===ve.KEY_SYSTEM_ERROR&&this.keySystemError(d)}},v.keySystemError=function(l){var d=this.getVariantLevelIndex(l.frag);l.levelRetry=!1,l.errorAction=this.getLevelSwitchAction(l,d)},v.getPlaylistRetryOrSwitchAction=function(l,d){var m=this.hls,E=Ts(m.config.playlistLoadPolicy,l),_=this.playlistError++,C=wl(E,_,bi(l),l.response);if(C)return{action:qr.RetryRequest,flags:Ti.None,retryConfig:E,retryCount:_};var w=this.getLevelSwitchAction(l,d);return E&&(w.retryConfig=E,w.retryCount=_),w},v.getFragRetryOrSwitchAction=function(l){var d=this.hls,m=this.getVariantLevelIndex(l.frag),E=d.levels[m],_=d.config,C=_.fragLoadPolicy,w=_.keyLoadPolicy,k=Ts(l.details.startsWith("key")?w:C,l),P=d.levels.reduce(function(U,K){return U+K.fragmentError},0);if(E){l.details!==re.FRAG_GAP&&E.fragmentError++;var B=wl(k,P,bi(l),l.response);if(B)return{action:qr.RetryRequest,flags:Ti.None,retryConfig:k,retryCount:P}}var M=this.getLevelSwitchAction(l,m);return k&&(M.retryConfig=k,M.retryCount=P),M},v.getLevelSwitchAction=function(l,d){var m=this.hls;d==null&&(d=m.loadLevel);var E=this.hls.levels[d];if(E){var _,C,w=l.details;E.loadError++,w===re.BUFFER_APPEND_ERROR&&E.fragmentError++;var k=-1,P=m.levels,B=m.loadLevel,M=m.minAutoLevel,U=m.maxAutoLevel;m.autoLevelEnabled||(m.loadLevel=-1);for(var K=(_=l.frag)==null?void 0:_.type,J=K===X.AUDIO&&w===re.FRAG_PARSING_ERROR||l.sourceBufferName==="audio"&&(w===re.BUFFER_ADD_CODEC_ERROR||w===re.BUFFER_APPEND_ERROR),ae=J&&P.some(function(Pe){var Be=Pe.audioCodec;return E.audioCodec!==Be}),se=l.sourceBufferName==="video"&&(w===re.BUFFER_ADD_CODEC_ERROR||w===re.BUFFER_APPEND_ERROR),ie=se&&P.some(function(Pe){var Be=Pe.codecSet,Ge=Pe.audioCodec;return E.codecSet!==Be&&E.audioCodec===Ge}),ue=(C=l.context)!=null?C:{},Le=ue.type,me=ue.groupId,De=function(){var Be=(Me+B)%P.length;if(Be!==B&&Be>=M&&Be<=U&&P[Be].loadError===0){var Ge,ut,et=P[Be];if(w===re.FRAG_GAP&&K===X.MAIN&&l.frag){var Ze=P[Be].details;if(Ze){var ht=Cl(l.frag,Ze.fragments,l.frag.start);if(ht!=null&&ht.gap)return 0}}else{if(Le===ye.AUDIO_TRACK&&et.hasAudioGroup(me)||Le===ye.SUBTITLE_TRACK&&et.hasSubtitleGroup(me))return 0;if(K===X.AUDIO&&(Ge=E.audioGroups)!=null&&Ge.some(function(gt){return et.hasAudioGroup(gt)})||K===X.SUBTITLE&&(ut=E.subtitleGroups)!=null&&ut.some(function(gt){return et.hasSubtitleGroup(gt)})||ae&&E.audioCodec===et.audioCodec||!ae&&E.audioCodec!==et.audioCodec||ie&&E.codecSet===et.codecSet)return 0}return k=Be,1}},Ne,Me=P.length;Me--&&(Ne=De(),!(Ne!==0&&Ne===1)););if(k>-1&&m.loadLevel!==k)return l.levelRetry=!0,this.playlistError=0,{action:qr.SendAlternateToPenaltyBox,flags:Ti.None,nextAutoLevel:k}}return{action:qr.SendAlternateToPenaltyBox,flags:Ti.MoveAllAlternatesMatchingHost}},v.onErrorOut=function(l,d){var m;switch((m=d.errorAction)==null?void 0:m.action){case qr.DoNothing:break;case qr.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(d),!d.errorAction.resolved&&d.details!==re.FRAG_GAP?d.fatal=!0:/MediaSource readyState: ended/.test(d.error.message)&&(this.warn('MediaSource ended after "'+d.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError());break}if(d.fatal){this.hls.stopLoad();return}},v.sendAlternateToPenaltyBox=function(l){var d=this.hls,m=l.errorAction;if(m){var E=m.flags,_=m.hdcpLevel,C=m.nextAutoLevel;switch(E){case Ti.None:this.switchLevel(l,C);break;case Ti.MoveAllAlternatesMatchingHDCP:_&&(d.maxHdcpLevel=Zn[Zn.indexOf(_)-1],m.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+d.maxHdcpLevel+'" or lower');break}m.resolved||this.switchLevel(l,C)}},v.switchLevel=function(l,d){if(d!==void 0&&l.errorAction&&(this.warn("switching to level "+d+" after "+l.details),this.hls.nextAutoLevel=d,l.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,l.details===re.BUFFER_ADD_CODEC_ERROR&&l.mimeType&&l.sourceBufferName!=="audiovideo"))for(var m=zc(l.mimeType),E=this.hls.levels,_=E.length;_--;)E[_][l.sourceBufferName+"Codec"]===m&&this.hls.removeLevel(_)},x}(_e);function za(g){var x={action:qr.DoNothing,flags:Ti.None};return g&&(x.resolved=!0),x}var uf={length:0,start:function(){return 0},end:function(){return 0}},yr=function(){function g(){}return g.isBuffered=function(v,u){if(v){for(var l=g.getBuffered(v),d=l.length;d--;)if(u>=l.start(d)&&u<=l.end(d))return!0}return!1},g.bufferedRanges=function(v){if(v){var u=g.getBuffered(v);return g.timeRangesToArray(u)}return[]},g.timeRangesToArray=function(v){for(var u=[],l=0;l1&&v.sort(function(J,ae){return J.start-ae.start||ae.end-J.end});var d=-1,m=[];if(l)for(var E=0;E=v[E].start&&u<=v[E].end&&(d=E);var _=m.length;if(_){var C=m[_-1].end;v[E].start-CC&&(m[_-1].end=v[E].end):m.push(v[E])}else m.push(v[E])}else m=v;for(var w=0,k,P=u,B=u,M=0;M=U&&u<=K&&(d=M),u+l>=U&&u "+E+")")},d.hls=u,d.fragmentTracker=l,d.appendSource=Hn(si(u.config.preferManagedMediaSource)),d.initTracks(),d.registerListeners(),d}S(x,g);var v=x.prototype;return v.hasSourceTypes=function(){return Object.keys(this.tracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null},v.registerListeners=function(){var l=this.hls;l.on(j.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(j.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(j.MANIFEST_LOADING,this.onManifestLoading,this),l.on(j.MANIFEST_PARSED,this.onManifestParsed,this),l.on(j.BUFFER_RESET,this.onBufferReset,this),l.on(j.BUFFER_APPENDING,this.onBufferAppending,this),l.on(j.BUFFER_CODECS,this.onBufferCodecs,this),l.on(j.BUFFER_EOS,this.onBufferEos,this),l.on(j.BUFFER_FLUSHING,this.onBufferFlushing,this),l.on(j.LEVEL_UPDATED,this.onLevelUpdated,this),l.on(j.FRAG_PARSED,this.onFragParsed,this),l.on(j.FRAG_CHANGED,this.onFragChanged,this),l.on(j.ERROR,this.onError,this)},v.unregisterListeners=function(){var l=this.hls;l.off(j.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(j.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(j.MANIFEST_LOADING,this.onManifestLoading,this),l.off(j.MANIFEST_PARSED,this.onManifestParsed,this),l.off(j.BUFFER_RESET,this.onBufferReset,this),l.off(j.BUFFER_APPENDING,this.onBufferAppending,this),l.off(j.BUFFER_CODECS,this.onBufferCodecs,this),l.off(j.BUFFER_EOS,this.onBufferEos,this),l.off(j.BUFFER_FLUSHING,this.onBufferFlushing,this),l.off(j.LEVEL_UPDATED,this.onLevelUpdated,this),l.off(j.FRAG_PARSED,this.onFragParsed,this),l.off(j.FRAG_CHANGED,this.onFragChanged,this),l.off(j.ERROR,this.onError,this)},v.transferMedia=function(){var l=this,d=this.media,m=this.mediaSource;if(!d)return null;var E={};if(this.operationQueue){var _=this.isUpdating();_||this.operationQueue.removeBlockers();var C=this.isQueued();(_||C)&&this.warn("Transfering MediaSource with"+(C?" operations in queue":"")+(_?" updating SourceBuffer(s)":"")+" "+this.operationQueue),this.operationQueue.destroy()}var w=this.transferData;return!this.sourceBufferCount&&w&&w.mediaSource===m?h(E,w.tracks):this.sourceBuffers.forEach(function(k){var P=k[0];P&&(E[P]=h({},l.tracks[P]),l.removeBuffer(P)),k[0]=k[1]=null}),{media:d,mediaSource:m,tracks:E}},v.initTracks=function(){var l={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=l,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0},v.onManifestLoading=function(){this.bufferCodecEventsTotal=0,this.details=null},v.onManifestParsed=function(l,d){var m,E=2;(d.audio&&!d.video||!d.altAudio)&&(E=1),this.bufferCodecEventsTotal=E,this.log(E+" bufferCodec event(s) expected."),(m=this.transferData)!=null&&m.mediaSource&&this.sourceBufferCount&&E&&this.bufferCreated()},v.onMediaAttaching=function(l,d){var m=this.media=d.media,E=si(this.appendSource);if(this.transferData=this.overrides=void 0,m&&E){var _=!!d.mediaSource;(_||d.overrides)&&(this.transferData=d,this.overrides=d.overrides);var C=this.mediaSource=d.mediaSource||new E;if(this.assignMediaSource(C),_)this._objectUrl=m.src,this.attachTransferred();else{var w=this._objectUrl=self.URL.createObjectURL(C);if(this.appendSource)try{m.removeAttribute("src");var k=self.ManagedMediaSource;m.disableRemotePlayback=m.disableRemotePlayback||k&&C instanceof k,Zc(m),rv(m,w),m.load()}catch{m.src=w}else m.src=w}m.addEventListener("emptied",this._onMediaEmptied)}},v.assignMediaSource=function(l){var d,m;this.log((((d=this.transferData)==null?void 0:d.mediaSource)===l?"transferred":"created")+" media source: "+((m=l.constructor)==null?void 0:m.name)),l.addEventListener("sourceopen",this._onMediaSourceOpen),l.addEventListener("sourceended",this._onMediaSourceEnded),l.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(l.addEventListener("startstreaming",this._onStartStreaming),l.addEventListener("endstreaming",this._onEndStreaming))},v.attachTransferred=function(){var l=this,d=this.media,m=this.transferData;if(!(!m||!d)){var E=this.tracks,_=m.tracks,C=_?Object.keys(_):null,w=C?C.length:0,k=function(){l.media&&l.mediaSourceOpenOrEnded&&l._onMediaSourceOpen()};if(_&&C&&w){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log("attachTransferred: (bufferCodecEventsTotal "+this.bufferCodecEventsTotal+`) required tracks: `+En(E,function(U,K){return U==="initSegment"?void 0:K})+`; transfer tracks: `+En(_,function(U,K){return U==="initSegment"?void 0:K})+"}"),!xi(_,E)){m.mediaSource=null,m.tracks=void 0;var P=d.currentTime,B=this.details,M=Math.max(P,(B==null?void 0:B.fragments[0].start)||0);if(M-P>1){this.log("attachTransferred: waiting for playback to reach new tracks start time "+P+" -> "+M);return}this.warn('attachTransferred: resetting MediaSource for incompatible tracks ("'+Object.keys(_)+'"->"'+Object.keys(E)+'") start time: '+M+" currentTime: "+P),this.onMediaDetaching(j.MEDIA_DETACHING,{}),this.onMediaAttaching(j.MEDIA_ATTACHING,m),d.currentTime=M;return}this.transferData=void 0,C.forEach(function(U){var K=U,J=_[K];if(J){var ae=J.buffer;if(ae){var se=l.fragmentTracker,ie=J.id;if(se.hasFragments(ie)||se.hasParts(ie)){var ue=yr.getBuffered(ae);se.detectEvictedFragments(K,ue,ie,null,!0)}var Le=Ro(K),me=[K,ae];l.sourceBuffers[Le]=me,ae.updating&&l.operationQueue&&l.operationQueue.prependBlocker(K),l.trackSourceBuffer(K,J)}}}),k(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),k()}},v.onMediaDetaching=function(l,d){var m=this,E=!!d.transferMedia;this.transferData=this.overrides=void 0;var _=this.media,C=this.mediaSource,w=this._objectUrl;if(C){if(this.log("media source "+(E?"transferring":"detaching")),E)this.sourceBuffers.forEach(function(M){var U=M[0];U&&m.removeBuffer(U)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){var k=C.readyState==="open";try{for(var P=C.sourceBuffers,B=P.length;B--;)k&&P[B].abort(),C.removeSourceBuffer(P[B]);k&&C.endOfStream()}catch(M){this.warn("onMediaDetaching: "+M.message+" while calling endOfStream")}}this.sourceBufferCount&&this.onBufferReset()}C.removeEventListener("sourceopen",this._onMediaSourceOpen),C.removeEventListener("sourceended",this._onMediaSourceEnded),C.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(C.removeEventListener("startstreaming",this._onStartStreaming),C.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}_&&(_.removeEventListener("emptied",this._onMediaEmptied),E||(w&&self.URL.revokeObjectURL(w),this.mediaSrc===w?(_.removeAttribute("src"),this.appendSource&&Zc(_),_.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(j.MEDIA_DETACHED,d)},v.onBufferReset=function(){var l=this;this.sourceBuffers.forEach(function(d){var m=d[0];m&&l.resetBuffer(m)}),this.initTracks()},v.resetBuffer=function(l){var d,m=(d=this.tracks[l])==null?void 0:d.buffer;if(this.removeBuffer(l),m)try{var E;(E=this.mediaSource)!=null&&E.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(m)}catch(_){this.warn("onBufferReset "+l,_)}delete this.tracks[l]},v.removeBuffer=function(l){this.removeBufferListeners(l),this.sourceBuffers[Ro(l)]=[null,null];var d=this.tracks[l];d&&(d.buffer=void 0)},v.resetQueue=function(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new sf(this.tracks)},v.onBufferCodecs=function(l,d){var m=this,E=this.tracks,_=Object.keys(d);this.log('BUFFER_CODECS: "'+_+'" (current SB count '+this.sourceBufferCount+")");var C="audiovideo"in d&&(E.audio||E.video)||E.audiovideo&&("audio"in d||"video"in d),w=!C&&this.sourceBufferCount&&this.media&&_.some(function(k){return!E[k]});if(C||w){this.warn('Unsupported transition between "'+Object.keys(E)+'" and "'+_+'" SourceBuffers');return}_.forEach(function(k){var P,B,M,U=d[k],K=U.id,J=U.codec,ae=U.levelCodec,se=U.container,ie=U.metadata,ue=U.supplemental,Le=E[k],me=(P=m.transferData)==null||(B=P.tracks)==null?void 0:B[k],De=me!=null&&me.buffer?me:Le,Ne=(De==null?void 0:De.pendingCodec)||(De==null?void 0:De.codec),Me=De==null?void 0:De.levelCodec;Le||(Le=E[k]={buffer:void 0,listeners:[],codec:J,supplemental:ue,container:se,levelCodec:ae,metadata:ie,id:K});var Pe=Sl(Ne,Me),Be=Pe==null?void 0:Pe.replace(Cs,"$1"),Ge=Sl(J,ae),ut=(M=Ge)==null?void 0:M.replace(Cs,"$1");Ge&&Pe&&Be!==ut&&(k.slice(0,5)==="audio"&&(Ge=Co(Ge,m.appendSource)),m.log("switching codec "+Ne+" to "+Ge),Ge!==(Le.pendingCodec||Le.codec)&&(Le.pendingCodec=Ge),Le.container=se,m.appendChangeType(k,se,Ge))}),(this.tracksReady||this.sourceBufferCount)&&(d.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()},v.appendChangeType=function(l,d,m){var E=this,_=d+";codecs="+m,C={label:"change-type="+_,execute:function(){var k=E.tracks[l];if(k){var P=k.buffer;P!=null&&P.changeType&&(E.log("changing "+l+" sourceBuffer type to "+_),P.changeType(_),k.codec=m,k.container=d)}E.shiftAndExecuteNext(l)},onStart:function(){},onComplete:function(){},onError:function(k){E.warn("Failed to change "+l+" SourceBuffer type",k)}};this.append(C,l,this.isPending(this.tracks[l]))},v.blockAudio=function(l){var d,m=this,E=l.start,_=E+l.duration*.05,C=((d=this.fragmentTracker.getAppendedFrag(E,X.MAIN))==null?void 0:d.gap)===!0;if(!C){var w={label:"block-audio",execute:function(){var P,B=m.tracks.video;(m.lastVideoAppendEnd>_||B!=null&&B.buffer&&yr.isBuffered(B.buffer,_)||((P=m.fragmentTracker.getAppendedFrag(_,X.MAIN))==null?void 0:P.gap)===!0)&&(m.blockedAudioAppend=null,m.shiftAndExecuteNext("audio"))},onStart:function(){},onComplete:function(){},onError:function(P){m.warn("Error executing block-audio operation",P)}};this.blockedAudioAppend={op:w,frag:l},this.append(w,"audio",!0)}},v.unblockAudio=function(){var l=this.blockedAudioAppend,d=this.operationQueue;l&&d&&(this.blockedAudioAppend=null,d.unblockAudio(l.op))},v.onBufferAppending=function(l,d){var m=this,E=this.tracks,_=d.data,C=d.type,w=d.parent,k=d.frag,P=d.part,B=d.chunkMeta,M=B.buffering[C],U=k.sn,K=self.performance.now();M.start=K;var J=k.stats.buffering,ae=P?P.stats.buffering:null;J.start===0&&(J.start=K),ae&&ae.start===0&&(ae.start=K);var se=E.audio,ie=!1;C==="audio"&&(se==null?void 0:se.container)==="audio/mpeg"&&(ie=!this.lastMpegAudioChunk||B.id===1||this.lastMpegAudioChunk.sn!==B.sn,this.lastMpegAudioChunk=B);var ue=this.tracks.video,Le=ue==null?void 0:ue.buffer;if(Le&&U!=="initSegment"){var me=P||k,De=this.blockedAudioAppend;if(C==="audio"&&w!=="main"&&!this.blockedAudioAppend){var Ne=me.start,Me=Ne+me.duration*.05,Pe=Le.buffered,Be=this.currentOp("video");!Pe.length&&!Be?this.blockAudio(me):!Be&&!yr.isBuffered(Le,Me)&&this.lastVideoAppendEndut||Ge=.1&&(m.log("Updating audio SourceBuffer timestampOffset to "+et+" (delta: "+Dt+") sn: "+U+")"),st.timestampOffset=et)}}}m.appendExecutor(_,C)},onStart:function(){},onComplete:function(){var gt=self.performance.now();M.executeEnd=M.end=gt,J.first===0&&(J.first=gt),ae&&ae.first===0&&(ae.first=gt);var st={};m.sourceBuffers.forEach(function(Dt){var ar=Dt[0],Gt=Dt[1];ar&&(st[ar]=yr.getBuffered(Gt))}),m.appendErrors[C]=0,C==="audio"||C==="video"?m.appendErrors.audiovideo=0:(m.appendErrors.audio=0,m.appendErrors.video=0),m.hls.trigger(j.BUFFER_APPENDED,{type:C,frag:k,part:P,chunkMeta:B,parent:k.type,timeRanges:st})},onError:function(gt){var st,Dt={type:ve.MEDIA_ERROR,parent:k.type,details:re.BUFFER_APPEND_ERROR,sourceBufferName:C,frag:k,part:P,chunkMeta:B,error:gt,err:gt,fatal:!1},ar=(st=m.media)==null?void 0:st.error;if(gt.code===DOMException.QUOTA_EXCEEDED_ERR)Dt.details=re.BUFFER_FULL_ERROR;else if(gt.code===DOMException.INVALID_STATE_ERR&&m.mediaSourceOpenOrEnded&&!ar)Dt.errorAction=za(!0);else if(gt.name===ws&&m.sourceBufferCount===0)Dt.errorAction=za(!0);else{var Gt=++m.appendErrors[C];m.warn("Failed "+Gt+"/"+m.hls.config.appendErrorMaxRetry+' times to append segment in "'+C+'" sourceBuffer ('+(ar||"no media error")+")"),(Gt>=m.hls.config.appendErrorMaxRetry||ar)&&(Dt.fatal=!0)}m.hls.trigger(j.ERROR,Dt)}};this.append(Ze,C,this.isPending(this.tracks[C]))},v.getFlushOp=function(l,d,m){var E=this;return this.log('queuing "'+l+'" remove '+d+"-"+m),{label:"remove",execute:function(){E.removeExecutor(l,d,m)},onStart:function(){},onComplete:function(){E.hls.trigger(j.BUFFER_FLUSHED,{type:l})},onError:function(C){E.warn("Failed to remove "+d+"-"+m+' from "'+l+'" SourceBuffer',C)}}},v.onBufferFlushing=function(l,d){var m=this,E=d.type,_=d.startOffset,C=d.endOffset;E?this.append(this.getFlushOp(E,_,C),E):this.sourceBuffers.forEach(function(w){var k=w[0];k&&m.append(m.getFlushOp(k,_,C),k)})},v.onFragParsed=function(l,d){var m=this,E=d.frag,_=d.part,C=[],w=_?_.elementaryStreams:E.elementaryStreams;w[Ft.AUDIOVIDEO]?C.push("audiovideo"):(w[Ft.AUDIO]&&C.push("audio"),w[Ft.VIDEO]&&C.push("video"));var k=function(){var B=self.performance.now();E.stats.buffering.end=B,_&&(_.stats.buffering.end=B);var M=_?_.stats:E.stats;m.hls.trigger(j.FRAG_BUFFERED,{frag:E,part:_,stats:M,id:E.type})};C.length===0&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(k,C).catch(function(P){m.warn("Fragment buffered callback "+P),m.stepOperationQueue(m.sourceBufferTypes)})},v.onFragChanged=function(l,d){this.trimBuffers()},v.onBufferEos=function(l,d){var m=this,E;this.sourceBuffers.forEach(function(w){var k=w[0];if(k){var P=m.tracks[k];(!d.type||d.type===k)&&(P.ending=!0,P.ended||(P.ended=!0,m.log(k+" buffer reached EOS")))}});var _=((E=this.overrides)==null?void 0:E.endOfStream)!==!1,C=this.sourceBufferCount>0&&!this.sourceBuffers.some(function(w){var k,P=w[0];return P&&!((k=m.tracks[P])!=null&&k.ended)});C&&(_?(this.log("Queueing EOS"),this.blockUntilOpen(function(){m.tracksEnded();var w=m.mediaSource;if(!w||w.readyState!=="open"){w&&m.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+w.readyState);return}m.log("Calling mediaSource.endOfStream()"),w.endOfStream(),m.hls.trigger(j.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(j.BUFFERED_TO_END,void 0)))},v.tracksEnded=function(){var l=this;this.sourceBuffers.forEach(function(d){var m=d[0];if(m!==null){var E=l.tracks[m];E&&(E.ending=!1)}})},v.onLevelUpdated=function(l,d){var m=d.details;m.fragments.length&&(this.details=m,this.updateDuration())},v.updateDuration=function(){var l=this,d=this.getDurationAndRange();d&&this.blockUntilOpen(function(){return l.updateMediaSource(d)})},v.onError=function(l,d){if(d.details===re.BUFFER_APPEND_ERROR&&d.frag){var m,E=(m=d.errorAction)==null?void 0:m.nextAutoLevel;Q(E)&&E!==d.frag.level&&this.resetAppendErrors()}},v.resetAppendErrors=function(){this.appendErrors={audio:0,video:0,audiovideo:0}},v.trimBuffers=function(){var l=this.hls,d=this.details,m=this.media;if(!(!m||d===null)&&this.sourceBufferCount){var E=l.config,_=m.currentTime,C=d.levelTargetDuration,w=d.live&&E.liveBackBufferLength!==null?E.liveBackBufferLength:E.backBufferLength;if(Q(w)&&w>=0){var k=Math.max(w,C),P=Math.floor(_/C)*C-k;this.flushBackBuffer(_,C,P)}if(Q(E.frontBufferFlushThreshold)&&E.frontBufferFlushThreshold>0){var B=Math.max(E.maxBufferLength,E.frontBufferFlushThreshold),M=Math.max(B,C),U=Math.floor(_/C)*C+M;this.flushFrontBuffer(_,C,U)}}},v.flushBackBuffer=function(l,d,m){var E=this;this.sourceBuffers.forEach(function(_){var C=_[0],w=_[1];if(w){var k=yr.getBuffered(w);if(k.length>0&&m>k.start(0)){var P;E.hls.trigger(j.BACK_BUFFER_REACHED,{bufferEnd:m});var B=E.tracks[C];if((P=E.details)!=null&&P.live)E.hls.trigger(j.LIVE_BACK_BUFFER_REACHED,{bufferEnd:m});else if(B!=null&&B.ended){E.log("Cannot flush "+C+" back buffer while SourceBuffer is in ended state");return}E.hls.trigger(j.BUFFER_FLUSHING,{startOffset:0,endOffset:m,type:C})}}})},v.flushFrontBuffer=function(l,d,m){var E=this;this.sourceBuffers.forEach(function(_){var C=_[0],w=_[1];if(w){var k=yr.getBuffered(w),P=k.length;if(P<2)return;var B=k.start(P-1),M=k.end(P-1);if(m>B||l>=B&&l<=M)return;E.hls.trigger(j.BUFFER_FLUSHING,{startOffset:B,endOffset:1/0,type:C})}})},v.getDurationAndRange=function(){var l,d=this.details,m=this.mediaSource;if(!d||!this.media||(m==null?void 0:m.readyState)!=="open")return null;var E=d.edge;if(d.live&&this.hls.config.liveDurationInfinity){var _=d.fragments.length;if(_&&d.live&&m.setLiveSeekableRange){var C=Math.max(0,d.fragmentStart),w=Math.max(C,E);return{duration:1/0,start:C,end:w}}return{duration:1/0}}var k=(l=this.overrides)==null?void 0:l.duration;if(k)return Q(k)?{duration:k}:null;var P=this.media.duration,B=Q(m.duration)?m.duration:0;return E>B&&E>P||!Q(P)?{duration:E}:null},v.updateMediaSource=function(l){var d=l.duration,m=l.start,E=l.end,_=this.mediaSource;!this.media||!_||_.readyState!=="open"||(_.duration!==d&&(Q(d)&&this.log("Updating MediaSource duration to "+d.toFixed(3)),_.duration=d),m!==void 0&&E!==void 0&&(this.log("MediaSource duration is set to "+_.duration+". Setting seekable range to "+m+"-"+E+"."),_.setLiveSeekableRange(m,E)))},v.checkPendingTracks=function(){var l=this.bufferCodecEventsTotal,d=this.pendingTrackCount,m=this.tracks;if(this.log("checkPendingTracks (pending: "+d+" codec events expected: "+l+") "+En(m)),this.tracksReady){var E,_=(E=this.transferData)==null?void 0:E.tracks;_&&Object.keys(_).length?this.attachTransferred():this.createSourceBuffers()}},v.bufferCreated=function(){var l=this;if(this.sourceBufferCount){var d={};this.sourceBuffers.forEach(function(E){var _=E[0],C=E[1];if(_){var w=l.tracks[_];d[_]={buffer:C,container:w.container,codec:w.codec,supplemental:w.supplemental,levelCodec:w.levelCodec,id:w.id,metadata:w.metadata}}}),this.hls.trigger(j.BUFFER_CREATED,{tracks:d}),this.log("SourceBuffers created. Running queue: "+this.operationQueue),this.sourceBuffers.forEach(function(E){var _=E[0];l.executeNext(_)})}else{var m=new Error("could not create source buffer for media codec(s)");this.hls.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:m,reason:m.message})}},v.createSourceBuffers=function(){var l=this.tracks,d=this.sourceBuffers,m=this.mediaSource;if(!m)throw new Error("createSourceBuffers called when mediaSource was null");for(var E in l){var _=E,C=l[_];if(this.isPending(C)){var w=this.getTrackCodec(C,_),k=C.container+";codecs="+w;C.codec=w,this.log("creating sourceBuffer("+k+")"+(this.currentOp(_)?" Queued":"")+" "+En(C));try{var P=m.addSourceBuffer(k),B=Ro(_),M=[_,P];d[B]=M,C.buffer=P}catch(K){var U;this.error("error while trying to add sourceBuffer: "+K.message),this.shiftAndExecuteNext(_),(U=this.operationQueue)==null||U.removeBlockers(),delete this.tracks[_],this.hls.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:K,sourceBufferName:_,mimeType:k,parent:C.id});return}this.trackSourceBuffer(_,C)}}this.bufferCreated()},v.getTrackCodec=function(l,d){var m=l.supplemental,E=l.codec;m&&(d==="video"||d==="audiovideo")&&xa(m,"video")&&(E=El(E,m));var _=Sl(E,l.levelCodec);return _?d.slice(0,5)==="audio"?Co(_,this.appendSource):_:""},v.trackSourceBuffer=function(l,d){var m=this,E=d.buffer;if(E){var _=this.getTrackCodec(d,l);this.tracks[l]={buffer:E,codec:_,container:d.container,levelCodec:d.levelCodec,supplemental:d.supplemental,metadata:d.metadata,id:d.id,listeners:[]},this.removeBufferListeners(l),this.addBufferListener(l,"updatestart",this.onSBUpdateStart),this.addBufferListener(l,"updateend",this.onSBUpdateEnd),this.addBufferListener(l,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(l,"bufferedchange",function(C,w){var k=w.removedRanges;k!=null&&k.length&&m.hls.trigger(j.BUFFER_FLUSHED,{type:C})})}},v.onSBUpdateStart=function(l){var d=this.currentOp(l);d&&d.onStart()},v.onSBUpdateEnd=function(l){var d;if(((d=this.mediaSource)==null?void 0:d.readyState)==="closed"){this.resetBuffer(l);return}var m=this.currentOp(l);m&&(m.onComplete(),this.shiftAndExecuteNext(l))},v.onSBUpdateError=function(l,d){var m,E=new Error(l+" SourceBuffer error. MediaSource readyState: "+((m=this.mediaSource)==null?void 0:m.readyState));this.error(""+E,d),this.hls.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.BUFFER_APPENDING_ERROR,sourceBufferName:l,error:E,fatal:!1});var _=this.currentOp(l);_&&_.onError(E)},v.removeExecutor=function(l,d,m){var E=this.media,_=this.mediaSource,C=this.tracks[l],w=C==null?void 0:C.buffer;if(!E||!_||!w){this.warn("Attempting to remove from the "+l+" SourceBuffer, but it does not exist"),this.shiftAndExecuteNext(l);return}var k=Q(E.duration)?E.duration:1/0,P=Q(_.duration)?_.duration:1/0,B=Math.max(0,d),M=Math.min(m,k,P);M>B&&(!C.ending||C.ended)?(C.ended=!1,this.log("Removing ["+B+","+M+"] from the "+l+" SourceBuffer"),w.remove(B,M)):this.shiftAndExecuteNext(l)},v.appendExecutor=function(l,d){var m=this.tracks[d],E=m==null?void 0:m.buffer;if(!E)throw new As("Attempting to append to the "+d+" SourceBuffer, but it does not exist");m.ending=!1,m.ended=!1,E.appendBuffer(l)},v.blockUntilOpen=function(l){var d=this;if(this.isUpdating()||this.isQueued())this.blockBuffers(l).catch(function(m){d.warn("SourceBuffer blocked callback "+m),d.stepOperationQueue(d.sourceBufferTypes)});else try{l()}catch(m){this.warn("Callback run without blocking "+this.operationQueue+" "+m)}},v.isUpdating=function(){return this.sourceBuffers.some(function(l){var d=l[0],m=l[1];return d&&m.updating})},v.isQueued=function(){var l=this;return this.sourceBuffers.some(function(d){var m=d[0];return m&&!!l.currentOp(m)})},v.isPending=function(l){return!!l&&!l.buffer},v.blockBuffers=function(l,d){var m=this;if(d===void 0&&(d=this.sourceBufferTypes),!d.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(l);var E=this.operationQueue,_=d.map(function(w){return m.appendBlocker(w)}),C=d.length>1&&!!this.blockedAudioAppend;return C&&this.unblockAudio(),Promise.all(_).then(function(w){E===m.operationQueue&&(l(),m.stepOperationQueue(m.sourceBufferTypes))})},v.stepOperationQueue=function(l){var d=this;l.forEach(function(m){var E,_=(E=d.tracks[m])==null?void 0:E.buffer;!_||_.updating||d.shiftAndExecuteNext(m)})},v.append=function(l,d,m){this.operationQueue&&this.operationQueue.append(l,d,m)},v.appendBlocker=function(l){if(this.operationQueue)return this.operationQueue.appendBlocker(l)},v.currentOp=function(l){return this.operationQueue?this.operationQueue.current(l):null},v.executeNext=function(l){l&&this.operationQueue&&this.operationQueue.executeNext(l)},v.shiftAndExecuteNext=function(l){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(l)},v.addBufferListener=function(l,d,m){var E=this.tracks[l];if(E){var _=E.buffer;if(_){var C=m.bind(this,l);E.listeners.push({event:d,listener:C}),_.addEventListener(d,C)}}},v.removeBufferListeners=function(l){var d=this.tracks[l];if(d){var m=d.buffer;m&&(d.listeners.forEach(function(E){m.removeEventListener(E.event,E.listener)}),d.listeners.length=0)}},s(x,[{key:"mediaSourceOpenOrEnded",get:function(){var l,d=(l=this.mediaSource)==null?void 0:l.readyState;return d==="open"||d==="ended"}},{key:"sourceBufferTracks",get:function(){var l=this;return Object.keys(this.tracks).reduce(function(d,m){var E=l.tracks[m];return d[m]={id:E.id,container:E.container,codec:E.codec,levelCodec:E.levelCodec},d},{})}},{key:"bufferedToEnd",get:function(){var l=this;return this.sourceBufferCount>0&&!this.sourceBuffers.some(function(d){var m,E,_=d[0];return _&&(!((m=l.tracks[_])!=null&&m.ended)||((E=l.tracks[_])==null?void 0:E.ending))})}},{key:"tracksReady",get:function(){var l=this.pendingTrackCount;return l>0&&(l>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}},{key:"mediaSrc",get:function(){var l,d,m=((l=this.media)==null||(d=l.querySelector)==null?void 0:d.call(l,"source"))||this.media;return m==null?void 0:m.src}},{key:"pendingTrackCount",get:function(){var l=this;return Object.keys(this.tracks).reduce(function(d,m){return d+(l.isPending(l.tracks[m])?1:0)},0)}},{key:"sourceBufferCount",get:function(){return this.sourceBuffers.reduce(function(l,d){var m=d[0];return l+(m?1:0)},0)}},{key:"sourceBufferTypes",get:function(){return this.sourceBuffers.map(function(l){var d=l[0];return d}).filter(function(l){return!!l})}}])}(_e);function Zc(g){var x=g.querySelectorAll("source");[].slice.call(x).forEach(function(v){g.removeChild(v)})}function rv(g,x){var v=self.document.createElement("source");v.type="video/mp4",v.src=x,g.appendChild(v)}function Ro(g){return g==="audio"?1:0}var kl=function(){function g(v){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=v,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var x=g.prototype;return x.setStreamController=function(u){this.streamController=u},x.destroy=function(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},x.registerListeners=function(){var u=this.hls;u.on(j.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),u.on(j.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(j.MANIFEST_PARSED,this.onManifestParsed,this),u.on(j.LEVELS_UPDATED,this.onLevelsUpdated,this),u.on(j.BUFFER_CODECS,this.onBufferCodecs,this),u.on(j.MEDIA_DETACHING,this.onMediaDetaching,this)},x.unregisterListener=function(){var u=this.hls;u.off(j.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),u.off(j.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(j.MANIFEST_PARSED,this.onManifestParsed,this),u.off(j.LEVELS_UPDATED,this.onLevelsUpdated,this),u.off(j.BUFFER_CODECS,this.onBufferCodecs,this),u.off(j.MEDIA_DETACHING,this.onMediaDetaching,this)},x.onFpsDropLevelCapping=function(u,l){var d=this.hls.levels[l.droppedLevel];this.isLevelAllowed(d)&&this.restrictedLevels.push({bitrate:d.bitrate,height:d.height,width:d.width})},x.onMediaAttaching=function(u,l){this.media=l.media instanceof HTMLVideoElement?l.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()},x.onManifestParsed=function(u,l){var d=this.hls;this.restrictedLevels=[],this.firstLevel=l.firstLevel,d.config.capLevelToPlayerSize&&l.video&&this.startCapping()},x.onLevelsUpdated=function(u,l){this.timer&&Q(this.autoLevelCapping)&&this.detectPlayerSize()},x.onBufferCodecs=function(u,l){var d=this.hls;d.config.capLevelToPlayerSize&&l.video&&this.startCapping()},x.onMediaDetaching=function(){this.stopCapping(),this.media=null},x.detectPlayerSize=function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}var u=this.hls.levels;if(u.length){var l=this.hls,d=this.getMaxLevel(u.length-1);d!==this.autoLevelCapping&&l.logger.log("Setting autoLevelCapping to "+d+": "+u[d].height+"p@"+u[d].bitrate+" for media "+this.mediaWidth+"x"+this.mediaHeight),l.autoLevelCapping=d,l.autoLevelEnabled&&l.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=l.autoLevelCapping}}},x.getMaxLevel=function(u){var l=this,d=this.hls.levels;if(!d.length)return-1;var m=d.filter(function(E,_){return l.isLevelAllowed(E)&&_<=u});return this.clientRect=null,g.getMaxLevelByMediaSize(m,this.mediaWidth,this.mediaHeight)},x.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},x.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},x.getDimensions=function(){if(this.clientRect)return this.clientRect;var u=this.media,l={width:0,height:0};if(u){var d=u.getBoundingClientRect();l.width=d.width,l.height=d.height,!l.width&&!l.height&&(l.width=d.right-d.left||u.width||0,l.height=d.bottom-d.top||u.height||0)}return this.clientRect=l,l},x.isLevelAllowed=function(u){var l=this.restrictedLevels;return!l.some(function(d){return u.bitrate===d.bitrate&&u.width===d.width&&u.height===d.height})},g.getMaxLevelByMediaSize=function(u,l,d){if(!(u!=null&&u.length))return-1;for(var m=function(P,B){return B?P.width!==B.width||P.height!==B.height:!0},E=u.length-1,_=Math.max(l,d),C=0;C=_||w.height>=_)&&m(w,u[C+1])){E=C;break}}return E},s(g,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var u=1;if(!this.hls.config.ignoreDevicePixelRatio)try{u=self.devicePixelRatio}catch{}return Math.min(u,this.hls.config.maxDevicePixelRatio)}}])}(),ff=/^(\d+)x(\d+)$/,cf=/(.+?)=(".*?"|.*?)(?:,|$)/g,Rr=function(){function g(v,u){typeof v=="string"&&(v=g.parseAttrList(v,u)),h(this,v)}var x=g.prototype;return x.decimalInteger=function(u){var l=parseInt(this[u],10);return l>Number.MAX_SAFE_INTEGER?1/0:l},x.hexadecimalInteger=function(u){if(this[u]){var l=(this[u]||"0x").slice(2);l=(l.length&1?"0":"")+l;for(var d=new Uint8Array(l.length/2),m=0;mNumber.MAX_SAFE_INTEGER?1/0:l},x.decimalFloatingPoint=function(u){return parseFloat(this[u])},x.optionalFloat=function(u,l){var d=this[u];return d?parseFloat(d):l},x.enumeratedString=function(u){return this[u]},x.enumeratedStringList=function(u,l){var d=this[u];return(d?d.split(/[ ,]+/):[]).reduce(function(m,E){return m[E.toLowerCase()]=!0,m},l)},x.bool=function(u){return this[u]==="YES"},x.decimalResolution=function(u){var l=ff.exec(this[u]);if(l!==null)return{width:parseInt(l[1],10),height:parseInt(l[2],10)}},g.parseAttrList=function(u,l){var d,m={},E='"';for(cf.lastIndex=0;(d=cf.exec(u))!==null;){var _=d[1].trim(),C=d[2],w=C.indexOf(E)===0&&C.lastIndexOf(E)===C.length-1,k=!1;if(w)C=C.slice(1,-1);else switch(_){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":k=!0}if(!(l&&(w||k))){if(!k&&!w)switch(_){case"CLOSED-CAPTIONS":if(C==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":ft.warn(u+": attribute "+_+" is missing quotes")}}m[_]=C}return m},s(g,[{key:"clientAttrs",get:function(){return Object.keys(this).filter(function(u){return u.substring(0,2)==="X-"})}}])}(),df="com.apple.hls.interstitial";function Ll(g){return g!=="ID"&&g!=="CLASS"&&g!=="CUE"&&g!=="START-DATE"&&g!=="DURATION"&&g!=="END-DATE"&&g!=="END-ON-NEXT"}function Qc(g){return g==="SCTE35-OUT"||g==="SCTE35-IN"||g==="SCTE35-CMD"}var Do=function(){function g(x,v,u){var l;if(u===void 0&&(u=0),this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(v==null?void 0:v.tagAnchor)||null,this.tagOrder=(l=v==null?void 0:v.tagOrder)!=null?l:u,v){var d=v.attr;for(var m in d)if(Object.prototype.hasOwnProperty.call(x,m)&&x[m]!==d[m]){ft.warn('DATERANGE tag attribute: "'+m+'" does not match for tags with ID: "'+x.ID+'"'),this._badValueForSameId=m;break}x=h(new Rr({}),d,x)}if(this.attr=x,v?(this._startDate=v._startDate,this._cue=v._cue,this._endDate=v._endDate,this._dateAtEnd=v._dateAtEnd):this._startDate=new Date(x["START-DATE"]),"END-DATE"in this.attr){var E=(v==null?void 0:v.endDate)||new Date(this.attr["END-DATE"]);Q(E.getTime())&&(this._endDate=E)}}return s(g,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"cue",get:function(){var v=this._cue;return v===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):v}},{key:"startTime",get:function(){var v=this.tagAnchor;return v===null||v.programDateTime===null?(ft.warn('Expected tagAnchor Fragment with PDT set for DateRange "'+this.id+'": '+v),NaN):v.start+(this.startDate.getTime()-v.programDateTime)/1e3}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){var v=this._endDate||this._dateAtEnd;if(v)return v;var u=this.duration;return u!==null?this._dateAtEnd=new Date(this._startDate.getTime()+u*1e3):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var v=this.attr.decimalFloatingPoint("DURATION");if(Q(v))return v}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isInterstitial",get:function(){return this.class===df}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&Q(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}])}(),Rl=10,Jc=function(){function g(v){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=v}var x=g.prototype;return x.reloaded=function(u){if(!u){this.advanced=!0,this.updated=!0;return}var l=this.lastPartSn-u.lastPartSn,d=this.lastPartIndex-u.lastPartIndex;this.updated=this.endSN!==u.endSN||!!d||!!l||!this.live,this.advanced=this.endSN>u.endSN||l>0||l===0&&d>0,this.updated||this.advanced?this.misses=Math.floor(u.misses*.6):this.misses=u.misses+1},s(g,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Q(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||Rl}},{key:"drift",get:function(){var u=this.driftEndTime-this.driftStartTime;if(u>0){var l=this.driftEnd-this.driftStart;return l*1e3/u}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var u;return(u=this.partList)!=null&&u.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var u;return(u=this.fragments)!=null&&u.length?this.fragments[this.fragments.length-1].end:0}},{key:"fragmentStart",get:function(){var u;return(u=this.fragments)!=null&&u.length?this.fragments[0].start:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var u;return(u=this.partList)!=null&&u.length?this.partList[this.partList.length-1].index:-1}},{key:"maxPartIndex",get:function(){var u=this.partList;if(u){var l=this.lastPartIndex;if(l!==-1){for(var d=u.length;d--;)if(u[d].index>l)return u[d].index;return l}}return 0}},{key:"lastPartSn",get:function(){var u;return(u=this.partList)!=null&&u.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}},{key:"expired",get:function(){if(this.live&&this.age&&this.misses<3){var u=this.partEnd-this.fragmentStart;return this.age>Math.max(u,this.totalduration)+this.levelTargetDuration}return!1}}])}(),Zr={cbc:0,ctr:1};function Hi(g){return g==="AES-128"||g==="AES-256"||g==="AES-256-CTR"}function Dl(g){switch(g){case"AES-128":case"AES-256":return Zr.cbc;case"AES-256-CTR":return Zr.ctr;default:throw new Error("invalid full segment method "+g)}}var Po=function(){function g(v,u,l,d,m){d===void 0&&(d=[1]),m===void 0&&(m=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=v,this.uri=u,this.keyFormat=l,this.keyFormatVersions=d,this.iv=m,this.encrypted=v?v!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Hi(v)}g.clearKeyUriToKeyIdMap=function(){};var x=g.prototype;return x.isSupported=function(){if(this.method){if(Hi(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES"}return!1},x.getDecryptData=function(u){if(!this.encrypted||!this.uri)return null;if(Hi(this.method)&&this.uri&&!this.iv){typeof u!="number"&&(ft.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),u=0);var l=nv(u),d=new g(this.method,this.uri,"identity",this.keyFormatVersions,l);return d}return this},g}();function nv(g){for(var x=new Uint8Array(16),v=12;v<16;v++)x[v]=g>>8*(15-v)&255;return x}var Pl=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Il=/#EXT-X-MEDIA:(.*)/g,Io=/^#EXT(?:INF|-X-TARGETDURATION):/m,ks=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),ed=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),Oo=function(){function g(){}return g.findGroup=function(v,u){for(var l=0;l0&&m.length0&&sd(w,et,ue),M=w.startSN=parseInt(Ze);break;case"SKIP":{w.skippedSegments&&ia(w,et,ue);var gt=new Rr(Ze,w),st=gt.decimalInteger("SKIPPED-SEGMENTS");if(Q(st)){w.skippedSegments+=st;for(var Dt=st;Dt--;)k.push(null);M+=st}var ar=gt.enumeratedString("RECENTLY-REMOVED-DATERANGES");ar&&(w.recentlyRemovedDateranges=(w.recentlyRemovedDateranges||[]).concat(ar.split(" ")));break}case"TARGETDURATION":w.targetduration!==0&&ia(w,et,ue),w.targetduration=Math.max(parseInt(Ze),1);break;case"VERSION":w.version!==null&&ia(w,et,ue),w.version=parseInt(Ze);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":w.live||ia(w,et,ue),w.live=!1;break;case"#":(Ze||ht)&&ie.tagList.push(ht?[Ze,ht]:[Ze]);break;case"DISCONTINUITY":J++,ie.tagList.push(["DIS"]);break;case"GAP":ie.gap=!0,ie.tagList.push([et]);break;case"BITRATE":ie.tagList.push([et,Ze]),ae=parseInt(Ze)*1e3,Q(ae)?ie.bitrate=ae:ae=0;break;case"DATERANGE":{var Gt=new Rr(Ze,w),xr=new Do(Gt,w.dateRanges[Gt.ID],w.dateRangeTagCount);w.dateRangeTagCount++,xr.isValid||w.skippedSegments?w.dateRanges[xr.id]=xr:ft.warn('Ignoring invalid DATERANGE tag: "'+Ze+'"'),ie.tagList.push(["EXT-X-DATERANGE",Ze]);break}case"DEFINE":break;case"DISCONTINUITY-SEQUENCE":w.startCC!==0?ia(w,et,ue):k.length>0&&sd(w,et,ue),w.startCC=J=parseInt(Ze);break;case"KEY":{var Qt=Ol(Ze,u,w);if(Qt.isSupported()){if(Qt.method==="NONE"){me=void 0;break}me||(me={}),me[Qt.keyFormat]&&(me=h({},me)),me[Qt.keyFormat]=Qt}else ft.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+Ze+'"');break}case"START":w.startTimeOffset=rd(Ze);break;case"MAP":{var zr=new Rr(Ze,w);if(ie.duration){var ur=new _r(d,C);vf(ur,zr,l,me),B=ur,ie.initSegment=B,B.rawProgramDateTime&&!ie.rawProgramDateTime&&(ie.rawProgramDateTime=B.rawProgramDateTime)}else{var Nr=ie.byteRangeEndOffset;if(Nr){var An=ie.byteRangeStartOffset;Me=Nr-An+"@"+An}else Me=null;vf(ie,zr,l,me),B=ie,Ne=!0}B.cc=J;break}case"SERVER-CONTROL":{Pe&&ia(w,et,ue),Pe=new Rr(Ze),w.canBlockReload=Pe.bool("CAN-BLOCK-RELOAD"),w.canSkipUntil=Pe.optionalFloat("CAN-SKIP-UNTIL",0),w.canSkipDateRanges=w.canSkipUntil>0&&Pe.bool("CAN-SKIP-DATERANGES"),w.partHoldBack=Pe.optionalFloat("PART-HOLD-BACK",0),w.holdBack=Pe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{w.partTarget&&ia(w,et,ue);var pn=new Rr(Ze);w.partTarget=pn.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Tr=w.partList;Tr||(Tr=w.partList=[]);var Fn=U>0?Tr[Tr.length-1]:void 0,Jr=U++,Mr=new Rr(Ze,w),kn=new Xn(Mr,ie,C,Jr,Fn);Tr.push(kn),ie.duration+=kn.duration;break}case"PRELOAD-HINT":{var Ln=new Rr(Ze,w);w.preloadHint=Ln;break}case"RENDITION-REPORT":{var Dr=new Rr(Ze,w);w.renditionReports=w.renditionReports||[],w.renditionReports.push(Dr);break}default:ft.warn("line parsed but not handled: "+ue);break}}}se&&!se.relurl?(k.pop(),K-=se.duration,w.partList&&(w.fragmentHint=se)):w.partList&&(hf(ie,se,P),ie.cc=J,w.fragmentHint=ie,me&&ad(ie,me,w)),w.targetduration||(w.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));var Yt=k.length,Gn=k[0],en=k[Yt-1];if(K+=w.skippedSegments*w.targetduration,K>0&&Yt&&en){w.averagetargetduration=K/Yt;var Mn=en.sn;w.endSN=Mn!=="initSegment"?Mn:0,w.live||(en.endList=!0),Gn&&w.startCC===void 0&&(w.startCC=Gn.cc),De>0&&(av(k,De),Gn&&P.unshift(Gn))}else w.endSN=0,w.startCC=0;return w.fragmentHint&&(K+=w.fragmentHint.duration),w.totalduration=K,P.length&&w.dateRangeTagCount&&Gn&&td(P,w),w.endCC=J,w},g}();function td(g,x){for(var v=g.length,u=g[v-1],l=x.live?1/0:x.totalduration,d=Object.keys(x.dateRanges),m=d.length;m--;){var E=x.dateRanges[d[m]],_=E.startDate.getTime();E.tagAnchor=u.ref;for(var C=v;C--;){var w=iv(x,_,g,C,l);if(w!==-1){E.tagAnchor=x.fragments[w].ref;break}}}}function iv(g,x,v,u,l){var d=v[u];if(d){var m=d.programDateTime;if(x>=m||u===0){var E,_=(((E=v[u+1])==null?void 0:E.start)||l)-d.start;if(x<=m+_*1e3){var C=v[u].sn-g.startSN,w=g.fragments;if(w.length>v.length)for(var k=v[u+1]||w[w.length-1],P=k.sn-g.startSN,B=P;B>C;B--){var M=w[B].programDateTime;if(x>=M&&xg.sn?(u=v-g.start,l=g):(u=g.start-v,l=x),l.duration!==u&&l.setDuration(u)}else if(x.sn>g.sn){var d=g.cc===x.cc;d&&g.minEndPTS?x.setStart(g.start+(g.minEndPTS-g.start)):x.setStart(g.start+g.duration)}else x.setStart(Math.max(g.start-x.duration,0))}function Fl(g,x,v,u,l,d){var m=u-v;m<=0&&(ft.warn("Fragment should have a positive duration",x),u=v+x.duration,d=l+x.duration);var E=v,_=u,C=x.startPTS,w=x.endPTS;if(Q(C)){var k=Math.abs(C-v);Q(x.deltaPTS)?x.deltaPTS=Math.max(k,x.deltaPTS):x.deltaPTS=k,E=Math.max(v,C),v=Math.min(v,C),l=Math.min(l,x.startDTS),_=Math.min(u,w),u=Math.max(u,w),d=Math.max(d,x.endDTS)}var P=v-x.start;x.start!==0&&x.setStart(v),x.setDuration(u-x.start),x.startPTS=v,x.maxStartPTS=E,x.startDTS=l,x.endPTS=u,x.minEndPTS=_,x.endDTS=d;var B=x.sn;if(!g||Bg.endSN)return 0;var M,U=B-g.startSN,K=g.fragments;for(K[U]=x,M=U;M>0;M--)pf(K[M],K[M-1]);for(M=U;M=0;l--){var d=u[l].initSegment;if(d){v=d;break}}g.fragmentHint&&delete g.fragmentHint.endPTS;var m;od(g,x,function(M,U,K,J){if(!x.startCC&&U.cc!==M.cc){for(var ae,se,ie=M.cc-U.cc,ue=K;ue=0,m=0;if(d&&ux){var d=u[u.length-1].duration*1e3;d0){this.scheduleRefresh(this.uri,l);return}}this.loadSteeringManifest(this.uri)}},v.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},v.clearTimeout=function(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},v.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},v.removeLevel=function(l){var d=this.levels;d&&(this.levels=d.filter(function(m){return m!==l}))},v.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},v.onManifestLoaded=function(l,d){var m=d.contentSteering;m!==null&&(this.pathwayId=m.pathwayId,this.uri=m.uri,this.started&&this.startLoad())},v.onManifestParsed=function(l,d){this.audioTracks=d.audioTracks,this.subtitleTracks=d.subtitleTracks},v.onError=function(l,d){var m=d.errorAction;if((m==null?void 0:m.action)===qr.SendAlternateToPenaltyBox&&m.flags===Ti.MoveAllAlternatesMatchingHost){var E=this.levels,_=this._pathwayPriority,C=this.pathwayId;if(d.context){var w=d.context,k=w.groupId,P=w.pathwayId,B=w.type;k&&E?C=this.getPathwayForGroupId(k,B,C):P&&(C=P)}C in this.penalizedPathways||(this.penalizedPathways[C]=performance.now()),!_&&E&&(_=this.pathways()),_&&_.length>1&&(this.updatePathwayPriority(_),m.resolved=this.pathwayId!==C),m.resolved||this.warn("Could not resolve "+d.details+' ("'+d.error.message+'") with content-steering for Pathway: '+C+" levels: "+(E&&E.length)+" priorities: "+En(_)+" penalized: "+En(this.penalizedPathways))}},v.filterParsedLevels=function(l){this.levels=l;var d=this.getLevelsForPathway(this.pathwayId);if(d.length===0){var m=l[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+m+'"'),d=this.getLevelsForPathway(m),this.pathwayId=m}return d.length!==l.length&&this.log("Found "+d.length+"/"+l.length+' levels in Pathway "'+this.pathwayId+'"'),d},v.getLevelsForPathway=function(l){return this.levels===null?[]:this.levels.filter(function(d){return l===d.pathwayId})},v.updatePathwayPriority=function(l){this._pathwayPriority=l;var d,m=this.penalizedPathways,E=performance.now();Object.keys(m).forEach(function(B){E-m[B]>Fo&&delete m[B]});for(var _=0;_0){this.log('Setting Pathway to "'+C+'"'),this.pathwayId=C,Ml(d),this.hls.trigger(j.LEVELS_UPDATED,{levels:d});var P=this.hls.levels[w];k&&P&&this.levels&&(P.attrs["STABLE-VARIANT-ID"]!==k.attrs["STABLE-VARIANT-ID"]&&P.bitrate!==k.bitrate&&this.log("Unstable Pathways change from bitrate "+k.bitrate+" to "+P.bitrate),this.hls.nextLoadLevel=w);break}}}},v.getPathwayForGroupId=function(l,d,m){for(var E=this.getLevelsForPathway(m).concat(this.levels||[]),_=0;_0&&_>k.config.fpsDroppedMonitoringThreshold*C){var P=k.currentLevel;k.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+P),P>0&&(k.autoLevelCapping===-1||k.autoLevelCapping>=P)&&(P=P-1,k.trigger(j.FPS_DROP_LEVEL_CAPPING,{level:P,droppedLevel:k.currentLevel}),k.autoLevelCapping=P,this.streamController.nextLevelSwitch())}}this.lastTime=m,this.lastDroppedFrames=d,this.lastDecodedFrames=l}},x.checkFPSInterval=function(){var u=this.media;if(u)if(this.isVideoPlaybackQualityAvailable){var l=u.getVideoPlaybackQuality();this.checkFPS(u,l.totalVideoFrames,l.droppedVideoFrames)}else this.checkFPS(u,u.webkitDecodedFrameCount,u.webkitDroppedFrameCount)},g}(),pd=function(){function g(){this.chunks=[],this.dataLength=0}var x=g.prototype;return x.push=function(u){this.chunks.push(u),this.dataLength+=u.length},x.flush=function(){var u=this.chunks,l=this.dataLength,d;if(u.length)u.length===1?d=u[0]:d=gd(u,l);else return new Uint8Array(0);return this.reset(),d},x.reset=function(){this.chunks.length=0,this.dataLength=0},g}();function gd(g,x){for(var v=new Uint8Array(x),u=0,l=0;l0)return g.subarray(v,v+u)}function md(g,x,v,u){var l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],d=x[v+2],m=d>>2&15;if(m>12){var E=new Error("invalid ADTS sampling index:"+m);g.emit(j.ERROR,j.ERROR,{type:ve.MEDIA_ERROR,details:re.FRAG_PARSING_ERROR,fatal:!0,error:E,reason:E.message});return}var _=(d>>6&3)+1,C=x[v+3]>>6&3|(d&1)<<2,w="mp4a.40."+_,k=l[m],P=m;(_===5||_===29)&&(P-=3);var B=[_<<3|(P&14)>>1,(P&1)<<7|C<<3];return ft.log("manifest codec:"+u+", parsed codec:"+w+", channels:"+C+", rate:"+k+" (ADTS object type:"+_+" sampling index:"+m+")"),{config:B,samplerate:k,channelCount:C,codec:w,parsedCodec:w,manifestCodec:u}}function xf(g,x){return g[x]===255&&(g[x+1]&246)===240}function Ls(g,x){return g[x+1]&1?7:9}function $a(g,x){return(g[x+3]&3)<<11|g[x+4]<<3|(g[x+5]&224)>>>5}function cv(g,x){return x+5=g.length)return!1;var u=$a(g,x);if(u<=v)return!1;var l=x+u;return l===g.length||Ka(g,l)}return!1}function Ul(g,x,v,u,l){if(!g.samplerate){var d=md(x,v,u,l);if(!d)return;h(g,d)}}function Hl(g){return 1024*9e4/g}function xd(g,x){var v=Ls(g,x);if(x+v<=g.length){var u=$a(g,x)-v;if(u>0)return{headerLength:v,frameLength:u}}}function Ef(g,x,v,u,l){var d=Hl(g.samplerate),m=u+l*d,E=xd(x,v),_;if(E){var C=E.frameLength,w=E.headerLength,k=w+C,P=Math.max(0,v+k-x.length);P?(_=new Uint8Array(k-w),_.set(x.subarray(v+w,x.length),0)):_=x.subarray(v+w,v+k);var B={unit:_,pts:m};return P||g.samples.push(B),{sample:B,length:k,missing:P}}var M=x.length-v;_=new Uint8Array(M),_.set(x.subarray(v,x.length),0);var U={unit:_,pts:m};return{sample:U,length:M,missing:-1}}function Ed(g,x){return yf(g,x)&&Bl(g,x+6)+10<=g.length-x}function hv(g){if(!(g.size<2)){var x=Zt(g.data,!0),v=new Uint8Array(g.data.subarray(x.length+1));return{key:g.type,info:x,data:v.buffer}}}function vv(g){if(!(g.size<2)){if(g.type==="TXXX"){var x=1,v=Zt(g.data.subarray(x),!0);x+=v.length+1;var u=Zt(g.data.subarray(x));return{key:g.type,info:v,data:u}}var l=Zt(g.data.subarray(1));return{key:g.type,info:"",data:l}}}function pv(g){if(g.type==="WXXX"){if(g.size<2)return;var x=1,v=Zt(g.data.subarray(x),!0);x+=v.length+1;var u=Zt(g.data.subarray(x));return{key:g.type,info:v,data:u}}var l=Zt(g.data);return{key:g.type,info:"",data:l}}function gv(g){return g instanceof ArrayBuffer?g:g.byteOffset==0&&g.byteLength==g.buffer.byteLength?g.buffer:new Uint8Array(g).buffer}function Sf(g,x,v){return x===void 0&&(x=0),v===void 0&&(v=1/0),Ci(g,x,v,Uint8Array)}function Ci(g,x,v,u){var l=Mo(g),d=1;"BYTES_PER_ELEMENT"in u&&(d=u.BYTES_PER_ELEMENT);var m=Sd(g)?g.byteOffset:0,E=(m+g.byteLength)/d,_=(m+x)/d,C=Math.floor(Math.max(0,Math.min(_,E))),w=Math.floor(Math.min(C+Math.max(v,0),E));return new u(l,C,w-C)}function Mo(g){return g instanceof ArrayBuffer?g:g.buffer}function Sd(g){return g&&g.buffer instanceof ArrayBuffer&&g.byteLength!==void 0&&g.byteOffset!==void 0}function _d(g){var x={key:g.type,description:"",data:"",mimeType:null,pictureType:null},v=3;if(!(g.size<2)){if(g.data[0]!==v){console.log("Ignore frame with unrecognized character encoding");return}var u=g.data.subarray(1).indexOf(0);if(u!==-1){var l=Zt(Sf(g.data,1,u)),d=g.data[2+u],m=g.data.subarray(3+u).indexOf(0);if(m!==-1){var E=Zt(Sf(g.data,3+u,m)),_;return l==="-->"?_=Zt(Sf(g.data,4+u+m)):_=gv(g.data.subarray(4+u+m)),x.mimeType=l,x.pictureType=d,x.description=E,x.data=_,x}}}}function bd(g){return g.type==="PRIV"?hv(g):g.type[0]==="W"?pv(g):g.type==="APIC"?_d(g):vv(g)}function Td(g){var x=String.fromCharCode(g[0],g[1],g[2],g[3]),v=Bl(g,4),u=10;return{type:x,size:v,data:g.subarray(u,u+v)}}var Rs=10,mv=10;function Cd(g){for(var x=0,v=[];yf(g,x);){var u=Bl(g,x+6);g[x+5]>>6&1&&(x+=Rs),x+=Rs;for(var l=x+u;x+mv0&&C.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:d,type:On.audioId3,duration:Number.POSITIVE_INFINITY});mx.length)){var d=Tf(x,v);if(d&&v+d.frameLength<=x.length){var m=d.samplesPerFrame*9e4/d.sampleRate,E=u+l*m,_={unit:x.subarray(v,v+d.frameLength),pts:E,dts:E};return g.config=[],g.channelCount=d.channelCount,g.samplerate=d.sampleRate,g.samples.push(_),{sample:_,length:d.frameLength,missing:0}}}}function Tf(g,x){var v=g[x+1]>>3&3,u=g[x+1]>>1&3,l=g[x+2]>>4&15,d=g[x+2]>>2&3;if(v!==1&&l!==0&&l!==15&&d!==3){var m=g[x+2]>>1&1,E=g[x+3]>>6,_=v===3?3-u:u===3?3:4,C=wd[_*14+l-1]*1e3,w=v===3?0:v===2?1:2,k=Vl[w*3+d],P=E===3?1:2,B=Ad[v][u],M=kd[u],U=B*8*M,K=Math.floor(B*C/k+m)*M;if(Is===null){var J=navigator.userAgent||"",ae=J.match(/Chrome\/(\d+)/i);Is=ae?parseInt(ae[1]):0}var se=!!Is&&Is<=87;return se&&u===2&&C>=224e3&&E===0&&(g[x+3]=g[x+3]|128),{sampleRate:k,channelCount:P,frameLength:K,samplesPerFrame:U}}}function jl(g,x){return g[x]===255&&(g[x+1]&224)===224&&(g[x+1]&6)!==0}function Cf(g,x){return x+10;){E[0]=x[v];var _=Math.min(l,8),C=8-_;m[0]=4278190080>>>24+C<>C,u=u?u<<_|d[0]:d[0],v+=1,l-=_}return u},xv=function(g){function x(){return g.apply(this,arguments)||this}S(x,g);var v=x.prototype;return v.resetInitSegment=function(l,d,m,E){g.prototype.resetInitSegment.call(this,l,d,m,E),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:d,duration:E,inputTimeScale:9e4,dropped:0}},x.probe=function(l){if(!l)return!1;var d=Nl(l,0),m=(d==null?void 0:d.length)||0;if(d&&l[m]===11&&l[m+1]===119&&Ds(d)!==void 0&&yv(l,m)<=16)return!1;for(var E=l.length;m>>8^se&255^99,u[K]=se,l[se]=K;var ie=U[K],ue=U[ie],Le=U[ue],me=U[se]*257^se*16843008;m[K]=me<<24|me>>>8,E[K]=me<<16|me>>>16,_[K]=me<<8|me>>>24,C[K]=me,me=Le*16843009^ue*65537^ie*257^K*16843008,k[se]=me<<24|me>>>8,P[se]=me<<16|me>>>16,B[se]=me<<8|me>>>24,M[se]=me,K?(K=ie^U[U[U[Le^ie]]],J^=U[U[J]]):K=J=1}},x.expandKey=function(u){for(var l=this.uint8ArrayToUint32Array_(u),d=!0,m=0;m=u.length){d();return}if(!(u[l].unit.length<32)&&(this.decryptAacSample(u,l,d),!this.decrypter.isSync()))return}},x.getAvcEncryptedData=function(u){for(var l=Math.floor((u.length-48)/160)*16+16,d=new Int8Array(l),m=0,E=32;E=u.length){m();return}for(var E=u[l].units;!(d>=E.length);d++){var _=E[d];if(!(_.data.length<=48||_.type!==1&&_.type!==5)&&(this.decryptAvcSample(u,l,d,m,_),!this.decrypter.isSync()))return}}},g}(),Wl=function(){function g(){this.VideoSample=null}var x=g.prototype;return x.createVideoSample=function(u,l,d){return{key:u,frame:!1,pts:l,dts:d,units:[],length:0}},x.getLastNalUnit=function(u){var l,d=this.VideoSample,m;if((!d||d.units.length===0)&&(d=u[u.length-1]),(l=d)!=null&&l.units){var E=d.units;m=E[E.length-1]}return m},x.pushAccessUnit=function(u,l){if(u.units.length&&u.frame){if(u.pts===void 0){var d=l.samples,m=d.length;if(m){var E=d[m-1];u.pts=E.pts,u.dts=E.dts}else{l.dropped++;return}}l.samples.push(u)}},x.parseNALu=function(u,l,d){var m=l.byteLength,E=u.naluState||0,_=E,C=[],w=0,k,P,B,M=-1,U=0;for(E===-1&&(M=0,U=this.getNALuType(l,0),E=0,w=1);w=0){var K={data:l.subarray(M,P),type:U};C.push(K)}else{var J=this.getLastNalUnit(u.samples);J&&(_&&w<=4-_&&J.state&&(J.data=J.data.subarray(0,J.data.byteLength-_)),P>0&&(J.data=Kt(J.data,l.subarray(0,P)),J.state=0))}w=0&&E>=0){var ae={data:l.subarray(M,m),type:U,state:E};C.push(ae)}if(C.length===0){var se=this.getLastNalUnit(u.samples);se&&(se.data=Kt(se.data,l))}return u.naluState=E,C},g}(),Xa=function(){function g(v){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=v,this.bytesAvailable=v.byteLength,this.word=0,this.bitsAvailable=0}var x=g.prototype;return x.loadWord=function(){var u=this.data,l=this.bytesAvailable,d=u.byteLength-l,m=new Uint8Array(4),E=Math.min(4,l);if(E===0)throw new Error("no bytes available");m.set(u.subarray(d,d+E)),this.word=new DataView(m.buffer).getUint32(0),this.bitsAvailable=E*8,this.bytesAvailable-=E},x.skipBits=function(u){var l;u=Math.min(u,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>u?(this.word<<=u,this.bitsAvailable-=u):(u-=this.bitsAvailable,l=u>>3,u-=l<<3,this.bytesAvailable-=l,this.loadWord(),this.word<<=u,this.bitsAvailable-=u)},x.readBits=function(u){var l=Math.min(this.bitsAvailable,u),d=this.word>>>32-l;if(u>32&&ft.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=l,this.bitsAvailable>0)this.word<<=l;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return l=u-l,l>0&&this.bitsAvailable?d<>>u)!==0)return this.word<<=u,this.bitsAvailable-=u,u;return this.loadWord(),u+this.skipLZ()},x.skipUEG=function(){this.skipBits(1+this.skipLZ())},x.skipEG=function(){this.skipBits(1+this.skipLZ())},x.readUEG=function(){var u=this.skipLZ();return this.readBits(u+1)-1},x.readEG=function(){var u=this.readUEG();return 1&u?1+u>>>1:-1*(u>>>1)},x.readBoolean=function(){return this.readBits(1)===1},x.readUByte=function(){return this.readBits(8)},x.readUShort=function(){return this.readBits(16)},x.readUInt=function(){return this.readBits(32)},g}(),kf=function(g){function x(){return g.apply(this,arguments)||this}S(x,g);var v=x.prototype;return v.parsePES=function(l,d,m,E){var _=this,C=this.parseNALu(l,m.data,E),w=this.VideoSample,k,P=!1;m.data=null,w&&C.length&&!l.audFound&&(this.pushAccessUnit(w,l),w=this.VideoSample=this.createVideoSample(!1,m.pts,m.dts)),C.forEach(function(B){var M,U;switch(B.type){case 1:{var K=!1;k=!0;var J=B.data;if(P&&J.length>4){var ae=_.readSliceType(J);(ae===2||ae===4||ae===7||ae===9)&&(K=!0)}if(K){var se;(se=w)!=null&&se.frame&&!w.key&&(_.pushAccessUnit(w,l),w=_.VideoSample=null)}w||(w=_.VideoSample=_.createVideoSample(!0,m.pts,m.dts)),w.frame=!0,w.key=K;break}case 5:k=!0,(M=w)!=null&&M.frame&&!w.key&&(_.pushAccessUnit(w,l),w=_.VideoSample=null),w||(w=_.VideoSample=_.createVideoSample(!0,m.pts,m.dts)),w.key=!0,w.frame=!0;break;case 6:{k=!0,fn(B.data,1,m.pts,d.samples);break}case 7:{var ie,ue;k=!0,P=!0;var Le=B.data,me=_.readSPS(Le);if(!l.sps||l.width!==me.width||l.height!==me.height||((ie=l.pixelRatio)==null?void 0:ie[0])!==me.pixelRatio[0]||((ue=l.pixelRatio)==null?void 0:ue[1])!==me.pixelRatio[1]){l.width=me.width,l.height=me.height,l.pixelRatio=me.pixelRatio,l.sps=[Le];for(var De=Le.subarray(1,4),Ne="avc1.",Me=0;Me<3;Me++){var Pe=De[Me].toString(16);Pe.length<2&&(Pe="0"+Pe),Ne+=Pe}l.codec=Ne}break}case 8:k=!0,l.pps=[B.data];break;case 9:k=!0,l.audFound=!0,(U=w)!=null&&U.frame&&(_.pushAccessUnit(w,l),w=null),w||(w=_.VideoSample=_.createVideoSample(!1,m.pts,m.dts));break;case 12:k=!0;break;default:k=!1;break}if(w&&k){var Be=w.units;Be.push(B)}}),E&&w&&(this.pushAccessUnit(w,l),this.VideoSample=null)},v.getNALuType=function(l,d){return l[d]&31},v.readSliceType=function(l){var d=new Xa(l);return d.readUByte(),d.readUEG(),d.readUEG()},v.skipScalingList=function(l,d){for(var m=8,E=8,_,C=0;C0&&l.warn("MPEG2-TS detected but first sync word found @ offset "+d),d!==-1},g.syncOffset=function(u){for(var l=u.length,d=Math.min(cn*5,l-cn)+1,m=0;m1&&(_===0&&C>2||w+cn>d))return _}else{if(C)return-1;break}m++}return-1},g.createTrack=function(u,l){return{container:u==="video"||u==="audio"?"video/mp2t":void 0,type:u,id:sn[u],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:u==="audio"?l:void 0}};var x=g.prototype;return x.resetInitSegment=function(u,l,d,m){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=g.createTrack("video"),this._videoTrack.duration=m,this._audioTrack=g.createTrack("audio",m),this._id3Track=g.createTrack("id3"),this._txtTrack=g.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=l,this.videoCodec=d},x.resetTimeStamp=function(){},x.resetContiguity=function(){var u=this._audioTrack,l=this._videoTrack,d=this._id3Track;u&&(u.pesData=null),l&&(l.pesData=null),d&&(d.pesData=null),this.aacOverFlow=null,this.remainderData=null},x.demux=function(u,l,d,m){d===void 0&&(d=!1),m===void 0&&(m=!1),d||(this.sampleAes=null);var E,_=this._videoTrack,C=this._audioTrack,w=this._id3Track,k=this._txtTrack,P=_.pid,B=_.pesData,M=C.pid,U=w.pid,K=C.pesData,J=w.pesData,ae=null,se=this.pmtParsed,ie=this._pmtId,ue=u.length;if(this.remainderData&&(u=Kt(this.remainderData,u),ue=u.length,this.remainderData=null),ue>4,Be=void 0;if(Pe>1){if(Be=De+5+u[De+4],Be===De+cn)continue}else Be=De+4;switch(Me){case P:if(Ne){if(B&&(E=ba(B,this.logger))){if(this.videoParser===null)switch(_.segmentCodec){case"avc":this.videoParser=new kf;break}this.videoParser!==null&&this.videoParser.parsePES(_,k,E,!1)}B={data:[],size:0}}B&&(B.data.push(u.subarray(Be,De+cn)),B.size+=De+cn-Be);break;case M:if(Ne){if(K&&(E=ba(K,this.logger)))switch(C.segmentCodec){case"aac":this.parseAACPES(C,E);break;case"mp3":this.parseMPEGPES(C,E);break}K={data:[],size:0}}K&&(K.data.push(u.subarray(Be,De+cn)),K.size+=De+cn-Be);break;case U:Ne&&(J&&(E=ba(J,this.logger))&&this.parseID3PES(w,E),J={data:[],size:0}),J&&(J.data.push(u.subarray(Be,De+cn)),J.size+=De+cn-Be);break;case 0:Ne&&(Be+=u[Be]+1),ie=this._pmtId=Kl(u,Be);break;case ie:{Ne&&(Be+=u[Be]+1);var Ge=Yl(u,Be,this.typeSupported,d,this.observer,this.logger);P=Ge.videoPid,P>0&&(_.pid=P,_.segmentCodec=Ge.segmentVideoCodec),M=Ge.audioPid,M>0&&(C.pid=M,C.segmentCodec=Ge.segmentAudioCodec),U=Ge.id3Pid,U>0&&(w.pid=U),ae!==null&&!se&&(this.logger.warn("MPEG-TS PMT found at "+De+" after unknown PID '"+ae+"'. Backtracking to sync byte @"+Le+" to parse all TS packets."),ae=null,De=Le-188),se=this.pmtParsed=!0;break}case 17:case 8191:break;default:ae=Me;break}}else me++;me>0&&Fs(this.observer,new Error("Found "+me+" TS packet/s that do not start with 0x47"),void 0,this.logger),_.pesData=B,C.pesData=K,w.pesData=J;var ut={audioTrack:C,videoTrack:_,id3Track:w,textTrack:k};return m&&this.extractRemainingSamples(ut),ut},x.flush=function(){var u=this.remainderData;this.remainderData=null;var l;return u?l=this.demux(u,-1,!1,!0):l={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(l),this.sampleAes?this.decrypt(l,this.sampleAes):l},x.extractRemainingSamples=function(u){var l=u.audioTrack,d=u.videoTrack,m=u.id3Track,E=u.textTrack,_=d.pesData,C=l.pesData,w=m.pesData,k;if(_&&(k=ba(_,this.logger))){if(this.videoParser===null)switch(d.segmentCodec){case"avc":this.videoParser=new kf;break}this.videoParser!==null&&(this.videoParser.parsePES(d,E,k,!0),d.pesData=null)}else d.pesData=_;if(C&&(k=ba(C,this.logger))){switch(l.segmentCodec){case"aac":this.parseAACPES(l,k);break;case"mp3":this.parseMPEGPES(l,k);break}l.pesData=null}else C!=null&&C.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),l.pesData=C;w&&(k=ba(w,this.logger))?(this.parseID3PES(m,k),m.pesData=null):m.pesData=w},x.demuxSampleAes=function(u,l,d){var m=this.demux(u,d,!0,!this.config.progressive),E=this.sampleAes=new Ho(this.observer,this.config,l);return this.decrypt(m,E)},x.decrypt=function(u,l){return new Promise(function(d){var m=u.audioTrack,E=u.videoTrack;m.samples&&m.segmentCodec==="aac"?l.decryptAacSamples(m.samples,0,function(){E.samples?l.decryptAvcSamples(E.samples,0,0,function(){d(u)}):d(u)}):E.samples&&l.decryptAvcSamples(E.samples,0,0,function(){d(u)})})},x.destroy=function(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0},x.parseAACPES=function(u,l){var d=0,m=this.aacOverFlow,E=l.data;if(m){this.aacOverFlow=null;var _=m.missing,C=m.sample.unit.byteLength;if(_===-1)E=Kt(m.sample.unit,E);else{var w=C-_;m.sample.unit.set(E.subarray(0,_),w),u.samples.push(m.sample),d=m.missing}}var k,P;for(k=d,P=E.length;k0)for(var P=x+5,B=k;B>2;){var M=g[P];switch(M){case 106:d.warn("AC-3 in M2TS support not included in build");break}var U=g[P+1]+2;P+=U,B-=U}break;case 194:case 135:return Fs(l,new Error("Unsupported EC-3 in M2TS found"),void 0,d),m;case 36:return Fs(l,new Error("Unsupported HEVC in M2TS found"),void 0,d),m}x+=k+5}return m}function Fs(g,x,v,u){u.warn("parsing error: "+x.message),g.emit(j.ERROR,j.ERROR,{type:ve.MEDIA_ERROR,details:re.FRAG_PARSING_ERROR,fatal:!1,levelRetry:v,error:x,reason:x.message})}function Vo(g,x){x.log(g+" with AES-128-CBC encryption found in unencrypted stream")}function ba(g,x){var v=0,u,l,d,m,E,_=g.data;if(!g||g.size===0)return null;for(;_[0].length<19&&_.length>1;)_[0]=Kt(_[0],_[1]),_.splice(1,1);u=_[0];var C=(u[0]<<16)+(u[1]<<8)+u[2];if(C===1){if(l=(u[4]<<8)+u[5],l&&l>g.size-6)return null;var w=u[7];w&192&&(m=(u[9]&14)*536870912+(u[10]&255)*4194304+(u[11]&254)*16384+(u[12]&255)*128+(u[13]&254)/2,w&64?(E=(u[14]&14)*536870912+(u[15]&255)*4194304+(u[16]&254)*16384+(u[17]&255)*128+(u[18]&254)/2,m-E>60*9e4&&(x.warn(Math.round((m-E)/9e4)+"s delta between PTS and DTS, align them"),m=E)):E=m),d=u[8];var k=d+9;if(g.size<=k)return null;g.size-=k;for(var P=new Uint8Array(g.size),B=0,M=_.length;BU){k-=U;continue}else u=u.subarray(k),U-=k,k=0;P.set(u,v),v+=U}return l&&(l-=d+3),{data:P,pts:m,dts:E,len:l}}return null}var Lf=function(){function g(){}return g.getSilentFrame=function(v,u){switch(v){case"mp4a.40.2":if(u===1)return new Uint8Array([0,200,0,128,35,128]);if(u===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(u===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(u===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(u===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(u===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(u===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(u===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(u===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}},g}(),Ta=Math.pow(2,32)-1,dn=function(){function g(){}return g.init=function(){g.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var v;for(v in g.types)g.types.hasOwnProperty(v)&&(g.types[v]=[v.charCodeAt(0),v.charCodeAt(1),v.charCodeAt(2),v.charCodeAt(3)]);var u=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]),l=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]);g.HDLR_TYPES={video:u,audio:l};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),m=new Uint8Array([0,0,0,0,0,0,0,0]);g.STTS=g.STSC=g.STCO=m,g.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),g.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),g.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),g.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var E=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),C=new Uint8Array([0,0,0,1]);g.FTYP=g.box(g.types.ftyp,E,C,E,_),g.DINF=g.box(g.types.dinf,g.box(g.types.dref,d))},g.box=function(v){for(var u=8,l=arguments.length,d=new Array(l>1?l-1:0),m=1;m>24&255,C[1]=u>>16&255,C[2]=u>>8&255,C[3]=u&255,C.set(v,4),E=0,u=8;E<_;E++)C.set(d[E],u),u+=d[E].byteLength;return C},g.hdlr=function(v){return g.box(g.types.hdlr,g.HDLR_TYPES[v])},g.mdat=function(v){return g.box(g.types.mdat,v)},g.mdhd=function(v,u){u*=v;var l=Math.floor(u/(Ta+1)),d=Math.floor(u%(Ta+1));return g.box(g.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,v>>24&255,v>>16&255,v>>8&255,v&255,l>>24,l>>16&255,l>>8&255,l&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},g.mdia=function(v){return g.box(g.types.mdia,g.mdhd(v.timescale||0,v.duration||0),g.hdlr(v.type),g.minf(v))},g.mfhd=function(v){return g.box(g.types.mfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255]))},g.minf=function(v){return v.type==="audio"?g.box(g.types.minf,g.box(g.types.smhd,g.SMHD),g.DINF,g.stbl(v)):g.box(g.types.minf,g.box(g.types.vmhd,g.VMHD),g.DINF,g.stbl(v))},g.moof=function(v,u,l){return g.box(g.types.moof,g.mfhd(v),g.traf(l,u))},g.moov=function(v){for(var u=v.length,l=[];u--;)l[u]=g.trak(v[u]);return g.box.apply(null,[g.types.moov,g.mvhd(v[0].timescale||0,v[0].duration||0)].concat(l).concat(g.mvex(v)))},g.mvex=function(v){for(var u=v.length,l=[];u--;)l[u]=g.trex(v[u]);return g.box.apply(null,[g.types.mvex].concat(l))},g.mvhd=function(v,u){u*=v;var l=Math.floor(u/(Ta+1)),d=Math.floor(u%(Ta+1)),m=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,v>>24&255,v>>16&255,v>>8&255,v&255,l>>24,l>>16&255,l>>8&255,l&255,d>>24,d>>16&255,d>>8&255,d&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 g.box(g.types.mvhd,m)},g.sdtp=function(v){var u=v.samples||[],l=new Uint8Array(4+u.length),d,m;for(d=0;d>>8&255),u.push(E&255),u=u.concat(Array.prototype.slice.call(m));for(d=0;d>>8&255),l.push(E&255),l=l.concat(Array.prototype.slice.call(m));var _=g.box(g.types.avcC,new Uint8Array([1,u[3],u[4],u[5],255,224|v.sps.length].concat(u).concat([v.pps.length]).concat(l))),C=v.width,w=v.height,k=v.pixelRatio[0],P=v.pixelRatio[1];return g.box(g.types.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,C>>8&255,C&255,w>>8&255,w&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,g.box(g.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),g.box(g.types.pasp,new Uint8Array([k>>24,k>>16&255,k>>8&255,k&255,P>>24,P>>16&255,P>>8&255,P&255])))},g.esds=function(v){var u=v.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2].concat(u,[6,1,2]))},g.audioStsd=function(v){var u=v.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,v.channelCount||0,0,16,0,0,0,0,u>>8&255,u&255,0,0])},g.mp4a=function(v){return g.box(g.types.mp4a,g.audioStsd(v),g.box(g.types.esds,g.esds(v)))},g.mp3=function(v){return g.box(g.types[".mp3"],g.audioStsd(v))},g.ac3=function(v){return g.box(g.types["ac-3"],g.audioStsd(v),g.box(g.types.dac3,v.config))},g.stsd=function(v){var u=v.segmentCodec;if(v.type==="audio"){if(u==="aac")return g.box(g.types.stsd,g.STSD,g.mp4a(v));if(u==="mp3"&&v.codec==="mp3")return g.box(g.types.stsd,g.STSD,g.mp3(v))}else if(v.pps&&v.sps){if(u==="avc")return g.box(g.types.stsd,g.STSD,g.avc1(v))}else throw new Error("video track missing pps or sps");throw new Error("unsupported "+v.type+" segment codec ("+u+"/"+v.codec+")")},g.tkhd=function(v){var u=v.id,l=(v.duration||0)*(v.timescale||0),d=v.width||0,m=v.height||0,E=Math.floor(l/(Ta+1)),_=Math.floor(l%(Ta+1));return g.box(g.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,u>>24&255,u>>16&255,u>>8&255,u&255,0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255,_>>24,_>>16&255,_>>8&255,_&255,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,d>>8&255,d&255,0,0,m>>8&255,m&255,0,0]))},g.traf=function(v,u){var l=g.sdtp(v),d=v.id,m=Math.floor(u/(Ta+1)),E=Math.floor(u%(Ta+1));return g.box(g.types.traf,g.box(g.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),g.box(g.types.tfdt,new Uint8Array([1,0,0,0,m>>24,m>>16&255,m>>8&255,m&255,E>>24,E>>16&255,E>>8&255,E&255])),g.trun(v,l.length+16+20+8+16+8+8),l)},g.trak=function(v){return v.duration=v.duration||4294967295,g.box(g.types.trak,g.tkhd(v),g.mdia(v))},g.trex=function(v){var u=v.id;return g.box(g.types.trex,new Uint8Array([0,0,0,0,u>>24,u>>16&255,u>>8&255,u&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},g.trun=function(v,u){var l=v.samples||[],d=l.length,m=12+16*d,E=new Uint8Array(m),_,C,w,k,P,B;for(u+=8+m,E.set([v.type==="video"?1:0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255],0),_=0;_>>24&255,w>>>16&255,w>>>8&255,w&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255,P.isLeading<<2|P.dependsOn,P.isDependedOn<<6|P.hasRedundancy<<4|P.paddingValue<<1|P.isNonSync,P.degradPrio&61440,P.degradPrio&15,B>>>24&255,B>>>16&255,B>>>8&255,B&255],12+16*_);return g.box(g.types.trun,E)},g.initSegment=function(v){g.types||g.init();var u=g.moov(v),l=Kt(g.FTYP,u);return l},g.hvc1=function(v){return new Uint8Array},g}();dn.types=void 0,dn.HDLR_TYPES=void 0,dn.STTS=void 0,dn.STSC=void 0,dn.STCO=void 0,dn.STSZ=void 0,dn.VMHD=void 0,dn.SMHD=void 0,dn.STSD=void 0,dn.FTYP=void 0,dn.DINF=void 0;var _v=9e4;function bv(g,x,v,u){var l=g*x*v;return Math.round(l)}function qa(g,x){return bv(g,1e3,1/_v)}var Ca=10*1e3,Pd=1024,Ms=1152,Vi=1536,ji=null,Ai=null;function Xl(g,x,v,u){return{duration:x,size:v,cts:u,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:g?2:1,isNonSync:g?0:1}}}var Rf=function(){function g(v,u,l,d){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=v,this.config=u,this.typeSupported=l,this.logger=d,this.ISGenerated=!1,ji===null){var m=navigator.userAgent||"",E=m.match(/Chrome\/(\d+)/i);ji=E?parseInt(E[1]):0}if(Ai===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);Ai=_?parseInt(_[1]):0}}var x=g.prototype;return x.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},x.resetTimeStamp=function(u){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=u},x.resetNextTimestamp=function(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},x.getVideoStartPts=function(u){var l=!1,d=u[0].pts,m=u.reduce(function(E,_){var C=_.pts,w=C-E;return w<-4294967296&&(l=!0,C=ki(C,d),w=C-E),w>0?E:C},d);return l&&this.logger.debug("PTS rollover detected"),m},x.remux=function(u,l,d,m,E,_,C,w){var k,P,B,M,U,K,J=E,ae=E,se=u.pid>-1,ie=l.pid>-1,ue=l.samples.length,Le=u.samples.length>0,me=C&&ue>0||ue>1,De=(!se||Le)&&(!ie||me)||this.ISGenerated||C;if(De){if(this.ISGenerated){var Ne,Me,Pe,Be,Ge=this.videoTrackConfig;(Ge&&(l.width!==Ge.width||l.height!==Ge.height||((Ne=l.pixelRatio)==null?void 0:Ne[0])!==((Me=Ge.pixelRatio)==null?void 0:Me[0])||((Pe=l.pixelRatio)==null?void 0:Pe[1])!==((Be=Ge.pixelRatio)==null?void 0:Be[1]))||!Ge&&me||this.nextAudioPts===null&&Le)&&this.resetInitSegment()}this.ISGenerated||(B=this.generateIS(u,l,E,_));var ut=this.isVideoContiguous,et=-1,Ze;if(me&&(et=Za(l.samples),!ut&&this.config.forceKeyFrameOnDiscontinuity))if(K=!0,et>0){this.logger.warn("[mp4-remuxer]: Dropped "+et+" out of "+ue+" video samples due to a missing keyframe");var ht=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(et),l.dropped+=et,ae+=(l.samples[0].pts-ht)/l.inputTimeScale,Ze=ae}else et===-1&&(this.logger.warn("[mp4-remuxer]: No keyframe found out of "+ue+" video samples"),K=!1);if(this.ISGenerated){if(Le&&me){var gt=this.getVideoStartPts(l.samples),st=ki(u.samples[0].pts,gt)-gt,Dt=st/l.inputTimeScale;J+=Math.max(0,Dt),ae+=Math.max(0,-Dt)}if(Le){if(u.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(u,l,E,_)),P=this.remuxAudio(u,J,this.isAudioContiguous,_,ie||me||w===X.AUDIO?ae:void 0),me){var ar=P?P.endPTS-P.startPTS:0;l.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(u,l,E,_)),k=this.remuxVideo(l,ae,ut,ar)}}else me&&(k=this.remuxVideo(l,ae,ut,0));k&&(k.firstKeyFrame=et,k.independent=et!==-1,k.firstKeyFramePTS=Ze)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(d.samples.length&&(U=Bs(d,E,this._initPTS,this._initDTS)),m.samples.length&&(M=Qa(m,E,this._initPTS))),{audio:P,video:k,initSegment:B,independent:K,text:M,id3:U}},x.generateIS=function(u,l,d,m){var E=u.samples,_=l.samples,C=this.typeSupported,w={},k=this._initPTS,P=!k||m,B="audio/mp4",M,U,K;if(P&&(M=U=1/0),u.config&&E.length){switch(u.timescale=u.samplerate,u.segmentCodec){case"mp3":C.mpeg?(B="audio/mpeg",u.codec=""):C.mp3&&(u.codec="mp3");break;case"ac3":u.codec="ac-3";break}w.audio={id:"audio",container:B,codec:u.codec,initSegment:u.segmentCodec==="mp3"&&C.mpeg?new Uint8Array(0):dn.initSegment([u]),metadata:{channelCount:u.channelCount}},P&&(K=u.inputTimeScale,!k||K!==k.timescale?M=U=E[0].pts-Math.round(K*d):P=!1)}if(l.sps&&l.pps&&_.length){if(l.timescale=l.inputTimeScale,w.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:dn.initSegment([l]),metadata:{width:l.width,height:l.height}},P)if(K=l.inputTimeScale,!k||K!==k.timescale){var J=this.getVideoStartPts(_),ae=Math.round(K*d);U=Math.min(U,ki(_[0].dts,J)-ae),M=Math.min(M,J-ae)}else P=!1;this.videoTrackConfig={width:l.width,height:l.height,pixelRatio:l.pixelRatio}}if(Object.keys(w).length)return this.ISGenerated=!0,P?(this._initPTS={baseTime:M,timescale:K},this._initDTS={baseTime:U,timescale:K}):M=K=void 0,{tracks:w,initPTS:M,timescale:K}},x.remuxVideo=function(u,l,d,m){var E=u.inputTimeScale,_=u.samples,C=[],w=_.length,k=this._initPTS,P=this.nextAvcDts,B=8,M=this.videoSampleDuration,U,K,J=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,se=!1;if(!d||P===null){var ie=l*E,ue=_[0].pts-ki(_[0].dts,_[0].pts);ji&&P!==null&&Math.abs(ie-ue-P)<15e3?d=!0:P=ie-ue}for(var Le=k.baseTime*E/k.timescale,me=0;me0?me-1:me].dts&&(se=!0)}se&&_.sort(function(Da,Sn){var wv=Da.dts-Sn.dts,Av=Da.pts-Sn.pts;return wv||Av}),U=_[0].dts,K=_[_.length-1].dts;var Ne=K-U,Me=Ne?Math.round(Ne/(w-1)):M||u.inputTimeScale/30;if(d){var Pe=U-P,Be=Pe>Me,Ge=Pe<-1;if((Be||Ge)&&(Be?this.logger.warn((u.segmentCodec||"").toUpperCase()+": "+qa(Pe)+" ms ("+Pe+"dts) hole between fragments detected at "+l.toFixed(3)):this.logger.warn((u.segmentCodec||"").toUpperCase()+": "+qa(-Pe)+" ms ("+Pe+"dts) overlapping between fragments detected at "+l.toFixed(3)),!Ge||P>=_[0].pts||ji)){U=P;var ut=_[0].pts-Pe;if(Be)_[0].dts=U,_[0].pts=ut;else for(var et=!0,Ze=0;Ze<_.length&&!(_[Ze].dts>ut&&et);Ze++){var ht=_[Ze].pts;if(_[Ze].dts-=Pe,_[Ze].pts-=Pe,Ze<_.length-1){var gt=_[Ze+1].pts,st=_[Ze].pts,Dt=gt<=st,ar=gt<=ht;et=Dt==ar}}this.logger.log("Video: Initial PTS/DTS adjusted: "+qa(ut)+"/"+qa(U)+", delta: "+qa(Pe)+" ms")}}U=Math.max(0,U);for(var Gt=0,xr=0,Qt=U,zr=0;zr0?Mn.dts-_[en-1].dts:Me;if(Qs=en>0?Mn.pts-_[en-1].pts:Me,xu.stretchShortVideoTrack&&this.nextAudioPts!==null){var qf=Math.floor(xu.maxBufferHole*E),Js=(m?J+m*E:this.nextAudioPts)-Mn.pts;Js>qf?(M=Js-Ko,M<0?M=Ko:kn=!0,this.logger.log("[mp4-remuxer]: It is approximately "+Js/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=Ko}else M=Ko}var Tv=Math.round(Mn.pts-Mn.dts);Ln=Math.min(Ln,M),Yt=Math.max(Yt,M),Dr=Math.min(Dr,Qs),Gn=Math.max(Gn,Qs),C.push(Xl(Mn.key,M,Xf,Tv))}if(C.length){if(ji){if(ji<70){var Zf=C[0].flags;Zf.dependsOn=2,Zf.isNonSync=0}}else if(Ai&&Gn-Dr0&&(m&&Math.abs(ie-se)<9e3||Math.abs(ki(J[0].pts-ue,ie)-se)<20*P),J.forEach(function(Yt){Yt.pts=ki(Yt.pts-ue,ie)}),!d||se<0){if(J=J.filter(function(Yt){return Yt.pts>=0}),!J.length)return;E===0?se=0:m&&!K?se=Math.max(0,ie):se=J[0].pts}if(u.segmentCodec==="aac")for(var Le=this.config.maxAudioFramesDrift,me=0,De=se;me=Le*P&&Be0){Dt+=ae;try{st=new Uint8Array(Dt)}catch(Yt){this.observer.emit(j.ERROR,j.ERROR,{type:ve.MUX_ERROR,details:re.REMUX_ALLOC_ERROR,fatal:!1,error:Yt,bytes:Dt,reason:"fail allocating audio mdat "+Dt});return}if(!M){var An=new DataView(st.buffer);An.setUint32(0,Dt),st.set(dn.types.mdat,4)}}else return;st.set(zr,ae);var pn=zr.byteLength;ae+=pn,U.push(Xl(!0,k,pn,0)),gt=ur}var Tr=U.length;if(Tr){var Fn=U[U.length-1];this.nextAudioPts=se=gt+w*Fn.duration;var Jr=M?new Uint8Array(0):dn.moof(u.sequenceNumber++,ht/w,h({},u,{samples:U}));u.samples=[];var Mr=ht/_,kn=se/_,Ln="audio",Dr={data1:Jr,data2:st,startPTS:Mr,endPTS:kn,startDTS:Mr,endDTS:kn,type:Ln,hasAudio:!0,hasVideo:!1,nb:Tr};return this.isAudioContiguous=!0,Dr}},g}();function ki(g,x){var v;if(x===null)return g;for(x4294967296;)g+=v;return g}function Za(g){for(var x=0;x0?this.lastEndTime=ue:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var Le=!!K.audio,me=!!K.video,De="";Le&&(De+="audio"),me&&(De+="video");var Ne={data1:M,startPTS:ie,startDTS:ie,endPTS:ue,endDTS:ue,type:De,hasAudio:Le,hasVideo:me,nb:1,dropped:0};return B.audio=Ne.type==="audio"?Ne:void 0,B.video=Ne.type!=="audio"?Ne:void 0,B.initSegment=U,B.id3=Bs(d,E,k,k),m.samples.length&&(B.text=Qa(m,E,k)),B},g}();function Df(g,x,v,u){if(g===null)return!0;var l=Math.max(u,1),d=x-g.baseTime/g.timescale;return Math.abs(d-v)>l}function Ja(g,x){var v=g==null?void 0:g.codec;if(v&&v.length>4)return v;if(x===Ft.AUDIO){if(v==="ec-3"||v==="ac-3"||v==="alac")return v;if(v==="fLaC"||v==="Opus"){var u=!1;return Co(v,u)}return ft.warn('Unhandled audio codec "'+v+'" in mp4 MAP'),v||"mp4a"}return ft.warn('Unhandled video codec "'+v+'" in mp4 MAP'),v||"avc1"}var Cn;try{Cn=self.performance.now.bind(self.performance)}catch{Cn=Date.now}var Lr=[{demux:Dd,remux:ql},{demux:Sv,remux:Rf},{demux:wf,remux:Rf},{demux:xv,remux:Rf}],br=function(){function g(v,u,l,d,m,E){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=v,this.typeSupported=u,this.config=l,this.id=m,this.logger=E}var x=g.prototype;return x.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},x.push=function(u,l,d,m){var E=this,_=d.transmuxing;_.executeStart=Cn();var C=new Uint8Array(u),w=this.currentTransmuxState,k=this.transmuxConfig;m&&(this.currentTransmuxState=m);var P=m||w,B=P.contiguous,M=P.discontinuity,U=P.trackSwitch,K=P.accurateTimeOffset,J=P.timeOffset,ae=P.initSegmentChange,se=k.audioCodec,ie=k.videoCodec,ue=k.defaultInitPts,Le=k.duration,me=k.initSegmentData,De=wa(C,l);if(De&&Hi(De.method)){var Ne=this.getDecrypter(),Me=Dl(De.method);if(Ne.isSync()){var Pe=Ne.softwareDecrypt(C,De.key.buffer,De.iv.buffer,Me),Be=d.part>-1;if(Be){var Ge=Ne.flush();Pe=Ge&&Ge.buffer}if(!Pe)return _.executeEnd=Cn(),hn(d);C=new Uint8Array(Pe)}else return this.asyncResult=!0,this.decryptionPromise=Ne.webCryptoDecrypt(C,De.key.buffer,De.iv.buffer,Me).then(function(gt){var st=E.push(gt,null,d);return E.decryptionPromise=null,st}),this.decryptionPromise}var ut=this.needsProbing(M,U);if(ut){var et=this.configureTransmuxer(C);if(et)return this.logger.warn("[transmuxer] "+et.message),this.observer.emit(j.ERROR,j.ERROR,{type:ve.MEDIA_ERROR,details:re.FRAG_PARSING_ERROR,fatal:!1,error:et,reason:et.message}),_.executeEnd=Cn(),hn(d)}(M||U||ae||ut)&&this.resetInitSegment(me,se,ie,Le,l),(M||ae||ut)&&this.resetInitialTimestamp(ue),B||this.resetContiguity();var Ze=this.transmux(C,De,J,K,d);this.asyncResult=Qr(Ze);var ht=this.currentTransmuxState;return ht.contiguous=!0,ht.discontinuity=!1,ht.trackSwitch=!1,_.executeEnd=Cn(),Ze},x.flush=function(u){var l=this,d=u.transmuxing;d.executeStart=Cn();var m=this.decrypter,E=this.currentTransmuxState,_=this.decryptionPromise;if(_)return this.asyncResult=!0,_.then(function(){return l.flush(u)});var C=[],w=E.timeOffset;if(m){var k=m.flush();k&&C.push(this.push(k.buffer,null,u))}var P=this.demuxer,B=this.remuxer;if(!P||!B){d.executeEnd=Cn();var M=[hn(u)];return this.asyncResult?Promise.resolve(M):M}var U=P.flush(w);return Qr(U)?(this.asyncResult=!0,U.then(function(K){return l.flushRemux(C,K,u),C})):(this.flushRemux(C,U,u),this.asyncResult?Promise.resolve(C):C)},x.flushRemux=function(u,l,d){var m=l.audioTrack,E=l.videoTrack,_=l.id3Track,C=l.textTrack,w=this.currentTransmuxState,k=w.accurateTimeOffset,P=w.timeOffset;this.logger.log("[transmuxer.ts]: Flushed "+this.id+" sn: "+d.sn+(d.part>-1?" part: "+d.part:"")+" of "+(this.id===X.MAIN?"level":"track")+" "+d.level);var B=this.remuxer.remux(m,E,_,C,P,k,!0,this.id);u.push({remuxResult:B,chunkMeta:d}),d.transmuxing.executeEnd=Cn()},x.resetInitialTimestamp=function(u){var l=this.demuxer,d=this.remuxer;!l||!d||(l.resetTimeStamp(u),d.resetTimeStamp(u))},x.resetContiguity=function(){var u=this.demuxer,l=this.remuxer;!u||!l||(u.resetContiguity(),l.resetNextTimestamp())},x.resetInitSegment=function(u,l,d,m,E){var _=this.demuxer,C=this.remuxer;!_||!C||(_.resetInitSegment(u,l,d,m),C.resetInitSegment(u,l,d,E))},x.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},x.transmux=function(u,l,d,m,E){var _;return l&&l.method==="SAMPLE-AES"?_=this.transmuxSampleAes(u,l,d,m,E):_=this.transmuxUnencrypted(u,d,m,E),_},x.transmuxUnencrypted=function(u,l,d,m){var E=this.demuxer.demux(u,l,!1,!this.config.progressive),_=E.audioTrack,C=E.videoTrack,w=E.id3Track,k=E.textTrack,P=this.remuxer.remux(_,C,w,k,l,d,!1,this.id);return{remuxResult:P,chunkMeta:m}},x.transmuxSampleAes=function(u,l,d,m,E){var _=this;return this.demuxer.demuxSampleAes(u,l,d).then(function(C){var w=_.remuxer.remux(C.audioTrack,C.videoTrack,C.id3Track,C.textTrack,d,m,!1,_.id);return{remuxResult:w,chunkMeta:E}})},x.configureTransmuxer=function(u){for(var l=this.config,d=this.observer,m=this.typeSupported,E,_=0,C=Lr.length;_0&&(x==null?void 0:x.key)!=null&&x.iv!==null&&x.method!=null&&(v=x),v}var hn=function(x){return{remuxResult:{},chunkMeta:x}};function Qr(g){return"then"in g&&g.then instanceof Function}var es=function(x,v,u,l,d){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=x,this.videoCodec=v,this.initSegmentData=u,this.duration=l,this.defaultInitPts=d||null},Ns=function(x,v,u,l,d,m){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=x,this.contiguous=v,this.accurateTimeOffset=u,this.trackSwitch=l,this.timeOffset=d,this.initSegmentChange=m};function Vn(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var Zl=/(\d+)-(\d+)\/(\d+)/,Pf=function(){function g(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||aa,this.controller=new self.AbortController,this.stats=new Xt}var x=g.prototype;return x.destroy=function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null},x.abortInternal=function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())},x.abort=function(){var u;this.abortInternal(),(u=this.callbacks)!=null&&u.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},x.load=function(u,l,d){var m=this,E=this.stats;if(E.loading.start)throw new Error("Loader can only be used once.");E.loading.start=self.performance.now();var _=Id(u,this.controller.signal),C=u.responseType==="arraybuffer",w=C?"byteLength":"length",k=l.loadPolicy,P=k.maxTimeToFirstByteMs,B=k.maxLoadTimeMs;this.context=u,this.config=l,this.callbacks=d,this.request=this.fetchSetup(u,_),self.clearTimeout(this.requestTimeout),l.timeout=P&&Q(P)?P:B,this.requestTimeout=self.setTimeout(function(){m.callbacks&&(m.abortInternal(),m.callbacks.onTimeout(E,u,m.response))},l.timeout);var M=Qr(this.request)?this.request.then(self.fetch):self.fetch(this.request);M.then(function(U){var K;m.response=m.loader=U;var J=Math.max(self.performance.now(),E.loading.start);if(self.clearTimeout(m.requestTimeout),l.timeout=B,m.requestTimeout=self.setTimeout(function(){m.callbacks&&(m.abortInternal(),m.callbacks.onTimeout(E,u,m.response))},B-(J-E.loading.start)),!U.ok){var ae=U.status,se=U.statusText;throw new Jl(se||"fetch, bad network response",ae,U)}E.loading.first=J,E.total=Od(U.headers)||E.total;var ie=(K=m.callbacks)==null?void 0:K.onProgress;return ie&&Q(l.highWaterMark)?m.loadProgressively(U,E,u,l.highWaterMark,ie):C?U.arrayBuffer():u.responseType==="json"?U.json():U.text()}).then(function(U){var K,J,ae=m.response;if(!ae)throw new Error("loader destroyed");self.clearTimeout(m.requestTimeout),E.loading.end=Math.max(self.performance.now(),E.loading.first);var se=U[w];se&&(E.loaded=E.total=se);var ie={url:ae.url,data:U,code:ae.status},ue=(K=m.callbacks)==null?void 0:K.onProgress;ue&&!Q(l.highWaterMark)&&ue(E,u,U,ae),(J=m.callbacks)==null||J.onSuccess(ie,E,u,ae)}).catch(function(U){var K;if(self.clearTimeout(m.requestTimeout),!E.aborted){var J=U&&U.code||0,ae=U?U.message:null;(K=m.callbacks)==null||K.onError({code:J,text:ae},u,U?U.details:null,E)}})},x.getCacheAge=function(){var u=null;if(this.response){var l=this.response.headers.get("age");u=l?parseFloat(l):null}return u},x.getResponseHeader=function(u){return this.response?this.response.headers.get(u):null},x.loadProgressively=function(u,l,d,m,E){m===void 0&&(m=0);var _=new pd,C=u.body.getReader(),w=function(){return C.read().then(function(P){if(P.done)return _.dataLength&&E(l,d,_.flush().buffer,u),Promise.resolve(new ArrayBuffer(0));var B=P.value,M=B.length;return l.loaded+=M,M=m&&E(l,d,_.flush().buffer,u)):E(l,d,B.buffer,u),w()}).catch(function(){return Promise.reject()})};return w()},g}();function Id(g,x){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:x,headers:new self.Headers(h({},g.headers))};return g.rangeEnd&&v.headers.set("Range","bytes="+g.rangeStart+"-"+String(g.rangeEnd-1)),v}function Ql(g){var x=Zl.exec(g);if(x)return parseInt(x[2])-parseInt(x[1])+1}function Od(g){var x=g.get("Content-Range");if(x){var v=Ql(x);if(Q(v))return v}var u=g.get("Content-Length");if(u)return parseInt(u)}function aa(g,x){return new self.Request(g.url,x)}var Jl=function(g){function x(v,u,l){var d;return d=g.call(this,v)||this,d.code=void 0,d.details=void 0,d.code=u,d.details=l,d}return S(x,g),x}(N(Error)),If=/^age:\s*[\d.]+\s*$/im,Of=function(){function g(v){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=v&&v.xhrSetup||null,this.stats=new Xt,this.retryDelay=0}var x=g.prototype;return x.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null},x.abortInternal=function(){var u=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),u&&(u.onreadystatechange=null,u.onprogress=null,u.readyState!==4&&(this.stats.aborted=!0,u.abort()))},x.abort=function(){var u;this.abortInternal(),(u=this.callbacks)!=null&&u.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},x.load=function(u,l,d){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=u,this.config=l,this.callbacks=d,this.loadInternal()},x.loadInternal=function(){var u=this,l=this.config,d=this.context;if(!(!l||!d)){var m=this.loader=new self.XMLHttpRequest,E=this.stats;E.loading.first=0,E.loaded=0,E.aborted=!1;var _=this.xhrSetup;_?Promise.resolve().then(function(){if(!(u.loader!==m||u.stats.aborted))return _(m,d.url)}).catch(function(C){if(!(u.loader!==m||u.stats.aborted))return m.open("GET",d.url,!0),_(m,d.url)}).then(function(){u.loader!==m||u.stats.aborted||u.openAndSendXhr(m,d,l)}).catch(function(C){var w;(w=u.callbacks)==null||w.onError({code:m.status,text:C.message},d,m,E)}):this.openAndSendXhr(m,d,l)}},x.openAndSendXhr=function(u,l,d){u.readyState||u.open("GET",l.url,!0);var m=l.headers,E=d.loadPolicy,_=E.maxTimeToFirstByteMs,C=E.maxLoadTimeMs;if(m)for(var w in m)u.setRequestHeader(w,m[w]);l.rangeEnd&&u.setRequestHeader("Range","bytes="+l.rangeStart+"-"+(l.rangeEnd-1)),u.onreadystatechange=this.readystatechange.bind(this),u.onprogress=this.loadprogress.bind(this),u.responseType=l.responseType,self.clearTimeout(this.requestTimeout),d.timeout=_&&Q(_)?_:C,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),u.send()},x.readystatechange=function(){var u=this.context,l=this.loader,d=this.stats;if(!(!u||!l)){var m=l.readyState,E=this.config;if(!d.aborted&&m>=2&&(d.loading.first===0&&(d.loading.first=Math.max(self.performance.now(),d.loading.start),E.timeout!==E.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),E.timeout=E.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.loadPolicy.maxLoadTimeMs-(d.loading.first-d.loading.start)))),m===4)){self.clearTimeout(this.requestTimeout),l.onreadystatechange=null,l.onprogress=null;var _=l.status,C=l.responseType==="text"?l.responseText:null;if(_>=200&&_<300){var w=C??l.response;if(w!=null){var k,P;d.loading.end=Math.max(self.performance.now(),d.loading.first);var B=l.responseType==="arraybuffer"?w.byteLength:w.length;d.loaded=d.total=B,d.bwEstimate=d.total*8e3/(d.loading.end-d.loading.first);var M=(k=this.callbacks)==null?void 0:k.onProgress;M&&M(d,u,w,l);var U={url:l.responseURL,data:w,code:_};(P=this.callbacks)==null||P.onSuccess(U,d,u,l);return}}var K=E.loadPolicy.errorRetry,J=d.retry,ae={url:u.url,data:void 0,code:_};if(wl(K,J,!1,ae))this.retry(K);else{var se;ft.error(_+" while loading "+u.url),(se=this.callbacks)==null||se.onError({code:_,text:l.statusText},u,l,d)}}}},x.loadtimeout=function(){if(this.config){var u=this.config.loadPolicy.timeoutRetry,l=this.stats.retry;if(wl(u,l,!0))this.retry(u);else{var d;ft.warn("timeout while loading "+((d=this.context)==null?void 0:d.url));var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))}}},x.retry=function(u){var l=this.context,d=this.stats;this.retryDelay=Ga(u,d.retry),d.retry++,ft.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(l==null?void 0:l.url)+", retrying "+d.retry+"/"+u.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},x.loadprogress=function(u){var l=this.stats;l.loaded=u.loaded,u.lengthComputable&&(l.total=u.total)},x.getCacheAge=function(){var u=null;if(this.loader&&If.test(this.loader.getAllResponseHeaders())){var l=this.loader.getResponseHeader("age");u=l?parseFloat(l):null}return u},x.getResponseHeader=function(u){return this.loader&&new RegExp("^"+u+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(u):null},g}(),Fd={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Aa=D(D({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Of,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Kc,bufferController:Al,capLevelController:kl,errorController:qc,fpsController:vd,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:null,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!1,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!1,certLoadPolicy:{default:Fd},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:Fd},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Us()),{},{subtitleStreamController:void 0,subtitleTrackController:void 0,timelineController:void 0,audioStreamController:void 0,audioTrackController:void 0,emeController:void 0,cmcdController:void 0,contentSteeringController:fv,interstitialsController:void 0});function Us(){return{cueHandler:kr,enableWebVTT:!1,enableIMSC1:!1,enableCEA708Captions:!1,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Hs(g,x,v){if((x.liveSyncDurationCount||x.liveMaxLatencyDurationCount)&&(x.liveSyncDuration||x.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(x.liveMaxLatencyDurationCount!==void 0&&(x.liveSyncDurationCount===void 0||x.liveMaxLatencyDurationCount<=x.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(x.liveMaxLatencyDuration!==void 0&&(x.liveSyncDuration===void 0||x.liveMaxLatencyDuration<=x.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var u=Vs(g),l=["manifest","level","frag"],d=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return l.forEach(function(m){var E=(m==="level"?"playlist":m)+"LoadPolicy",_=x[E]===void 0,C=[];d.forEach(function(w){var k=m+"Loading"+w,P=x[k];if(P!==void 0&&_){C.push(k);var B=u[E].default;switch(x[E]={default:B},w){case"TimeOut":B.maxLoadTimeMs=P,B.maxTimeToFirstByteMs=P;break;case"MaxRetry":B.errorRetry.maxNumRetry=P,B.timeoutRetry.maxNumRetry=P;break;case"RetryDelay":B.errorRetry.retryDelayMs=P,B.timeoutRetry.retryDelayMs=P;break;case"MaxRetryTimeout":B.errorRetry.maxRetryDelayMs=P,B.timeoutRetry.maxRetryDelayMs=P;break}}}),C.length&&v.warn('hls.js config: "'+C.join('", "')+'" setting(s) are deprecated, use "'+E+'": '+En(x[E]))}),D(D({},u),x)}function Vs(g){return g&&typeof g=="object"?Array.isArray(g)?g.map(Vs):Object.keys(g).reduce(function(x,v){return x[v]=Vs(g[v]),x},{}):g}function eu(g,x){var v=g.loader;if(v!==Pf&&v!==Of)x.log("[config]: Custom loader detected, cannot enable progressive streaming"),g.progressive=!1;else{var u=Vn();u&&(g.loader=Pf,g.progressive=!0,g.enableSoftwareAES=!0,x.log("[config]: Progressive streaming enabled, using FetchLoader"))}}var Or={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},oi=function(){function g(v){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=v,this._registerListeners()}var x=g.prototype;return x._registerListeners=function(){var u=this.hls;u.on(j.MANIFEST_LOADING,this.onManifestLoading,this),u.on(j.BUFFER_APPENDED,this.onBufferAppended,this),u.on(j.FRAG_BUFFERED,this.onFragBuffered,this),u.on(j.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var u=this.hls;u.off(j.MANIFEST_LOADING,this.onManifestLoading,this),u.off(j.BUFFER_APPENDED,this.onBufferAppended,this),u.off(j.FRAG_BUFFERED,this.onFragBuffered,this),u.off(j.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},x.getAppendedFrag=function(u,l){var d=this.activePartLists[l];if(d)for(var m=d.length;m--;){var E=d[m];if(!E)break;var _=E.end;if(E.start<=u&&_!==null&&u<=_)return E}return this.getBufferedFrag(u,l)},x.getBufferedFrag=function(u,l){return this.getFragAtPos(u,l,!0)},x.getFragAtPos=function(u,l,d){for(var m=this.fragments,E=Object.keys(m),_=E.length;_--;){var C=m[E[_]];if((C==null?void 0:C.body.type)===l&&(!d||C.buffered)){var w=C.body;if(w.start<=u&&u<=w.end)return w}}return null},x.detectEvictedFragments=function(u,l,d,m,E){var _=this;this.timeRanges&&(this.timeRanges[u]=l);var C=(m==null?void 0:m.fragment.sn)||-1;Object.keys(this.fragments).forEach(function(w){var k=_.fragments[w];if(k&&!(C>=k.body.sn)){if(!k.buffered&&(!k.loaded||E)){k.body.type===d&&_.removeFragment(k.body);return}var P=k.range[u];if(P){if(P.time.length===0){_.removeFragment(k.body);return}P.time.some(function(B){var M=!_.isTimeBuffered(B.startPTS,B.endPTS,l);return M&&_.removeFragment(k.body),M})}}})},x.detectPartialFragments=function(u){var l=this,d=this.timeRanges;if(!(!d||u.frag.sn==="initSegment")){var m=u.frag,E=jn(m),_=this.fragments[E];if(!(!_||_.buffered&&m.gap)){var C=!m.relurl;if(Object.keys(d).forEach(function(k){var P=m.elementaryStreams[k];if(P){var B=d[k],M=C||P.partial===!0;_.range[k]=l.getBufferedTimes(m,u.part,M,B)}}),_.loaded=null,Object.keys(_.range).length){_.buffered=!0;var w=_.body.endList=m.endList||_.body.endList;w&&(this.endListFragments[_.body.type]=_),Gi(_)||this.removeParts(m.sn-1,m.type)}else this.removeFragment(_.body)}}},x.removeParts=function(u,l){var d=this.activePartLists[l];d&&(this.activePartLists[l]=zi(d,function(m){return m.fragment.sn>=u}))},x.fragBuffered=function(u,l){var d=jn(u),m=this.fragments[d];!m&&l&&(m=this.fragments[d]={body:u,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},u.gap&&(this.hasGaps=!0)),m&&(m.loaded=null,m.buffered=!0)},x.getBufferedTimes=function(u,l,d,m){for(var E={time:[],partial:d},_=u.start,C=u.end,w=u.minEndPTS||C,k=u.maxStartPTS||_,P=0;P=B&&w<=M){E.time.push({startPTS:Math.max(_,m.start(P)),endPTS:Math.min(C,m.end(P))});break}else if(_B){var U=Math.max(_,m.start(P)),K=Math.min(C,m.end(P));K>U&&(E.partial=!0,E.time.push({startPTS:U,endPTS:K}))}else if(C<=B)break}return E},x.getPartialFragment=function(u){var l=null,d,m,E,_=0,C=this.bufferPadding,w=this.fragments;return Object.keys(w).forEach(function(k){var P=w[k];P&&Gi(P)&&(m=P.body.start-C,E=P.body.end+C,u>=m&&u<=E&&(d=Math.min(u-m,E-u),_<=d&&(l=P.body,_=d)))}),l},x.isEndListAppended=function(u){var l=this.endListFragments[u];return l!==void 0&&(l.buffered||Gi(l))},x.getState=function(u){var l=jn(u),d=this.fragments[l];return d?d.buffered?Gi(d)?Or.PARTIAL:Or.OK:Or.APPENDING:Or.NOT_LOADED},x.isTimeBuffered=function(u,l,d){for(var m,E,_=0;_=m&&l<=E)return!0;if(l<=m)return!1}return!1},x.onManifestLoading=function(){this.removeAllFragments()},x.onFragLoaded=function(u,l){if(!(l.frag.sn==="initSegment"||l.frag.bitrateTest)){var d=l.frag,m=l.part?null:l,E=jn(d);this.fragments[E]={body:d,appendedPTS:null,loaded:m,buffered:!1,range:Object.create(null)}}},x.onBufferAppended=function(u,l){var d=l.frag,m=l.part,E=l.timeRanges,_=l.type;if(d.sn!=="initSegment"){var C=d.type;if(m){var w=this.activePartLists[C];w||(this.activePartLists[C]=w=[]),w.push(m)}this.timeRanges=E;var k=E[_];this.detectEvictedFragments(_,k,C,m)}},x.onFragBuffered=function(u,l){this.detectPartialFragments(l)},x.hasFragment=function(u){var l=jn(u);return!!this.fragments[l]},x.hasFragments=function(u){var l=this.fragments,d=Object.keys(l);if(!u)return d.length>0;for(var m=d.length;m--;){var E=l[d[m]];if((E==null?void 0:E.body.type)===u)return!0}return!1},x.hasParts=function(u){var l;return!!((l=this.activePartLists[u])!=null&&l.length)},x.removeFragmentsInRange=function(u,l,d,m,E){var _=this;m&&!this.hasGaps||Object.keys(this.fragments).forEach(function(C){var w=_.fragments[C];if(w){var k=w.body;k.type!==d||m&&!k.gap||k.startu&&(w.buffered||E)&&_.removeFragment(k)}})},x.removeFragment=function(u){var l=jn(u);u.clearElementaryStreamInfo();var d=this.activePartLists[u.type];if(d){var m=u.sn;this.activePartLists[u.type]=zi(d,function(E){return E.fragment.sn!==m})}delete this.fragments[l],u.endList&&delete this.endListFragments[u.type]},x.removeAllFragments=function(){var u,l;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;var d=(u=this.hls)==null||(l=u.latestLevelDetails)==null?void 0:l.partList;d&&d.forEach(function(m){return m.clearElementaryStreamInfo()})},g}();function Gi(g){var x,v,u;return g.buffered&&(g.body.gap||((x=g.range.video)==null?void 0:x.partial)||((v=g.range.audio)==null?void 0:v.partial)||((u=g.range.audiovideo)==null?void 0:u.partial))}function jn(g){return g.type+"_"+g.level+"_"+g.sn}function zi(g,x){return g.filter(function(v){var u=x(v);return u||v.clearElementaryStreamInfo(),u})}var ka=Math.pow(2,17),Md=function(){function g(v){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=v}var x=g.prototype;return x.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},x.abort=function(){this.loader&&this.loader.abort()},x.load=function(u,l){var d=this,m=u.url;if(!m)return Promise.reject(new Kr({type:ve.NETWORK_ERROR,details:re.FRAG_LOAD_ERROR,fatal:!1,frag:u,error:new Error("Fragment does not have a "+(m?"part list":"url")),networkDetails:null}));this.abort();var E=this.config,_=E.fLoader,C=E.loader;return new Promise(function(w,k){if(d.loader&&d.loader.destroy(),u.gap)if(u.tagList.some(function(J){return J[0]==="GAP"})){k(ru(u));return}else u.gap=!1;var P=d.loader=_?new _(E):new C(E),B=tu(u);u.loader=P;var M=na(E.fragLoadPolicy.default),U={loadPolicy:M,timeout:M.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:u.sn==="initSegment"?1/0:ka};u.stats=P.stats;var K={onSuccess:function(ae,se,ie,ue){d.resetLoader(u,P);var Le=ae.data;ie.resetIV&&u.decryptdata&&(u.decryptdata.iv=new Uint8Array(Le.slice(0,16)),Le=Le.slice(16)),w({frag:u,part:null,payload:Le,networkDetails:ue})},onError:function(ae,se,ie,ue){d.resetLoader(u,P),k(new Kr({type:ve.NETWORK_ERROR,details:re.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:D({url:m,data:void 0},ae),error:new Error("HTTP Error "+ae.code+" "+ae.text),networkDetails:ie,stats:ue}))},onAbort:function(ae,se,ie){d.resetLoader(u,P),k(new Kr({type:ve.NETWORK_ERROR,details:re.INTERNAL_ABORTED,fatal:!1,frag:u,error:new Error("Aborted"),networkDetails:ie,stats:ae}))},onTimeout:function(ae,se,ie){d.resetLoader(u,P),k(new Kr({type:ve.NETWORK_ERROR,details:re.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,error:new Error("Timeout after "+U.timeout+"ms"),networkDetails:ie,stats:ae}))}};l&&(K.onProgress=function(J,ae,se,ie){return l({frag:u,part:null,payload:se,networkDetails:ie})}),P.load(B,U,K)})},x.loadPart=function(u,l,d){var m=this;this.abort();var E=this.config,_=E.fLoader,C=E.loader;return new Promise(function(w,k){if(m.loader&&m.loader.destroy(),u.gap||l.gap){k(ru(u,l));return}var P=m.loader=_?new _(E):new C(E),B=tu(u,l);u.loader=P;var M=na(E.fragLoadPolicy.default),U={loadPolicy:M,timeout:M.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ka};l.stats=P.stats,P.load(B,U,{onSuccess:function(J,ae,se,ie){m.resetLoader(u,P),m.updateStatsFromPart(u,l);var ue={frag:u,part:l,payload:J.data,networkDetails:ie};d(ue),w(ue)},onError:function(J,ae,se,ie){m.resetLoader(u,P),k(new Kr({type:ve.NETWORK_ERROR,details:re.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:l,response:D({url:B.url,data:void 0},J),error:new Error("HTTP Error "+J.code+" "+J.text),networkDetails:se,stats:ie}))},onAbort:function(J,ae,se){u.stats.aborted=l.stats.aborted,m.resetLoader(u,P),k(new Kr({type:ve.NETWORK_ERROR,details:re.INTERNAL_ABORTED,fatal:!1,frag:u,part:l,error:new Error("Aborted"),networkDetails:se,stats:J}))},onTimeout:function(J,ae,se){m.resetLoader(u,P),k(new Kr({type:ve.NETWORK_ERROR,details:re.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:l,error:new Error("Timeout after "+U.timeout+"ms"),networkDetails:se,stats:J}))}})})},x.updateStatsFromPart=function(u,l){var d=u.stats,m=l.stats,E=m.total;if(d.loaded+=m.loaded,E){var _=Math.round(u.duration/l.duration),C=Math.min(Math.round(d.loaded/E),_),w=_-C,k=w*Math.round(d.loaded/C);d.total=d.loaded+k}else d.total=Math.max(d.loaded,d.total);var P=d.loading,B=m.loading;P.start?P.first+=B.first-B.start:(P.start=B.start,P.first=B.first),P.end=B.end},x.resetLoader=function(u,l){u.loader=null,this.loader===l&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),l.destroy()},g}();function tu(g,x){x===void 0&&(x=null);var v=x||g,u={frag:g,part:x,responseType:"arraybuffer",url:v.url,headers:{},rangeStart:0,rangeEnd:0},l=v.byteRangeStartOffset,d=v.byteRangeEndOffset;if(Q(l)&&Q(d)){var m,E=l,_=d;if(g.sn==="initSegment"&&Qn((m=g.decryptdata)==null?void 0:m.method)){var C=d-l;C%16&&(_=d+(16-C%16)),l!==0&&(u.resetIV=!0,E=l-16)}u.rangeStart=E,u.rangeEnd=_}return u}function ru(g,x){var v=new Error("GAP "+(g.gap?"tag":"attribute")+" found"),u={type:ve.MEDIA_ERROR,details:re.FRAG_GAP,fatal:!1,frag:g,error:v,networkDetails:null};return x&&(u.part=x),(x||g).stats.aborted=!0,new Kr(u)}function Qn(g){return g==="AES-128"||g==="AES-256"}var Kr=function(g){function x(v){var u;return u=g.call(this,v.error.message)||this,u.data=void 0,u.data=v,u}return S(x,g),x}(N(Error)),Fr=function(g){function x(u,l){var d;return d=g.call(this,u,l)||this,d._boundTick=void 0,d._tickTimer=null,d._tickInterval=null,d._tickCallCount=0,d._boundTick=d.tick.bind(d),d}S(x,g);var v=x.prototype;return v.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},v.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},v.onHandlerDestroyed=function(){},v.hasInterval=function(){return!!this._tickInterval},v.hasNextTick=function(){return!!this._tickTimer},v.setInterval=function(l){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,l),!0)},v.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},v.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},v.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},v.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},v.doTick=function(){},x}(_e),li=function(x,v,u,l,d,m){l===void 0&&(l=0),d===void 0&&(d=-1),m===void 0&&(m=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=jo(),this.buffering={audio:jo(),video:jo(),audiovideo:jo()},this.level=x,this.sn=v,this.id=u,this.size=l,this.part=d,this.partial=m};function jo(){return{start:0,executeStart:0,executeEnd:0,end:0}}function js(g,x){for(var v=0,u=g.length;vg.startCC)}function nu(g,x){if(g){var v=g.start+x;g.start=g.startPTS=v,g.endPTS=v+g.duration}}function Mf(g,x){for(var v=x.fragments,u=0,l=v.length;uK.end){var ie=U>se;(Uue&&(_.lastCurrentTime=U),!_.loadingParts){var Le=Math.max(K.end,U),me=_.shouldLoadParts(_.getLevelDetails(),Le);me&&(_.log("LL-Part loading ON after seeking to "+U.toFixed(2)+" with buffer @"+Le.toFixed(2)),_.loadingParts=me)}}!_.hls.hasEnoughToStart&&!K.len&&(_.log("setting startPosition to "+U+" because of seek before start"),_.nextLoadPosition=_.startPosition=U),_.tickImmediate()},_.onMediaEnded=function(){_.log("setting startPosition to 0 because media ended"),_.startPosition=_.lastCurrentTime=0},_.playlistType=E,_.hls=u,_.fragmentLoader=new Md(u.config),_.keyLoader=d,_.fragmentTracker=l,_.config=u.config,_.decrypter=new Os(u.config),_}S(x,g);var v=x.prototype;return v.registerListeners=function(){var l=this.hls;l.on(j.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(j.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(j.MANIFEST_LOADING,this.onManifestLoading,this),l.on(j.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(j.ERROR,this.onError,this)},v.unregisterListeners=function(){var l=this.hls;l.off(j.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(j.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(j.MANIFEST_LOADING,this.onManifestLoading,this),l.off(j.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(j.ERROR,this.onError,this)},v.doTick=function(){this.onTickEnd()},v.onTickEnd=function(){},v.startLoad=function(l){},v.stopLoad=function(){if(this.state!==ot.STOPPED){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var l=this.fragCurrent;l!=null&&l.loader&&(l.abortRequests(),this.fragmentTracker.removeFragment(l)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ot.STOPPED}},v.pauseBuffering=function(){this.buffering=!1},v.resumeBuffering=function(){this.buffering=!0},v._streamEnded=function(l,d){if(d.live||!this.media)return!1;var m=l.end||0,E=this.config.timelineOffset||0;if(m<=E)return!1;var _=l.nextStart,C=_&&_>E&&_0&&k!=null&&k.key&&k.iv&&Hi(k.method)){var P=self.performance.now();return m.decrypter.decrypt(new Uint8Array(w),k.key.buffer,k.iv.buffer,Dl(k.method)).catch(function(B){throw _.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.FRAG_DECRYPT_ERROR,fatal:!1,error:B,reason:B.message,frag:C}),B}).then(function(B){var M=self.performance.now();return _.trigger(j.FRAG_DECRYPTED,{frag:C,payload:B,stats:{tstart:P,tdecrypt:M}}),E.payload=B,m.completeInitSegmentLoad(E)})}return m.completeInitSegmentLoad(E)}).catch(function(E){m.state===ot.STOPPED||m.state===ot.ERROR||(m.warn(E),m.resetFragmentLoading(l))})},v.completeInitSegmentLoad=function(l){var d=this.levels;if(!d)throw new Error("init load aborted, missing levels");var m=l.frag.stats;this.state!==ot.STOPPED&&(this.state=ot.IDLE),l.frag.data=new Uint8Array(l.payload),m.parsing.start=m.buffering.start=self.performance.now(),m.parsing.end=m.buffering.end=self.performance.now(),this.tick()},v.fragContextChanged=function(l){var d=this.fragCurrent;return!l||!d||l.sn!==d.sn||l.level!==d.level},v.fragBufferedComplete=function(l,d){var m=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered "+l.type+" sn: "+l.sn+(d?" part: "+d.index:"")+" of "+this.fragInfo(l,!1,d)+" > buffer:"+(m?Bf.toString(yr.getBuffered(m)):"(detached)")+")"),Sr(l)){var E;if(l.type!==X.SUBTITLE){var _=l.elementaryStreams;if(!Object.keys(_).some(function(w){return!!_[w]})){this.state=ot.IDLE;return}}var C=(E=this.levels)==null?void 0:E[l.level];C!=null&&C.fragmentError&&(this.log("Resetting level fragment error count of "+C.fragmentError+" on frag buffered"),C.fragmentError=0)}this.state=ot.IDLE},v._handleFragmentLoadComplete=function(l){var d=this.transmuxer;if(d){var m=l.frag,E=l.part,_=l.partsLoaded,C=!_||_.length===0||_.some(function(k){return!k}),w=new li(m.level,m.sn,m.stats.chunkCount+1,0,E?E.index:-1,!C);d.flush(w)}},v._handleFragmentLoadProgress=function(l){},v._doFragLoad=function(l,d,m,E){var _,C=this;m===void 0&&(m=null),this.fragCurrent=l;var w=d==null?void 0:d.details;if(!this.levels||!w)throw new Error("frag load aborted, missing level"+(w?"":" detail")+"s");var k=null;l.encrypted&&!((_=l.decryptdata)!=null&&_.key)?(this.log("Loading key for "+l.sn+" of ["+w.startSN+"-"+w.endSN+"], "+this.playlistLabel()+" "+l.level),this.state=ot.KEY_LOADING,this.fragCurrent=l,k=this.keyLoader.load(l).then(function(ie){if(!C.fragContextChanged(ie.frag))return C.hls.trigger(j.KEY_LOADED,ie),C.state===ot.KEY_LOADING&&(C.state=ot.IDLE),ie}),this.hls.trigger(j.KEY_LOADING,{frag:l}),this.fragCurrent===null&&(k=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!l.encrypted&&w.encryptedFragments.length&&this.keyLoader.loadClear(l,w.encryptedFragments);var P=this.fragPrevious;if(Sr(l)&&(!P||l.sn!==P.sn)){var B=this.shouldLoadParts(d.details,l.end);B!==this.loadingParts&&(this.log("LL-Part loading "+(B?"ON":"OFF")+" loading sn "+(P==null?void 0:P.sn)+"->"+l.sn),this.loadingParts=B)}if(m=Math.max(l.start,m||0),this.loadingParts&&Sr(l)){var M=w.partList;if(M&&E){m>l.end&&w.fragmentHint&&(l=w.fragmentHint);var U=this.getNextPart(M,l,m);if(U>-1){var K=M[U];l=this.fragCurrent=K.fragment,this.log("Loading "+l.type+" sn: "+l.sn+" part: "+K.index+" ("+U+"/"+(M.length-1)+") of "+this.fragInfo(l,!1,K)+") cc: "+l.cc+" ["+w.startSN+"-"+w.endSN+"], target: "+parseFloat(m.toFixed(3))),this.nextLoadPosition=K.start+K.duration,this.state=ot.FRAG_LOADING;var J;return k?J=k.then(function(ie){return!ie||C.fragContextChanged(ie.frag)?null:C.doFragPartsLoad(l,K,d,E)}).catch(function(ie){return C.handleFragLoadError(ie)}):J=this.doFragPartsLoad(l,K,d,E).catch(function(ie){return C.handleFragLoadError(ie)}),this.hls.trigger(j.FRAG_LOADING,{frag:l,part:K,targetBufferTime:m}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):J}else if(!l.url||this.loadedEndOfParts(M,m))return Promise.resolve(null)}}if(Sr(l)&&this.loadingParts)this.log("LL-Part loading OFF after next part miss @"+m.toFixed(2)),this.loadingParts=!1;else if(!l.url)return Promise.resolve(null);this.log("Loading "+l.type+" sn: "+l.sn+" of "+this.fragInfo(l,!1)+") cc: "+l.cc+" "+(w?"["+w.startSN+"-"+w.endSN+"]":"")+", target: "+parseFloat(m.toFixed(3))),Q(l.sn)&&!this.bitrateTest&&(this.nextLoadPosition=l.start+l.duration),this.state=ot.FRAG_LOADING;var ae=this.config.progressive,se;return ae&&k?se=k.then(function(ie){return!ie||C.fragContextChanged(ie==null?void 0:ie.frag)?null:C.fragmentLoader.load(l,E)}).catch(function(ie){return C.handleFragLoadError(ie)}):se=Promise.all([this.fragmentLoader.load(l,ae?E:void 0),k]).then(function(ie){var ue=ie[0];return!ae&&ue&&E&&E(ue),ue}).catch(function(ie){return C.handleFragLoadError(ie)}),this.hls.trigger(j.FRAG_LOADING,{frag:l,targetBufferTime:m}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):se},v.doFragPartsLoad=function(l,d,m,E){var _=this;return new Promise(function(C,w){var k,P=[],B=(k=m.details)==null?void 0:k.partList,M=function(K){_.fragmentLoader.loadPart(l,K,E).then(function(J){P[K.index]=J;var ae=J.part;_.hls.trigger(j.FRAG_LOADED,J);var se=dd(m.details,l.sn,K.index+1)||hd(B,l.sn,K.index+1);if(se)M(se);else return C({frag:l,part:ae,partsLoaded:P})}).catch(w)};M(d)})},v.handleFragLoadError=function(l){if("data"in l){var d=l.data;l.data&&d.details===re.INTERNAL_ABORTED?this.handleFragLoadAborted(d.frag,d.part):this.hls.trigger(j.ERROR,d)}else this.hls.trigger(j.ERROR,{type:ve.OTHER_ERROR,details:re.INTERNAL_EXCEPTION,err:l,error:l,fatal:!0});return null},v._handleTransmuxerFlush=function(l){var d=this.getCurrentContext(l);if(!d||this.state!==ot.PARSING){!this.fragCurrent&&this.state!==ot.STOPPED&&this.state!==ot.ERROR&&(this.state=ot.IDLE);return}var m=d.frag,E=d.part,_=d.level,C=self.performance.now();m.stats.parsing.end=C,E&&(E.stats.parsing.end=C);var w=this.getLevelDetails(),k=w&&m.sn>w.endSN,P=k||this.shouldLoadParts(w,m.end);P!==this.loadingParts&&(this.log("LL-Part loading "+(P?"ON":"OFF")+" after parsing segment ending @"+m.end.toFixed(2)),this.loadingParts=P),this.updateLevelTiming(m,E,_,l.partial)},v.shouldLoadParts=function(l,d){if(this.config.lowLatencyMode){if(!l)return this.loadingParts;if(l!=null&&l.partList){var m,E=l.partList[0],_=E.end+(((m=l.fragmentHint)==null?void 0:m.duration)||0);if(d>=_){var C,w=this.hls.hasEnoughToStart?((C=this.media)==null?void 0:C.currentTime)||this.lastCurrentTime:this.getLoadPosition();if(w>E.start-E.fragment.duration)return!0}}}return!1},v.getCurrentContext=function(l){var d=this.levels,m=this.fragCurrent,E=l.level,_=l.sn,C=l.part;if(!(d!=null&&d[E]))return this.warn("Levels object was unset while buffering fragment "+_+" of "+this.playlistLabel()+" "+E+". The current chunk will not be buffered."),null;var w=d[E],k=w.details,P=C>-1?dd(k,_,C):null,B=P?P.fragment:cd(k,_,m);return B?(m&&m!==B&&(B.stats=m.stats),{frag:B,part:P,level:w}):null},v.bufferFragmentData=function(l,d,m,E,_){var C;if(!(!l||this.state!==ot.PARSING)){var w=l.data1,k=l.data2,P=w;if(w&&k&&(P=Kt(w,k)),!!((C=P)!=null&&C.length)){var B={type:l.type,frag:d,part:m,chunkMeta:E,parent:d.type,data:P};if(this.hls.trigger(j.BUFFER_APPENDING,B),l.dropped&&l.independent&&!m){if(_)return;this.flushBufferGap(d)}}}},v.flushBufferGap=function(l){var d=this.media;if(d){if(!yr.isBuffered(d,d.currentTime)){this.flushMainBuffer(0,l.start);return}var m=d.currentTime,E=yr.bufferInfo(d,m,0),_=l.duration,C=Math.min(this.config.maxFragLookUpTolerance*2,_*.25),w=Math.max(Math.min(l.start-C,E.end-C),m+C);l.start-w>C&&this.flushMainBuffer(w,l.start)}},v.getFwdBufferInfo=function(l,d){var m,E=this.getLoadPosition();if(!Q(E))return null;var _=this.lastCurrentTime>E,C=_||(m=this.media)!=null&&m.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(l,E,d,C)},v.getFwdBufferInfoAtPos=function(l,d,m,E){var _=yr.bufferInfo(l,d,E);if(_.len===0&&_.nextStart!==void 0){var C=this.fragmentTracker.getBufferedFrag(d,m);if(C&&(_.nextStart<=C.end||C.gap)){var w=Math.max(Math.min(_.nextStart,C.end)-d,E);return yr.bufferInfo(l,d,w)}}return _},v.getMaxBufferLength=function(l){var d=this.config,m;return l?m=Math.max(8*d.maxBufferSize/l,d.maxBufferLength):m=d.maxBufferLength,Math.min(m,d.maxMaxBufferLength)},v.reduceMaxBufferLength=function(l,d){var m=this.config,E=Math.max(Math.min(l-d,m.maxBufferLength),d),_=Math.max(l-d*3,m.maxMaxBufferLength/2,E);return _>=E?(m.maxMaxBufferLength=_,this.warn("Reduce max buffer length to "+_+"s"),!0):!1},v.getAppendedFrag=function(l,d){var m;d===void 0&&(d=X.MAIN);var E=(m=this.fragmentTracker)==null?void 0:m.getAppendedFrag(l,d);return E&&"fragment"in E?E.fragment:E},v.getNextFragment=function(l,d){var m=d.fragments,E=m.length;if(!E)return null;var _=this.config,C=m[0].start,w=_.lowLatencyMode&&!!d.partList,k=null;if(d.live){var P=_.initialLiveManifestSize;if(E=C?M:U)||k.start:l;this.log("Setting startPosition to "+K+" to match start frag at live edge. mainStart: "+M+" liveSyncPosition: "+U+" frag.start: "+((B=k)==null?void 0:B.start)),this.startPosition=this.nextLoadPosition=K}}else l<=C&&(k=m[0]);if(!k){var J=this.loadingParts?d.partEnd:d.fragmentEnd;k=this.getFragmentAtPosition(l,J,d)}var ae=this.filterReplacedPrimary(k,d);if(!ae&&k){var se=k.sn-d.startSN;ae=this.filterReplacedPrimary(m[se+1]||null,d)}return this.mapToInitFragWhenRequired(ae)},v.isLoopLoading=function(l,d){var m=this.fragmentTracker.getState(l);return(m===Or.OK||m===Or.PARTIAL&&!!l.gap)&&this.nextLoadPosition>d},v.getNextFragmentLoopLoading=function(l,d,m,E,_){var C=null;if(l.gap&&(C=this.getNextFragment(this.nextLoadPosition,d),C&&!C.gap&&m.nextStart)){var w=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,m.nextStart,E,0);if(w!==null&&m.len+w.len>=_){var k=C.sn;return this.loopSn!==k&&(this.log('buffer full after gaps in "'+E+'" playlist starting at sn: '+k),this.loopSn=k),null}}return this.loopSn=void 0,C},v.filterReplacedPrimary=function(l,d){return l&&(zo(this.hls.config),l)},v.mapToInitFragWhenRequired=function(l){return l!=null&&l.initSegment&&!(l!=null&&l.initSegment.data)&&!this.bitrateTest?l.initSegment:l},v.getNextPart=function(l,d,m){for(var E=-1,_=!1,C=!0,w=0,k=l.length;w-1&&mm.start&&m.loaded},v.getInitialLiveFragment=function(l,d){var m=this.fragPrevious,E=null;if(m){if(l.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+m.programDateTime),E=Yc(d,m.endProgramDateTime,this.config.maxFragLookUpTolerance)),!E){var _=m.sn+1;if(_>=l.startSN&&_<=l.endSN){var C=d[_-l.startSN];m.cc===C.cc&&(E=C,this.log("Live playlist, switching playlist, load frag with next SN: "+E.sn))}E||(E=Sa(d,m.cc),E&&this.log("Live playlist, switching playlist, load frag with same CC: "+E.sn))}}else{var w=this.hls.liveSyncPosition;w!==null&&(E=this.getFragmentAtPosition(w,this.bitrateTest?l.fragmentEnd:l.edge,l))}return E},v.getFragmentAtPosition=function(l,d,m){var E=this.config,_=this.fragPrevious,C=m.fragments,w=m.endSN,k=m.fragmentHint,P=E.maxFragLookUpTolerance,B=m.partList,M=!!(this.loadingParts&&B!=null&&B.length&&k);M&&k&&!this.bitrateTest&&B[B.length-1].fragment.sn===k.sn&&(C=C.concat(k),w=k.sn);var U;if(ld-P||(K=this.media)!=null&&K.paused||!this.startFragRequested?0:P;U=Cl(_,C,l,ae)}else U=C[C.length-1];if(U){var se=U.sn-m.startSN,ie=this.fragmentTracker.getState(U);if((ie===Or.OK||ie===Or.PARTIAL&&U.gap)&&(_=U),_&&U.sn===_.sn&&(!M||B[0].fragment.sn>U.sn||!m.live&&!M)){var ue=_&&U.level===_.level;if(ue){var Le=C[se+1];U.sn"+l.startSN+" fragments: "+E),k}return _},v.waitForCdnTuneIn=function(l){var d=3;return l.live&&l.canBlockReload&&l.partTarget&&l.tuneInGoal>Math.max(l.partHoldBack,l.partTarget*d)},v.setStartPosition=function(l,d){var m=this.startPosition;m=0&&(m=this.nextLoadPosition),m},v.handleFragLoadAborted=function(l,d){this.transmuxer&&l.type===this.playlistType&&Sr(l)&&l.stats.aborted&&(this.warn("Fragment "+l.sn+(d?" part "+d.index:"")+" of "+this.playlistLabel()+" "+l.level+" was aborted"),this.resetFragmentLoading(l))},v.resetFragmentLoading=function(l){(!this.fragCurrent||!this.fragContextChanged(l)&&this.state!==ot.FRAG_LOADING_WAITING_RETRY)&&(this.state=ot.IDLE)},v.onFragmentOrKeyLoadError=function(l,d){if(d.chunkMeta&&!d.frag){var m=this.getCurrentContext(d.chunkMeta);m&&(d.frag=m.frag)}var E=d.frag;if(!(!E||E.type!==l||!this.levels)){if(this.fragContextChanged(E)){var _;this.warn("Frag load error must match current frag to retry "+E.url+" > "+((_=this.fragCurrent)==null?void 0:_.url));return}var C=d.details===re.FRAG_GAP;C&&this.fragmentTracker.fragBuffered(E,!0);var w=d.errorAction,k=w||{},P=k.action,B=k.flags,M=k.retryCount,U=M===void 0?0:M,K=k.retryConfig,J=!!w&&!!K,ae=J&&P===qr.RetryRequest,se=J&&!w.resolved&&B===Ti.MoveAllAlternatesMatchingHost;if(!ae&&se&&Sr(E)&&!E.endList)this.resetFragmentErrors(l),this.treatAsGap(E),w.resolved=!0;else if((ae||se)&&U.5;_&&this.reduceMaxBufferLength(E.len,(d==null?void 0:d.duration)||10);var C=!_;return C&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+m+" buffer"),d&&(this.fragmentTracker.removeFragment(d),this.nextLoadPosition=d.start),this.resetLoadingState(),C}return!1},v.resetFragmentErrors=function(l){l===X.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==ot.STOPPED&&(this.state=ot.IDLE)},v.afterBufferFlushed=function(l,d,m){if(l){var E=yr.getBuffered(l);this.fragmentTracker.detectEvictedFragments(d,E,m),this.state===ot.ENDED&&this.resetLoadingState()}},v.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==ot.STOPPED&&(this.state=ot.IDLE)},v.resetStartWhenNotLoaded=function(l){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;var d=l?l.details:null;d!=null&&d.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(d,d.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},v.resetWhenMissingContext=function(l){this.warn("The loading context changed while buffering fragment "+l.sn+" of "+this.playlistLabel()+" "+l.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()},v.removeUnbufferedFrags=function(l){l===void 0&&(l=0),this.fragmentTracker.removeFragmentsInRange(l,1/0,this.playlistType,!1,!0)},v.updateLevelTiming=function(l,d,m,E){var _=this,C=m.details;if(!C){this.warn("level.details undefined");return}var w=Object.keys(l.elementaryStreams).reduce(function(B,M){var U=l.elementaryStreams[M];if(U){var K=U.endPTS-U.startPTS;if(K<=0)return _.warn("Could not parse fragment "+l.sn+" "+M+" duration reliably ("+K+")"),B||!1;var J=E?0:Fl(C,l,U.startPTS,U.endPTS,U.startDTS,U.endDTS);return _.hls.trigger(j.LEVEL_PTS_UPDATED,{details:C,level:m,drift:J,type:M,frag:l,start:U.startPTS,end:U.endPTS}),!0}return B},!1);if(!w){var k;if(m.fragmentError===0&&this.treatAsGap(l,m),((k=this.transmuxer)==null?void 0:k.error)===null){var P=new Error("Found no media in fragment "+l.sn+" of "+this.playlistLabel()+" "+l.level+" resetting transmuxer to fallback to playlist timing");if(this.warn(P.message),this.hls.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.FRAG_PARSING_ERROR,fatal:!1,error:P,frag:l,reason:"Found no media in msn "+l.sn+" of "+this.playlistLabel()+' "'+m.url+'"'}),!this.hls)return;this.resetTransmuxer()}}this.state=ot.PARSED,this.log("Parsed "+l.type+" sn: "+l.sn+(d?" part: "+d.index:"")+" of "+this.fragInfo(l,!1,d)+")"),this.hls.trigger(j.FRAG_PARSED,{frag:l,part:d})},v.playlistLabel=function(){return this.playlistType===X.MAIN?"level":"track"},v.fragInfo=function(l,d,m){var E,_;return d===void 0&&(d=!0),this.playlistLabel()+" "+l.level+" ("+(m?"part":"frag")+":["+((E=d&&!m?l.startPTS:(m||l).start)!=null?E:NaN).toFixed(3)+"-"+((_=d&&!m?l.endPTS:(m||l).end)!=null?_:NaN).toFixed(3)+"]"+(m&&l.type==="main"?"INDEPENDENT="+(m.independent?"YES":"NO"):"")},v.treatAsGap=function(l,d){d&&d.fragmentError++,l.gap=!0,this.fragmentTracker.removeFragment(l),this.fragmentTracker.fragBuffered(l,!0)},v.resetTransmuxer=function(){var l;(l=this.transmuxer)==null||l.reset()},v.recoverWorkerError=function(l){l.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())},s(x,[{key:"startPositionValue",get:function(){var l=this.nextLoadPosition,d=this.startPosition;return d===-1&&l?l:d}},{key:"bufferingEnabled",get:function(){return this.buffering}},{key:"inFlightFrag",get:function(){return{frag:this.fragCurrent,state:this.state}}},{key:"timelineOffset",get:function(){var l=this.config.timelineOffset;if(l){var d;return((d=this.getLevelDetails())==null?void 0:d.appliedTimelineOffset)||l}return 0}},{key:"primaryPrefetch",get:function(){return zo(this.hls.config),!1}},{key:"state",get:function(){return this._state},set:function(l){var d=this._state;d!==l&&(this._state=l,this.log(d+"->"+l))}}])}(Fr);function zo(g){return!1}function zs(g,x,v){ts(g,x,v),g.addEventListener(x,v)}function ts(g,x,v){g.removeEventListener(x,v)}var sa=2,Nd=.1,au=.05,su=100,Ws=function(g){function x(u,l){var d;return d=g.call(this,"gap-controller",u.logger)||this,d.hls=null,d.fragmentTracker=null,d.media=null,d.mediaSource=void 0,d.nudgeRetry=0,d.stallReported=!1,d.stalled=null,d.moved=!1,d.seeking=!1,d.buffered={},d.lastCurrentTime=0,d.ended=0,d.waiting=0,d.onMediaPlaying=function(){d.ended=0,d.waiting=0},d.onMediaWaiting=function(){var m;(m=d.media)!=null&&m.seeking||(d.waiting=self.performance.now(),d.tick())},d.onMediaEnded=function(){if(d.hls){var m;d.ended=((m=d.media)==null?void 0:m.currentTime)||1,d.hls.trigger(j.MEDIA_ENDED,{stalled:!1})}},d.hls=u,d.fragmentTracker=l,d.registerListeners(),d}S(x,g);var v=x.prototype;return v.registerListeners=function(){var l=this.hls;l&&(l.on(j.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(j.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(j.BUFFER_APPENDED,this.onBufferAppended,this))},v.unregisterListeners=function(){var l=this.hls;l&&(l.off(j.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(j.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(j.BUFFER_APPENDED,this.onBufferAppended,this))},v.destroy=function(){g.prototype.destroy.call(this),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0},v.onMediaAttached=function(l,d){this.setInterval(su),this.mediaSource=d.mediaSource;var m=this.media=d.media;zs(m,"playing",this.onMediaPlaying),zs(m,"waiting",this.onMediaWaiting),zs(m,"ended",this.onMediaEnded)},v.onMediaDetaching=function(l,d){this.clearInterval();var m=this.media;m&&(ts(m,"playing",this.onMediaPlaying),ts(m,"waiting",this.onMediaWaiting),ts(m,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0},v.onBufferAppended=function(l,d){this.buffered=d.timeRanges},v.tick=function(){var l;if(!(!((l=this.media)!=null&&l.readyState)||!this.hasBuffered)){var d=this.media.currentTime;this.poll(d,this.lastCurrentTime),this.lastCurrentTime=d}},v.poll=function(l,d){var m,E,_=(m=this.hls)==null?void 0:m.config;if(_){var C=this.media,w=this.stalled;if(C){var k=C.seeking,P=this.seeking&&!k,B=!this.seeking&&k,M=C.paused&&!k||C.ended||C.playbackRate===0;if(this.seeking=k,l!==d){d&&(this.ended=0),this.moved=!0,k||(this.nudgeRetry=0,_.nudgeOnVideoHole&&!M&&l>d&&this.nudgeOnVideoHole(l,d)),this.waiting===0&&this.stallResolved(l);return}if(B||P){P&&this.stallResolved(l);return}if(M){this.nudgeRetry=0,this.stallResolved(l),!this.ended&&C.ended&&this.hls&&(this.ended=l||1,this.hls.trigger(j.MEDIA_ENDED,{stalled:!1}));return}if(!yr.getBuffered(C).length){this.nudgeRetry=0;return}var U=yr.bufferInfo(C,l,0),K=U.nextStart||0,J=this.fragmentTracker;if(k&&J&&this.hls){var ae=ou(this.hls.inFlightFragments,l),se=U.len>sa,ie=!K||ae||K-l>sa&&!J.getPartialFragment(l);if(se||ie)return;this.moved=!1}var ue=(E=this.hls)==null?void 0:E.latestLevelDetails;if(!this.moved&&this.stalled!==null&&J){var Le=U.len>0;if(!Le&&!K)return;var me=Math.max(K,U.start||0)-l,De=!!(ue!=null&&ue.live),Ne=De?ue.targetduration*2:sa,Me=J.getPartialFragment(l);if(me>0&&(me<=Ne||Me)){C.paused||this._trySkipBufferHole(Me);return}}var Pe=_.detectStallWithCurrentTimeMs,Be=self.performance.now(),Ge=this.waiting;if(w===null){Ge>0&&Be-Ge=Pe||Ge)&&this.hls){var et;if(((et=this.mediaSource)==null?void 0:et.readyState)==="ended"&&!(ue!=null&&ue.live)&&Math.abs(l-((ue==null?void 0:ue.edge)||0))<1){if(this.ended)return;this.ended=l||1,this.hls.trigger(j.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(U),!this.media||!this.hls)return}var Ze=yr.bufferInfo(C,l,_.maxBufferHole);this._tryFixBufferStall(Ze,ut)}}},v.stallResolved=function(l){var d=this.stalled;if(d&&this.hls&&(this.stalled=null,this.stallReported)){var m=self.performance.now()-d;this.log("playback not stuck anymore @"+l+", after "+Math.round(m)+"ms"),this.stallReported=!1,this.waiting=0,this.hls.trigger(j.STALL_RESOLVED,{})}},v.nudgeOnVideoHole=function(l,d){var m,E=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(m=this.buffered.audio)!=null&&m.length&&E&&E.length>1&&l>E.end(0)){var _=yr.bufferedInfo(yr.timeRangesToArray(this.buffered.audio),l,0);if(_.len>1&&d>=_.start){var C=yr.timeRangesToArray(E),w=yr.bufferedInfo(C,d,0).bufferedIndex;if(w>-1&&ww)&&B-P<1&&l-P<2){var M=new Error("nudging playhead to flush pipeline after video hole. currentTime: "+l+" hole: "+P+" -> "+B+" buffered index: "+k);this.warn(M.message),this.media.currentTime+=1e-6;var U=this.fragmentTracker.getPartialFragment(l)||void 0,K=yr.bufferInfo(this.media,l,0);this.hls.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:M,reason:M.message,frag:U,buffer:K.len,bufferInfo:K})}}}}},v._tryFixBufferStall=function(l,d){var m,E,_=this.fragmentTracker,C=this.media,w=(m=this.hls)==null?void 0:m.config;if(!(!C||!_||!w)){var k=C.currentTime,P=(E=this.hls)==null?void 0:E.latestLevelDetails,B=_.getPartialFragment(k);if(B||P!=null&&P.live&&k1&&l.len>w.maxBufferHole||l.nextStart&&l.nextStart-kw.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(l))}},v._reportStall=function(l){var d=this.hls,m=this.media,E=this.stallReported,_=this.stalled;if(!E&&_!==null&&m&&d){this.stallReported=!0;var C=new Error("Playback stalling at @"+m.currentTime+" due to low buffer ("+En(l)+")");this.warn(C.message),d.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.BUFFER_STALLED_ERROR,fatal:!1,error:C,buffer:l.len,bufferInfo:l,stalled:{start:_}})}},v._trySkipBufferHole=function(l){var d,m=this.fragmentTracker,E=this.media,_=(d=this.hls)==null?void 0:d.config;if(!E||!m||!_)return 0;var C=E.currentTime,w=yr.bufferInfo(E,C,0),k=C0&&w.len<1&&E.readyState<3,M=k-C;if(M>0&&(P||B)){if(M>_.maxBufferHole){var U=!1;if(C===0){var K=m.getAppendedFrag(0,X.MAIN);K&&k0}}])}(Fr);function ou(g,x){var v=lu(g.main);if(v&&v.start<=x)return v;var u=lu(g.audio);return u&&u.start<=x?u:null}function lu(g){if(!g)return null;switch(g.state){case ot.IDLE:case ot.STOPPED:case ot.ENDED:case ot.ERROR:return null}return g.frag}function Nf(g,x){var v;try{v=new Event("addtrack")}catch{v=document.createEvent("Event"),v.initEvent("addtrack",!1,!1)}v.track=g,x.dispatchEvent(v)}function Uf(g,x){var v=g.mode;if(v==="disabled"&&(g.mode="hidden"),g.cues)for(var u=g.cues.length;u--;)x&&g.cues[u].removeEventListener("enter",x),g.removeCue(g.cues[u]);v==="disabled"&&(g.mode=v)}function $s(g,x,v,u){var l=g.mode;if(l==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var d=rs(g.cues,x,v),m=0;mg[v].endTime)return-1;for(var u=0,l=v,d;u<=l;)if(d=Math.floor((l+u)/2),xg[d].startTime&&u-1)for(var d=l,m=g.length;d=x&&E.endTime<=v)u.push(E);else if(E.startTime>v)return u}return u}var Hf=.25;function uu(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Wi(g,x,v,u,l){var d=new g(x,v,"");try{d.value=u,l&&(d.type=l)}catch{d=new g(x,v,En(l?D({type:l},u):u))}return d}var Li=function(){var g=uu();try{g&&new g(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function Vf(g){return Uint8Array.from(g.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}var Ud=function(){function g(v){var u=this;this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=function(){u.hls&&u.hls.trigger(j.EVENT_CUE_ENTER,{})},this.hls=v,this._registerListeners()}var x=g.prototype;return x.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null},x._registerListeners=function(){var u=this.hls;u.on(j.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(j.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(j.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(j.MANIFEST_LOADING,this.onManifestLoading,this),u.on(j.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),u.on(j.BUFFER_FLUSHING,this.onBufferFlushing,this),u.on(j.LEVEL_UPDATED,this.onLevelUpdated,this),u.on(j.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)},x._unregisterListeners=function(){var u=this.hls;u.off(j.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(j.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(j.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(j.MANIFEST_LOADING,this.onManifestLoading,this),u.off(j.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),u.off(j.BUFFER_FLUSHING,this.onBufferFlushing,this),u.off(j.LEVEL_UPDATED,this.onLevelUpdated,this),u.off(j.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)},x.onMediaAttaching=function(u,l){var d;this.media=l.media,((d=l.overrides)==null?void 0:d.cueRemoval)===!1&&(this.removeCues=!1)},x.onMediaAttached=function(){var u=this.hls.latestLevelDetails;u&&this.updateDateRangeCues(u)},x.onMediaDetaching=function(u,l){this.media=null;var d=!!l.transferMedia;d||(this.id3Track&&(this.removeCues&&Uf(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})},x.onManifestLoading=function(){this.dateRangeCuesAppended={}},x.createTrack=function(u){var l=this.getID3Track(u.textTracks);return l.mode="hidden",l},x.getID3Track=function(u){if(this.media){for(var l=0;lLi&&(M=Li);var U=M-B;U<=0&&(M=B+Hf);for(var K=0;K.01&&this.updateDateRangeCues(l.details)},x.updateDateRangeCues=function(u,l){var d=this;if(!(!this.media||!u.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)){var m=this.id3Track,E=u.dateRanges,_=Object.keys(E),C=this.dateRangeCuesAppended;if(m&&l){var w;if((w=m.cues)!=null&&w.length)for(var k=Object.keys(C).filter(function(ae){return!_.includes(ae)}),P=function(){var se=k[B],ie=C[se].cues;delete C[se],Object.keys(ie).forEach(function(ue){try{var Le=ie[ue];Le.removeEventListener("enter",d.onEventCueEnter),m.removeCue(Le)}catch{}})},B=k.length;B--;)P();else C=this.dateRangeCuesAppended={}}var M=u.fragments[u.fragments.length-1];if(!(_.length===0||!Q(M==null?void 0:M.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var U=uu(),K=function(){var se=_[J],ie=E[se],ue=ie.startTime,Le=C[se],me=(Le==null?void 0:Le.cues)||{},De=(Le==null?void 0:Le.durationKnown)||!1,Ne=Li,Me=ie.duration,Pe=ie.endDate;if(Pe&&Me!==null)Ne=ue+Me,De=!0;else if(ie.endOnNext&&!De){var Be=_.reduce(function(Dt,ar){if(ar!==ie.id){var Gt=E[ar];if(Gt.class===ie.class&&Gt.startDate>ie.startDate&&(!Dt||ie.startDate.01&&(Ze.startTime=ue,Ze.endTime=Ne);else if(U){var ht=ie.attr[et];Qc(et)&&(ht=Vf(ht));var gt={key:et,data:ht},st=Wi(U,ue,Ne,gt,On.dateRange);st&&(st.id=se,d.id3Track.addCue(st),me[et]=st)}}}C[se]={cues:me,dateRange:ie,durationKnown:De}},J=0;J<_.length;J++)K()}}},g}(),oa=function(){function g(v){var u=this;this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=function(){var l=u.media,d=u.levelDetails;if(!(!l||!d)){u.currentTime=l.currentTime;var m=u.computeLatency();if(m!==null){u._latency=m;var E=u.config,_=E.lowLatencyMode,C=E.maxLiveSyncPlaybackRate;if(!(!_||C===1||!d.live)){var w=u.targetLatency;if(w!==null){var k=m-w,P=Math.min(u.maxLatency,w+d.targetduration),B=k.05&&u.forwardBufferLength>1){var M=Math.min(2,Math.max(1,C)),U=Math.round(2/(1+Math.exp(-.75*k-u.edgeStalled))*20)/20,K=Math.min(M,Math.max(1,U));u.changeMediaPlaybackRate(l,K)}else l.playbackRate!==1&&l.playbackRate!==0&&u.changeMediaPlaybackRate(l,1)}}}}},this.hls=v,this.config=v.config,this.registerListeners()}var x=g.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null},x.registerListeners=function(){var u=this.hls;u&&(u.on(j.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(j.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(j.MANIFEST_LOADING,this.onManifestLoading,this),u.on(j.LEVEL_UPDATED,this.onLevelUpdated,this),u.on(j.ERROR,this.onError,this))},x.unregisterListeners=function(){var u=this.hls;u&&(u.off(j.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(j.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(j.MANIFEST_LOADING,this.onManifestLoading,this),u.off(j.LEVEL_UPDATED,this.onLevelUpdated,this),u.off(j.ERROR,this.onError,this))},x.onMediaAttached=function(u,l){this.media=l.media,this.media.addEventListener("timeupdate",this.onTimeupdate)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)},x.onManifestLoading=function(){this._latency=null,this.stallCount=0},x.onLevelUpdated=function(u,l){var d=l.details;d.advanced&&this.onTimeupdate(),!d.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)},x.onError=function(u,l){var d;l.details===re.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(d=this.levelDetails)!=null&&d.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))},x.changeMediaPlaybackRate=function(u,l){var d,m;u.playbackRate!==l&&((d=this.hls)==null||d.logger.debug("[latency-controller]: latency="+this.latency.toFixed(3)+", targetLatency="+((m=this.targetLatency)==null?void 0:m.toFixed(3))+", forwardBufferLength="+this.forwardBufferLength.toFixed(3)+": adjusting playback rate from "+u.playbackRate+" to "+l),u.playbackRate=l)},x.estimateLiveEdge=function(){var u=this.levelDetails;return u===null?null:u.edge+u.age},x.computeLatency=function(){var u=this.estimateLiveEdge();return u===null?null:u-this.currentTime},s(g,[{key:"levelDetails",get:function(){var u;return((u=this.hls)==null?void 0:u.latestLevelDetails)||null}},{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var u=this.config;if(u.liveMaxLatencyDuration!==void 0)return u.liveMaxLatencyDuration;var l=this.levelDetails;return l?u.liveMaxLatencyDurationCount*l.targetduration:0}},{key:"targetLatency",get:function(){var u=this.levelDetails;if(u===null||this.hls===null)return null;var l=u.holdBack,d=u.partHoldBack,m=u.targetduration,E=this.config,_=E.liveSyncDuration,C=E.liveSyncDurationCount,w=E.lowLatencyMode,k=this.hls.userConfig,P=w&&d||l;(this._targetLatencyUpdated||k.liveSyncDuration||k.liveSyncDurationCount||P===0)&&(P=_!==void 0?_:C*m);var B=m;return P+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,B)},set:function(u){this.stallCount=0,this.config.liveSyncDuration=u,this._targetLatencyUpdated=!0}},{key:"liveSyncPosition",get:function(){var u=this.estimateLiveEdge(),l=this.targetLatency;if(u===null||l===null)return null;var d=this.levelDetails;if(d===null)return null;var m=d.edge,E=u-l-this.edgeStalled,_=m-d.totalduration,C=m-(this.config.lowLatencyMode&&d.partTarget||d.targetduration);return Math.min(Math.max(_,E),C)}},{key:"drift",get:function(){var u=this.levelDetails;return u===null?1:u.drift}},{key:"edgeStalled",get:function(){var u=this.levelDetails;if(u===null)return 0;var l=(this.config.lowLatencyMode&&u.partTarget||u.targetduration)*3;return Math.max(u.age-l,0)}},{key:"forwardBufferLength",get:function(){var u=this.media,l=this.levelDetails;if(!u||!l)return 0;var d=u.buffered.length;return(d?u.buffered.end(d-1):l.edge)-this.currentTime}}])}(),La=function(g){function x(u,l){var d;return d=g.call(this,l,u.logger)||this,d.hls=void 0,d.canLoad=!1,d.timer=-1,d.hls=u,d}S(x,g);var v=x.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.clearTimer=function(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)},v.startLoad=function(){this.canLoad=!0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(l,d,m){var E=d==null?void 0:d.renditionReports;if(E){for(var _=-1,C=0;C=0&&U>d.partTarget&&(M+=1)}var K=m&&wo(m);return new bs(B,M>=0?M:void 0,K)}}},v.loadPlaylist=function(l){this.clearTimer()},v.loadingPlaylist=function(l,d){this.clearTimer()},v.shouldLoadPlaylist=function(l){return this.canLoad&&!!l&&!!l.url&&(!l.details||l.details.live)},v.getUrlWithDirectives=function(l,d){if(d)try{return d.addDirectives(l)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}return l},v.playlistLoaded=function(l,d,m){var E=d.details,_=d.stats,C=self.performance.now(),w=_.loading.first?Math.max(0,C-_.loading.first):0;E.advancedDateTime=Date.now()-w;var k=this.hls.config.timelineOffset;if(k!==E.appliedTimelineOffset){var P=Math.max(k||0,0);E.appliedTimelineOffset=P,E.fragments.forEach(function(Dt){Dt.start=Dt.playlistOffset+P})}if(E.live||m!=null&&m.live){var B="levelInfo"in d?d.levelInfo:d.track;if(E.reloaded(m),m&&E.fragments.length>0){sv(m,E);var M=E.playlistParsingError;if(M){this.warn(M);var U=this.hls;if(!U.config.ignorePlaylistParsingErrors){var K,J=d.networkDetails;U.trigger(j.ERROR,{type:ve.NETWORK_ERROR,details:re.LEVEL_PARSING_ERROR,fatal:!1,url:E.url,error:M,reason:M.message,level:d.level||void 0,parent:(K=E.fragments[0])==null?void 0:K.type,networkDetails:J,stats:_});return}E.playlistParsingError=null}}E.requestScheduled===-1&&(E.requestScheduled=_.loading.start);var ae=this.hls.mainForwardBufferInfo,se=ae?ae.end-ae.len:0,ie=(E.edge-se)*1e3,ue=fd(E,ie);if(E.requestScheduled+ue0){if(Ze>E.targetduration*3)this.log("Playlist last advanced "+et.toFixed(2)+"s ago. Omitting segment and part directives."),me=void 0,De=void 0;else if(m!=null&&m.tuneInGoal&&Ze-E.partTarget>m.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+m.tuneInGoal+" to: "+ht+" with playlist age: "+E.age),ht=0;else{var gt=Math.floor(ht/E.targetduration);if(me+=gt,De!==void 0){var st=Math.round(ht%E.targetduration/E.partTarget);De+=st}this.log("CDN Tune-in age: "+E.ageHeader+"s last advanced "+et.toFixed(2)+"s goal: "+ht+" skip sn "+gt+" to part "+De)}E.tuneInGoal=ht}if(Le=this.getDeliveryDirectives(E,d.deliveryDirectives,me,De),Ne||!ut){E.requestScheduled=C,this.loadingPlaylist(B,Le);return}}else(E.canBlockReload||E.canSkipUntil)&&(Le=this.getDeliveryDirectives(E,d.deliveryDirectives,me,De));Le&&me!==void 0&&E.canBlockReload&&(E.requestScheduled=_.loading.first+Math.max(ue-w*2,ue/2)),this.scheduleLoading(B,Le,E)}else this.clearTimer()},v.scheduleLoading=function(l,d,m){var E=this,_=m||l.details;if(!_){this.loadingPlaylist(l,d);return}var C=self.performance.now(),w=_.requestScheduled;if(C>=w){this.loadingPlaylist(l,d);return}var k=w-C;this.log("reload live playlist "+(l.name||l.bitrate+"bps")+" in "+Math.round(k)+" ms"),this.clearTimer(),this.timer=self.setTimeout(function(){return E.loadingPlaylist(l,d)},k)},v.getDeliveryDirectives=function(l,d,m,E){var _=wo(l);return d!=null&&d.skip&&l.deltaUpdateFailed&&(m=d.msn,E=d.part,_=ja.No),new bs(m,E,_)},v.checkRetry=function(l){var d=this,m=l.details,E=bi(l),_=l.errorAction,C=_||{},w=C.action,k=C.retryCount,P=k===void 0?0:k,B=C.retryConfig,M=!!_&&!!B&&(w===qr.RetryRequest||!_.resolved&&w===qr.SendAlternateToPenaltyBox);if(M){var U;if(P>=B.maxNumRetry)return!1;if(E&&(U=l.context)!=null&&U.deliveryDirectives)this.warn("Retrying playlist loading "+(P+1)+"/"+B.maxNumRetry+' after "'+m+'" without delivery-directives'),this.loadPlaylist();else{var K=Ga(B,P);this.clearTimer(),this.timer=self.setTimeout(function(){return d.loadPlaylist()},K),this.warn("Retrying playlist loading "+(P+1)+"/"+B.maxNumRetry+' after "'+m+'" in '+K+"ms")}l.levelRetry=!0,_.resolved=!0}return M},x}(_e),fu=function(g){function x(u,l){var d;return d=g.call(this,u,"level-controller")||this,d._levels=[],d._firstLevel=-1,d._maxAutoLevel=-1,d._startLevel=void 0,d.currentLevel=null,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.steering=void 0,d.onParsedComplete=void 0,d.steering=l,d._registerListeners(),d}S(x,g);var v=x.prototype;return v._registerListeners=function(){var l=this.hls;l.on(j.MANIFEST_LOADING,this.onManifestLoading,this),l.on(j.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(j.LEVEL_LOADED,this.onLevelLoaded,this),l.on(j.LEVELS_UPDATED,this.onLevelsUpdated,this),l.on(j.FRAG_BUFFERED,this.onFragBuffered,this),l.on(j.ERROR,this.onError,this)},v._unregisterListeners=function(){var l=this.hls;l.off(j.MANIFEST_LOADING,this.onManifestLoading,this),l.off(j.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(j.LEVEL_LOADED,this.onLevelLoaded,this),l.off(j.LEVELS_UPDATED,this.onLevelsUpdated,this),l.off(j.FRAG_BUFFERED,this.onFragBuffered,this),l.off(j.ERROR,this.onError,this)},v.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),g.prototype.destroy.call(this)},v.stopLoad=function(){var l=this._levels;l.forEach(function(d){d.loadError=0,d.fragmentError=0}),g.prototype.stopLoad.call(this)},v.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1},v.onManifestLoading=function(l,d){this.resetLevels()},v.onManifestLoaded=function(l,d){var m=this,E=this.hls.config.preferManagedMediaSource,_=[],C={},w={},k=!1,P=!1,B=!1;d.levels.forEach(function(M){var U,K=M.attrs,J=M.audioCodec,ae=M.videoCodec;J&&(M.audioCodec=J=Co(J,E)||void 0),((U=ae)==null?void 0:U.indexOf("avc1"))===0&&(ae=M.videoCodec=Gc(ae));var se=M.width,ie=M.height,ue=M.unknownCodecs,Le=ue?ue.length:0;if(ue)for(var me=Le;me--;){var De=ue[me];m.isAudioSupported(De)?(M.audioCodec=J=J?J+","+De:De,Le--,Bi.audio[J.substring(0,4)]=2):m.isVideoSupported(De)&&(M.videoCodec=ae=ae?ae+","+De:De,Le--,Bi.video[ae.substring(0,4)]=2)}if(k||(k=!!(se&&ie)),P||(P=!!ae),B||(B=!!J),Le||J&&!m.isAudioSupported(J)||ae&&!m.isVideoSupported(ae)){m.log('Some or all CODECS not supported "'+K.CODECS+'"');return}var Ne=K.CODECS,Me=K["FRAME-RATE"],Pe=K["HDCP-LEVEL"],Be=K["PATHWAY-ID"],Ge=K.RESOLUTION,ut=K["VIDEO-RANGE"],et=(Be||".")+"-",Ze=""+et+M.bitrate+"-"+Ge+"-"+Me+"-"+Ne+"-"+ut+"-"+Pe;if(C[Ze])if(C[Ze].uri!==M.url&&!M.attrs["PATHWAY-ID"]){var gt=w[Ze]+=1;M.attrs["PATHWAY-ID"]=new Array(gt+1).join(".");var st=m.createLevel(M);C[Ze]=st,_.push(st)}else C[Ze].addGroupId("audio",K.AUDIO),C[Ze].addGroupId("text",K.SUBTITLES);else{var ht=m.createLevel(M);C[Ze]=ht,w[Ze]=1,_.push(ht)}}),this.filterAndSortMediaOptions(_,d,k,P,B)},v.createLevel=function(l){var d=new Ao(l),m=l.supplemental;if(m!=null&&m.videoCodec&&!this.isVideoSupported(m.videoCodec)){var E=new Error('SUPPLEMENTAL-CODECS not supported "'+m.videoCodec+'"');this.log(E.message),d.supportedResult=Er.getUnsupportedResult(E,[])}return d},v.isAudioSupported=function(l){return xa(l,"audio",this.hls.config.preferManagedMediaSource)},v.isVideoSupported=function(l){return xa(l,"video",this.hls.config.preferManagedMediaSource)},v.filterAndSortMediaOptions=function(l,d,m,E,_){var C=this,w=[],k=[],P=l;if((m||E)&&_&&(P=P.filter(function(Ne){var Me=Ne.videoCodec,Pe=Ne.videoRange,Be=Ne.width,Ge=Ne.height;return(!!Me||!!(Be&&Ge))&&ev(Pe)})),P.length===0){Promise.resolve().then(function(){if(C.hls){var Ne="no level with compatible codecs found in manifest",Me=Ne;d.levels.length&&(Me="one or more CODECS in variant not supported: "+En(d.levels.map(function(Be){return Be.attrs.CODECS}).filter(function(Be,Ge,ut){return ut.indexOf(Be)===Ge})),C.warn(Me),Ne+=" ("+Me+")");var Pe=new Error(Ne);C.hls.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:d.url,error:Pe,reason:Me})}});return}d.audioTracks&&(w=d.audioTracks.filter(function(Ne){return!Ne.audioCodec||C.isAudioSupported(Ne.audioCodec)}),jf(w)),d.subtitles&&(k=d.subtitles,jf(k));var B=P.slice(0);P.sort(function(Ne,Me){if(Ne.attrs["HDCP-LEVEL"]!==Me.attrs["HDCP-LEVEL"])return(Ne.attrs["HDCP-LEVEL"]||"")>(Me.attrs["HDCP-LEVEL"]||"")?1:-1;if(m&&Ne.height!==Me.height)return Ne.height-Me.height;if(Ne.frameRate!==Me.frameRate)return Ne.frameRate-Me.frameRate;if(Ne.videoRange!==Me.videoRange)return bl.indexOf(Ne.videoRange)-bl.indexOf(Me.videoRange);if(Ne.videoCodec!==Me.videoCodec){var Pe=rr(Ne.videoCodec),Be=rr(Me.videoCodec);if(Pe!==Be)return Be-Pe}if(Ne.uri===Me.uri&&Ne.codecSet!==Me.codecSet){var Ge=ir(Ne.codecSet),ut=ir(Me.codecSet);if(Ge!==ut)return ut-Ge}return Ne.averageBitrate!==Me.averageBitrate?Ne.averageBitrate-Me.averageBitrate:0});var M=B[0];if(this.steering&&(P=this.steering.filterParsedLevels(P),P.length!==B.length)){for(var U=0;Use&&se===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=ie)}break}var ue=_&&!E,Le=this.hls.config,me=!!(Le.audioStreamController&&Le.audioTrackController),De={levels:P,audioTracks:w,subtitleTracks:k,sessionData:d.sessionData,sessionKeys:d.sessionKeys,firstLevel:this._firstLevel,stats:d.stats,audio:_,video:E,altAudio:me&&!ue&&w.some(function(Ne){return!!Ne.url})};this.hls.trigger(j.MANIFEST_PARSED,De)},v.onError=function(l,d){d.fatal||!d.context||d.context.type===ye.LEVEL&&d.context.level===this.level&&this.checkRetry(d)},v.onFragBuffered=function(l,d){var m=d.frag;if(m!==void 0&&m.type===X.MAIN){var E=m.elementaryStreams;if(!Object.keys(E).some(function(C){return!!E[C]}))return;var _=this._levels[m.level];_!=null&&_.loadError&&(this.log("Resetting level error count of "+_.loadError+" on frag buffered"),_.loadError=0)}},v.onLevelLoaded=function(l,d){var m,E=d.level,_=d.details,C=d.levelInfo;if(!C){var w;this.warn("Invalid level index "+E),(w=d.deliveryDirectives)!=null&&w.skip&&(_.deltaUpdateFailed=!0);return}if(C===this.currentLevel||d.withoutMultiVariant){C.fragmentError===0&&(C.loadError=0);var k=C.details;k===d.details&&k.advanced&&(k=void 0),this.playlistLoaded(E,d,k)}else(m=d.deliveryDirectives)!=null&&m.skip&&(_.deltaUpdateFailed=!0)},v.loadPlaylist=function(l){g.prototype.loadPlaylist.call(this),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,l)},v.loadingPlaylist=function(l,d){g.prototype.loadingPlaylist.call(this,l,d);var m=this.getUrlWithDirectives(l.uri,d),E=this.currentLevelIndex,_=l.attrs["PATHWAY-ID"],C=l.details,w=C==null?void 0:C.age;this.log("Loading level index "+E+((d==null?void 0:d.msn)!==void 0?" at sn "+d.msn+" part "+d.part:"")+(_?" Pathway "+_:"")+(w&&C.live?" age "+w.toFixed(1)+(C.type&&" "+C.type||""):"")+" "+m),this.hls.trigger(j.LEVEL_LOADING,{url:m,level:E,levelInfo:l,pathwayId:l.attrs["PATHWAY-ID"],id:0,deliveryDirectives:d||null})},v.removeLevel=function(l){var d=this,m;if(this._levels.length!==1){var E=this._levels.filter(function(C,w){return w!==l?!0:(d.steering&&d.steering.removeLevel(C),C===d.currentLevel&&(d.currentLevel=null,d.currentLevelIndex=-1,C.details&&C.details.fragments.forEach(function(k){return k.level=-1})),!1)});Ml(E),this._levels=E,this.currentLevelIndex>-1&&(m=this.currentLevel)!=null&&m.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);var _=E.length-1;this._firstLevel=Math.min(this._firstLevel,_),this._startLevel&&(this._startLevel=Math.min(this._startLevel,_)),this.hls.trigger(j.LEVELS_UPDATED,{levels:E})}},v.onLevelsUpdated=function(l,d){var m=d.levels;this._levels=m},v.checkMaxAutoUpdated=function(){var l=this.hls,d=l.autoLevelCapping,m=l.maxAutoLevel,E=l.maxHdcpLevel;this._maxAutoLevel!==m&&(this._maxAutoLevel=m,this.hls.trigger(j.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:d,levels:this.levels,maxAutoLevel:m,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:E}))},s(x,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"loadLevelObj",get:function(){return this.currentLevel}},{key:"level",get:function(){return this.currentLevelIndex},set:function(l){var d=this._levels;if(d.length!==0){if(l<0||l>=d.length){var m=new Error("invalid level idx"),E=l<0;if(this.hls.trigger(j.ERROR,{type:ve.OTHER_ERROR,details:re.LEVEL_SWITCH_ERROR,level:l,fatal:E,error:m,reason:m.message}),E)return;l=Math.min(l,d.length-1)}var _=this.currentLevelIndex,C=this.currentLevel,w=C?C.attrs["PATHWAY-ID"]:void 0,k=d[l],P=k.attrs["PATHWAY-ID"];if(this.currentLevelIndex=l,this.currentLevel=k,!(_===l&&C&&w===P)){this.log("Switching to level "+l+" ("+(k.height?k.height+"p ":"")+(k.videoRange?k.videoRange+" ":"")+(k.codecSet?k.codecSet+" ":"")+"@"+k.bitrate+")"+(P?" with Pathway "+P:"")+" from level "+_+(w?" with Pathway "+w:""));var B={level:l,attrs:k.attrs,details:k.details,bitrate:k.bitrate,averageBitrate:k.averageBitrate,maxBitrate:k.maxBitrate,realBitrate:k.realBitrate,width:k.width,height:k.height,codecSet:k.codecSet,audioCodec:k.audioCodec,videoCodec:k.videoCodec,audioGroups:k.audioGroups,subtitleGroups:k.subtitleGroups,loaded:k.loaded,loadError:k.loadError,fragmentError:k.fragmentError,name:k.name,id:k.id,uri:k.uri,url:k.url,urlId:0,audioGroupIds:k.audioGroupIds,textGroupIds:k.textGroupIds};this.hls.trigger(j.LEVEL_SWITCHING,B);var M=k.details;if(!M||M.live){var U=this.switchParams(k.uri,C==null?void 0:C.details,M);this.loadPlaylist(U)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(l){this.manualLevelIndex=l,this._startLevel===void 0&&(this._startLevel=l),l!==-1&&(this.level=l)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(l){this._firstLevel=l}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var l=this.hls.config.startLevel;return l!==void 0?l:this.hls.firstAutoLevel}return this._startLevel},set:function(l){this._startLevel=l}},{key:"pathways",get:function(){return this.steering?this.steering.pathways():[]}},{key:"pathwayPriority",get:function(){return this.steering?this.steering.pathwayPriority:null},set:function(l){if(this.steering){var d=this.steering.pathways(),m=l.filter(function(E){return d.indexOf(E)!==-1});if(l.length<1){this.warn("pathwayPriority "+l+" should contain at least one pathway from list: "+d);return}this.steering.pathwayPriority=m}}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(l){this.level=l,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=l)}}])}(La);function jf(g){var x={};g.forEach(function(v){var u=v.groupId||"";v.id=x[u]=x[u]||0,x[u]++})}var Ks=[];typeof t<"u"&&t&&Hd();function Hd(){self.addEventListener("message",function(g){var x=g.data,v=x.instanceNo;if(v!==void 0){var u=Ks[v];if(x.cmd==="reset"&&(delete Ks[x.resetNo],u&&u.destroy(),x.cmd="init"),x.cmd==="init"){var l=JSON.parse(x.config),d=new fe;d.on(j.FRAG_DECRYPTED,$i),d.on(j.ERROR,$i);var m=Ar(l.debug,x.id);is(m,v),Ks[v]=new br(d,x.typeSupported,l,"",x.id,m),$i("init",null,v);return}if(u)switch(x.cmd){case"configure":{u.configure(x.config);break}case"demux":{var E=u.push(x.data,x.decryptdata,x.chunkMeta,x.state);Qr(E)?E.then(function(w){ns(self,w,v)}).catch(function(w){$i(j.ERROR,{instanceNo:v,type:ve.MEDIA_ERROR,details:re.FRAG_PARSING_ERROR,chunkMeta:x.chunkMeta,fatal:!1,error:w,err:w,reason:"transmuxer-worker push error"},v)}):ns(self,E,v);break}case"flush":{var _=x.chunkMeta,C=u.flush(_);Qr(C)?C.then(function(w){Ys(self,w,_,v)}).catch(function(w){$i(j.ERROR,{type:ve.MEDIA_ERROR,details:re.FRAG_PARSING_ERROR,chunkMeta:x.chunkMeta,fatal:!1,error:w,err:w,reason:"transmuxer-worker flush error"},v)}):Ys(self,C,_,v);break}}}})}function ns(g,x,v){if(Gf(x.remuxResult))return!1;var u=[],l=x.remuxResult,d=l.audio,m=l.video;return d&&Ri(u,d),m&&Ri(u,m),g.postMessage({event:"transmuxComplete",data:x,instanceNo:v},u),!0}function Ri(g,x){x.data1&&g.push(x.data1.buffer),x.data2&&g.push(x.data2.buffer)}function Ys(g,x,v,u){var l=x.reduce(function(d,m){return ns(g,m,u)||d},!1);l||g.postMessage({event:"transmuxComplete",data:x[0],instanceNo:u}),g.postMessage({event:"flush",data:v,instanceNo:u})}function $i(g,x,v){self.postMessage({event:g,data:x,instanceNo:v})}function is(g,x){var v=function(d){var m=function(_){$i("workerLog",{logType:d,message:_},x)};g[d]=m};for(var u in g)v(u)}function Gf(g){return!g.audio&&!g.video&&!g.text&&!g.id3&&!g.initSegment}var Ki="1.6.2",as={};function zf(){return typeof r=="function"}function Hr(){var g=as[Ki];if(g)return g.clientCount++,g;var x=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+r.toString()+")(true);"],{type:"text/javascript"}),v=self.URL.createObjectURL(x),u=new self.Worker(v),l={worker:u,objectURL:v,clientCount:1};return as[Ki]=l,l}function cu(g){var x=as[g];if(x)return x.clientCount++,x;var v=new self.URL(g,self.location.href).href,u=new self.Worker(v),l={worker:u,scriptURL:v,clientCount:1};return as[g]=l,l}function Wf(g){var x=as[g||Ki];if(x){var v=x.clientCount--;if(v===1){var u=x.worker,l=x.objectURL;delete as[g||Ki],l&&self.URL.revokeObjectURL(l),u.terminate()}}}var du=0,hu=function(){function g(v,u,l,d){var m=this;this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=du++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=function(B){var M=B.data,U=m.hls;if(!(!U||!(M!=null&&M.event)||M.instanceNo!==m.instanceNo))switch(M.event){case"init":{var K,J=(K=m.workerContext)==null?void 0:K.objectURL;J&&self.URL.revokeObjectURL(J);break}case"transmuxComplete":{m.handleTransmuxComplete(M.data);break}case"flush":{m.onFlush(M.data);break}case"workerLog":{U.logger[M.data.logType]&&U.logger[M.data.logType](M.data.message);break}default:{M.data=M.data||{},M.data.frag=m.frag,M.data.part=m.part,M.data.id=m.id,U.trigger(M.event,M.data);break}}},this.onWorkerError=function(B){if(m.hls){var M=new Error(B.message+" ("+B.filename+":"+B.lineno+")");m.hls.config.enableWorker=!1,m.hls.logger.warn('Error in "'+m.id+'" Web Worker, fallback to inline'),m.hls.trigger(j.ERROR,{type:ve.OTHER_ERROR,details:re.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:M})}};var E=v.config;this.hls=v,this.id=u,this.useWorker=!!E.enableWorker,this.onTransmuxComplete=l,this.onFlush=d;var _=function(M,U){U=U||{},U.frag=m.frag||void 0,M===j.ERROR&&(U=U,U.parent=m.id,U.part=m.part,m.error=U.error),m.hls.trigger(M,U)};this.observer=new fe,this.observer.on(j.FRAG_DECRYPTED,_),this.observer.on(j.ERROR,_);var C=_i(E.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){var w=this.hls.logger,k=E.workerPath||zf();if(k){try{E.workerPath?(w.log("loading Web Worker "+E.workerPath+' for "'+u+'"'),this.workerContext=cu(E.workerPath)):(w.log('injecting Web Worker for "'+u+'"'),this.workerContext=Hr());var P=this.workerContext.worker;P.addEventListener("message",this.onWorkerMessage),P.addEventListener("error",this.onWorkerError),P.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:C,id:u,config:En(E)})}catch(B){w.warn('Error setting up "'+u+'" Web Worker, fallback to inline',B),this.terminateWorker(),this.error=null,this.transmuxer=new br(this.observer,C,E,"",u,v.logger)}return}}this.transmuxer=new br(this.observer,C,E,"",u,v.logger)}var x=g.prototype;return x.reset=function(){if(this.frag=null,this.part=null,this.workerContext){var u=this.instanceNo;this.instanceNo=du++;var l=this.hls.config,d=_i(l.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:u,typeSupported:d,id:this.id,config:En(l)})}},x.terminateWorker=function(){if(this.workerContext){var u=this.workerContext.worker;this.workerContext=null,u.removeEventListener("message",this.onWorkerMessage),u.removeEventListener("error",this.onWorkerError),Wf(this.hls.config.workerPath)}},x.destroy=function(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null},x.push=function(u,l,d,m,E,_,C,w,k,P){var B,M,U=this;k.transmuxing.start=self.performance.now();var K=this.instanceNo,J=this.transmuxer,ae=_?_.start:E.start,se=E.decryptdata,ie=this.frag,ue=!(ie&&E.cc===ie.cc),Le=!(ie&&k.level===ie.level),me=ie?k.sn-ie.sn:-1,De=this.part?k.part-this.part.index:-1,Ne=me===0&&k.id>1&&k.id===(ie==null?void 0:ie.stats.chunkCount),Me=!Le&&(me===1||me===0&&(De===1||Ne&&De<=0)),Pe=self.performance.now();(Le||me||E.stats.parsing.start===0)&&(E.stats.parsing.start=Pe),_&&(De||!Me)&&(_.stats.parsing.start=Pe);var Be=!(ie&&((B=E.initSegment)==null?void 0:B.url)===((M=ie.initSegment)==null?void 0:M.url)),Ge=new Ns(ue,Me,w,Le,ae,Be);if(!Me||ue||Be){this.hls.logger.log("[transmuxer-interface]: Starting new transmux session for "+E.type+" sn: "+k.sn+(k.part>-1?" part: "+k.part:"")+" "+(this.id===X.MAIN?"level":"track")+": "+k.level+" id: "+k.id+` discontinuity: `+ue+` trackSwitch: `+Le+` contiguous: `+Me+` accurateTimeOffset: `+w+` timeOffset: `+ae+` initSegmentChange: `+Be);var ut=new es(d,m,l,C,P);this.configureTransmuxer(ut)}if(this.frag=E,this.part=_,this.workerContext)this.workerContext.worker.postMessage({instanceNo:K,cmd:"demux",data:u,decryptdata:se,chunkMeta:k,state:Ge},u instanceof ArrayBuffer?[u]:[]);else if(J){var et=J.push(u,se,k,Ge);Qr(et)?et.then(function(Ze){U.handleTransmuxComplete(Ze)}).catch(function(Ze){U.transmuxerError(Ze,k,"transmuxer-interface push error")}):this.handleTransmuxComplete(et)}},x.flush=function(u){var l=this;u.transmuxing.start=self.performance.now();var d=this.instanceNo,m=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:d,cmd:"flush",chunkMeta:u});else if(m){var E=m.flush(u);Qr(E)?E.then(function(_){l.handleFlushResult(_,u)}).catch(function(_){l.transmuxerError(_,u,"transmuxer-interface flush error")}):this.handleFlushResult(E,u)}},x.transmuxerError=function(u,l,d){this.hls&&(this.error=u,this.hls.trigger(j.ERROR,{type:ve.MEDIA_ERROR,details:re.FRAG_PARSING_ERROR,chunkMeta:l,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:u,err:u,reason:d}))},x.handleFlushResult=function(u,l){var d=this;u.forEach(function(m){d.handleTransmuxComplete(m)}),this.onFlush(l)},x.configureTransmuxer=function(u){var l=this.instanceNo,d=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({instanceNo:l,cmd:"configure",config:u}):d&&d.configure(u)},x.handleTransmuxComplete=function(u){u.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(u)},g}();function vu(){return self.SourceBuffer||self.WebKitSourceBuffer}function Ra(){var g=si();if(!g)return!1;var x=vu();return!x||x.prototype&&typeof x.prototype.appendBuffer=="function"&&typeof x.prototype.remove=="function"}function Vr(){if(!Ra())return!1;var g=si();return typeof(g==null?void 0:g.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(function(x){return g.isTypeSupported(Si(x,"video"))})||["mp4a.40.2","fLaC"].some(function(x){return g.isTypeSupported(Si(x,"audio"))}))}function on(){var g,x=vu();return typeof(x==null||(g=x.prototype)==null?void 0:g.changeType)=="function"}var vn=100,pu=function(g){function x(u,l,d){var m;return m=g.call(this,u,l,d,"stream-controller",X.MAIN)||this,m.audioCodecSwap=!1,m.level=-1,m._forceStartLoad=!1,m._hasEnoughToStart=!1,m.altAudio=0,m.audioOnly=!1,m.fragPlaying=null,m.fragLastKbps=0,m.couldBacktrack=!1,m.backtrackFragment=null,m.audioCodecSwitch=!1,m.videoBuffer=null,m.onMediaPlaying=function(){m.tick()},m.onMediaSeeked=function(){var E=m.media,_=E?E.currentTime:null;if(!(_===null||!Q(_))&&(m.log("Media seeked to "+_.toFixed(3)),!!m.getBufferedFrag(_))){var C=m.getFwdBufferInfoAtPos(E,_,X.MAIN,0);if(C===null||C.len===0){m.warn("Main forward buffer length at "+_+' on "seeked" event '+(C?C.len:"empty")+")");return}m.tick()}},m.registerListeners(),m}S(x,g);var v=x.prototype;return v.registerListeners=function(){g.prototype.registerListeners.call(this);var l=this.hls;l.on(j.MANIFEST_PARSED,this.onManifestParsed,this),l.on(j.LEVEL_LOADING,this.onLevelLoading,this),l.on(j.LEVEL_LOADED,this.onLevelLoaded,this),l.on(j.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),l.on(j.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(j.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.on(j.BUFFER_CREATED,this.onBufferCreated,this),l.on(j.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(j.LEVELS_UPDATED,this.onLevelsUpdated,this),l.on(j.FRAG_BUFFERED,this.onFragBuffered,this)},v.unregisterListeners=function(){g.prototype.unregisterListeners.call(this);var l=this.hls;l.off(j.MANIFEST_PARSED,this.onManifestParsed,this),l.off(j.LEVEL_LOADED,this.onLevelLoaded,this),l.off(j.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),l.off(j.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(j.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.off(j.BUFFER_CREATED,this.onBufferCreated,this),l.off(j.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(j.LEVELS_UPDATED,this.onLevelsUpdated,this),l.off(j.FRAG_BUFFERED,this.onFragBuffered,this)},v.onHandlerDestroying=function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),g.prototype.onHandlerDestroying.call(this)},v.startLoad=function(l,d){if(this.levels){var m=this.lastCurrentTime,E=this.hls;if(this.stopLoad(),this.setInterval(vn),this.level=-1,!this.startFragRequested){var _=E.startLevel;_===-1&&(E.config.testBandwidth&&this.levels.length>1?(_=0,this.bitrateTest=!0):_=E.firstAutoLevel),E.nextLoadLevel=_,this.level=E.loadLevel,this._hasEnoughToStart=!!d}m>0&&l===-1&&!d&&(this.log("Override startPosition with lastCurrentTime @"+m.toFixed(3)),l=m),this.state=ot.IDLE,this.nextLoadPosition=this.lastCurrentTime=l+this.timelineOffset,this.startPosition=d?-1:l,this.tick()}else this._forceStartLoad=!0,this.state=ot.STOPPED},v.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},v.doTick=function(){switch(this.state){case ot.WAITING_LEVEL:{var l=this.levels,d=this.level,m=l==null?void 0:l[d],E=m==null?void 0:m.details;if(E&&(!E.live||this.levelLastLoaded===m&&!this.waitForLive(m))){if(this.waitForCdnTuneIn(E))break;this.state=ot.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ot.IDLE;break}break}case ot.FRAG_LOADING_WAITING_RETRY:{var _,C=self.performance.now(),w=this.retryDate;if(!w||C>=w||(_=this.media)!=null&&_.seeking){var k=this.levels,P=this.level,B=k==null?void 0:k[P];this.resetStartWhenNotLoaded(B||null),this.state=ot.IDLE}}break}this.state===ot.IDLE&&this.doTickIdle(),this.onTickEnd()},v.onTickEnd=function(){var l;g.prototype.onTickEnd.call(this),(l=this.media)!=null&&l.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()},v.doTickIdle=function(){var l=this.hls,d=this.levelLastLoaded,m=this.levels,E=this.media;if(!(d===null||!E&&!this.primaryPrefetch&&(this.startFragRequested||!l.config.startFragPrefetch))&&!(this.altAudio&&this.audioOnly)){var _=this.buffering?l.nextLoadLevel:l.loadLevel;if(m!=null&&m[_]){var C=m[_],w=this.getMainFwdBufferInfo();if(w!==null){var k=this.getLevelDetails();if(k&&this._streamEnded(w,k)){var P={};this.altAudio===2&&(P.type="video"),this.hls.trigger(j.BUFFER_EOS,P),this.state=ot.ENDED;return}if(this.buffering){l.loadLevel!==_&&l.manualLevel===-1&&this.log("Adapting to level "+_+" from level "+this.level),this.level=l.nextLoadLevel=_;var B=C.details;if(!B||this.state===ot.WAITING_LEVEL||this.waitForLive(C)){this.level=_,this.state=ot.WAITING_LEVEL,this.startFragRequested=!1;return}var M=w.len,U=this.getMaxBufferLength(C.maxBitrate);if(!(M>=U)){this.backtrackFragment&&this.backtrackFragment.start>w.end&&(this.backtrackFragment=null);var K=this.backtrackFragment?this.backtrackFragment.start:w.end,J=this.getNextFragment(K,B);if(this.couldBacktrack&&!this.fragPrevious&&J&&Sr(J)&&this.fragmentTracker.getState(J)!==Or.OK){var ae,se=((ae=this.backtrackFragment)!=null?ae:J).sn,ie=se-B.startSN,ue=B.fragments[ie-1];ue&&J.cc===ue.cc&&(J=ue,this.fragmentTracker.removeFragment(ue))}else this.backtrackFragment&&w.len&&(this.backtrackFragment=null);if(J&&this.isLoopLoading(J,K)){var Le=J.gap;if(!Le){var me=this.audioOnly&&!this.altAudio?Ft.AUDIO:Ft.VIDEO,De=(me===Ft.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;De&&this.afterBufferFlushed(De,me,X.MAIN)}J=this.getNextFragmentLoopLoading(J,B,w,X.MAIN,U)}J&&(J.initSegment&&!J.initSegment.data&&!this.bitrateTest&&(J=J.initSegment),this.loadFragment(J,C,K))}}}}}},v.loadFragment=function(l,d,m){var E=this.fragmentTracker.getState(l);E===Or.NOT_LOADED||E===Or.PARTIAL?Sr(l)?this.bitrateTest?(this.log("Fragment "+l.sn+" of level "+l.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(l,d)):g.prototype.loadFragment.call(this,l,d,m):this._loadInitSegment(l,d):this.clearTrackerIfNeeded(l)},v.getBufferedFrag=function(l){return this.fragmentTracker.getBufferedFrag(l,X.MAIN)},v.followingBufferedFrag=function(l){return l?this.getBufferedFrag(l.end+.5):null},v.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},v.nextLevelSwitch=function(){var l=this.levels,d=this.media;if(d!=null&&d.readyState){var m,E=this.getAppendedFrag(d.currentTime);E&&E.start>1&&this.flushMainBuffer(0,E.start-1);var _=this.getLevelDetails();if(_!=null&&_.live){var C=this.getMainFwdBufferInfo();if(!C||C.len<_.targetduration*2)return}if(!d.paused&&l){var w=this.hls.nextLoadLevel,k=l[w],P=this.fragLastKbps;P&&this.fragCurrent?m=this.fragCurrent.duration*k.maxBitrate/(1e3*P)+1:m=0}else m=0;var B=this.getBufferedFrag(d.currentTime+m);if(B){var M=this.followingBufferedFrag(B);if(M){this.abortCurrentFrag();var U=M.maxStartPTS?M.maxStartPTS:M.start,K=M.duration,J=Math.max(B.end,U+Math.min(Math.max(K-this.config.maxFragLookUpTolerance,K*(this.couldBacktrack?.5:.125)),K*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(J,Number.POSITIVE_INFINITY)}}}},v.abortCurrentFrag=function(){var l=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,l&&(l.abortRequests(),this.fragmentTracker.removeFragment(l)),this.state){case ot.KEY_LOADING:case ot.FRAG_LOADING:case ot.FRAG_LOADING_WAITING_RETRY:case ot.PARSING:case ot.PARSED:this.state=ot.IDLE;break}this.nextLoadPosition=this.getLoadPosition()},v.flushMainBuffer=function(l,d){g.prototype.flushMainBuffer.call(this,l,d,this.altAudio===2?"video":null)},v.onMediaAttached=function(l,d){g.prototype.onMediaAttached.call(this,l,d);var m=d.media;zs(m,"playing",this.onMediaPlaying),zs(m,"seeked",this.onMediaSeeked)},v.onMediaDetaching=function(l,d){var m=this.media;m&&(ts(m,"playing",this.onMediaPlaying),ts(m,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,g.prototype.onMediaDetaching.call(this,l,d);var E=!!d.transferMedia;E||(this._hasEnoughToStart=!1)},v.onManifestLoading=function(){g.prototype.onManifestLoading.call(this),this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1},v.onManifestParsed=function(l,d){var m=!1,E=!1;d.levels.forEach(function(_){var C=_.audioCodec;C&&(m=m||C.indexOf("mp4a.40.2")!==-1,E=E||C.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=m&&E&&!on(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},v.onLevelLoading=function(l,d){var m=this.levels;if(!(!m||this.state!==ot.IDLE)){var E=d.levelInfo;(!E.details||E.details.live&&(this.levelLastLoaded!==E||E.details.expired)||this.waitForCdnTuneIn(E.details))&&(this.state=ot.WAITING_LEVEL)}},v.onLevelLoaded=function(l,d){var m,E=this.levels,_=this.startFragRequested,C=d.level,w=d.details,k=w.totalduration;if(!E){this.warn("Levels were reset while loading level "+C);return}this.log("Level "+C+" loaded ["+w.startSN+","+w.endSN+"]"+(w.lastPartSn?"[part-"+w.lastPartSn+"-"+w.lastPartIndex+"]":"")+", cc ["+w.startCC+", "+w.endCC+"] duration:"+k);var P=d.levelInfo,B=this.fragCurrent;B&&(this.state===ot.FRAG_LOADING||this.state===ot.FRAG_LOADING_WAITING_RETRY)&&B.level!==d.level&&B.loader&&this.abortCurrentFrag();var M=0;if(w.live||(m=P.details)!=null&&m.live){var U;if(this.checkLiveUpdate(w),w.deltaUpdateFailed)return;M=this.alignPlaylists(w,P.details,(U=this.levelLastLoaded)==null?void 0:U.details)}if(P.details=w,this.levelLastLoaded=P,_||this.setStartPosition(w,M),this.hls.trigger(j.LEVEL_UPDATED,{details:w,level:C}),this.state===ot.WAITING_LEVEL){if(this.waitForCdnTuneIn(w))return;this.state=ot.IDLE}_&&w.live&&this.synchronizeToLiveEdge(w),this.tick()},v.synchronizeToLiveEdge=function(l){var d=this.config,m=this.media;if(m){var E=this.hls.liveSyncPosition,_=this.getLoadPosition(),C=l.fragmentStart,w=l.edge,k=_>=C-d.maxFragLookUpTolerance&&_<=w;if(E!==null&&m.duration>E&&(_-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=d.levels},v.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},v.seekToStartPos=function(){var l=this.media;if(l){var d=l.currentTime,m=this.startPosition;if(m>=0&&d0&&(kme.cc;if(_.independent!==!1){var Me=M.startPTS,Pe=M.endPTS,Be=M.startDTS,Ge=M.endDTS;if(P)P.elementaryStreams[M.type]={startPTS:Me,endPTS:Pe,startDTS:Be,endDTS:Ge};else if(M.firstKeyFrame&&M.independent&&C.id===1&&!Ne&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ut=this.getMainFwdBufferInfo(),et=(ut?ut.end:this.getLoadPosition())+this.config.maxBufferHole,Ze=M.firstKeyFramePTS?M.firstKeyFramePTS:Me;if(!De&&etsa&&(k.gap=!0);k.setElementaryStreamInfo(M.type,Me,Pe,Be,Ge),this.backtrackFragment&&(this.backtrackFragment=k),this.bufferFragmentData(M,k,P,C,De||Ne)}else if(De||Ne)k.gap=!0;else{this.backtrack(k);return}}if(se){var ht=se.startPTS,gt=se.endPTS,st=se.startDTS,Dt=se.endDTS;P&&(P.elementaryStreams[Ft.AUDIO]={startPTS:ht,endPTS:gt,startDTS:st,endDTS:Dt}),k.setElementaryStreamInfo(Ft.AUDIO,ht,gt,st,Dt),this.bufferFragmentData(se,k,P,C)}if(ae&&K!=null&&(d=K.samples)!=null&&d.length){var ar={id:m,frag:k,details:ae,samples:K.samples};E.trigger(j.FRAG_PARSING_METADATA,ar)}if(ae&&U){var Gt={id:m,frag:k,details:ae,samples:U.samples};E.trigger(j.FRAG_PARSING_USERDATA,Gt)}},v.logMuxedErr=function(l){this.warn((Sr(l)?"Media":"Init")+" segment with muxed audiovideo where only video expected: "+l.url)},v._bufferInitSegment=function(l,d,m,E){var _=this;if(this.state===ot.PARSING){this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&(delete d.audio,d.audiovideo&&this.logMuxedErr(m));var C=d.audio,w=d.video,k=d.audiovideo;if(C){var P=Sl(C.codec,l.audioCodec);P==="mp4a"&&(P="mp4a.40.5");var B=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){P&&(P.indexOf("mp4a.40.5")!==-1?P="mp4a.40.2":P="mp4a.40.5");var M=C.metadata;M&&"channelCount"in M&&(M.channelCount||1)!==1&&B.indexOf("firefox")===-1&&(P="mp4a.40.5")}P&&P.indexOf("mp4a.40.5")!==-1&&B.indexOf("android")!==-1&&C.container!=="audio/mpeg"&&(P="mp4a.40.2",this.log("Android: force audio codec to "+P)),l.audioCodec&&l.audioCodec!==P&&this.log('Swapping manifest audio codec "'+l.audioCodec+'" for "'+P+'"'),C.levelCodec=P,C.id=X.MAIN,this.log("Init audio buffer, container:"+C.container+", codecs[selected/level/parsed]=["+(P||"")+"/"+(l.audioCodec||"")+"/"+C.codec+"]"),delete d.audiovideo}if(w){w.levelCodec=l.videoCodec,w.id=X.MAIN;var U=w.codec;if((U==null?void 0:U.length)===4)switch(U){case"hvc1":case"hev1":w.codec="hvc1.1.6.L120.90";break;case"av01":w.codec="av01.0.04M.08";break;case"avc1":w.codec="avc1.42e01e";break}this.log("Init video buffer, container:"+w.container+", codecs[level/parsed]=["+(l.videoCodec||"")+"/"+U+"]"+(w.codec!==U?" parsed-corrected="+w.codec:"")+(w.supplemental?" supplemental="+w.supplemental:"")),delete d.audiovideo}k&&(this.log("Init audiovideo buffer, container:"+k.container+", codecs[level/parsed]=["+l.codecs+"/"+k.codec+"]"),delete d.video,delete d.audio);var K=Object.keys(d);if(K.length){if(this.hls.trigger(j.BUFFER_CODECS,d),!this.hls)return;K.forEach(function(J){var ae=d[J],se=ae.initSegment;se!=null&&se.byteLength&&_.hls.trigger(j.BUFFER_APPENDING,{type:J,data:se,frag:m,part:null,chunkMeta:E,parent:m.type})})}this.tickImmediate()}},v.getMainFwdBufferInfo=function(){var l=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(l,X.MAIN)},v.backtrack=function(l){this.couldBacktrack=!0,this.backtrackFragment=l,this.resetTransmuxer(),this.flushBufferGap(l),this.fragmentTracker.removeFragment(l),this.fragPrevious=null,this.nextLoadPosition=l.start,this.state=ot.IDLE},v.checkFragmentChanged=function(){var l=this.media,d=null;if(l&&l.readyState>1&&l.seeking===!1){var m=l.currentTime;if(yr.isBuffered(l,m)?d=this.getAppendedFrag(m):yr.isBuffered(l,m+.1)&&(d=this.getAppendedFrag(m+.1)),d){this.backtrackFragment=null;var E=this.fragPlaying,_=d.level;(!E||d.sn!==E.sn||E.level!==_)&&(this.fragPlaying=d,this.hls.trigger(j.FRAG_CHANGED,{frag:d}),(!E||E.level!==_)&&this.hls.trigger(j.LEVEL_SWITCHED,{level:_}))}}},s(x,[{key:"hasEnoughToStart",get:function(){return this._hasEnoughToStart}},{key:"maxBufferLength",get:function(){var l=this.levels,d=this.level,m=l==null?void 0:l[d];return m?this.getMaxBufferLength(m.maxBitrate):this.config.maxBufferLength}},{key:"nextLevel",get:function(){var l=this.nextBufferedFrag;return l?l.level:-1}},{key:"currentFrag",get:function(){var l;if(this.fragPlaying)return this.fragPlaying;var d=((l=this.media)==null?void 0:l.currentTime)||this.lastCurrentTime;return Q(d)?this.getAppendedFrag(d):null}},{key:"currentProgramDateTime",get:function(){var l,d=((l=this.media)==null?void 0:l.currentTime)||this.lastCurrentTime;if(Q(d)){var m=this.getLevelDetails(),E=this.currentFrag||(m?Cl(null,m.fragments,d):null);if(E){var _=E.programDateTime;if(_!==null){var C=_+(d-E.start)*1e3;return new Date(C)}}}return null}},{key:"currentLevel",get:function(){var l=this.currentFrag;return l?l.level:-1}},{key:"nextBufferedFrag",get:function(){var l=this.currentFrag;return l?this.followingBufferedFrag(l):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])}(Go),Wo=function(){function g(v){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=v}var x=g.prototype;return x.abort=function(u){for(var l in this.keyUriToKeyInfo){var d=this.keyUriToKeyInfo[l].loader;if(d){var m;if(u&&u!==((m=d.context)==null?void 0:m.frag.type))return;d.abort()}}},x.detach=function(){for(var u in this.keyUriToKeyInfo){var l=this.keyUriToKeyInfo[u];(l.mediaKeySessionContext||l.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[u]}},x.destroy=function(){this.detach();for(var u in this.keyUriToKeyInfo){var l=this.keyUriToKeyInfo[u].loader;l&&l.destroy()}this.keyUriToKeyInfo={}},x.createKeyLoadError=function(u,l,d,m,E){return l===void 0&&(l=re.KEY_LOAD_ERROR),new Kr({type:ve.NETWORK_ERROR,details:l,fatal:!1,frag:u,response:E,error:d,networkDetails:m})},x.loadClear=function(u,l){var d=this;if(this.emeController&&this.config.emeEnabled)for(var m=u.sn,E=u.cc,_=function(){var k=l[C];if(E<=k.cc&&(m==="initSegment"||k.sn==="initSegment"||m2&&d.push.apply(d,l.split(",").map(function(U){return{type:"media-source",audio:{contentType:Si(U,"audio"),channels:""+M}}}))}}))}),Promise.all(d.map(function(w){var k=fi(w);return gu[k]||(gu[k]=v.decodingInfo(w))})).then(function(w){return{supported:!w.some(function(k){return!k.supported}),configurations:d,decodingInfoResults:w}}).catch(function(w){return{supported:!1,configurations:d,decodingInfoResults:[],error:w}})}function fi(g){var x=g.audio,v=g.video,u=v||x;if(u){var l=zc(u.contentType);if(v)return"r"+v.height+"x"+v.width+"f"+Math.ceil(v.framerate)+(v.transferFunction||"sd")+"_"+l+"_"+Math.ceil(v.bitrate/1e5);if(x)return"c"+x.channels+(x.spatialRendering?"s":"n")+"_"+l}return""}var qs=function(){function g(v){v===void 0&&(v={}),this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new fe,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;var u=this.logger=Ar(v.debug||!1,"Hls instance",v.assetPlayerId),l=this.config=Hs(g.DefaultConfig,v,u);this.userConfig=v,l.progressive&&eu(l,u);var d=l.abrController,m=l.bufferController,E=l.capLevelController,_=l.errorController,C=l.fpsController,w=new _(this),k=this.abrController=new d(this),P=new oi(this),B=l.interstitialsController,M=B?this.interstitialsController=new B(this,g):null,U=this.bufferController=new m(this,P),K=this.capLevelController=new E(this),J=new C(this),ae=new wn(this),se=l.contentSteeringController,ie=se?new se(this):null,ue=this.levelController=new fu(this,ie),Le=new Ud(this),me=new Wo(this.config),De=this.streamController=new pu(this,P,me),Ne=this.gapController=new Ws(this,P);K.setStreamController(De),J.setStreamController(De);var Me=[ae,ue,De];M&&Me.splice(1,0,M),ie&&Me.splice(1,0,ie),this.networkControllers=Me;var Pe=[k,U,Ne,K,J,Le,P];this.audioTrackController=this.createController(l.audioTrackController,Me);var Be=l.audioStreamController;Be&&Me.push(this.audioStreamController=new Be(this,P,me)),this.subtitleTrackController=this.createController(l.subtitleTrackController,Me);var Ge=l.subtitleStreamController;Ge&&Me.push(this.subtititleStreamController=new Ge(this,P,me)),this.createController(l.timelineController,Pe),me.emeController=this.emeController=this.createController(l.emeController,Pe),this.cmcdController=this.createController(l.cmcdController,Pe),this.latencyController=this.createController(oa,Pe),this.coreComponents=Pe,Me.push(w);var ut=w.onErrorOut;typeof ut=="function"&&this.on(j.ERROR,ut,w),this.on(j.MANIFEST_LOADED,ae.onManifestLoaded,ae)}g.isMSESupported=function(){return Ra()},g.isSupported=function(){return Vr()},g.getMediaSource=function(){return si()};var x=g.prototype;return x.createController=function(u,l){if(u){var d=new u(this);return l&&l.push(d),d}return null},x.on=function(u,l,d){d===void 0&&(d=this),this._emitter.on(u,l,d)},x.once=function(u,l,d){d===void 0&&(d=this),this._emitter.once(u,l,d)},x.removeAllListeners=function(u){this._emitter.removeAllListeners(u)},x.off=function(u,l,d,m){d===void 0&&(d=this),this._emitter.off(u,l,d,m)},x.listeners=function(u){return this._emitter.listeners(u)},x.emit=function(u,l,d){return this._emitter.emit(u,l,d)},x.trigger=function(u,l){if(this.config.debug)return this.emit(u,u,l);try{return this.emit(u,u,l)}catch(m){if(this.logger.error("An internal error happened while handling event "+u+'. Error message: "'+m.message+'". Here is a stacktrace:',m),!this.triggeringException){this.triggeringException=!0;var d=u===j.ERROR;this.trigger(j.ERROR,{type:ve.OTHER_ERROR,details:re.INTERNAL_EXCEPTION,fatal:d,event:u,error:m}),this.triggeringException=!1}}return!1},x.listenerCount=function(u){return this._emitter.listenerCount(u)},x.destroy=function(){this.logger.log("destroy"),this.trigger(j.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(function(l){return l.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(l){return l.destroy()}),this.coreComponents.length=0;var u=this.config;u.xhrSetup=u.fetchSetup=void 0,this.userConfig=null},x.attachMedia=function(u){if(!u||"media"in u&&!u.media){var l=new Error("attachMedia failed: invalid argument ("+u+")");this.trigger(j.ERROR,{type:ve.OTHER_ERROR,details:re.ATTACH_MEDIA_ERROR,fatal:!0,error:l});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());var d="media"in u,m=d?u.media:u,E=d?u:{media:m};this._media=m,this.trigger(j.MEDIA_ATTACHING,E)},x.detachMedia=function(){this.logger.log("detachMedia"),this.trigger(j.MEDIA_DETACHING,{}),this._media=null},x.transferMedia=function(){this._media=null;var u=this.bufferController.transferMedia();return this.trigger(j.MEDIA_DETACHING,{transferMedia:u}),u},x.loadSource=function(u){this.stopLoad();var l=this.media,d=this._url,m=this._url=q.buildAbsoluteURL(self.location.href,u,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:"+m),l&&d&&(d!==m||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(l)),this.trigger(j.MANIFEST_LOADING,{url:u})},x.startLoad=function(u,l){u===void 0&&(u=-1),this.logger.log("startLoad("+(u+(l?", ":""))+")"),this.started=!0,this.resumeBuffering();for(var d=0;d-1?this.abrController.forcedAutoLevel:u},set:function(u){this.logger.log("set startLevel:"+u),u!==-1&&(u=Math.max(u,this.minAutoLevel)),this.levelController.startLevel=u}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(u){var l=!!u;l!==this.config.capLevelToPlayerSize&&(l?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=l)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(u){this._autoLevelCapping!==u&&(this.logger.log("set autoLevelCapping:"+u),this._autoLevelCapping=u,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var u=this.abrController.bwEstimator;return u?u.getEstimate():NaN},set:function(u){this.abrController.resetEstimator(u)}},{key:"abrEwmaDefaultEstimate",get:function(){var u=this.abrController.bwEstimator;return u?u.defaultEstimate:NaN}},{key:"ttfbEstimate",get:function(){var u=this.abrController.bwEstimator;return u?u.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(u){J0(u)&&this._maxHdcpLevel!==u&&(this._maxHdcpLevel=u,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var u=this.levels,l=this.config.minAutoBitrate;if(!u)return 0;for(var d=u.length,m=0;m=l)return m;return 0}},{key:"maxAutoLevel",get:function(){var u=this.levels,l=this.autoLevelCapping,d=this.maxHdcpLevel,m;if(l===-1&&u!=null&&u.length?m=u.length-1:m=l,d)for(var E=m;E--;){var _=u[E].attrs["HDCP-LEVEL"];if(_&&_<=d)return E}return m}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(u){this.abrController.nextAutoLevel=u}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"maxBufferLength",get:function(){return this.streamController.maxBufferLength}},{key:"allAudioTracks",get:function(){var u=this.audioTrackController;return u?u.allAudioTracks:[]}},{key:"audioTracks",get:function(){var u=this.audioTrackController;return u?u.audioTracks:[]}},{key:"audioTrack",get:function(){var u=this.audioTrackController;return u?u.audioTrack:-1},set:function(u){var l=this.audioTrackController;l&&(l.audioTrack=u)}},{key:"allSubtitleTracks",get:function(){var u=this.subtitleTrackController;return u?u.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTrack:-1},set:function(u){var l=this.subtitleTrackController;l&&(l.subtitleTrack=u)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var u=this.subtitleTrackController;return u?u.subtitleDisplay:!1},set:function(u){var l=this.subtitleTrackController;l&&(l.subtitleDisplay=u)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(u){this.config.lowLatencyMode=u}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency},set:function(u){this.latencyController.targetLatency=u}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}},{key:"pathways",get:function(){return this.levelController.pathways}},{key:"pathwayPriority",get:function(){return this.levelController.pathwayPriority},set:function(u){this.levelController.pathwayPriority=u}},{key:"bufferedToEnd",get:function(){var u;return!!((u=this.bufferController)!=null&&u.bufferedToEnd)}},{key:"interstitialsManager",get:function(){var u;return((u=this.interstitialsController)==null?void 0:u.interstitialsManager)||null}}],[{key:"version",get:function(){return Ki}},{key:"Events",get:function(){return j}},{key:"MetadataSchema",get:function(){return On}},{key:"ErrorTypes",get:function(){return ve}},{key:"ErrorDetails",get:function(){return re}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:Aa},set:function(u){g.defaultConfig=u}}])}();return qs.defaultConfig=void 0,qs})})(!1)}(wp)),wp.exports}var ER=xR();const os=Zu(ER);var iS={};iS.getBrowserVersion=function(){var n=navigator.userAgent;if(n.toLowerCase().indexOf("mobile")>-1)return"Unknown";if(n.indexOf("Firefox")>-1){var a=n.match(/firefox\/[\d.]+/gi)[0].match(/[\d]+/)[0];return"Firefox "+a}else if(n.indexOf("Edge")>-1){var r=n.match(/edge\/[\d.]+/gi)[0].match(/[\d]+/)[0];return"Edge "+r}else{if(n.indexOf("rv:11")>-1)return"IE 11";if(n.indexOf("Opera")>-1||n.indexOf("OPR")>-1){if(n.indexOf("Opera")>-1){var t=n.match(/opera\/[\d.]+/gi)[0].match(/[\d]+/)[0];return"Opera "+t}if(n.indexOf("OPR")>-1){var e=n.match(/opr\/[\d.]+/gi)[0].match(/[\d]+/)[0];return"Opera "+e}}else if(n.indexOf("Chrome")>-1){var i=n.match(/chrome\/[\d.]+/gi)[0].match(/[\d]+/)[0];return"Chrome "+i}else if(n.indexOf("Safari")>-1){var s=n.match(/safari\/[\d.]+/gi)[0].match(/[\d]+/)[0];return"Safari "+s}else if(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1){if(n.indexOf("MSIE")>-1){var f=n.match(/msie [\d.]+/gi)[0].match(/[\d]+/)[0];return"IE "+f}if(n.indexOf("Trident")>-1){var h=n.match(/trident\/[\d.]+/gi)[0].match(/[\d]+/)[0],p=parseInt(h)+4;return"IE "+p}}else return"Unknown"}};var wP=function(n){dR(r,n);var a=gR(r);function r(t){var e;return fR(this,r),e=a.call(this,t),e.browser=iS.getBrowserVersion(),e.hls=null,e.hlsOpts={},e.player.handleSource=!1,e}return cR(r,[{key:"_adaptHlsJsConfig",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=this.playerConfig;return!(e!=null&&e.startPosition)&&typeof i.startTime=="number"&&(e.startPosition=i.startTime),e}},{key:"afterCreate",value:function(){var e=this,i=this.config.hlsOpts;this.hlsOpts=this._adaptHlsJsConfig(i),this.on(rf,function(s){/^blob/.test(s)||(e.playerConfig.url=s,e.register(s))});try{Fi.defineGetterOrSetter(this.player,{url:{get:function(){try{return e.player.video.src}catch{return null}},configurable:!0}})}catch{}}},{key:"beforePlayerInit",value:function(){this.register(this.player.config.url)}},{key:"destroy",value:function(){this.hls&&this.hls.destroy();var e=this.player;Fi.defineGetterOrSetter(e,{url:{get:function(){try{return e.__url}catch{return null}},configurable:!0}})}},{key:"register",value:function(e){var i=this,s=this.player;this.hls&&this.hls.destroy(),this.hls=new os(this.hlsOpts),this.hls.once(os.Events.MEDIA_ATTACHED,function(){i.hls.loadSource(e)}),this.hls.on(os.Events.ERROR,function(f,h){var p;if(s.emit("HLS_ERROR",{errorType:h.type,errorDetails:h.details,errorFatal:h.fatal}),h.fatal)switch(h.type){case os.ErrorTypes.NETWORK_ERROR:(h==null||(p=h.networkDetails)===null||p===void 0?void 0:p.status)!==404&&i.hls.startLoad();break;case os.ErrorTypes.MEDIA_ERROR:i.hls.recoverMediaError();break;default:s.emit("error",h)}}),this.hls.attachMedia(this.player.media||this.player.video),this._statistics()}},{key:"_statistics",value:function(){var e={speed:0,playerType:"HlsPlayer"},i={videoDataRate:0,audioDataRate:0},s=this.player,f=this.hls;f.on(os.Events.FRAG_LOAD_PROGRESS,function(h,p){e.speed=p.stats.loaded/1e3}),f.on(os.Events.FRAG_PARSING_DATA,function(h,p){p.type==="video"&&(i.fps=parseInt(p.nb/(p.endPTS-p.startPTS)))}),f.on(os.Events.FRAG_PARSING_INIT_SEGMENT,function(h,p){if(i.hasAudio=!!(p.tracks&&p.tracks.audio),i.hasVideo=!!(p.tracks&&p.tracks.audio),i.hasAudio){var S=p.tracks.audio;i.audioChannelCount=S.metadata&&S.metadata.channelCount?S.metadata.channelCount:0,i.audioCodec=S.codec}if(i.hasVideo){var b=p.tracks.video;i.videoCodec=b.codec,i.width=b.metadata&&b.metadata.width?b.metadata.width:0,i.height=b.metadata&&b.metadata.height?b.metadata.height:0}i.duration=p.frag&&p.frag.duration?p.frag.duration:0,i.level=p.frag&&p.frag.levels?p.frag.levels:0,(i.videoCodec||i.audioCodec)&&(i.mimeType='video/hls; codecs="'.concat(i.videoCodec,";").concat(i.audioCodec,'"')),s.mediainfo=i,s.emit("media_info",i)}),this._statisticsTimmer=setInterval(function(){s.emit("statistics_info",e),e.speed=0},1e3)}}],[{key:"pluginName",get:function(){return"HlsJsPlugin"}},{key:"defaultConfig",get:function(){return{hlsOpts:{}}}},{key:"isSupported",get:function(){return os.isSupported}}]),r}(Fi);function Q1(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);a&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)}return r}function ri(n){for(var a=1;a=0;--be){var ge=this.tryEntries[be],ve=ge.completion;if(ge.tryLoc==="root")return Q("end");if(ge.tryLoc<=this.prev){var re=r.call(ge,"catchLoc"),j=r.call(ge,"finallyLoc");if(re&&j){if(this.prev=0;--Q){var be=this.tryEntries[Q];if(be.tryLoc<=this.prev&&r.call(be,"finallyLoc")&&this.prev=0;--q){var Q=this.tryEntries[q];if(Q.finallyLoc===Y)return this.complete(Q.completion,Q.afterLoc),te(Q),b}},catch:function(Y){for(var q=this.tryEntries.length-1;q>=0;--q){var Q=this.tryEntries[q];if(Q.tryLoc===Y){var be=Q.completion;if(be.type==="throw"){var ge=be.arg;te(Q)}return ge}}throw new Error("illegal catch attempt")},delegateYield:function(Y,q,Q){return this.delegate={iterator:ne(Y),resultName:q,nextLoc:Q},this.method==="next"&&(this.arg=void 0),b}},n}function ag(n){"@babel/helpers - typeof";return ag=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},ag(n)}function J1(n,a,r,t,e,i,s){try{var f=n[i](s),h=f.value}catch(p){r(p);return}f.done?a(h):Promise.resolve(h).then(t,e)}function Un(n){return function(){var a=this,r=arguments;return new Promise(function(t,e){var i=n.apply(a,r);function s(h){J1(i,t,e,s,f,"next",h)}function f(h){J1(i,t,e,s,f,"throw",h)}s(void 0)})}}function Uc(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function ex(n,a){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function jt(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function _R(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jt(n)}function sS(n){var a=SR();return function(){var t=P0(n),e;if(a){var i=P0(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return _R(this,e)}}function bR(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var t=r.call(n,a);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function oS(n){var a=bR(n,"string");return typeof a=="symbol"?a:String(a)}function tx(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);a&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)}return r}function Ac(n){for(var a=1;a=0;--be){var ge=this.tryEntries[be],ve=ge.completion;if(ge.tryLoc==="root")return Q("end");if(ge.tryLoc<=this.prev){var re=r.call(ge,"catchLoc"),j=r.call(ge,"finallyLoc");if(re&&j){if(this.prev=0;--Q){var be=this.tryEntries[Q];if(be.tryLoc<=this.prev&&r.call(be,"finallyLoc")&&this.prev=0;--q){var Q=this.tryEntries[q];if(Q.finallyLoc===Y)return this.complete(Q.completion,Q.afterLoc),te(Q),b}},catch:function(Y){for(var q=this.tryEntries.length-1;q>=0;--q){var Q=this.tryEntries[q];if(Q.tryLoc===Y){var be=Q.completion;if(be.type==="throw"){var ge=be.arg;te(Q)}return ge}}throw new Error("illegal catch attempt")},delegateYield:function(Y,q,Q){return this.delegate={iterator:ne(Y),resultName:q,nextLoc:Q},this.method==="next"&&(this.arg=void 0),b}},n}function hl(n){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},hl(n)}function rx(n,a,r,t,e,i,s){try{var f=n[i](s),h=f.value}catch(p){r(p);return}f.done?a(h):Promise.resolve(h).then(t,e)}function vs(n){return function(){var a=this,r=arguments;return new Promise(function(t,e){var i=n.apply(a,r);function s(h){rx(i,t,e,s,f,"next",h)}function f(h){rx(i,t,e,s,f,"throw",h)}s(void 0)})}}function mi(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function nx(n,a){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function l0(n,a,r){return lS()?l0=Reflect.construct.bind():l0=function(e,i,s){var f=[null];f.push.apply(f,i);var h=Function.bind.apply(e,f),p=new h;return s&&kc(p,s.prototype),p},l0.apply(null,arguments)}function TR(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function I0(n){var a=typeof Map=="function"?new Map:void 0;return I0=function(t){if(t===null||!TR(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a<"u"){if(a.has(t))return a.get(t);a.set(t,e)}function e(){return l0(t,arguments,vl(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),kc(e,t)},I0(n)}function CR(n,a){if(n==null)return{};var r={},t=Object.keys(n),e,i;for(i=0;i=0)&&(r[e]=n[e]);return r}function wR(n,a){if(n==null)return{};var r=CR(n,a),t,e;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(e=0;e=0)&&Object.prototype.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}function Rt(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function AR(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rt(n)}function jc(n){var a=lS();return function(){var t=vl(n),e;if(a){var i=vl(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return AR(this,e)}}function kR(n,a){for(;!Object.prototype.hasOwnProperty.call(n,a)&&(n=vl(n),n!==null););return n}function u0(){return typeof Reflect<"u"&&Reflect.get?u0=Reflect.get.bind():u0=function(a,r,t){var e=kR(a,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?a:t):i.value}},u0.apply(this,arguments)}function LR(n,a){if(n){if(typeof n=="string")return ix(n,a);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set")return Array.from(n);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ix(n,a)}}function ix(n,a){(a==null||a>n.length)&&(a=n.length);for(var r=0,t=new Array(a);r=n.length?{done:!0}:{done:!1,value:n[t++]}},e:function(h){throw h},f:e}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,s=!1,f;return{s:function(){r=r.call(n)},n:function(){var h=r.next();return i=h.done,h},e:function(h){s=!0,f=h},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(s)throw f}}}}function DR(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var t=r.call(n,a);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function uS(n){var a=DR(n,"string");return typeof a=="symbol"?a:String(a)}var ni=function(){function n(){mi(this,n)}return yi(n,null,[{key:"start",value:function(r){return!r||!r.length||r.length===1&&r.end(0)-r.start(0)<1e-6||r.length===1&&r.start(0)<0?0:r.start(0)}},{key:"end",value:function(r){return!r||!r.length||r.length===1&&r.end(0)-r.start(0)<1e-6?0:r.end(r.length-1)}},{key:"get",value:function(r){if(r)try{return r.buffered}catch{}}},{key:"buffers",value:function(r,t){if(!r||!r.length)return[];for(var e=[],i=0,s=r.length;ip&&(h[1]=b)}else e.push([r.start(i),r.end(i)])}}return e}},{key:"totalLength",value:function(r){return!r||!r.length?0:r.reduce(function(t,e){return t+=e[1]-e[0]},0)}},{key:"info",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!r||!r.length)return{start:0,end:0,buffers:[]};for(var i=0,s=0,f=0,h=0,p=0,S=0,b=0,A=n.buffers(r,e),R=0,D=A.length;R=I[0]&&t<=I[1])i=I[0],s=I[1],f=R;else if(t+eI[1]&&(S=I[0],b=I[1])}return{start:i,end:s,index:f,buffers:A,nextStart:h,nextEnd:p,prevStart:S,prevEnd:b,currentTime:t,behind:t-i,remaining:s?s-t:0,length:n.totalLength&&n.totalLength(A)}}},{key:"isBuffered",value:function(r,t){if(r){var e=n.get(r);if(e!=null&&e.length){for(var i=0;i=e.start(i)&&t<=e.end(i))return!0}}return!1}}]),n}(),PR=typeof window<"u",pi,cr={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",MSE_CHANGE_TYPE:"MSE_CHANGE_TYPE"}},Ap=(pi={},We(pi,cr.MANIFEST,{HLS:1100,DASH:1200}),We(pi,cr.NETWORK,2100),We(pi,cr.NETWORK_TIMEOUT,2101),We(pi,cr.NETWORK_FORBIDDEN,2103),We(pi,cr.NETWORK_NOTFOUND,2104),We(pi,cr.NETWROK_RANGE_NOT_SATISFIABLE,2116),We(pi,cr.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),We(pi,cr.REMUX,{FMP4:4100,MP4:4200}),We(pi,cr.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,MSE_CHANGE_TYPE:5205,EME_HIJACK:5301}),We(pi,cr.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),We(pi,cr.OTHER,8e3),We(pi,cr.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),pi),ea=function(n){Vc(r,n);var a=jc(r);function r(t,e,i,s,f){var h;return mi(this,r),h=a.call(this,f||(i==null?void 0:i.message)),h.errorType=t===cr.NETWORK_TIMEOUT?cr.NETWORK:t,h.originError=i,h.ext=s,h.errorCode=Ap[t][e]||Ap[t],h.errorMessage=h.message,h.errorCode||(h.errorType=cr.OTHER,h.errorCode=Ap[h.errorType]),h}return yi(r,null,[{key:"create",value:function(e,i,s,f,h){return e instanceof r?e:(e instanceof Error&&(s=e,e=""),e||(e=cr.OTHER),new r(e,i,s,f,h))}},{key:"network",value:function(e){var i;return new r(e!=null&&e.isTimeout?cr.NETWORK_TIMEOUT:cr.NETWORK,null,e instanceof Error?e:null,{url:e==null?void 0:e.url,response:e==null?void 0:e.response,httpCode:e==null||(i=e.response)===null||i===void 0?void 0:i.status})}}]),r}(I0(Error)),xh={DEBUG:1,LOG:2,WARN:3,ERROR:4},IR=200*1024,OR=["Boolean","Number","String","Undefined","Null","Date","Object"],yo=function(){function n(a,r){mi(this,n),this.name=a||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(r==null?void 0:r.logCacheLevel)||3,this.logMaxSize=(r==null?void 0:r.logMaxSize)||IR,this.logSize=0,this.logTextArray=[]}return yi(n,[{key:"debug",value:function(){for(var r,t=arguments.length,e=new Array(t),i=0;i1?e-1:0),s=1;s=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var h=this.logTextArray.shift();this.logSize-=h.length}}}},{key:"getLogCache",value:function(){var r=this.logTextArray.join(` `);return this.reset(),r}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var r;n.disabled||(console.group(this._prefix),(r=console).table.apply(r,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(r){this.logCacheLevel=r}}],[{key:"enable",value:function(){n.disabled=!1}},{key:"disable",value:function(){n.disabled=!0}}]),n}();We(yo,"disabled",!0);function vc(){return new Date().toLocaleString()}function FR(n){if(hl(n)!=="object")return n;var a=Object.prototype.toString.call(n).slice(8,-1);switch(a){case"Array":case"Uint8Array":case"ArrayBuffer":return a+"["+n.length+"]";case"Object":return"{}";default:return a}}function fS(n,a,r){r||(r=1),a||(a=2);var t={};if(!n||hl(n)!=="object")return n;var e=Object.prototype.toString.call(n).slice(8,-1);if(!OR.includes(e))return e;if(!(r>a)){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r===a?t[i]=FR(n[i]):hl(n[i])==="object"?t[i]=fS(n[i],a,r+1):t[i]=n[i]);return t}}function Vu(){var n,a,r=new Promise(function(t,e){n=t,a=e});return r.used=!1,r.resolve=function(){return r.used=!0,n.apply(void 0,arguments)},r.reject=function(){return r.used=!0,a.apply(void 0,arguments)},r}function Uu(){try{return parseInt(performance.now(),10)}catch{return new Date().getTime()}}var MR={stringify:function(a){try{return JSON.stringify(a)}catch{return""}},parse:function(a){try{return JSON.parse(a)}catch{return}}};function ax(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;try{return PR?n&&typeof ManagedMediaSource<"u"?ManagedMediaSource:window.MediaSource:null}catch{}}function kp(n){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(n))}function BR(n){var a=[];if(n instanceof TimeRanges)for(var r=0;r0))}),t}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var r;return((r=this.mediaSource)===null||r===void 0?void 0:r.duration)||-1}},{key:"isEnded",get:function(){return this.mediaSource?this.mediaSource.readyState==="ended":!1}},{key:"streaming",get:function(){return kp(this.mediaSource)?this.mediaSource.streaming:!0}},{key:"isFull",value:function(r){return r?this._mseFullFlag[r]:this._mseFullFlag[n.VIDEO]}},{key:"updateDuration",value:function(r){var t=this,e=this.mediaSource&&this.mediaSource.duration>r;if(this.mediaSource&&this.mediaSource.duration>r){var i=0;if(Object.keys(this._sourceBuffer).forEach(function(s){try{i=Math.max(t.bufferEnd(s)||0,i)}catch{}}),r=1,f=i.readyState==="open",s&&f)try{i.endOfStream()}catch{}Object.keys(this._sourceBuffer).forEach(function(S){try{i.removeSourceBuffer(e._sourceBuffer[S])}catch{}}),kp(i)&&(i.removeEventListener("startstreaming",this._onStartStreaming),i.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch{}this.media=null}this.mediaSource=null,this._openPromise=Vu(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return p.stop()}},t,this)}));function r(){return a.apply(this,arguments)}return r}()},{key:"createSource",value:function(r,t){if(!(this._sourceBuffer[r]||!this.mediaSource)){var e;try{e=this._sourceBuffer[r]=this.mediaSource.addSourceBuffer(t)}catch(i){throw new ea(cr.MEDIA,cr.SUB_TYPES.MSE_ADD_SB,i)}e.mimeType=t,e.addEventListener("updateend",this._onSBUpdateEnd.bind(this,r)),e.addEventListener("error",this._onSBUpdateError.bind(this,r))}}},{key:"changeType",value:function(r,t){var e=this,i=this._sourceBuffer[r];return!this.mediaSource||!i||i.mimeType===t?Promise.resolve():typeof i.changeType!="function"?Promise.reject(new ea(cr.MEDIA,cr.SUB_TYPES.MSE_CHANGE_TYPE,new Error("changeType is not a function"))):this._enqueueOp(r,function(){try{i.changeType(t)}catch(s){throw new ea(cr.MEDIA,cr.SUB_TYPES.MSE_CHANGE_TYPE,s)}i.mimeType=t,e._onSBUpdateEnd(r)},"changeType",{mimeType:t})}},{key:"createOrChangeSource",value:function(r,t){return this.createSource(r,t),this.changeType(r,t)}},{key:"append",value:function(r,t,e){var i=this;return!t||!t.byteLength||!this._sourceBuffer[r]?Promise.resolve():this._enqueueOp(r,function(){var s;!i.mediaSource||i.media.error||(i._logger.debug("MSE APPEND START",e),i._opst=Uu(),(s=i._sourceBuffer[r])===null||s===void 0||s.appendBuffer(t))},Eh.APPEND,e)}},{key:"remove",value:function(r,t,e,i){var s=this,f=!1;return this._mseFullFlag[r]&&(f=!0),this._enqueueOp(r,function(){if(!(!s.mediaSource||s.media.error)){var h=s._sourceBuffer[r];if(t>=e||!h){s._onSBUpdateEnd(r);return}s._opst=Uu(),s._logger.debug("MSE REMOVE START",r,t,e,i),h.remove(t,e)}},Eh.REMOVE,i,f)}},{key:"clearBuffer",value:function(r,t){var e=this,i;return Object.keys(this._sourceBuffer).forEach(function(s){i=e.remove(s,r,t)}),i||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var r=this,t;return Object.keys(this._sourceBuffer).forEach(function(e){var i=r._sourceBuffer[e];t=r.remove(e,0,ni.end(ni.get(i)))}),t}},{key:"clearOpQueues",value:function(r,t){var e;this._logger.debug("MSE clearOpQueue START");var i=this._queue[r];if(t&&i){this._queue[r]=[];return}if(!(!i||!i[r]||i.length<5)){var s=[];i.forEach(function(f){f.context&&f.context.isinit&&s.push(f)}),this._queue[r]=i.slice(0,2),s.length>0&&(e=this._queue[r]).push.apply(e,s)}}},{key:"endOfStream",value:function(r){var t=this;return!this.mediaSource||this.mediaSource.readyState!=="open"?Promise.resolve():this._enqueueBlockingOp(function(){var e=t.mediaSource;!e||e.readyState!=="open"||(t._logger.debug("MSE endOfStream START"),r?e.endOfStream(r):e.endOfStream())},"endOfStream")}},{key:"setLiveSeekableRange",value:function(r,t){var e=this.mediaSource;r<0||t=0){var i;this._mseFullFlag[r]=!0,e.context&&hl(e.context)==="object"&&(e.context.isFull=!0),this._logger.error("[MSE error], context,",e.context," ,name,",e.opName,",err,SourceBuffer is full"),e==null||(i=e.promise)===null||i===void 0||i.reject(new ea(cr.MEDIA,cr.SUB_TYPES.MSE_FULL,f))}else{var s;this._logger.error(f),e==null||(s=e.promise)===null||s===void 0||s.reject(f.constructor===ea?f:new ea(cr.MEDIA,cr.SUB_TYPES.MSE_OTHER,f)),t.shift(),this._startQueue(r)}}}}},{key:"setTimeoffset",value:function(r,t,e){var i=this;return this._enqueueOp(r,function(){t<0&&(t+=.001),i._sourceBuffer[r].timestampOffset=t,i._onSBUpdateEnd(r)},"setTimeoffset",e)}},{key:"abort",value:function(r,t){var e=this;return this.isOpened?this._enqueueOp(r,function(){e._sourceBuffer[r].abort(),e._onSBUpdateEnd(r)},"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=ax();if(!t)return!1;try{return t.isTypeSupported(r)}catch(e){return this._logger.error(r,e),!1}}},{key:"isMMSOnly",value:function(){return typeof ManagedMediaSource<"u"&&typeof MediaSource>"u"}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),n}();We(Lc,"VIDEO","video");We(Lc,"AUDIO","audio");var ul={FETCH:"fetch",XHR:"xhr"},Rc={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"},Ha=function(n){Vc(r,n);var a=jc(r);function r(t,e,i,s){var f;return mi(this,r),f=a.call(this,s),We(Rt(f),"retryCount",0),We(Rt(f),"isTimeout",!1),We(Rt(f),"loaderType",ul.FETCH),We(Rt(f),"startTime",0),We(Rt(f),"endTime",0),We(Rt(f),"options",{}),f.url=t,f.request=e,f.response=i,f}return yi(r)}(I0(Error)),cS=Object.prototype.toString;function NR(n){return n!==null&&hl(n)==="object"}function sx(n){if(cS.call(n)!=="[object Object]")return!1;var a=Object.getPrototypeOf(n);return a===null||a===Object.prototype}function UR(n){return cS.call(n)==="[object Date]"}function dS(n){if(!(!n||n[0]===null||n[0]===void 0||n[0]===0&&(n[1]===null||n[1]===void 0))){var a="bytes="+n[0]+"-";return n[1]&&(a+=n[1]),a}}function ox(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function hS(n,a){if(n){if(!a)return n;var r,t=Object.keys(a).map(function(i){if(r=a[i],r!=null)return Array.isArray(r)?i=i+"[]":r=[r],r.map(function(s){return UR(s)?s=s.toISOString():NR(s)&&(s=JSON.stringify(s)),"".concat(ox(i),"=").concat(ox(s))}).join("&")}).filter(Boolean).join("&");if(t){var e=n.indexOf("#");e!==-1&&(n=n.slice(0,e)),n+=(n.indexOf("?")===-1?"?":"&")+t}return n}}function og(n,a,r,t,e,i,s,f,h,p,S){e=e!=null?parseFloat(e):null,t=parseInt(t||"0",10),Number.isNaN(t)&&(t=0);var b={range:h,vid:p,index:f,contentLength:t,age:e,startTime:i,firstByteTime:s,endTime:Date.now(),priOptions:S};return{data:n,done:a,options:b,response:r}}function lg(n,a){return Math.round(n*8*1e3/a/1024)}var Et={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",APPEND_BUFFER:"core.appendbuffer",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",CHASEFRAME:"core.chaseframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",DEMUXED_TRACK:"core.demuxedtrack",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},lx=2*1024*1024,ug=function(n){Vc(r,n);var a=jc(r);function r(){var t;return mi(this,r),t=a.call(this),We(Rt(t),"_abortController",null),We(Rt(t),"_timeoutTimer",null),We(Rt(t),"_reader",null),We(Rt(t),"_response",null),We(Rt(t),"_aborted",!1),We(Rt(t),"_index",-1),We(Rt(t),"_range",null),We(Rt(t),"_receivedLength",0),We(Rt(t),"_running",!1),We(Rt(t),"_logger",null),We(Rt(t),"_vid",""),We(Rt(t),"_firtstByte",0),We(Rt(t),"_onProcessMinLen",0),We(Rt(t),"_onCancel",null),We(Rt(t),"_priOptions",null),t}return yi(r,[{key:"load",value:function(e){var i,s=this,f=e.url,h=e.vid,p=e.timeout,S=e.responseType,b=e.onProgress,A=e.index,R=e.onTimeout,D=e.onCancel,I=e.range,O=e.transformResponse,V=e.request,N=e.params,G=e.logger,z=e.method,Z=e.headers,H=e.body,ee=e.mode,te=e.credentials,fe=e.cache,ne=e.redirect,oe=e.referrer,Y=e.referrerPolicy,q=e.onProcessMinLen,Q=e.priOptions,be=e.streamRes,ge=e.firstMaxChunkSize;this._logger=G,this._aborted=!1,this._onProcessMinLen=q,this._onCancel=D,this._abortController=typeof AbortController<"u"&&new AbortController,this._running=!0,this._index=A,this._range=I||[0,0],this._vid=h||f,this._priOptions=Q||{},this._firstMaxChunkSize=ge;var ve={method:z,headers:Z,body:H,mode:ee,credentials:te,cache:fe,redirect:ne,referrer:oe,referrerPolicy:Y,signal:(i=this._abortController)===null||i===void 0?void 0:i.signal},re=!1;clearTimeout(this._timeoutTimer),f=hS(f,N);var j=dS(I);j&&(V?Z=V.headers:Z=ve.headers=ve.headers||(Headers?new Headers:{}),Headers&&Z instanceof Headers?Z.append("Range",j):Z.Range=j),p&&(this._timeoutTimer=setTimeout(function(){if(re=!0,s.cancel(),R){var X=new Ha(f,ve,null,"timeout");X.isTimeout=!0,R(X,{index:s._index,range:s._range,vid:s._vid,priOptions:s._priOptions})}},p));var ye=Date.now();return this._logger.debug("[fetch load start], index,",A,",range,",I),new Promise(function(X,ce){var Ae=be?new Promise(function(_e){_e(be)}):fetch(V||f,V?void 0:ve);Ae.then(function(){var _e=vs(bn().mark(function it(nt){var wt,at,$t,gr;return bn().wrap(function(ft){for(;;)switch(ft.prev=ft.next){case 0:if(clearTimeout(s._timeoutTimer),s._response=nt,!(s._aborted||!s._running)){ft.next=4;break}return ft.abrupt("return");case 4:if(O&&(nt=O(nt,f)||nt),nt.ok){ft.next=7;break}throw new Ha(f,ve,nt,"bad network response");case 7:if(wt=Date.now(),S!==Rc.TEXT){ft.next=15;break}return ft.next=11,nt.text();case 11:at=ft.sent,s._running=!1,ft.next=37;break;case 15:if(S!==Rc.JSON){ft.next=22;break}return ft.next=18,nt.json();case 18:at=ft.sent,s._running=!1,ft.next=37;break;case 22:if(!b){ft.next=29;break}return s.resolve=X,s.reject=ce,s._loadChunk(nt,b,ye,wt),ft.abrupt("return");case 29:return ft.next=31,nt.arrayBuffer();case 31:at=ft.sent,at=new Uint8Array(at),s._running=!1,$t=Date.now()-ye,gr=lg(at.byteLength,$t),s.emit(Et.REAL_TIME_SPEED,{speed:gr,len:at.byteLength,time:$t,vid:s._vid,index:s._index,range:s._range,priOptions:s._priOptions});case 37:s._logger.debug("[fetch load end], index,",A,",range,",I),X(og(at,!0,nt,nt.headers.get("Content-Length"),nt.headers.get("age"),ye,wt,A,I,s._vid,s._priOptions));case 39:case"end":return ft.stop()}},it)}));return function(it){return _e.apply(this,arguments)}}()).catch(function(_e){var it;clearTimeout(s._timeoutTimer),s._running=!1,!(s._aborted&&!re)&&(_e=_e instanceof Ha?_e:new Ha(f,ve,null,(it=_e)===null||it===void 0?void 0:it.message),_e.startTime=ye,_e.endTime=Date.now(),_e.isTimeout=re,_e.options={index:s._index,range:s._range,vid:s._vid,priOptions:s._priOptions},ce(_e))})})}},{key:"cancel",value:function(){var t=vs(bn().mark(function i(){return bn().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(!this._aborted){f.next=2;break}return f.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){f.next=14;break}if(f.prev=5,!this._reader){f.next=9;break}return f.next=9,this._reader.cancel();case 9:f.next=13;break;case 11:f.prev=11,f.t0=f.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch{}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return f.stop()}},i,this,[[5,11]])}));function e(){return t.apply(this,arguments)}return e}()},{key:"_loadChunk",value:function(e,i,s,f){var h=this;if(!e.body||!e.body.getReader){this._running=!1;var p=new Ha(e.url,"",e,"onProgress of bad response.body.getReader");p.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(p);return}this._onProcessMinLen>0&&(this._cache=new Uint8Array(lx),this._writeIdx=0);var S=this._reader=e.body.getReader(),b,A,R,D=function(){var I=vs(bn().mark(function O(){var V,N,G,z,Z,H,ee,te,fe,ne;return bn().wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:return A=Date.now(),Y.prev=1,Y.next=4,S.read();case 4:b=Y.sent,R=Date.now(),Y.next=13;break;case 8:return Y.prev=8,Y.t0=Y.catch(1),R=Date.now(),h._aborted||(h._running=!1,Y.t0.options={index:h._index,range:h._range,vid:h._vid,priOptions:h._priOptions},h.reject(Y.t0)),Y.abrupt("return");case 13:if(N=((V=h._range)===null||V===void 0?void 0:V.length)>0?h._range[0]:0,G=N+h._receivedLength,!h._aborted){Y.next=19;break}return h._running=!1,i(void 0,!1,{range:[G,G],vid:h._vid,index:h._index,startTime:A,endTime:R,st:s,firstByteTime:f,priOptions:h._priOptions},e),Y.abrupt("return");case 19:z=b.value?b.value.byteLength:0,h._receivedLength+=z,h._logger.debug("【fetchLoader,onProgress call】,task,",h._range,", start,",G,", end,",N+h._receivedLength,", done,",b.done),h._onProcessMinLen>0?h._writeIdx+z>=h._onProcessMinLen||b.done?(Z=new Uint8Array(h._writeIdx+z),Z.set(h._cache.slice(0,h._writeIdx),0),z>0&&Z.set(b.value,h._writeIdx),h._writeIdx=0,h._logger.debug("【fetchLoader,onProgress enough】,done,",b.done,",len,",Z.byteLength,", writeIdx,",h._writeIdx)):z>0&&h._writeIdx+z0&&(H=new Uint8Array(h._writeIdx+z+2048),h._logger.debug("【fetchLoader,onProgress extra start】,size,",h._writeIdx+z+2048,", datalen,",z,", writeIdx,",h._writeIdx),H.set(h._cache.slice(0,h._writeIdx),0),z>0&&H.set(b.value,h._writeIdx),h._writeIdx+=z,delete h._cache,h._cache=H,h._logger.debug("【fetchLoader,onProgress extra end】,len,",z,", writeIdx,",h._writeIdx)):Z=b.value,(Z&&Z.byteLength>0||b.done)&&(h._firstMaxChunkSize&&(h._firtstByte?h._cacheData&&(te=new Uint8Array(h._cacheData.byteLength+Z.byteLength),te.set(h._cacheData,0),te.set(Z,h._cacheData.byteLength),Z=te,h._cacheData=null):(h._firtstByte++,ee=Z.slice(0,h._firstMaxChunkSize),h._cacheData=Z.slice(h._firstMaxChunkSize),Z=ee)),i(Z,b.done,{range:[h._range[0]+h._receivedLength-(Z?Z.byteLength:0),h._range[0]+h._receivedLength],vid:h._vid,index:h._index,startTime:A,endTime:R,st:s,firstByteTime:f,priOptions:h._priOptions},e)),b.done?(fe=Date.now()-s,ne=lg(h._receivedLength,fe),h.emit(Et.REAL_TIME_SPEED,{speed:ne,len:h._receivedLength,time:fe,vid:h._vid,index:h._index,range:h._range,priOptions:h._priOptions}),h._running=!1,h._logger.debug("[fetchLoader onProgress end],task,",h._range,",done,",b.done),h.resolve(og(b,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),s,f,h._index,h._range,h._vid,h._priOptions))):h._firstMaxChunkSize?setTimeout(function(){D()},0):D();case 25:case"end":return Y.stop()}},O,null,[[1,8]])}));return function(){return I.apply(this,arguments)}}();D()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return typeof fetch<"u"}}]),r}(Ju);function HR(n){return Ac({loaderType:ul.FETCH,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:Rc.TEXT,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},n)}var VR=function(n){Vc(r,n);var a=jc(r);function r(){var t;return mi(this,r),t=a.call(this),We(Rt(t),"_xhr",null),We(Rt(t),"_aborted",!1),We(Rt(t),"_timeoutTimer",null),We(Rt(t),"_range",null),We(Rt(t),"_receivedLength",0),We(Rt(t),"_url",null),We(Rt(t),"_onProgress",null),We(Rt(t),"_index",-1),We(Rt(t),"_headers",null),We(Rt(t),"_currentChunkSizeKB",384),We(Rt(t),"_timeout",null),We(Rt(t),"_xhr",null),We(Rt(t),"_withCredentials",null),We(Rt(t),"_startTime",-1),We(Rt(t),"_loadCompleteResolve",null),We(Rt(t),"_loadCompleteReject",null),We(Rt(t),"_runing",!1),We(Rt(t),"_logger",!1),We(Rt(t),"_vid",""),We(Rt(t),"_responseType",void 0),We(Rt(t),"_credentials",void 0),We(Rt(t),"_method",void 0),We(Rt(t),"_transformResponse",void 0),We(Rt(t),"_firstRtt",void 0),We(Rt(t),"_onCancel",null),We(Rt(t),"_priOptions",null),t}return yi(r,[{key:"load",value:function(e){var i=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials=e.credentials==="include"||e.credentials==="same-origin",this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=hS(e.url,e.params);var s=Date.now();return new Promise(function(f,h){i._loadCompleteResolve=f,i._loadCompleteReject=h,i._startLoad()}).catch(function(f){if(clearTimeout(i._timeoutTimer),i._runing=!1,!i._aborted)throw f=f instanceof Ha?f:new Ha(i._url,i._request),f.startTime=s,f.endTime=Date.now(),f.options={index:i._index,vid:i._vid,priOptions:i._priOptions},f})}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===Rc.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var i=this._currentChunkSizeKB*1024,s=this._range[0]+this._receivedLength,f=this._range[1];i],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var i=this;try{this._startTime=Date.now();var s=this._xhr=new XMLHttpRequest;s.open(this._method||"GET",this._url,!0),s.responseType=this._responseType,this._timeout&&(s.timeout=this._timeout),s.withCredentials=this._withCredentials,s.onload=this._onLoad.bind(this),s.onreadystatechange=this._onReadyStatechange.bind(this),s.onerror=function(p){var S,b,A;i._running=!1;var R=new Ha(i._url,i._request,p==null||(S=p.currentTarget)===null||S===void 0?void 0:S.response,"xhr.onerror.status:"+(p==null||(b=p.currentTarget)===null||b===void 0?void 0:b.status)+",statusText,"+(p==null||(A=p.currentTarget)===null||A===void 0?void 0:A.statusText));R.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i._loadCompleteReject(R)},s.ontimeout=function(p){i.cancel();var S=new Ha(i._url,i._request,{status:408},"timeout");i._onTimeout&&(S.isTimeout=!0,i._onTimeout(S,{index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions})),S.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i._loadCompleteReject(S)};var f=this._headers||{},h=dS(e);h&&(f.Range=h),f&&Object.keys(f).forEach(function(p){s.setRequestHeader(p,f[p])}),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),s.send(this._body)}catch(p){p.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(p)}}},{key:"_onReadyStatechange",value:function(e){var i=e.target;i.readyState===2&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var i,s=e.target.status;if(s<200||s>299){var f=new Ha(this._url,null,Ac(Ac({},e.target.response),{},{status:s}),"bad response,status:"+s);return f.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(f)}var h=null,p=!1,S,b=((i=this._range)===null||i===void 0?void 0:i.length)>0?this._range[0]:0;if(this._responseType===Rc.ARRAY_BUFFER){var A,R=new Uint8Array(e.target.response);if(S=b+this._receivedLength,R&&R.byteLength>0){this._receivedLength+=R.byteLength;var D=Date.now()-this._startTime,I=lg(this._receivedLength,D);this.emit(Et.REAL_TIME_SPEED,{speed:I,len:this._receivedLength,time:D,vid:this._vid,index:this._index,range:[S,b+this._receivedLength],priOptions:this._priOptions})}h=R,((A=this._range)===null||A===void 0?void 0:A.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",S,"end ",b+this._receivedLength,",dataLen,",R?R.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",p)}else p=!0,h=e.target.response;var O={ok:s>=200&&s<300,status:s,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(O=this._transformResponse(O,this._url)||O),this._onProgress&&this._onProgress(h,p,{index:this._index,vid:this._vid,range:[S,b+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},O),p?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(og(this._onProgress?null:h,p,O,O.headers["content-length"],O.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted&&(this._aborted=!0,this._runing=!1,u0(vl(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr))return this._xhr.abort()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var i=e.getAllResponseHeaders().trim().split(`\r `),s={},f=RR(i),h;try{for(f.s();!(h=f.n()).done;){var p=h.value,S=p.split(": ");s[S[0].toLowerCase()]=S.slice(1).join(": ")}}catch(b){f.e(b)}finally{f.f()}return s}}],[{key:"isSupported",value:function(){return typeof XMLHttpRequest<"u"}}]),r}(Ju),jR=["retry","retryDelay","onRetryError","transformError"],GR=function(){function n(a,r){mi(this,n),this.promise=Vu(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new yo("Loader")),this._loaderType=a,this._loader=a===ul.FETCH&&typeof fetch<"u"?new ug:new VR,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}return yi(n,[{key:"exec",value:function(){var r=this,t=this._config,e=t.retry,i=t.retryDelay,s=t.onRetryError,f=t.transformError,h=wR(t,jR),p=function(){var S=vs(bn().mark(function b(){var A,R,D;return bn().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return O.prev=0,O.next=3,r._loader.load(h);case 3:A=O.sent,r.promise.resolve(A),O.next=27;break;case 7:if(O.prev=7,O.t0=O.catch(0),r._loader.running=!1,r._logger.debug("[task request catch err]",O.t0),!r._canceled){O.next=13;break}return O.abrupt("return");case 13:if(O.t0.loaderType=r._loaderType,O.t0.retryCount=r._retryCount,R=O.t0,f&&(R=f(R)||R),s&&r._retryCount>0&&s(R,r._retryCount,{index:h.index,vid:h.vid,range:h.range,priOptions:h.priOptions}),r._retryCount++,D=!0,r._retryCheckFunc&&(D=r._retryCheckFunc(O.t0)),!(D&&r._retryCount<=e)){O.next=26;break}return clearTimeout(r._retryTimer),r._logger.debug("[task request setTimeout],retry",r._retryCount,",retry range,",h.range),r._retryTimer=setTimeout(p,i),O.abrupt("return");case 26:r.promise.reject(R);case 27:case"end":return O.stop()}},b,null,[[0,7]])}));return function(){return S.apply(this,arguments)}}();return p(),this.promise}},{key:"cancel",value:function(){var a=vs(bn().mark(function t(){return bn().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,i.abrupt("return",this._loader.cancel());case 4:case"end":return i.stop()}},t,this)}));function r(){return a.apply(this,arguments)}return r}()},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),n}();function zR(n){return n&&!n.paused&&!n.ended&&n.playbackRate!==0&&n.readyState!==0}function WR(n){if(!n)return{};if(typeof n.getVideoPlaybackQuality=="function"){var a=n.getVideoPlaybackQuality();return{droppedVideoFrames:a.droppedVideoFrames||a.corruptedVideoFrames,totalVideoFrames:a.totalVideoFrames,creationTime:a.creationTime}}return{droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDecodedFrameCount,creationTime:performance.now()}}function $R(){for(var n=arguments.length,a=new Array(n),r=0;r0&&arguments[0]!==void 0?arguments[0]:0;return new Promise(function(a){return setTimeout(a,n)})}var YR=function(n){Vc(r,n);var a=jc(r);function r(t){var e;return mi(this,r),e=a.call(this,t),We(Rt(e),"type",ul.FETCH),We(Rt(e),"_queue",[]),We(Rt(e),"_alive",[]),We(Rt(e),"_currentTask",null),We(Rt(e),"_finnalUrl",""),We(Rt(e),"_config",void 0),e._config=HR(t),(e._config.loaderType===ul.XHR||!ug.isSupported())&&(e.type=ul.XHR),e.log=t.logger,e}return yi(r,[{key:"isFetch",value:function(){return this.type===ul.FETCH}},{key:"load",value:function(e){var i=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"||!e?s.url=e||s.url||this._config.url:s=e,s=Object.assign({},this._config,s),s.params&&(s.params=Object.assign({},s.params)),s.headers&&sx(s.headers)&&(s.headers=Object.assign({},s.headers)),s.body&&sx(s.body)&&(s.body=Object.assign({},s.body)),s.transformRequest&&(s=s.transformRequest(s)||s),s.logger=this.log;var f=new GR(this.type,s);return f.loader.on(Et.REAL_TIME_SPEED,function(h){i.emit(Et.REAL_TIME_SPEED,h)}),this._queue.push(f),this._queue.length===1&&(!this._currentTask||!this._currentTask.running)&&this._processTask(),f.promise}},{key:"cancel",value:function(){var t=vs(bn().mark(function i(){var s;return bn().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return s=this._queue.map(function(p){return p.cancel()}).concat(this._alive.map(function(p){return p.cancel()})),this._currentTask&&s.push(this._currentTask.cancel()),this._queue=[],this._alive=[],h.next=6,Promise.all(s);case 6:return h.next=8,KR();case 8:case"end":return h.stop()}},i,this)}));function e(){return t.apply(this,arguments)}return e}()},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),!!this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var i=this._currentTask.exec().catch(function(s){});i&&typeof i.finally=="function"&&i.finally(function(){var s,f;(s=e._currentTask)!==null&&s!==void 0&&s.alive&&((f=e._alive)===null||f===void 0?void 0:f.length)>0&&(e._alive=e._alive.filter(function(h){return h&&h!==e._currentTask})),e._processTask()})}}}],[{key:"isFetchSupport",value:function(){return ug.isSupported()}}]),r}(Ju),XR=function(){function n(){mi(this,n),We(this,"_prevCurrentTime",0)}return yi(n,[{key:"do",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,e=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(r){var s=r.currentTime,f=0;if(this._prevCurrentTime===s){var h=ni.info(ni.get(r),s);if(!h.buffers.length)return;e&&h.nextStart||h.nextStart&&h.nextStart-si&&!r.seeking&&(f=s+.1)}this._prevCurrentTime=s,f&&s!==f&&(r.currentTime=f)}}}]),n}(),qR=function(){function n(a){var r=this;mi(this,n),We(this,"_seiSet",new Set),this.emitter=a,a.on(Et.SEI,function(t){t&&r._seiSet.add(t)})}return yi(n,[{key:"throw",value:function(r,t){var e=this;if(!(r==null||!this._seiSet.size)){var i=r-.2,s=r+.2,f=[];this._seiSet.forEach(function(h){h.time>=i&&h.time<=s&&f.push(h)}),f.forEach(function(h){e._seiSet.delete(h),e.emitter.emit(Et.SEI_IN_TIME,h)}),t&&this._seiSet.forEach(function(h){h.times&&(this._chunkCache=this._chunkCache.slice(-s))}}},{key:"getAvgSpeed",value:function(){var r;if(!this._chunkCache.length&&!this._speeds.length)return 0;if(this._speeds.length)return this._speeds.reduce(function(f,h){return f+=h})/this._speeds.length;var t=this._chunkCache[this._chunkCache.length-1],e=performance.now()-t.timestamp;e>(((r=this._opts)===null||r===void 0?void 0:r.longtimeNoReceived)||JR)&&this._chunkCache.push({size:0,duration:e,timestamp:performance.now()});var i=this._chunkCache.reduce(function(f,h){return f+=h.size},0),s=this._chunkCache.reduce(function(f,h){return f+=h.duration},0);return 8e3*i/s}},{key:"getLatestSpeed",value:function(){return!this._chunkCache.length&&!this._speeds.length?0:this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeed}},{key:"getTotalSize",value:function(){return this._totalSize}},{key:"getTotalCost",value:function(){return this._totalCost}},{key:"reset",value:function(){this._chunkCache=[],this._speeds=[],this._totalSize=0,this._totalCost=0}}]),n}(),ux=function(){function n(a){mi(this,n),We(this,"encodeType",""),We(this,"audioCodec",""),We(this,"videoCodec",""),We(this,"domain",""),We(this,"fps",0),We(this,"bitrate",0),We(this,"width",0),We(this,"height",0),We(this,"samplerate",0),We(this,"channelCount",0),We(this,"gop",0),We(this,"_bitsAccumulateSize",0),We(this,"_bitsAccumulateDuration",0),We(this,"_startGopId",-1),this._timescale=a}return yi(n,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(r){this.encodeType=r}},{key:"setFpsFromScriptData",value:function(r){var t,e=r.data,i=e==null||(t=e.onMetaData)===null||t===void 0?void 0:t.framerate;i&&i>0&&i<100&&(this.fps=i)}},{key:"setVideoMeta",value:function(r){if(this.width=r.width,this.height=r.height,this.videoCodec=r.codec,this.encodeType=r.codecType,r.fpsNum&&r.fpsDen){var t=r.fpsNum/r.fpsDen;t>0&&t<100&&(this.fps=t)}}},{key:"setAudioMeta",value:function(r){this.audioCodec=r.codec,this.samplerate=r.sampleRate,this.channelCount=r.channelCount}},{key:"setDomain",value:function(r){this.domain=r.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(r){var t=this;if((!this.fps||this.fps>=100)&&r.length){var e=r.reduce(function(i,s){return i+=s.duration},0)/r.length;this.fps=Math.round(this._timescale/e)}r.forEach(function(i){t._startGopId===-1&&(t._startGopId=i.gopId),i.gopId===t._startGopId&&t.gop++,t._bitsAccumulateDuration+=i.duration/(t._timescale/1e3),t._bitsAccumulateSize+=i.units.reduce(function(s,f){return s+=f.length},0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=t._bitsAccumulateSize*8,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)})}}]),n}(),tD=function(){function n(a){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;mi(this,n),We(this,"_core",null),We(this,"_samples",[]),this._core=a,this._timescale=r,this._stats=new ux(r),this._bindEvents()}return yi(n,[{key:"getStats",value:function(){var r,t,e,i,s,f,h,p,S,b,A,R=((r=this._core)===null||r===void 0?void 0:r.media)||{},D=R.currentTime,I=D===void 0?0:D,O=R.decodeFps,V=O===void 0?0:O;return Ac(Ac({},this._stats.getStats()),{},{downloadSpeed:((t=this._core)===null||t===void 0||(e=t.speedInfo)===null||e===void 0?void 0:e.call(t).speed)||0,avgSpeed:((i=this._core)===null||i===void 0||(s=i.speedInfo)===null||s===void 0?void 0:s.call(i).avgSpeed)||0,totalReceivedByte:((f=this._core)===null||f===void 0||(h=f.speedInfo)===null||h===void 0?void 0:h.call(f).totalSize)||0,totalReceivedCost:((p=this._core)===null||p===void 0||(S=p.speedInfo)===null||S===void 0?void 0:S.call(p).totalCost)||0,currentTime:I,bufferEnd:((b=this._core)===null||b===void 0||(A=b.bufferInfo())===null||A===void 0?void 0:A.remaining)||0,decodeFps:V})}},{key:"_bindEvents",value:function(){var r=this;this._core.on(Et.DEMUXED_TRACK,function(t){var e=t.videoTrack;return r._stats.updateBitrate(e.samples)}),this._core.on(Et.FLV_SCRIPT_DATA,function(t){r._stats.setFpsFromScriptData(t)}),this._core.on(Et.METADATA_PARSED,function(t){t.type==="video"?r._stats.setVideoMeta(t.track):r._stats.setAudioMeta(t.track)}),this._core.on(Et.TTFB,function(t){r._stats.setDomain(t.responseUrl)})}},{key:"reset",value:function(){this._samples=[],this._stats=new ux(this._timescale)}}]),n}();function rD(n,a){var r=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(r!=null){var t,e,i,s,f=[],h=!0,p=!1;try{if(i=(r=r.call(n)).next,a!==0)for(;!(h=(t=i.call(r)).done)&&(f.push(t.value),f.length!==a);h=!0);}catch(S){p=!0,e=S}finally{try{if(!h&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(p)throw e}}return f}}function Yr(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function fx(n,a){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function iD(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function aD(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iD(n)}function pS(n){var a=nD();return function(){var t=O0(n),e;if(a){var i=O0(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return aD(this,e)}}function sD(n,a){return lD(n)||rD(n,a)||gS(n,a)||cD()}function Ia(n){return oD(n)||uD(n)||gS(n)||fD()}function oD(n){if(Array.isArray(n))return cg(n)}function lD(n){if(Array.isArray(n))return n}function uD(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function gS(n,a){if(n){if(typeof n=="string")return cg(n,a);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set")return Array.from(n);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cg(n,a)}}function cg(n,a){(a==null||a>n.length)&&(a=n.length);for(var r=0,t=new Array(a);r0){var r=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-r.dts+t.duration}return 0}},{key:"exist",value:function(){return/av01/.test(this.codec)?!0:!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),n}(),vD=function(){function n(){Yr(this,n),Je(this,"id",2),Je(this,"type",$u.AUDIO),Je(this,"codecType",yn.AAC),Je(this,"pid",-1),Je(this,"codec",""),Je(this,"container",""),Je(this,"sequenceNumber",0),Je(this,"sampleDuration",0),Je(this,"timescale",0),Je(this,"formatTimescale",0),Je(this,"baseMediaDecodeTime",0),Je(this,"duration",0),Je(this,"warnings",[]),Je(this,"samples",[]),Je(this,"baseDts",0),Je(this,"sampleSize",16),Je(this,"sampleRate",0),Je(this,"channelCount",0),Je(this,"objectType",0),Je(this,"sampleRateIndex",0),Je(this,"config",[]),Je(this,"present",!1),Je(this,"isVideoEncryption",!1),Je(this,"isAudioEncryption",!1),Je(this,"kid",null),Je(this,"ext",void 0)}return Xr(n,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&(this.codec||this.container)&&(this.codecType===yn.AAC||this.codecType===yn.G711PCMA||this.codecType===yn.G711PCMU||this.codecType===yn.OPUS||this.codecType===yn.MP3))}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var r=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-r.dts+t.duration}return 0}}]),n}(),pD=function(){function n(a,r,t){Yr(this,n),Je(this,"flag",{}),Je(this,"keyframe",!1),Je(this,"gopId",0),Je(this,"duration",0),Je(this,"size",0),Je(this,"units",[]),Je(this,"chromaFormat",420),this.originPts=this.pts=a,this.originDts=this.dts=r,t&&(this.units=t)}return Xr(n,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),n}(),f0=Xr(function n(a,r,t,e){Yr(this,n),Je(this,"duration",1024),Je(this,"flag",{dependsOn:2,isNonSyncSample:0}),Je(this,"keyframe",!0),this.originPts=this.pts=this.dts=a,this.data=r,this.size=r.byteLength,this.sampleOffset=e,t&&(this.duration=t)}),yS=Xr(function n(a,r){Yr(this,n),Je(this,"time",0),this.data=a,this.originPts=this.pts=r}),gD=function(n){vS(r,n);var a=pS(r);function r(){return Yr(this,r),a.apply(this,arguments)}return Xr(r)}(yS),mD=function(n){vS(r,n);var a=pS(r);function r(){return Yr(this,r),a.apply(this,arguments)}return Xr(r)}(yS),yD=function(){function n(){Yr(this,n),Je(this,"id",3),Je(this,"type",$u.METADATA),Je(this,"timescale",0),Je(this,"flvScriptSamples",[]),Je(this,"seiSamples",[])}return Xr(n,[{key:"exist",value:function(){return!!((this.flvScriptSamples.length||this.seiSamples.length)&&this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!!(this.flvScriptSamples.length||this.seiSamples.length)}}]),n}(),F0=function(){function n(a){Yr(this,n),this.name=a||"",this._prefix="[".concat(this.name,"]")}return Xr(n,[{key:"warn",value:function(){var r;if(!n.disabled){for(var t=arguments.length,e=new Array(t),i=0;i=e)){var s=i,f=[],h=(r[i+2]&60)>>>2,p=n.FREQ[h];if(!p)throw new Error("Invalid sampling index: ".concat(h));for(var S=((r[i+2]&192)>>>6)+1,b=(r[i+2]&1)<<2|(r[i+3]&192)>>>6,A=n._getConfig(h,b,S),R=A.config,D=A.codec,I,O,V=0,N=n.getFrameDuration(p);i+7>5,!O||e-i=e?void 0:r.subarray(i),frames:f,samplingFrequencyIndex:h,sampleRate:p,objectType:S,channelCount:b,codec:D,config:R,originCodec:"mp4a.40.".concat(S)}}}},{key:"parseAudioSpecificConfig",value:function(r){if(r.length){var t=r[0]>>>3,e=(r[0]&7)<<1|r[1]>>>7,i=(r[1]&120)>>>3,s=n.FREQ[e];if(s){var f=n._getConfig(e,i,t),h=f.config,p=f.codec;return{samplingFrequencyIndex:e,sampleRate:s,objectType:t,channelCount:i,config:h,codec:p,originCodec:"mp4a.40.".concat(t)}}}}},{key:"getFrameDuration",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:9e4;return 1024*t/r}},{key:"_getConfig",value:function(r,t,e){var i=[],s,f;return ED?r>=6?(s=5,f=r-3):(s=2,f=r):SD?(s=2,f=r):(s=5,f=r,r>=6?f=r-3:t===1&&(s=2,f=r)),i[0]=s<<3,i[0]|=(r&14)>>1,i[1]=(r&1)<<7,i[1]|=t<<3,s===5&&(i[1]|=(f&14)>>1,i[2]=(f&1)<<7,i[2]|=8,i[3]=0),{config:i,codec:"mp4a.40.".concat(s)}}},{key:"getSilentFrame",value:function(r,t){switch(r){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}]),n}();Je(M0,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var dg=function(){function n(){Yr(this,n)}return Xr(n,null,[{key:"getFrameDuration",value:function(r){return 20}},{key:"parseHeaderPackets",value:function(r){if(r.length){for(var t=new DataView(r.buffer,r.byteOffset,r.byteLength),e="",i=0;i<8;i++)e+=String.fromCodePoint(r[i]);if(e!=="OpusHead")throw new Error("Invalid Opus MagicSignature");var s=r[9];console.log("Pre-skip",r[10],r[11]);var f=t.getUint32(12,!0),h=t.getInt16(16,!0);if(f){var p="opus",S="opus",b=new Uint8Array(r.buffer,r.byteOffset+8,r.byteLength-8);return{outputGain:h,sampleRate:f,channelCount:s,config:b,codec:p,originCodec:S}}}}}]),n}(),_D=500,bD=3,Lp=1e3,Rp=5e3,TD=1e3,CD=200,cx=5e3,dx=5,wD=function(){function n(a,r,t){Yr(this,n),this.videoTrack=a,this.audioTrack=r,this.metadataTrack=t,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastVideoDuration=0,this._keyFrameInNextChunk=!1,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0}return Xr(n,[{key:"fix",value:function(){var r=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=Math.round(t*1e3);var s=this.videoTrack,f=this.audioTrack;(e||!i)&&(this._videoLastSample=null,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0),e&&!i&&(this._baseDtsInited=!1),this._baseDtsInited||this._calculateBaseDts(f,s),!i&&t&&(this._audioNextPts=this._videoNextDts=t);var h=this._baseDtsInited&&(this._videoTimestampBreak||!this.videoTrack.exist())&&(this._audioTimestampBreak||!this.audioTrack.exist());if(h&&this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(f),this._keyFrameInNextChunk=!1,this._fixVideo(s),this.metadataTrack.exist()){var p=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach(function(S){S.pts=S.originPts-r._baseDts,S.time=Math.max(0,S.pts)/p}),this.metadataTrack.flvScriptSamples.forEach(function(S){S.pts=S.originPts-r._baseDts,S.time=Math.max(0,S.pts)/p})}s.samples.length&&(s.baseMediaDecodeTime=s.samples[0].dts),f.samples.length&&(f.baseMediaDecodeTime=f.samples[0].pts*f.timescale/1e3)}},{key:"_fixVideo",value:function(r){var t=this,e=r.samples;if(e.length){e.forEach(function(N){N.dts-=t._baseDts,N.pts-=t._baseDts,N.keyframe&&(t._keyFrameInNextChunk=!0)});var i;if(r.fpsNum&&r.fpsDen)i=r.timescale*(r.fpsDen/r.fpsNum);else if(r.length>1){var s=r.samples[0],f=r.samples[e.length-1];i=Math.floor((f.dts-s.dts)/(e.length-1))}else i=this._lastVideoDuration||40;var h=e.pop();if(this._videoLastSample&&e.unshift(this._videoLastSample),this._videoLastSample=h,!!e.length){if(this._videoNextDts===void 0){var p=e[0];this._videoNextDts=p.dts}var S=e.length,b=0,A=e[0],R=this._videoNextDts-A.dts;if(Math.abs(R)>CD){if(Math.abs(A.dts-this._lastVideoExceptionChunkFirstDtsDot)>cx){var D;this._lastVideoExceptionChunkFirstDtsDot=A.dts,r.warnings.push({type:ta.LARGE_VIDEO_GAP_BETWEEN_CHUNK,nextDts:this._videoNextDts,firstSampleDts:A.dts,nextSampleDts:(D=e[1])===null||D===void 0?void 0:D.dts,sampleDuration:R})}this._videoTimestampBreak>=dx?(this._videoNextDts=A.dts,this._videoTimestampBreak=0):(A.dts+=R,A.pts+=R,this.audioTrack.exist()||(this._videoTimestampBreak=1))}for(var I=0;ITD||b<0)&&(this._videoTimestampBreak++,Math.abs(O-this._lastVideoExceptionLargeGapDot)>cx&&(this._lastVideoExceptionLargeGapDot=O,r.warnings.push({type:ta.LARGE_VIDEO_GAP,time:O/r.timescale,dts:O,originDts:e[I].originDts,nextDts:this._videoNextDts,sampleDuration:b,refSampleDuration:i})),b=i),e[I].duration=b,this._videoNextDts+=b,this._lastVideoDuration=b}}}}},{key:"_fixAudio",value:function(r){var t=this,e=r.samples;e.length&&(e.forEach(function(i){i.dts=i.pts-=t._baseDts}),this._doFixAudioInternal(r,e,1e3))}},{key:"_calculateBaseDts",value:function(r,t){var e=r.samples,i=t.samples;if(!e.length&&!i.length)return!1;var s=1/0,f=1/0;e.length&&(r.baseDts=s=e[0].pts),i.length&&(t.baseDts=f=i[0].dts),this._baseDts=Math.min(s,f);var h=f-s;return Number.isFinite(h)&&Math.abs(h)>_D&&t.warnings.push({type:ta.LARGE_AV_SHIFT,videoBaseDts:f,audioBasePts:s,baseDts:this._baseDts,delta:h}),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){var r=this._calculateBaseDts(this.audioTrack,this.videoTrack);r&&(this.audioTrack.exist()?this.videoTrack.exist()?this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts):this._baseDts-=this._audioNextPts:this._baseDts-=this._videoNextDts,this._videoTimestampBreak=0,this._audioTimestampBreak=0)}},{key:"_doFixAudioInternal",value:function(r,t,e){if(!r.sampleDuration)switch(r.codecType){case yn.AAC:{r.sampleDuration=M0.getFrameDuration(r.timescale,e);break}case yn.OPUS:{r.sampleDuration=dg.getFrameDuration(r.samples,e);break}case yn.G711PCMA:case yn.G711PCMU:{r.sampleDuration=this._getG711Duration(r);break}default:console.error("can't fix audio codecType:",r.codecType);break}var i=r.sampleDuration,s=r.codecType===yn.OPUS?20:r.codecType===yn.AAC?1024:i*r.timescale/1e3;if(this._audioNextPts===void 0){var f=t[0];this._audioNextPts=f.pts}for(var h=0;h=dx&&this._keyFrameInNextChunk&&(p=this._audioNextPts=S.dts,b=0,this._audioTimestampBreak=0),!this._audioTimestampBreak&&b>=bD*i&&b<=Lp&&!xD){var A=this._getSilentFrame(r)||t[0].data.subarray(),R=Math.floor(b/i);Math.abs(S.pts-this._lastAudioExceptionGapDot)>Rp&&(this._lastAudioExceptionGapDot=S.pts,r.warnings.push({type:ta.AUDIO_FILLED,pts:S.pts,originPts:S.originPts,count:R,nextPts:p,refSampleDuration:i}));for(var D=0;D=-1*Lp)Math.abs(S.pts-this._lastAudioExceptionOverlapDot)>Rp&&(this._lastAudioExceptionOverlapDot=S.pts,r.warnings.push({type:ta.AUDIO_DROPPED,pts:S.pts,originPts:S.originPts,nextPts:p,refSampleDuration:i})),t.splice(h,1),h--;else{if(Math.abs(b)>Lp&&(this._audioTimestampBreak++,Math.abs(S.pts-this._lastAudioExceptionLargeGapDot)>Rp&&(this._lastAudioExceptionLargeGapDot=S.pts,r.warnings.push({type:ta.LARGE_AUDIO_GAP,time:S.pts/1e3,pts:S.pts,originPts:S.originPts,nextPts:p,sampleDuration:b,refSampleDuration:i}))),r.codecType===yn.OPUS){var O=t[t.length-1];O&&(O.duration=S.pts-O.pts)}else S.dts=S.pts=p,S.duration=s;this._audioNextPts+=i}}}},{key:"_getG711Duration",value:function(r){var t=r.sampleSize,e=r.channelCount,i=r.sampleRate,s=r.samples[0];if(s)return s.data.byteLength*2/e/(t/8)/i*1e3}},{key:"_getSilentFrame",value:function(r){return r.codecType===yn.AAC?M0.getSilentFrame(r.codec,r.channelCount):new Uint8Array(8*r.sampleDuration*r.channelCount)}}]),n}();function Na(){for(var n=arguments.length,a=new Array(n),r=0;r1&&arguments[1]!==void 0?arguments[1]:0;return(n[a]<<24>>>0)+(n[a+1]<<16)+(n[a+2]<<8)+(n[a+3]||0)}function AD(n){for(var a="avc1.",r,t=0;t<3;t++)r=n[t].toString(16),r.length<2&&(r="0".concat(r)),a+=r;return a}function hx(n){if(!Array.isArray(n)){for(var a=[],r="",t=0;t0);e>=3&&(r=r.subarray(0,t+1));for(var i=r.length,s=2,f=0;r[s]!==null&&r[s]!==void 0&&r[s]!==1;)s++;if(s++,f=s+2,f>=i)return[];for(var h=[];f1&&arguments[1]!==void 0?arguments[1]:4;if(!(r.length<4)){for(var e=r.length,i=[],s=0,f;s+t>>=8),s+=t,!!f){if(s+f>e)break;i.push(r.subarray(s,s+f)),s+=f}return i}}},{key:"parseSEI",value:function(r,t){for(var e=r.length,i=t?2:1,s=0,f=0,h="";r[i]===255;)s+=255,i++;for(s+=r[i++];r[i]===255;)f+=255,i++;if(f+=r[i++],s===5&&e>i+16)for(var p=0;p<16;p++)h+=r[i].toString(16),i++;return{payload:r.subarray(i,i+f),type:s,size:f,uuid:h}}},{key:"removeEPB",value:function(r){for(var t=r.byteLength,e=[],i=1;ir)this._word<<=r,this._bitsAvailable-=r;else{r-=this._bitsAvailable;var t=Math.floor(r/8);r-=t*8,this._bytesAvailable-=t,this._loadWord(),this._word<<=r,this._bitsAvailable-=r}}},{key:"readBits",value:function(r){if(r>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,r),e=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),t=r-t,t>0&&this._bitsAvailable?e<>>r)!==0)return this._word<<=r,this._bitsAvailable-=r,r;return this._loadWord(),r+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var r=this.skipLZ();return this.readBits(r+1)-1}},{key:"readEG",value:function(){var r=this.readUEG();return 1&r?1+r>>>1:-1*(r>>>1)}},{key:"readBool",value:function(){return this.readBits(1)===1}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(r){for(var t=8,e=8,i,s=0;s1&&arguments[1]!==void 0?arguments[1]:{};if(!(r.length<23)){t=t||{};for(var e=(r[21]&3)+1,i,s,f=[],h=[],p=[],S=23,b=r[22],A,R,D,I=0;I1&&arguments[1]!==void 0?arguments[1]:{};t=t||{};var e=new hg(r);e.readUByte(),e.readUByte(),e.readBits(4);var i=e.readBits(3);t.numTemporalLayers=Math.max(i+1,t.numTemporalLayers||0),t.temporalIdNested=e.readBits(1),n._parseProfileTierLevel(e,i,t),e.readUEG();var s=t.chromaFormatIdc=e.readUEG(),f=420;s<=3&&(f=[0,420,422,444][s]);var h=0;s===3&&(h=e.readBits(1));var p=e.readUEG(),S=e.readUEG(),b=e.readBits(1),A,R,D,I;if(b===1&&(A=e.readUEG(),R=e.readUEG(),D=e.readUEG(),I=e.readUEG()),t.bitDepthLumaMinus8=e.readUEG(),t.bitDepthChromaMinus8=e.readUEG(),b===1){var O=(s===1||s===2)&&h===0?2:1,V=s===1&&h===0?2:1;p-=O*(R+A),S-=V*(I+D)}return{codec:"hev1.1.6.L93.B0",width:p,height:S,chromaFormat:f,hvcC:t}}},{key:"_parseProfileTierLevel",value:function(r,t,e){var i=e.generalTierFlag||0;e.generalProfileSpace=r.readBits(2),e.generalTierFlag=Math.max(r.readBits(1),i),e.generalProfileIdc=Math.max(r.readBits(5),e.generalProfileIdc||0),e.generalProfileCompatibilityFlags=r.readBits(32),e.generalConstraintIndicatorFlags=[r.readBits(8),r.readBits(8),r.readBits(8),r.readBits(8),r.readBits(8),r.readBits(8)];var s=r.readBits(8);ir.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(t));for(var p=0;p0&&r.readBits((8-t)*2);for(var S=0;S=128){t.push(String.fromCharCode(f&65535)),i+=2;continue}}}else if(e[i]<240){if(n._checkContinuation(e,i,2)){var h=(e[i]&15)<<12|(e[i+1]&63)<<6|e[i+2]&63;if(h>=2048&&(h&63488)!==55296){t.push(String.fromCharCode(h&65535)),i+=3;continue}}}else if(e[i]<248&&n._checkContinuation(e,i,3)){var p=(e[i]&7)<<18|(e[i+1]&63)<<12|(e[i+2]&63)<<6|e[i+3]&63;if(p>65536&&p<1114112){p-=65536,t.push(String.fromCharCode(p>>>10|55296)),t.push(String.fromCharCode(p&1023|56320)),i+=4;continue}}}t.push("�"),++i}return t.join("")}},{key:"_checkContinuation",value:function(r,t,e){var i=r;if(t+e0&&(f=vx.decode(new Uint8Array(r.buffer,r.byteOffset+i,q))),i+=q}break;default:i=t;break}return{data:f,size:i,isEnd:s}}},{key:"_parseString",value:function(r){var t=r.getUint16(0),e="";return t>0&&(e=vx.decode(new Uint8Array(r.buffer,r.byteOffset+2,t))),{data:e,size:2+t}}},{key:"_parseObject",value:function(r){if(!(r.byteLength<3)){var t=n._parseString(r),e=n._parseValue(new DataView(r.buffer,r.byteOffset+t.size,r.byteLength-t.size));return{data:{name:t.data,value:e.data},size:t.size+e.size,isEnd:e.isEnd}}}}]),n}(),Oa={G711A:7,G711M:8,AAC:10,OPUS:13},ca=new F0("FlvDemuxer"),xS=function(){function n(a,r,t){Yr(this,n),Je(this,"_headerParsed",!1),Je(this,"_remainingData",null),Je(this,"_gopId",0),Je(this,"_needAddMetaBeforeKeyFrameNal",!0),this.videoTrack=a||new hD,this.audioTrack=r||new vD,this.metadataTrack=t||new yD,this._fixer=new wD(this.videoTrack,this.audioTrack,this.metadataTrack)}return Xr(n,[{key:"demux",value:function(r){var t,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=arguments.length>3?arguments[3]:void 0,f=this.audioTrack,h=this.videoTrack,p=this.metadataTrack;if((e||!i)&&(this._remainingData=null),e&&(this._headerParsed=!1),e?(h.reset(),f.reset(),p.reset()):(h.samples=[],f.samples=[],p.seiSamples=[],p.flvScriptSamples=[],h.warnings=[],f.warnings=[],this._remainingData&&(r=Na(this._remainingData,r),this._remainingData=null)),!r.length)return{videoTrack:h,audioTrack:f,metadataTrack:p};var S=0;if(!this._headerParsed){if(!n.probe(r))throw new Error("Invalid flv file");f.present=(r[4]&4)>>>2!==0,h.present=(r[4]&1)!==0,this._headerParsed=!0,S=c0(r,5)+4}for(var b=r.length,A,R,D,I,O;S+15b));)D=(r[S+7]<<24>>>0)+(r[S+4]<<16)+(r[S+5]<<8)+r[S+6],S+=11,I=r.subarray(S,S+R),A===8?this._parseAudio(I,D):A===9?(s&&(this.seamlessLoadingSwitching=!0),this._parseVideo(I,D)):A===18?this._parseScript(I,D):ca.warn("Invalid tag type: ".concat(A)),S+=R,O=c0(r,S),O!==11+R&&ca.warn("Invalid PrevTagSize ".concat(O," (").concat(11+R,")")),S+=4;S>>4,i=this.audioTrack;if(e!==Oa.AAC&&e!==Oa.G711A&&e!==Oa.G711M&&e!==Oa.OPUS){ca.warn("Unsupported sound format: ".concat(e)),i.reset();return}if(e!==Oa.AAC&&e!==Oa.OPUS){var s=(r[0]&12)>>2,f=(r[0]&2)>>1,h=r[0]&1;i.sampleRate=n.AUDIO_RATE[s],i.sampleSize=f?16:8,i.channelCount=h+1}switch(e){case Oa.G711A:case Oa.G711M:this._parseG711(r,t,e);break;case Oa.AAC:this._parseAac(r,t);break;case Oa.OPUS:this._parseOpus(r,t);break}}}},{key:"_parseOpus",value:function(r,t){var e=this.audioTrack,i=r[1];switch(e.codecType=yn.OPUS,i){case 0:{var s=dg.parseHeaderPackets(r.subarray(2));s?(e.codec=s.codec,e.channelCount=s.channelCount,e.sampleRate=s.sampleRate,e.config=s.config,e.sampleDuration=dg.getFrameDuration([],e.timescale)):(e.reset(),ca.warn("Cannot parse AudioSpecificConfig",r));break}case 1:{if(t==null)return;var f=new f0(t,r.subarray(2),e.sampleDuration);e.samples.push(f);break}default:ca.warn("Unknown OpusPacketType: ".concat(i))}}},{key:"_parseG711",value:function(r,t,e){var i=this.audioTrack,s=r.subarray(1);if(!(s.byteLength<1)){var f=new f0(t,s);i.codecType=e===7?yn.G711PCMA:yn.G711PCMU,i.sampleRate=8e3,i.codec=i.codecType,i.samples.push(f)}}},{key:"_parseAac",value:function(r,t){var e=this.audioTrack;if(e.codecType=yn.AAC,r[1]===0){var i=M0.parseAudioSpecificConfig(r.subarray(2));i?(e.codec=i.codec,e.channelCount=i.channelCount,e.sampleRate=i.sampleRate,e.config=i.config,e.objectType=i.objectType,e.sampleRateIndex=i.samplingFrequencyIndex):(e.reset(),ca.warn("Cannot parse AudioSpecificConfig",r))}else if(r[1]===1){if(t==null)return;e.samples.push(new f0(t,r.subarray(2)))}else ca.warn("Unknown AACPacketType: ".concat(r[1]))}},{key:"_parseVideo",value:function(r,t){var e=this;if(!(r.length<6)){var i=(r[0]&240)>>>4,s=r[0]&15,f=this.videoTrack;if(s!==7&&s!==12){f.reset(),ca.warn("Unsupported codecId: ".concat(s));return}var h=s===12;f.codecType=h?Dc.HEVC:Dc.AVC;var p=r[1],S=(r[2]<<16|r[3]<<8|r[4])<<8>>8;if(p===0){var b=r.subarray(5),A=h?LD.parseHEVCDecoderConfigurationRecord(b):kD.parseAVCDecoderConfigurationRecord(b);if(A){var R=A.hvcC,D=A.sps,I=A.ppsArr,O=A.spsArr,V=A.vpsArr,N=A.nalUnitSize;R&&(f.hvcC=f.hvcC||R),D&&(f.codec=D.codec,f.width=D.width,f.height=D.height,f.sarRatio=D.sarRatio,f.fpsNum=D.fpsNum,f.fpsDen=D.fpsDen),O.length&&(f.sps=O),I.length&&(f.pps=I),V&&V.length&&(f.vps=V),N&&(f.nalUnitSize=N)}else ca.warn("Cannot parse ".concat(h?"HEVC":"AVC","DecoderConfigurationRecord"),r)}else if(p===1){var G=Ku.parseAvcC(r.subarray(5),f.nalUnitSize);if(G=this._checkAddMetaNalToUnits(h,G,f),G&&G.length){var z=new pD(t+S,t,G);if(this.seamlessLoadingSwitching&&t>>1&63:Z[0]&31;switch(H){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!h&&H!==5||h&&H===5)break;z.setToKeyframe();break;case 6:case 39:case 40:if(!h&&H!==6||h&&H===6)break;e.metadataTrack.seiSamples.push(new mD(Ku.parseSEI(Ku.removeEPB(Z),h),t+S));break}}),z.keyframe&&this._gopId++,z.gopId=this._gopId}else ca.warn("Cannot parse NALUs",r)}else p===2||ca.warn("Unknown AVCPacketType: ".concat(p))}}},{key:"_checkAddMetaNalToUnits",value:function(r,t,e){if(!r||!this._needAddMetaBeforeKeyFrameNal)return this._needAddMetaBeforeKeyFrameNal=!1,t;var i=t.map(function(s){return s[0]>>>1&63});return i.includes(32)?(this._needAddMetaBeforeKeyFrameNal=!1,t):(t.unshift(e.pps[0]),t.unshift(e.sps[0]),t.unshift(e.vps[0]),t.filter(Boolean))}},{key:"_parseScript",value:function(r,t){this.metadataTrack.flvScriptSamples.push(new gD(RD.parse(r),t))}}],[{key:"probe",value:function(r){return r[0]!==70||r[1]!==76||r[2]!==86||r[3]!==1?!1:c0(r,5)>=9}}]),n}();Je(xS,"AUDIO_RATE",[5500,11e3,22e3,44e3]);function DD(n){for(var a=0,r=arguments.length,t=new Array(r>1?r-1:0),e=1;e>8&255,r&255])}},{key:"writeUint32",value:function(r){return new Uint8Array([r>>24,r>>16&255,r>>8&255,r&255])}}]),n}(),px=Math.pow(2,32)-1,Wt=function(){function n(){Yr(this,n)}return Xr(n,null,[{key:"box",value:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i>24&255,f[1]=s>>16&255,f[2]=s>>8&255,f[3]=s&255,f.set(r,4);var h=8;return e.forEach(function(p){f.set(p,h),h+=p.byteLength}),f}},{key:"ftyp",value:function(r){var t=r.find(function(e){return e.type===$u.VIDEO&&e.codecType===Dc.HEVC});return t?n.FTYPHEV1:n.FTYPAVC1}},{key:"initSegment",value:function(r){var t=n.ftyp(r),e=Na(t,n.moov(r));return e}},{key:"pssh",value:function(r){var t=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],hx(r.kid),[0,0,0,0]));return n.box(n.types.pssh,t)}},{key:"moov",value:function(r){if(r[0].useEME&&(r[0].encv||r[0].enca)){r[0].pssh||(r[0].pssh={kid:r[0].kid});var t=this.pssh(r[0].pssh);return n.box.apply(n,[n.types.moov,n.mvhd(r[0].mvhdDurtion||r[0].duration,r[0].mvhdTimecale||r[0].timescale),n.mvex(r)].concat(Ia(r.map(function(e){return n.trak(e)})),[t]))}else return n.box.apply(n,[n.types.moov,n.mvhd(r[0].mvhdDurtion||r[0].duration,r[0].mvhdTimecale||r[0].timescale)].concat(Ia(r.map(function(e){return n.trak(e)})),[n.mvex(r)]))}},{key:"mvhd",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:9e4,e=n.box(n.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24&255,r>>16&255,r>>8&255,r&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 e}},{key:"trak",value:function(r){var t=n.box(n.types.trak,n.tkhd(r.id,r.tkhdDuration||0,r.width,r.height),n.mdia(r));return t}},{key:"tkhd",value:function(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=n.box(n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,r&255,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,t&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,e>>8&255,e&255,0,0,i>>8&255,i&255,0,0]));return s}},{key:"mdia",value:function(r){var t=n.box(n.types.mdia,n.mdhd(r.duration,r.timescale),n.hdlr(r.type),n.minf(r));return t}},{key:"mdhd",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:9e4,e=n.box(n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24&255,r>>16&255,r>>8&255,r&255,85,196,0,0]));return e}},{key:"hdlr",value:function(r){var t=n.box(n.types.hdlr,n.HDLR_TYPES[r]);return t}},{key:"minf",value:function(r){var t=n.box(n.types.minf,r.type===$u.VIDEO?n.VMHD:n.SMHD,n.DINF,n.stbl(r));return t}},{key:"stbl",value:function(r){var t=[];r&&r.ext&&r.ext.stss&&t.push(n.stss(r.ext.stss.entries));var e=n.box(n.types.stbl,n.stsd(r),n.STTS,t[0],n.STSC,n.STSZ,n.STCO);return e}},{key:"stsd",value:function(r){var t;r.type==="audio"?r.useEME&&r.enca?t=n.enca(r):r.codecType===yn.OPUS?t=n.opus(r):t=n.mp4a(r):r.useEME&&r.encv?t=n.encv(r):r.av1C?t=n.av01(r):t=n.avc1hev1(r);var e=n.box(n.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),t);return e}},{key:"enca",value:function(r){var t=r.enca.channelCount,e=r.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>8&255,e&255,0,0]),s=n.esds(r.config),f=n.sinf(r.enca);return n.box(n.types.enca,i,s,f)}},{key:"encv",value:function(r){var t,e,i=r.sps.length>0?r.sps[0]:[],s=r.pps.length>0?r.pps[0]:[],f=r.width,h=r.height,p=r.sarRatio[0],S=r.sarRatio[1],b=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,f>>8&255,f&255,h>>8&255,h&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),A=new Uint8Array((t=(e=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,i.length&255]).concat.apply(e,Ia(i)).concat([1,s.length>>>8&255,s.length&255])).concat.apply(t,Ia(s))),R=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),D=n.sinf(r.encv),I=new Uint8Array([p>>24,p>>16&255,p>>8&255,p&255,S>>24,S>>16&255,S>>8&255,S&255]);return n.box(n.types.encv,b,n.box(n.types.avcC,A),n.box(n.types.btrt,R),D,n.box(n.types.pasp,I))}},{key:"schi",value:function(r){var t=new Uint8Array([]),e=n.tenc(r);return n.box(n.types.schi,t,e)}},{key:"tenc",value:function(r){var t=new Uint8Array([0,0,0,0,0,0,r.default_IsEncrypted&255,r.default_IV_size&255].concat(hx(r.default_KID)));return n.box(n.types.tenc,t)}},{key:"sinf",value:function(r){var t=new Uint8Array([]),e=new Uint8Array([r.data_format.charCodeAt(0),r.data_format.charCodeAt(1),r.data_format.charCodeAt(2),r.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),s=n.schi(r);return n.box(n.types.sinf,t,n.box(n.types.frma,e),n.box(n.types.schm,i),s)}},{key:"av01",value:function(r){return n.box(n.types.av01,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,r.width>>8&255,r.width&255,r.height>>8&255,r.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,17,17]),r.av1C,r.colr)}},{key:"avc1hev1",value:function(r){var t=r.codecType===Dc.HEVC,e=t?n.types.hvc1:n.types.avc1,i=t?n.hvcC(r):n.avcC(r),s=[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,r.width>>8&255,r.width&255,r.height>>8&255,r.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,17,17]),i];return t?s.push(n.box(n.types.fiel,new Uint8Array([1,0]))):r.sarRatio&&r.sarRatio.length>1&&s.push(n.pasp(r.sarRatio)),n.box.apply(n,[e].concat(s))}},{key:"avcC",value:function(r){var t,e,i=[],s=[],f;return r.sps.forEach(function(h){f=h.byteLength,i.push(f>>>8&255),i.push(f&255),i.push.apply(i,Ia(h))}),r.pps.forEach(function(h){f=h.byteLength,s.push(f>>>8&255),s.push(f&255),s.push.apply(s,Ia(h))}),n.box(n.types.avcC,new Uint8Array((t=(e=[1,i[3],i[4],i[5],255,224|r.sps.length]).concat.apply(e,i).concat([r.pps.length])).concat.apply(t,s)))}},{key:"hvcC",value:function(r){var t=r.hvcC;if(t instanceof ArrayBuffer||t instanceof Uint8Array)return t;var e=r.vps,i=r.sps,s=r.pps,f;if(t){var h=t.generalProfileCompatibilityFlags,p=t.generalConstraintIndicatorFlags,S=(e.length&&1)+(i.length&&1)+(s.length&&1);f=[1,t.generalProfileSpace<<6|t.generalTierFlag<<5|t.generalProfileIdc,h>>>24,h>>>16,h>>>8,h,p[0],p[1],p[2],p[3],p[4],p[5],t.generalLevelIdc,240,0,252,t.chromaFormatIdc|252,t.bitDepthLumaMinus8|248,t.bitDepthChromaMinus8|248,0,0,t.numTemporalLayers<<3|t.temporalIdNested<<2|3,S];var b=function(R){var D;f.push(R.length>>8,R.length),(D=f).push.apply(D,Ia(R))};e.length&&(f.push(160,0,e.length),e.forEach(b)),i.length&&(f.push(161,0,i.length),i.forEach(b)),s.length&&(f.push(162,0,s.length),s.forEach(b))}else f=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return n.box(n.types.hvcC,new Uint8Array(f))}},{key:"pasp",value:function(r){var t=sD(r,2),e=t[0],i=t[1];return n.box(n.types.pasp,new Uint8Array([e>>24,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255]))}},{key:"mp4a",value:function(r){return n.box(n.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r.channelCount,0,16,0,0,0,0,r.sampleRate>>8&255,r.sampleRate&255,0,0]),r.config.length?n.esds(r.config):void 0)}},{key:"esds",value:function(r){var t=r.length,e=n.box(n.types.esds,new Uint8Array([0,0,0,0,3,23+t,0,0,0,4,15+t,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([t]).concat(r).concat([6,1,2])));return e}},{key:"opus",value:function(r){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r.channelCount,0,16,0,0,0,0,r.sampleRate>>8&255,r.sampleRate&255,0,0]),e=r.config.length?n.dOps(r):[];return n.box(n.types.Opus,t,e)}},{key:"dOps",value:function(r){if(r.config)return r.config[4]=r.sampleRate>>>24&255,r.config[5]=r.sampleRate>>>16&255,r.config[6]=r.sampleRate>>>8&255,r.config[7]=r.sampleRate&255,n.box(n.types.dOps,r.config)}},{key:"mvex",value:function(r){var t=n.box.apply(n,[n.types.mvex].concat(Ia(r.map(function(e){return n.trex(e.id)}))));return t}},{key:"trex",value:function(r){var t=n.box(n.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]));return t}},{key:"trex1",value:function(r){var t=n.box(n.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]));return t}},{key:"trex2",value:function(r){var t=n.box(n.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]));return t}},{key:"moof",value:function(r){var t=n.box.apply(n,[n.types.moof,n.mfhd(r[0].samples?r[0].samples[0].gopId:0)].concat(Ia(r.map(function(e){return n.traf(e)}))));return t}},{key:"mfhd",value:function(r){var t=n.box(n.types.mfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]));return t}},{key:"traf",value:function(r){var t=n.tfhd(r.id),e=n.tfdt(r,r.baseMediaDecodeTime),i=0,s;if(r.isVideo&&r.videoSenc&&(s=r.videoSenc,s.forEach(function(q){i=i+8,q.subsamples&&q.subsamples.length&&(i=i+2,i=i+q.subsamples.length*6)})),r.videoSencLength=i,!r.useEME||!r.isVideoEncryption&&!r.isAudioEncryption){var f=n.sdtp(r),h=76;return n.box(n.types.traf,t,e,f,n.trun(r.samples,f.byteLength+h))}else if(r.isVideoEncryption)if(r.isVideo){var p=n.saiz(r),S=n.saio(r),b=n.trun1(r),A=n.senc(r),R=n.box(n.types.traf,t,e,p,S,b,A);return R}else if(r.isAudioEncryption){var O=n.sbgp(),V=n.saiz(r),N=n.saio(r),G=n.senc(r),z=n.trun1(r),Z=n.box(n.types.traf,t,e,O,V,N,G,z);return Z}else{var D=n.sbgp(),I=n.trun1(r);return n.box(n.types.traf,t,e,D,I)}else if(r.isVideo){var H=n.trun1(r);return n.box(n.types.traf,t,e,H)}else{var ee=n.sbgp(),te=n.saiz(r),fe=n.saio(r),ne=n.senc(r),oe=n.trun1(r),Y=n.box(n.types.traf,t,e,ee,te,fe,ne,oe);return Y}}},{key:"sdtp",value:function(r){var t=new $n;return r.samples.forEach(function(e){t.write(new Uint8Array(r.isVideo?[e.keyframe?32:16]:[16]))}),n.box(n.types.sdtp,this.extension(0,0),t.buffer)}},{key:"trun1",value:function(r){var t=new $n,e=$n.writeUint32(r.samples.length),i=null;if(r.isVideo){var s=r.videoSencLength;i=$n.writeUint32(r.samples.length*16+s+149),!r.isVideoEncryption&&r.isAudioEncryption&&(i=$n.writeUint32(r.samples.length*16+92))}else{var f=r.samples.length*12+124;r.isAudioEncryption&&(f=r.samples.length*12+8*r.audioSenc.length+177),i=$n.writeUint32(f)}return r.samples.forEach(function(h){t.write($n.writeUint32(h.duration)),t.write($n.writeUint32(h.size)),t.write($n.writeUint32(h.keyframe?33554432:65536)),r.isVideo&&t.write($n.writeUint32(h.cts?h.cts:0))}),n.box(n.types.trun,this.extension(0,r.flags),e,i,t.buffer)}},{key:"senc",value:function(r){var t=new $n,e=r.samples.length,i=r.isVideo?16:8,s=r.isVideo?2:0,f=[],h=0;return r.isVideo?(f=r.videoSenc,h=r.videoSencLength):f=r.audioSenc,h=h||i*e,t.write($n.writeUint32(16+h),n.types.senc,this.extension(0,s)),t.write($n.writeUint32(e)),f.forEach(function(p){for(var S=0;S>24&255,t>>16&255,t>>8&255,t&255]);return n.box(n.types.saio,e)}},{key:"saiz",value:function(r){var t=r.samples.length,e=new Uint8Array([0,0,0,0,16,t>>24&255,t>>16&255,t>>8&255,t&255]);return n.box(n.types.saiz,e)}},{key:"sbgp",value:function(){var r=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return n.box(n.types.sbgp,this.extension(0,0),r)}},{key:"extension",value:function(r,t){return new Uint8Array([r,t>>16&255,t>>8&255,t&255])}},{key:"tfhd",value:function(r){return n.box(n.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]))}},{key:"tfdt",value:function(r,t){var e=Math.floor(t/(px+1)),i=Math.floor(t%(px+1));return r.useEME&&(r.isVideoEncryption||r.isAudioEncryption)?n.box(n.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])):n.box(n.types.tfdt,new Uint8Array([1,0,0,0,e>>24,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255]))}},{key:"trun",value:function(r,t){var e=r.length,i=12+16*e;t+=8+i;var s=new Uint8Array(i);s.set([0,0,15,1,e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0);for(var f=0;f>>24&255,p>>>16&255,p>>>8&255,p&255,S>>>24&255,S>>>16&255,S>>>8&255,S&255,A.isLeading<<2|(A.dependsOn===null||A.dependsOn===void 0?1:A.dependsOn),A.isDependedOn<<6|A.hasRedundancy<<4|A.paddingValue<<1|(A.isNonSyncSample===null||A.isNonSyncSample===void 0?1:A.isNonSyncSample),A.degradationPriority&61440,A.degradationPriority&15,D>>>24&255,D>>>16&255,D>>>8&255,D&255],12+16*f)}return n.box(n.types.trun,s)}},{key:"moovMP4",value:function(r){return n.box.apply(n,[n.types.moov,n.mvhd(r[0].duration,r[0].timescale)].concat(Ia(r.map(function(t){return n.trackMP4(t)}))))}},{key:"trackMP4",value:function(r){return n.box(n.types.trak,n.tkhd(r.id,r.duration,r.width,r.height),n.mdiaMP4(r))}},{key:"mdiaMP4",value:function(r){return n.box(n.types.mdia,n.mdhd(r.duration,r.timescale),n.hdlr(r.type),n.minfMP4(r))}},{key:"minfMP4",value:function(r){return n.box(n.types.minf,r.type===$u.VIDEO?n.VMHD:n.SMHD,n.DINF,n.stblMP4(r))}},{key:"stblMP4",value:function(r){var t=r.ext,e=[n.stsd(r),n.stts(t.stts),n.stsc(t.stsc),n.stsz(t.stsz),n.stco(t.stco)];return t.stss.length&&e.push(n.stss(t.stss)),t.ctts.length&&e.push(n.ctts(t.ctts)),n.box.apply(n,[n.types.stbl].concat(e))}},{key:"stts",value:function(r){var t=r.length,e=new Uint8Array(8*t),i=0;return r.forEach(function(s){var f=s.value,h=s.count;e.set([h>>24,h>>16&255,h>>8&255,h&255,f>>24,f>>16&255,f>>8&255,f&255],i),i+=8}),n.box(n.types.stts,Na(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]),e))}},{key:"stsc",value:function(r){var t=r.length,e=new Uint8Array(12*t),i=0;return r.forEach(function(s){var f=s.firstChunk,h=s.samplesPerChunk,p=s.sampleDescIndex;e.set([f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&255,p>>24,p>>16&255,p>>8&255,p&255],i),i+=12}),n.box(n.types.stsc,Na(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]),e))}},{key:"stsz",value:function(r){var t=r.length,e=new Uint8Array(4*t),i=0;return r.forEach(function(s){e.set([s>>24,s>>16&255,s>>8&255,s&255],i),i+=4}),n.box(n.types.stsz,Na(new Uint8Array([0,0,0,0,0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]),e))}},{key:"stco",value:function(r){var t=r.length,e=new Uint8Array(4*t),i=0;return r.forEach(function(s){e.set([s>>24,s>>16&255,s>>8&255,s&255],i),i+=4}),n.box(n.types.stco,Na(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]),e))}},{key:"stss",value:function(r){var t=r.length,e=new Uint8Array(4*t),i=0;return r.forEach(function(s){e.set([s>>24,s>>16&255,s>>8&255,s&255],i),i+=4}),n.box(n.types.stss,Na(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]),e))}},{key:"ctts",value:function(r){var t=r.length,e=new Uint8Array(8*t),i=0;return r.forEach(function(s){var f=s.value,h=s.count;e.set([h>>24,h>>16&255,h>>8&255,h&255,f>>24,f>>16&255,f>>8&255,f&255],i),i+=8}),n.box(n.types.ctts,Na(new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]),e))}},{key:"styp",value:function(){return n.box(n.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(r){var t=r.timescale,e=r.samples[0].duration,i=e*r.samples.length,s=r.samples[0].sampleOffset*e,f=8;r.samples.forEach(function(A){f+=A.size});var h=0;if(r.isVideo){var p=0,S;r.videoSenc&&(S=r.videoSenc),r.isVideo&&S.forEach(function(A){p=p+8,A.subsamples&&A.subsamples.length&&(p=p+2,p=p+A.subsamples.length*6)}),r.videoSencLength=p,h=f+141+r.samples.length*16+p,r.useEME&&r.isAudioEncryption&&!r.isVideoEncryption&&(h=f+r.samples.length*16+84)}else h=f+116+r.samples.length*12,r.useEME&&r.isAudioEncryption&&(h=f+169+r.samples.length*12+8*r.audioSenc.length);var b=new Uint8Array([0,0,0,0,0,0,0,r.id&255,t>>24&255,t>>16&255,t>>8&255,t&255,s>>24&255,s>>16&255,s>>8&255,s&255,0,0,0,0,0,0,0,1,0,h>>16&255,h>>8&255,h&255,i>>24&255,i>>16&255,i>>8&255,i&255,144,0,0,0]);return n.box(n.types.sidx,b)}},{key:"mdat",value:function(r){var t=n.box(n.types.mdat,r);return t}}]),n}();Je(Wt,"types",["Opus","dOps","av01","av1C","avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce(function(n,a){return n[a]=[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)],n},Object.create(null)));Je(Wt,"HDLR_TYPES",{video: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]),audio: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])});Je(Wt,"FTYPAVC1",Wt.box(Wt.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49])));Je(Wt,"FTYPHEV1",Wt.box(Wt.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49])));Je(Wt,"DINF",Wt.box(Wt.types.dinf,Wt.box(Wt.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]))));Je(Wt,"VMHD",Wt.box(Wt.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])));Je(Wt,"SMHD",Wt.box(Wt.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0])));Je(Wt,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0]));Je(Wt,"STTS",Wt.box(Wt.types.stts,Wt.StblTable));Je(Wt,"STSC",Wt.box(Wt.types.stsc,Wt.StblTable));Je(Wt,"STSZ",Wt.box(Wt.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0])));Je(Wt,"STCO",Wt.box(Wt.types.stco,Wt.StblTable));var ES=function(){function n(a,r){Yr(this,n),this.name=a||"",this._prefix="[".concat(this.name,"]"),n.disabled=r}return Xr(n,[{key:"debug",value:function(){var r;if(!n.disabled){for(var t=arguments.length,e=new Array(t),i=0;i0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=this.videoTrack,i=this.audioTrack,s=e.exist(),f=i.exist(),h,p,S,b=[];r&&(t&&t.initMerge?(s&&b.push(this.videoTrack),f&&b.push(this.audioTrack),S=Wt.initSegment(b)):(s&&(h=Wt.initSegment([this.videoTrack])),f&&(p=Wt.initSegment([this.audioTrack]))));var A,R;return s&&e.hasSample()&&(A=this._remuxVideo()),f&&i.hasSample()&&(R=this._remuxAudio()),e.samples=[],i.samples=[],{initSegment:S,videoInitSegment:h,audioInitSegment:p,videoSegment:A,audioSegment:R}}},{key:"_remuxVideo",value:function(){var r=this.videoTrack;this.forceFirstIDR&&(r.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=r.samples,e=/av01/.test(r.codec),i=0;e?t.forEach(function(G){i+=G.data.byteLength}):t.forEach(function(G){i+=G.units.reduce(function(z,Z){return z+Z.byteLength},0),i+=G.units.length*4});var s=new Uint8Array(i);if(e)for(var f=0,h=t.length,p=0,S;f2&&arguments[2]!==void 0?arguments[2]:{};Uc(this,n),pt(this,"flv",null),pt(this,"_demuxer",new xS),pt(this,"_remuxer",null),pt(this,"_mse",null),pt(this,"_softVideo",null),pt(this,"_sourceCreated",!1),pt(this,"_needInitSegment",!0),pt(this,"_discontinuity",!0),pt(this,"_contiguous",!1),pt(this,"_initSegmentId",""),pt(this,"_cachedBuffer",null),pt(this,"_demuxStartTime",0),pt(this,"_opts",null),this.flv=a,this._opts=t,r?this._softVideo=r:(this._remuxer=new PD(this._demuxer.videoTrack,this._demuxer.audioTrack),this._mse=new Lc(null,{preferMMS:typeof t.preferMMS=="boolean"?t.preferMMS:!!t.perferMMS}),this._mse.bindMedia(a.media))}return Hc(n,[{key:"baseDts",get:function(){var r,t;return(r=this._demuxer)===null||r===void 0||(t=r._fixer)===null||t===void 0?void 0:t._baseDts}},{key:"blobUrl",get:function(){var r;return(r=this._mse)===null||r===void 0?void 0:r.url}},{key:"isFull",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lc.VIDEO;return this._mse.isFull(r)}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!0,this._initSegmentId=""}},{key:"unContiguous",value:function(r){this._contiguous=!1,this._demuxStartTime=r}},{key:"reset",value:function(){var a=Un(sr().mark(function t(){var e,i=arguments;return sr().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(e=i.length>0&&i[0]!==void 0?i[0]:!1,!(this._mse&&!e)){f.next=6;break}return f.next=4,this._mse.unbindMedia();case 4:return f.next=6,this._mse.bindMedia(this.flv.media);case 6:this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!1,this._sourceCreated=!1,this._initSegmentId="",this.resetSeamlessSwitchStats();case 12:case"end":return f.stop()}},t,this)}));function r(){return a.apply(this,arguments)}return r}()},{key:"resetSeamlessSwitchStats",value:function(){this.seamlessLoadingSwitch=null,this.seamlessLoadingSwitching=!1,this._demuxer&&(this._demuxer.seamlessLoadingSwitching=!1)}},{key:"endOfStream",value:function(){var a=Un(sr().mark(function t(){return sr().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!this._mse){i.next=7;break}if(!this._sourceCreated){i.next=5;break}return i.next=4,this._mse.endOfStream();case 4:this.flv.emit(Et.BUFFEREOS);case 5:i.next=8;break;case 7:this._softVideo&&this._softVideo.endOfStream();case 8:case"end":return i.stop()}},t,this)}));function r(){return a.apply(this,arguments)}return r}()},{key:"updateDuration",value:function(){var a=Un(sr().mark(function t(e){return sr().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!this._mse){s.next=7;break}if(this._mse.isOpened){s.next=4;break}return s.next=4,this._mse.open();case 4:return ls.debug("update duration",e),s.next=7,this._mse.updateDuration(e);case 7:case"end":return s.stop()}},t,this)}));function r(t){return a.apply(this,arguments)}return r}()},{key:"destroy",value:function(){var a=Un(sr().mark(function t(){return sr().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!this._mse){i.next=3;break}return i.next=3,this._mse.unbindMedia();case 3:this._mse=null,this._softVideo=null,this._demuxer=null,this._remuxer=null;case 7:case"end":return i.stop()}},t,this)}));function r(){return a.apply(this,arguments)}return r}()},{key:"appendBuffer",value:function(){var a=Un(sr().mark(function t(e){var i=this,s,f,h,p,S,b,A,R,D,I,O,V,N,G,z,Z,H,ee;return sr().wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:if(s=!1,this._cachedBuffer&&(e=$R(this._cachedBuffer,e),this._cachedBuffer=null),f=this._demuxer,!(!e||!e.length||!f)){fe.next=5;break}return fe.abrupt("return");case 5:fe.prev=5,this.flv._transferCost.start(sl.DEMUX),f.demuxAndFix(e,this.seamlessLoadingSwitching||this._discontinuity,this._contiguous,this._demuxStartTime,this.seamlessLoadingSwitching),this.seamlessLoadingSwitching=!1,this.flv._transferCost.end(sl.DEMUX),fe.next=15;break;case 12:throw fe.prev=12,fe.t0=fe.catch(5),new ea(cr.DEMUX,cr.SUB_TYPES.FLV,fe.t0);case 15:if(h=f.videoTrack,p=f.audioTrack,S=f.metadataTrack,!this.seamlessLoadingSwitch){fe.next=25;break}if(b=h.samples.findIndex(function(ne){return ne.originDts===h.lastKeyFrameDts}),!(b>=0)){fe.next=25;break}return h.samples.splice(b),fe.next=22,this.seamlessLoadingSwitch();case 22:this.seamlessLoadingSwitch=null,e=null,s=!0;case 25:if(A=h.exist(),R=p.exist(),this._opts.onlyAudio&&(A=!1,h.present=!1),this._opts.onlyVideo&&(R=!1,p.present=!1),!(!A&&h.present||!R&&p.present)){fe.next=42;break}if(D=0,I=A?h:R?p:void 0,I&&I.samples.length&&(D=(I.samples[I.samples.length-1].originPts-I.samples[0].originPts)/I.timescale*1e3),!(D>this._opts.analyzeDuration)){fe.next=40;break}ls.warn("analyze duration exceeded, ".concat(D,"ms"),I),h.present=A,p.present=R,this.flv.emit(Et.ANALYZE_DURATION_EXCEEDED,{duration:D}),fe.next=42;break;case 40:return this._cachedBuffer=e,fe.abrupt("return");case 42:if(O=h.type,V=p.type,this._fireEvents(h,p,S),s||(this._discontinuity=!1,this._contiguous=!0,this._demuxStartTime=0),N=this._mse,G=function(){var oe;if((oe=i.flv)!==null&&oe!==void 0&&oe.emit){var Y;(Y=i.flv)===null||Y===void 0||Y.emit(Et.APPEND_BUFFER,{})}},this.flv.emit(Et.DEMUXED_TRACK,{videoTrack:h}),z="".concat(h.codec,"/").concat(h.width,"/").concat(h.height,"/").concat(p.codec,"/").concat(p.config),z!==this._initSegmentId&&(this._needInitSegment=!0,this._initSegmentId=z,this._emitMetaParsedEvent(h,p)),!N){fe.next=83;break}if(this._sourceCreated){fe.next=59;break}return fe.next=55,N.open();case 55:A&&(ls.log("codec: video/mp4;codecs=".concat(h.codec)),N.createSource(O,"video/mp4;codecs=".concat(h.codec))),R&&(ls.log("codec: audio/mp4;codecs=".concat(p.codec)),N.createSource(V,"audio/mp4;codecs=".concat(p.codec))),this._sourceCreated=!0,this.flv.emit(Et.SOURCEBUFFER_CREATED);case 59:fe.prev=59,this._needInitSegment&&!this._opts.mseLowLatency&&(h.duration=this._opts.durationForMSELowLatencyOff*h.timescale,p.duration=this._opts.durationForMSELowLatencyOff*R.timescale),this.flv._transferCost.start(sl.REMUX),Z=this._remuxer.remux(this._needInitSegment),this.flv._transferCost.end(sl.REMUX),fe.next=69;break;case 66:throw fe.prev=66,fe.t1=fe.catch(59),new ea(cr.REMUX,cr.SUB_TYPES.FMP4,fe.t1);case 69:if(!(this._needInitSegment&&!Z.videoInitSegment&&!Z.audioInitSegment)){fe.next=71;break}return fe.abrupt("return");case 71:return this._needInitSegment=!1,H=[],Z.videoInitSegment&&H.push(N.append(O,Z.videoInitSegment)),Z.audioInitSegment&&H.push(N.append(V,Z.audioInitSegment)),Z.videoSegment&&H.push(N.append(O,Z.videoSegment)),Z.audioSegment&&H.push(N.append(V,Z.audioSegment)),this.flv._transferCost.start(sl.APPEND),ee=Promise.all(H),ee.then(G).then(function(){i.flv._transferCost.end(sl.APPEND),G()}),fe.abrupt("return",ee);case 83:this._softVideo&&(this._softVideo.appendBuffer(h,p),G());case 84:case"end":return fe.stop()}},t,this,[[5,12],[59,66]])}));function r(t){return a.apply(this,arguments)}return r}()},{key:"evictBuffer",value:function(){var a=Un(sr().mark(function t(e){var i=this,s,f,h,p;return sr().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(s=this.flv.media,!(!this._mse||!this._demuxer||!s||!e||e<0)){b.next=3;break}return b.abrupt("return");case 3:if(f=s.currentTime,h=f-e,!(h<=0)){b.next=7;break}return b.abrupt("return");case 7:if(p=ni.start(ni.get(s)),!(p+1>=h)){b.next=10;break}return b.abrupt("return");case 10:return b.abrupt("return",this._mse.clearBuffer(0,h).then(function(){return i.flv.emit(Et.REMOVE_BUFFER,{removeEnd:h})}));case 11:case"end":return b.stop()}},t,this)}));function r(t){return a.apply(this,arguments)}return r}()},{key:"_emitMetaParsedEvent",value:function(r,t){r.exist()&&this.flv.emit(Et.METADATA_PARSED,{type:"video",track:r,meta:{codec:r.codec,timescale:r.timescale,width:r.width,height:r.height,sarRatio:r.sarRatio,baseDts:r.baseDts}}),t.exist()&&this.flv.emit(Et.METADATA_PARSED,{type:"audio",track:t,meta:{codec:t.codec,channelCount:t.channelCount,sampleRate:t.sampleRate,timescale:t.timescale,baseDts:t.baseDts}}),ls.debug("track parsed",r,t)}},{key:"_fireEvents",value:function(r,t,e){var i=this;ls.debug("videoTrack samples count: ".concat(r.samples.length,", audioTrack samples count: ").concat(t.samples.length)),e.flvScriptSamples.forEach(function(s){i.flv.emit(Et.FLV_SCRIPT_DATA,s),ls.debug("flvScriptData",s)}),r.samples.forEach(function(s){s.keyframe&&i.flv.emit(Et.KEYFRAME,{pts:s.originPts})}),r.warnings.forEach(function(s){var f;switch(s.type){case ta.LARGE_AV_SHIFT:f=Et.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case ta.LARGE_VIDEO_GAP:f=Et.LARGE_VIDEO_DTS_GAP_DETECT;break;case ta.LARGE_VIDEO_GAP_BETWEEN_CHUNK:f=Et.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT;break}f&&i.flv.emit(Et.STREAM_EXCEPTION,ri(ri({},s),{},{type:f})),ls.warn("video exception",s)}),t.warnings.forEach(function(s){var f;switch(s.type){case ta.LARGE_AUDIO_GAP:f=Et.LARGE_AUDIO_DTS_GAP_DETECT;break;case ta.AUDIO_FILLED:f=Et.AUDIO_GAP_DETECT;break;case ta.AUDIO_DROPPED:f=Et.AUDIO_OVERLAP_DETECT;break}f&&i.flv.emit(Et.STREAM_EXCEPTION,ri(ri({},s),{},{type:f})),ls.warn("audio exception",s)}),e.seiSamples.forEach(function(s){i.flv.emit(Et.SEI,ri(ri({},s),{},{sei:{code:s.data.type,content:s.data.payload,dts:s.pts}}))})}}]),n}();function FD(n){var a=ri({retryCount:3,retryDelay:1e3,disconnectRetryCount:0,loadTimeout:1e4,maxReaderInterval:5e3,preloadTime:5,defaultVodLoadSize:1e7,isLive:!1,softDecode:!1,bufferBehind:10,maxJumpDistance:3,analyzeDuration:2e4,seamlesslyReload:!1,keepStatusAfterSwitch:!0,onlyVideo:!1,onlyAudio:!1,preferMMS:!1,mseLowLatency:!0,durationForMSELowLatencyOff:6,chunkCountForSpeed:50,skipChunkSize:1e3,longtimeNoReceived:3e3,enableStartGapJump:!0},n);return a.isLive&&a.preloadTime&&(a.maxLatency||(a.maxLatency=a.preloadTime*2),a.targetLatency||(a.targetLatency=a.preloadTime),(a.disconnectTime===null||a.disconnectTime===void 0)&&(a.disconnectTime=a.maxLatency)),a}function gx(n,a){var r=0,t=n.length-1,e=0,i=0,s=t;for(a=n[e]&&ah.disconnectTime&&e.disconnect()}}}}),pt(jt(e),"_onPlay",function(){var i,s,f=e._opts.softDecode||((i=e.media)===null||i===void 0||(s=i.buffered)===null||s===void 0?void 0:s.length);if(e.isLive){!e._loading&&f&&e.replay(void 0,!0);return}var h=e.bufferInfo();(h.start||h.nextStart)>Sh&&e._tick()}),pt(jt(e),"_onLoadeddata",function(){e.isLive&&!e._opts.mseLowLatency&&e.media.duration!==1/0&&e._bufferService.updateDuration(1/0).catch(function(i){})}),pt(jt(e),"_onSeeking",Un(sr().mark(function i(){return sr().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:!e.isLive&&e.seekable&&(e._preLoadEndPoint=-1,e._checkPreload());case 1:case"end":return f.stop()}},i)}))),pt(jt(e),"_onTimeupdate",function(){if(e.media){var i=e._opts,s=e.media.currentTime;if(i.isLive&&i.maxLatency&&i.targetLatency){var f=ni.end(ni.get(e.media)),h=f-s;h>=i.maxLatency&&(e.media.currentTime=f-i.targetLatency,e.emit(Et.CHASEFRAME,{currentTime:e.media.currentTime,latency:i.targetLatency}))}e._seiService.throw(s,!0),!(i.isLive||!e.seekable||e._loading)&&e._checkPreload()}}),pt(jt(e),"_onWaiting",function(){e.isLive&&!e._loading&&e._disconnectRetryCount&&(e._disconnectRetryCount--,e.load())}),pt(jt(e),"_onBufferUpdate",function(){if(!e._opts.isLive){var i=e.bufferInfo(),s=i.end,f=i.nextEnd;Math.abs((s||f)-e.media.duration)<1&&(e._end(),e.media.readyState<=2&&e._tick())}}),pt(jt(e),"_checkPreload",Un(sr().mark(function i(){var s,f,h,p,S,b,A,R,D,I;return sr().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(s=e.bufferInfo(),f=s.remaining,h=f===void 0?0:f,p=e._opts,S=e._keyframes.filepositions,b=e._keyframes.times,A=e.media.currentTime,!(h0&&arguments[0]!==void 0?arguments[0]:Sh;return ni.info(ni.get(this.media),(e=this.media)===null||e===void 0?void 0:e.currentTime,i)}},{key:"playbackQuality",value:function(){return WR(this.media)}},{key:"load",value:function(){var t=Un(sr().mark(function i(s){var f,h,p=arguments;return sr().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(f=p.length>1&&p[1]!==void 0?p[1]:!1,h=p.length>2?p[2]:void 0,this._bufferService){b.next=4;break}return b.abrupt("return");case 4:return b.next=6,this._reset(f);case 6:this._loadData(s,this._opts.isLive?[]:[0,this._opts.defaultVodLoadSize],h),clearTimeout(this._tickTimer),this._tickTimer=setTimeout(this._tick,this._tickInterval);case 9:case"end":return b.stop()}},i,this)}));function e(i){return t.apply(this,arguments)}return e}()},{key:"replay",value:function(){var t=Un(sr().mark(function i(){var s=this,f,h,p=arguments;return sr().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(f=p.length>0&&p[0]!==void 0?p[0]:this._opts.seamlesslyReload,h=p.length>1?p[1]:void 0,this.media){b.next=4;break}return b.abrupt("return");case 4:if(this._resetDisconnectCount(),!f){b.next=11;break}return b.next=8,this._clear();case 8:setTimeout(function(){s._seamlessSwitching=!0,s._loadData(s._opts.url),s._bufferService.seamlessSwitch()}),b.next=13;break;case 11:return b.next=13,this.load();case 13:return b.abrupt("return",this.media.play(!h).catch(function(){}));case 14:case"end":return b.stop()}},i,this)}));function e(){return t.apply(this,arguments)}return e}()},{key:"disconnect",value:function(){var e;return Ma.debug("disconnect!"),(e=this._bufferService)===null||e===void 0||e.resetSeamlessSwitchStats(),this._clear()}},{key:"switchURL",value:function(){var t=Un(sr().mark(function i(s,f){var h=this;return sr().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:if(this._bufferService){S.next=2;break}return S.abrupt("return");case 2:if(this._resetDisconnectCount(),!(this._loading&&f)){S.next=6;break}return this._bufferService.seamlessLoadingSwitch=function(){var b=Un(sr().mark(function A(R){return sr().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,h._clear();case 2:h._bufferService.seamlessLoadingSwitching=!0,h._urlSwitching=!0,h._seamlessSwitching=!0,h._bufferService.seamlessSwitch(),h._loadData(s);case 7:case"end":return I.stop()}},A)}));return function(A){return b.apply(this,arguments)}}(),S.abrupt("return");case 6:if(!(!f||!this._opts.isLive)){S.next=11;break}return S.next=9,this.load(s);case 9:return this._urlSwitching=!0,S.abrupt("return",this.media.play(!0).catch(function(){}));case 11:return S.next=13,this._clear();case 13:setTimeout(function(){h._urlSwitching=!0,h._seamlessSwitching=!0,h._loadData(s),h._bufferService.seamlessSwitch()});case 14:case"end":return S.stop()}},i,this)}));function e(i,s){return t.apply(this,arguments)}return e}()},{key:"destroy",value:function(){var t=Un(sr().mark(function i(){return sr().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(this.media){f.next=2;break}return f.abrupt("return");case 2:return this.removeAllListeners(),this._seiService.reset(),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("loadeddata",this._onLoadeddata),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),this.media.removeEventListener("waiting",this._onWaiting),this.media.removeEventListener("progress",this._onBufferUpdate),f.next=12,Promise.all([this._clear(),this._bufferService.destroy()]);case 12:this.media=null,this._bufferService=null;case 14:case"end":return f.stop()}},i,this)}));function e(){return t.apply(this,arguments)}return e}()},{key:"_emitError",value:function(e){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;Ma.table(e),Ma.error(e),Ma.error((i=this.media)===null||i===void 0?void 0:i.error),this._urlSwitching&&(this._urlSwitching=!1,this._seamlessSwitching=!1,this.emit(Et.SWITCH_URL_FAILED,e)),this.emit(Et.ERROR,e),s&&(this._seiService.reset(),this._end())}},{key:"_reset",value:function(){var t=Un(sr().mark(function i(){var s,f=arguments;return sr().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return s=f.length>0&&f[0]!==void 0?f[0]:!1,this._seiService.reset(),this._bandwidthService.reset(),this._stats.reset(),p.next=6,this._clear();case 6:return p.next=8,this._bufferService.reset(s);case 8:case"end":return p.stop()}},i,this)}));function e(){return t.apply(this,arguments)}return e}()},{key:"_loadData",value:function(){var t=Un(sr().mark(function i(s,f,h){var p;return sr().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(s&&(this._opts.url=s),p=s=this._opts.url,s){b.next=4;break}throw new Error("Source url is missing");case 4:if(this._opts.preProcessUrl&&(p=this._opts.preProcessUrl(s).url),this._mediaLoader.finnalUrl=p,this.emit(Et.LOAD_START,{url:p,seamlessSwitching:this._seamlessSwitching}),Ma.debug("load data, loading:",this._loading,p),!this._loading){b.next=11;break}return b.next=11,this._mediaLoader.cancel();case 11:return this._loading=!0,b.prev=12,b.next=15,this._mediaLoader.load({url:p,range:f,streamRes:h,firstMaxChunkSize:this._opts.firstMaxChunkSize});case 15:b.next=21;break;case 17:return b.prev=17,b.t0=b.catch(12),this._loading=!1,b.abrupt("return",this._emitError(ea.network(b.t0),!1));case 21:case"end":return b.stop()}},i,this,[[12,17]])}));function e(i,s,f){return t.apply(this,arguments)}return e}()},{key:"_clear",value:function(){var t=Un(sr().mark(function i(){return sr().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(!this._mediaLoader){f.next=3;break}return f.next=3,this._mediaLoader.cancel();case 3:clearTimeout(this._maxChunkWaitTimer),clearTimeout(this._tickTimer),this._loading=!1,this._firstProgressEmit=!1;case 7:case"end":return f.stop()}},i,this)}));function e(){return t.apply(this,arguments)}return e}()}],[{key:"isSupported",value:function(e){return!e||e==="video"||e==="audio"?Lc.isSupported():typeof WebAssembly<"u"}},{key:"enableLogger",value:function(){yo.enable(),F0.enable()}},{key:"disableLogger",value:function(){yo.disable(),F0.disable()}}]),r}(Ju);try{localStorage.getItem("xgd")?Pc.enableLogger():Pc.disableLogger()}catch{}var BD=function(){function n(a,r){var t=this;Uc(this,n),pt(this,"_onLowDecode",function(){var e,i,s,f,h=t._opts,p=h.media,S=h.innerDegrade,b=h.backupURL;(e=t._plugin)===null||e===void 0||(i=e.player)===null||i===void 0||i.emit("lowdecode",p.degradeInfo),(s=t._plugin)===null||s===void 0||(f=s.player)===null||f===void 0||f.emit("core_event",ri(ri({},p.degradeInfo),{},{eventName:Et.LOWDECODE})),(S===1||S===3)&&b&&t._degrade(b)}),pt(this,"_degrade",function(e){var i=t._plugin.player,s=i.video;if((s==null?void 0:s.TAG)==="MVideo"){var f=i.video.degradeVideo;i.video=f,s.degrade(e),e&&(i.config.url=e);var h=i.root.firstChild;h.TAG==="MVideo"&&i.root.replaceChild(f,h);var p=t._plugin.constructor.pluginName.toLowerCase();i.unRegisterPlugin(p),i.once("canplay",function(){i.play()})}}),pt(this,"forceDegradeToVideo",function(e){var i=t._opts.innerDegrade;(i===1||i===3)&&t._degrade(e)}),this._opts=a,this._plugin=r,this._init()}return Hc(n,[{key:"_init",value:function(){var r=this._opts,t=r.media,e=r.isLive,i=r.preloadTime,s=r.innerDegrade,f=r.decodeMode;if(t){if(!e&&t.setPlayMode){t.setPlayMode("VOD");return}s&&t.setAttribute("innerdegrade",s),i&&t.setAttribute("preloadtime",i),t.setDecodeMode&&t.setDecodeMode(f),this._bindEvents()}}},{key:"_bindEvents",value:function(){var r=this._opts.media;r.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var r,t;(r=this._opts)===null||r===void 0||(t=r.media)===null||t===void 0||t.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]),n}(),ND=function(n){aS(r,n);var a=sS(r);function r(){var t;Uc(this,r);for(var e=arguments.length,i=new Array(e),s=0;s0&&arguments[0]!==void 0?arguments[0]:t.player.config.url;var h=arguments.length>1?arguments[1]:void 0;(f=t.flv)===null||f===void 0||f.load(t.player.config.url,!0,h)}),pt(jt(t),"destroy",function(){var f;t.flv&&(t.flv.destroy(),t.flv=null),(f=t.pluginExtension)===null||f===void 0||f.destroy(),t.pluginExtension=null}),pt(jt(t),"_onSwitchURL",function(f,h){if(t.flv){var p,S;t.player.config.url=f,ag(h)==="object"&&(h=h.seamless),t.flv.switchURL(f,h),!h&&(p=t.player.config)!==null&&p!==void 0&&(S=p.flv)!==null&&S!==void 0&&S.keepStatusAfterSwitch&&t._keepPauseStatus()}}),pt(jt(t),"_keepPauseStatus",function(){var f=t.player.paused;f&&t.player.once("canplay",function(){t.player.pause()})}),pt(jt(t),"_onDefinitionChange",function(f){var h=f.to;t.flv&&t.flv.switchURL(h)}),t}return Hc(r,[{key:"core",get:function(){return this.flv}},{key:"version",get:function(){var e;return(e=this.flv)===null||e===void 0?void 0:e.version}},{key:"softDecode",get:function(){var e,i,s=(e=this.player)===null||e===void 0||(i=e.config)===null||i===void 0?void 0:i.mediaType;return!!s&&s!=="video"&&s!=="audio"&&s!=="offscreen-video"}},{key:"loader",get:function(){var e;return(e=this.flv)===null||e===void 0?void 0:e.loader}},{key:"transferCost",get:function(){return this.flv._transferCost.transferCost}},{key:"beforePlayerInit",value:function(){var e=this,i=this.player.config,s=this.player.media||this.player.video;if(i.url){this.flv&&this.flv.destroy(),this.player.switchURL=this._onSwitchURL;var f=i.flv||{};if((f.disconnectTime===null||f.disconnectTime===void 0)&&(f.disconnectTime=0),this.flv=new Pc(ri({softDecode:this.softDecode,isLive:i.isLive,media:s,preProcessUrl:function(S,b){var A,R;return((A=e.player)===null||A===void 0||(R=A.preProcessUrl)===null||R===void 0?void 0:R.call(A,S,b))||{url:S,ext:b}}},f)),this.softDecode||Fi.defineGetterOrSetter(this.player,{url:{get:function(){var S;return(S=e.flv)===null||S===void 0?void 0:S.blobUrl},configurable:!0}}),this.softDecode&&(this.pluginExtension=new BD(ri({media:this.player.video,isLive:i.isLive},i.flv),this),this.player.forceDegradeToVideo=function(){for(var p,S=arguments.length,b=new Array(S),A=0;A=a||ee<0||b&&te>=i}function V(){var H=Dp();if(O(H))return N(H);f=setTimeout(V,I(H))}function N(H){return f=void 0,A&&t?R(H):(t=e=void 0,s)}function G(){f!==void 0&&clearTimeout(f),p=0,t=h=e=f=void 0}function z(){return f===void 0?s:N(Dp())}function Z(){var H=Dp(),ee=O(H);if(t=arguments,e=this,h=H,ee){if(f===void 0)return D(h);if(b)return clearTimeout(f),f=setTimeout(V,a),R(h)}return f===void 0&&(f=setTimeout(V,a)),s}return Z.cancel=G,Z.flush=z,Z}var d0={exports:{}},fP=d0.exports,Ex;function kP(){return Ex||(Ex=1,function(n,a){(function(r,t){n.exports=t()})(fP,function(){function r(Te){return(r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Ee){return typeof Ee}:function(Ee){return Ee&&typeof Symbol=="function"&&Ee.constructor===Symbol&&Ee!==Symbol.prototype?"symbol":typeof Ee})(Te)}function t(Te,Ee){if(!(Te instanceof Ee))throw new TypeError("Cannot call a class as a function")}function e(Te,Ee){for(var xe=0;xe"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var xe,qe=h(Te);return S(this,Ee?(xe=h(this).constructor,Reflect.construct(qe,arguments,xe)):qe.apply(this,arguments))}}function A(Te,Ee){(Ee==null||Ee>Te.length)&&(Ee=Te.length);for(var xe=0,qe=new Array(Ee);xe=Te.length?{done:!0}:{done:!1,value:Te[xe++]}},e:function(Se){throw Se},f:Ee};throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ct,Ue=!0,St=!1;return{s:function(){qe=qe.call(Te)},n:function(){var Se=qe.next();return Ue=Se.done,Se},e:function(Se){St=!0,ct=Se},f:function(){try{Ue||qe.return==null||qe.return()}finally{if(St)throw ct}}}}function D(){if(I.url)window.location.href=I.url;else if(I.rewriteHTML)try{document.documentElement.innerHTML=I.rewriteHTML}catch{document.documentElement.innerText=I.rewriteHTML}else{try{window.opener=null,window.open("","_self"),window.close(),window.history.back()}catch(Te){console.log(Te)}setTimeout(function(){window.location.href=I.timeOutUrl||"https://theajack.github.io/disable-devtool/404.html?h=".concat(encodeURIComponent(location.host))},500)}}var I={md5:"",ondevtoolopen:D,ondevtoolclose:null,url:"",timeOutUrl:"",tkName:"ddtk",interval:500,disableMenu:!0,stopIntervalTime:5e3,clearIntervalWhenDevOpenTrigger:!1,detectors:[0,1,3,4,5,6,7],clearLog:!0,disableSelect:!1,disableCopy:!1,disableCut:!1,disablePaste:!1,ignore:null,disableIframeParents:!0,seo:!0,rewriteHTML:""},O=["detectors","ondevtoolclose","ignore"];function V(Te){var Ee,xe=0>5]|=128<>>9<<4)]=St;for(var Se=1732584193,He=-271733879,ze=-1732584194,Ve=271733878,$e=0;$e>5]|=(Ue.charCodeAt(He/ft)&Se)<>2]>>ct%4*8+4&15)+xe.charAt(Ee[ct>>2]>>ct%4*8&15);return qe}function Pr(Te,Ee,xe,qe,ct,Ue){return an((Ee=an(an(Ee,Te),an(qe,Ue)))<>>32-ct,xe)}function lr(Te,Ee,xe,qe,ct,Ue,St){return Pr(Ee&xe|~Ee&qe,Te,Ee,ct,Ue,St)}function Er(Te,Ee,xe,qe,ct,Ue,St){return Pr(Ee&qe|xe&~qe,Te,Ee,ct,Ue,St)}function kr(Te,Ee,xe,qe,ct,Ue,St){return Pr(Ee^xe^qe,Te,Ee,ct,Ue,St)}function Zt(Te,Ee,xe,qe,ct,Ue,St){return Pr(xe^(Ee|~qe),Te,Ee,ct,Ue,St)}function an(Te,Ee){var xe=(65535&Te)+(65535&Ee);return(Te>>16)+(Ee>>16)+(xe>>16)<<16|65535&xe}var Xt=function(){f(Ee,_e);var Te=b(Ee);function Ee(){return t(this,Ee),Te.call(this,{type:j.RegToString,enabled:te.qqBrowser||te.firefox})}return i(Ee,[{key:"init",value:function(){var xe=this;this.lastTime=0,this.reg=/./,Z(this.reg),this.reg.toString=function(){var qe;return te.qqBrowser?(qe=new Date().getTime(),xe.lastTime&&qe-xe.lastTime<100?xe.onDevToolOpen():xe.lastTime=qe):te.firefox&&xe.onDevToolOpen(),""}}},{key:"detect",value:function(){Z(this.reg)}}]),Ee}(),Ft=function(){f(Ee,_e);var Te=b(Ee);function Ee(){return t(this,Ee),Te.call(this,{type:j.DefineId})}return i(Ee,[{key:"init",value:function(){var xe=this;this.div=document.createElement("div"),this.div.__defineGetter__("id",function(){xe.onDevToolOpen()}),Object.defineProperty(this.div,"id",{get:function(){xe.onDevToolOpen()}})}},{key:"detect",value:function(){Z(this.div)}}]),Ee}(),jr=function(){f(Ee,_e);var Te=b(Ee);function Ee(){return t(this,Ee),Te.call(this,{type:j.Size,enabled:!te.iframe&&!te.edge})}return i(Ee,[{key:"init",value:function(){var xe=this;this.checkWindowSizeUneven(),window.addEventListener("resize",function(){setTimeout(function(){xe.checkWindowSizeUneven()},100)},!0)}},{key:"detect",value:function(){}},{key:"checkWindowSizeUneven",value:function(){var xe=function(){if(Sr(window.devicePixelRatio))return window.devicePixelRatio;var ct=window.screen;return!(Sr(ct)||!ct.deviceXDPI||!ct.logicalXDPI)&&ct.deviceXDPI/ct.logicalXDPI}();if(xe!==!1){var qe=20010*this.maxPrintTime&&this.onDevToolOpen()}}]),Ee}(),xn=(s(_r={},j.RegToString,Xt),s(_r,j.DefineId,Ft),s(_r,j.Size,jr),s(_r,j.DateToString,Xn),s(_r,j.FuncToString,In),s(_r,j.Debugger,Tn),s(_r,j.Performance,qn),s(_r,j.DebugLib,it),_r),sn=Object.assign(function(Te){function Ee(){var St=0"u"||!window.document)return null;var Te=document.querySelector("[disable-devtool-auto]");if(!Te)return null;var Ee=["disable-menu","disable-select","disable-copy","disable-cut","disable-paste","clear-log"],xe=["interval"],qe={};return["md5","url","tk-name","detectors"].concat(Ee,xe).forEach(function(ct){var Ue=Te.getAttribute(ct);Ue!==null&&(xe.indexOf(ct)!==-1?Ue=parseInt(Ue):Ee.indexOf(ct)!==-1?Ue=Ue!=="false":ct==="detector"&&Ue!=="all"&&(Ue=Ue.split(" ")),qe[function(St){if(St.indexOf("-")===-1)return St;var Se=!1;return St.split("").map(function(He){return He==="-"?(Se=!0,""):Se?(Se=!1,He.toUpperCase()):He}).join("")}(ct)]=Ue)}),qe}(),Xt&&sn(Xt),sn})}(d0)),d0.exports}export{z_ as B,yP as C,tf as E,fs as F,wP as H,gP as I,pP as L,EP as N,mP as P,_P as R,hs as S,hP as a,Ce as b,TP as c,CP as d,xP as e,AP as f,Zu as g,Mi as h,ai as i,Ct as j,ef as k,zu as l,Yn as m,ND as n,bP as o,SP as p,kP as q,cP as r,vP as u};