You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Video__Detail__id.3528a8...

121 lines
1.1 MiB

!(function(){var Xo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[6444],{65352:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return We}});var B=K(89490),de=K(11036),Se=K(39224),he=K(43403),j=K(92310),p=K.n(j),me=K(29301),ce=K(76846),l=K(96452),X=K(6089),P=K(80402),g=K(34280),_=K(49658),E=K(59301),A=K(71409),M=K(77900),H=K(8654);function V(Ee){var Ie=Ee.prefixCls,ne=Ee.align,we=Ee.arrow,ke=Ee.arrowPos,ee=we||{},Y=ee.className,C=ee.content,Q=ke.x,F=Q===void 0?0:Q,U=ke.y,W=U===void 0?0:U,re=E.useRef();if(!ne||!ne.points)return null;var le={position:"absolute"};if(ne.autoArrow!==!1){var ye=ne.points[0],De=ne.points[1],Ae=ye[0],je=ye[1],Ue=De[0],Ke=De[1];Ae===Ue||!["t","b"].includes(Ae)?le.top=W:Ae==="t"?le.top=0:le.bottom=0,je===Ke||!["l","r"].includes(je)?le.left=F:je==="l"?le.left=0:le.right=0}return E.createElement("div",{ref:re,className:p()("".concat(Ie,"-arrow"),Y),style:le},C)}function L(Ee){var Ie=Ee.prefixCls,ne=Ee.open,we=Ee.zIndex,ke=Ee.mask,ee=Ee.motion;return ke?E.createElement(M.default,(0,A.Z)({},ee,{motionAppear:!0,visible:ne,removeOnLeave:!0}),function(Y){var C=Y.className;return E.createElement("div",{style:{zIndex:we},className:p()("".concat(Ie,"-mask"),C)})}):null}var I=E.memo(function(Ee){var Ie=Ee.children;return Ie},function(Ee,Ie){return Ie.cache}),w=I,R=E.forwardRef(function(Ee,Ie){var ne=Ee.popup,we=Ee.className,ke=Ee.prefixCls,ee=Ee.style,Y=Ee.target,C=Ee.onVisibleChanged,Q=Ee.open,F=Ee.keepDom,U=Ee.fresh,W=Ee.onClick,re=Ee.mask,le=Ee.arrow,ye=Ee.arrowPos,De=Ee.align,Ae=Ee.motion,je=Ee.maskMotion,Ue=Ee.forceRender,Ke=Ee.getPopupContainer,dt=Ee.autoDestroy,Re=Ee.portal,tt=Ee.zIndex,Pt=Ee.onMouseEnter,yt=Ee.onMouseLeave,Bt=Ee.onPointerEnter,jt=Ee.onPointerDownCapture,oi=Ee.ready,ei=Ee.offsetX,Ht=Ee.offsetY,Qt=Ee.offsetR,Et=Ee.offsetB,ht=Ee.onAlign,pt=Ee.onPrepare,ti=Ee.stretch,Ot=Ee.targetWidth,Xe=Ee.targetHeight,vt=typeof ne=="function"?ne():ne,Kt=Q||F,ai=(Ke==null?void 0:Ke.length)>0,St=E.useState(!Ke||!ai),qt=(0,de.Z)(St,2),Ct=qt[0],He=qt[1];if((0,g.Z)(function(){!Ct&&ai&&Y&&He(!0)},[Ct,ai,Y]),!Ct)return null;var h="auto",m={left:"-1000vw",top:"-1000vh",right:h,bottom:h};if(oi||!Q){var y,k=De.points,Z=De.dynamicInset||((y=De._experimental)===null||y===void 0?void 0:y.dynamicInset),pe=Z&&k[0][1]==="r",be=Z&&k[0][0]==="b";pe?(m.right=Qt,m.left=h):(m.left=ei,m.right=h),be?(m.bottom=Et,m.top=h):(m.top=Ht,m.bottom=h)}var ot={};return ti&&(ti.includes("height")&&Xe?ot.height=Xe:ti.includes("minHeight")&&Xe&&(ot.minHeight=Xe),ti.includes("width")&&Ot?ot.width=Ot:ti.includes("minWidth")&&Ot&&(ot.minWidth=Ot)),Q||(ot.pointerEvents="none"),E.createElement(Re,{open:Ue||Kt,getContainer:Ke&&function(){return Ke(Y)},autoDestroy:dt},E.createElement(L,{prefixCls:ke,open:Q,zIndex:tt,mask:re,motion:je}),E.createElement(me.Z,{onResize:ht,disabled:!Q},function(at){return E.createElement(M.default,(0,A.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Ue,leavedClassName:"".concat(ke,"-hidden")},Ae,{onAppearPrepare:pt,onEnterPrepare:pt,visible:Q,onVisibleChanged:function(Nt){var Zt;Ae==null||(Zt=Ae.onVisibleChanged)===null||Zt===void 0||Zt.call(Ae,Nt),C(Nt)}}),function(mt,Nt){var Zt=mt.className,bt=mt.style,Vt=p()(ke,Zt,we);return E.createElement("div",{ref:(0,H.sQ)(at,Ie,Nt),className:Vt,style:(0,B.Z)((0,B.Z)((0,B.Z)((0,B.Z)({"--arrow-x":"".concat(ye.x||0,"px"),"--arrow-y":"".concat(ye.y||0,"px")},m),ot),bt),{},{boxSizing:"border-box",zIndex:tt},ee),onMouseEnter:Pt,onMouseLeave:yt,onPointerEnter:Bt,onClick:W,onPointerDownCapture:jt},le&&E.createElement(V,{prefixCls:ke,arrow:le,arrowPos:ye,align:De}),E.createElement(w,{cache:!Q&&!U},vt))})}))}),q=R,se=E.forwardRef(function(Ee,Ie){var ne=Ee.children,we=Ee.getTriggerDOMNode,ke=(0,H.Yr)(ne),ee=E.useCallback(function(C){(0,H.mH)(Ie,we?we(C):C)},[we]),Y=(0,H.x1)(ee,(0,H.C4)(ne));return ke?E.cloneElement(ne,{ref:Y}):ne}),te=se,ge=E.createContext(null),Le=ge;function xe(Ee){return Ee?Array.isArray(Ee)?Ee:[Ee]:[]}function $e(Ee,Ie,ne,we){return E.useMemo(function(){var ke=xe(ne!=null?ne:Ie),ee=xe(we!=null?we:Ie),Y=new Set(ke),C=new Set(ee);return Ee&&(Y.has("hover")&&(Y.delete("hover"),Y.add("click")),C.has("hover")&&(C.delete("hover"),C.add("click"))),[Y,C]},[Ee,Ie,ne,we])}var J=K(29194);function D(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ne=arguments.length>2?arguments[2]:void 0;return ne?Ee[0]===Ie[0]:Ee[0]===Ie[0]&&Ee[1]===Ie[1]}function N(Ee,Ie,ne,we){for(var ke=ne.points,ee=Object.keys(Ee),Y=0;Y<ee.length;Y+=1){var C,Q=ee[Y];if(D((C=Ee[Q])===null||C===void 0?void 0:C.points,ke,we))return"".concat(Ie,"-placement-").concat(Q)}return""}function O(Ee,Ie,ne,we){return Ie||(ne?{motionName:"".concat(Ee,"-").concat(ne)}:we?{motionName:we}:null)}function oe(Ee){return Ee.ownerDocument.defaultView}function ie(Ee){for(var Ie=[],ne=Ee==null?void 0:Ee.parentElement,we=["hidden","scroll","clip","auto"];ne;){var ke=oe(ne).getComputedStyle(ne),ee=ke.overflowX,Y=ke.overflowY,C=ke.overflow;[ee,Y,C].some(function(Q){return we.includes(Q)})&&Ie.push(ne),ne=ne.parentElement}return Ie}function S(Ee){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ee)?Ie:Ee}function v(Ee){return S(parseFloat(Ee),0)}function z(Ee,Ie){var ne=(0,B.Z)({},Ee);return(Ie||[]).forEach(function(we){if(!(we instanceof HTMLBodyElement||we instanceof HTMLHtmlElement)){var ke=oe(we).getComputedStyle(we),ee=ke.overflow,Y=ke.overflowClipMargin,C=ke.borderTopWidth,Q=ke.borderBottomWidth,F=ke.borderLeftWidth,U=ke.borderRightWidth,W=we.getBoundingClientRect(),re=we.offsetHeight,le=we.clientHeight,ye=we.offsetWidth,De=we.clientWidth,Ae=v(C),je=v(Q),Ue=v(F),Ke=v(U),dt=S(Math.round(W.width/ye*1e3)/1e3),Re=S(Math.round(W.height/re*1e3)/1e3),tt=(ye-De-Ue-Ke)*dt,Pt=(re-le-Ae-je)*Re,yt=Ae*Re,Bt=je*Re,jt=Ue*dt,oi=Ke*dt,ei=0,Ht=0;if(ee==="clip"){var Qt=v(Y);ei=Qt*dt,Ht=Qt*Re}var Et=W.x+jt-ei,ht=W.y+yt-Ht,pt=Et+W.width+2*ei-jt-oi-tt,ti=ht+W.height+2*Ht-yt-Bt-Pt;ne.left=Math.max(ne.left,Et),ne.top=Math.max(ne.top,ht),ne.right=Math.min(ne.right,pt),ne.bottom=Math.min(ne.bottom,ti)}}),ne}function ae(Ee){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ne="".concat(Ie),we=ne.match(/^(.*)\%$/);return we?Ee*(parseFloat(we[1])/100):parseFloat(ne)}function Te(Ee,Ie){var ne=Ie||[],we=(0,de.Z)(ne,2),ke=we[0],ee=we[1];return[ae(Ee.width,ke),ae(Ee.height,ee)]}function Fe(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ee[0],Ee[1]]}function Ye(Ee,Ie){var ne=Ie[0],we=Ie[1],ke,ee;return ne==="t"?ee=Ee.y:ne==="b"?ee=Ee.y+Ee.height:ee=Ee.y+Ee.height/2,we==="l"?ke=Ee.x:we==="r"?ke=Ee.x+Ee.width:ke=Ee.x+Ee.width/2,{x:ke,y:ee}}function _t(Ee,Ie){var ne={t:"b",b:"t",l:"r",r:"l"};return Ee.map(function(we,ke){return ke===Ie?ne[we]||"c":we}).join("")}function Ut(Ee,Ie,ne,we,ke,ee,Y){var C=E.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ke[we]||{}}),Q=(0,de.Z)(C,2),F=Q[0],U=Q[1],W=E.useRef(0),re=E.useMemo(function(){return Ie?ie(Ie):[]},[Ie]),le=E.useRef({}),ye=function(){le.current={}};Ee||ye();var De=(0,X.Z)(function(){if(Ie&&ne&&Ee){let mn=function(en,tn){var Di=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xt,cn=St.x+en,Wn=St.y+tn,ts=cn+pe,os=Wn+Z,Hn=Math.max(cn,Di.left),ni=Math.max(Wn,Di.top),vi=Math.min(ts,Di.right),Hi=Math.min(os,Di.bottom);return Math.max(0,(vi-Hn)*(Hi-ni))},Nn=function(){sn=St.y+ci,Yi=sn+Z,Zi=St.x+gi,Ji=Zi+pe};var Ue,Ke,dt,Re,tt=Ie,Pt=tt.ownerDocument,yt=oe(tt),Bt=yt.getComputedStyle(tt),jt=Bt.width,oi=Bt.height,ei=Bt.position,Ht=tt.style.left,Qt=tt.style.top,Et=tt.style.right,ht=tt.style.bottom,pt=tt.style.overflow,ti=(0,B.Z)((0,B.Z)({},ke[we]),ee),Ot=Pt.createElement("div");(Ue=tt.parentElement)===null||Ue===void 0||Ue.appendChild(Ot),Ot.style.left="".concat(tt.offsetLeft,"px"),Ot.style.top="".concat(tt.offsetTop,"px"),Ot.style.position=ei,Ot.style.height="".concat(tt.offsetHeight,"px"),Ot.style.width="".concat(tt.offsetWidth,"px"),tt.style.left="0",tt.style.top="0",tt.style.right="auto",tt.style.bottom="auto",tt.style.overflow="hidden";var Xe;if(Array.isArray(ne))Xe={x:ne[0],y:ne[1],width:0,height:0};else{var vt,Kt,ai=ne.getBoundingClientRect();ai.x=(vt=ai.x)!==null&&vt!==void 0?vt:ai.left,ai.y=(Kt=ai.y)!==null&&Kt!==void 0?Kt:ai.top,Xe={x:ai.x,y:ai.y,width:ai.width,height:ai.height}}var St=tt.getBoundingClientRect();St.x=(Ke=St.x)!==null&&Ke!==void 0?Ke:St.left,St.y=(dt=St.y)!==null&&dt!==void 0?dt:St.top;var qt=Pt.documentElement,Ct=qt.clientWidth,He=qt.clientHeight,h=qt.scrollWidth,m=qt.scrollHeight,y=qt.scrollTop,k=qt.scrollLeft,Z=St.height,pe=St.width,be=Xe.height,ot=Xe.width,at={left:0,top:0,right:Ct,bottom:He},mt={left:-k,top:-y,right:h-k,bottom:m-y},Nt=ti.htmlRegion,Zt="visible",bt="visibleFirst";Nt!=="scroll"&&Nt!==bt&&(Nt=Zt);var Vt=Nt===bt,Ft=z(mt,re),et=z(at,re),xt=Nt===Zt?et:Ft,Ve=Vt?et:xt;tt.style.left="auto",tt.style.top="auto",tt.style.right="0",tt.style.bottom="0";var Ze=tt.getBoundingClientRect();tt.style.left=Ht,tt.style.top=Qt,tt.style.right=Et,tt.style.bottom=ht,tt.style.overflow=pt,(Re=tt.parentElement)===null||Re===void 0||Re.removeChild(Ot);var Rt=S(Math.round(pe/parseFloat(jt)*1e3)/1e3),Lt=S(Math.round(Z/parseFloat(oi)*1e3)/1e3);if(Rt===0||Lt===0||(0,ce.Sh)(ne)&&!(0,J.Z)(ne))return;var ui=ti.offset,Tt=ti.targetOffset,It=Te(St,ui),zt=(0,de.Z)(It,2),ve=zt[0],Ce=zt[1],Qe=Te(Xe,Tt),qe=(0,de.Z)(Qe,2),rt=qe[0],ct=qe[1];Xe.x-=rt,Xe.y-=ct;var lt=ti.points||[],gt=(0,de.Z)(lt,2),Wt=gt[0],Mt=gt[1],Jt=Fe(Mt),Yt=Fe(Wt),mi=Ye(Xe,Jt),Ei=Ye(St,Yt),Ti=(0,B.Z)({},ti),gi=mi.x-Ei.x+ve,ci=mi.y-Ei.y+Ce,Li=mn(gi,ci),Pi=mn(gi,ci,et),wi=Ye(Xe,["t","l"]),bi=Ye(St,["t","l"]),Ni=Ye(Xe,["b","r"]),Ri=Ye(St,["b","r"]),Fi=ti.overflow||{},Ci=Fi.adjustX,Ii=Fi.adjustY,on=Fi.shiftX,Vi=Fi.shiftY,Ai=function(tn){return typeof tn=="boolean"?tn:tn>=0},sn,Yi,Zi,Ji;Nn();var Ki=Ai(Ii),ii=Yt[0]===Jt[0];if(Ki&&Yt[0]==="t"&&(Yi>Ve.bottom||le.current.bt)){var Dt=ci;ii?Dt-=Z-be:Dt=wi.y-Ri.y-Ce;var _i=mn(gi,Dt),Oi=mn(gi,Dt,et);_i>Li||_i===Li&&(!Vt||Oi>=Pi)?(le.current.bt=!0,ci=Dt,Ce=-Ce,Ti.points=[_t(Yt,0),_t(Jt,0)]):le.current.bt=!1}if(Ki&&Yt[0]==="b"&&(sn<Ve.top||le.current.tb)){var Bi=ci;ii?Bi+=Z-be:Bi=Ni.y-bi.y-Ce;var gn=mn(gi,Bi),ln=mn(gi,Bi,et);gn>Li||gn===Li&&(!Vt||ln>=Pi)?(le.current.tb=!0,ci=Bi,Ce=-Ce,Ti.points=[_t(Yt,0),_t(Jt,0)]):le.current.tb=!1}var Xi=Ai(Ci),hn=Yt[1]===Jt[1];if(Xi&&Yt[1]==="l"&&(Ji>Ve.right||le.current.rl)){var fn=gi;hn?fn-=pe-ot:fn=wi.x-Ri.x-ve;var _n=mn(fn,ci),xn=mn(fn,ci,et);_n>Li||_n===Li&&(!Vt||xn>=Pi)?(le.current.rl=!0,gi=fn,ve=-ve,Ti.points=[_t(Yt,1),_t(Jt,1)]):le.current.rl=!1}if(Xi&&Yt[1]==="r"&&(Zi<Ve.left||le.current.lr)){var Ui=gi;hn?Ui+=pe-ot:Ui=Ni.x-bi.x-ve;var vn=mn(Ui,ci),yn=mn(Ui,ci,et);vn>Li||vn===Li&&(!Vt||yn>=Pi)?(le.current.lr=!0,gi=Ui,ve=-ve,Ti.points=[_t(Yt,1),_t(Jt,1)]):le.current.lr=!1}Nn();var pn=on===!0?0:on;typeof pn=="number"&&(Zi<et.left&&(gi-=Zi-et.left-ve,Xe.x+ot<et.left+pn&&(gi+=Xe.x-et.left+ot-pn)),Ji>et.right&&(gi-=Ji-et.right-ve,Xe.x>et.right-pn&&(gi+=Xe.x-et.right+pn)));var dn=Vi===!0?0:Vi;typeof dn=="number"&&(sn<et.top&&(ci-=sn-et.top-Ce,Xe.y+be<et.top+dn&&(ci+=Xe.y-et.top+be-dn)),Yi>et.bottom&&(ci-=Yi-et.bottom-Ce,Xe.y>et.bottom-dn&&(ci+=Xe.y-et.bottom+dn)));var pi=St.x+gi,Pn=pi+pe,Tn=St.y+ci,Gn=Tn+Z,On=Xe.x,qn=On+ot,Mn=Xe.y,Qn=Mn+be,Wi=Math.max(pi,On),Vn=Math.min(Pn,qn),An=(Wi+Vn)/2,as=An-pi,Jn=Math.max(Tn,Mn),jn=Math.min(Gn,Qn),es=(Jn+jn)/2,wn=es-Tn;Y==null||Y(Ie,Ti);var Rn=Ze.right-St.x-(gi+St.width),un=Ze.bottom-St.y-(ci+St.height);Rt===1&&(gi=Math.round(gi),Rn=Math.round(Rn)),Lt===1&&(ci=Math.round(ci),un=Math.round(un));var In={ready:!0,offsetX:gi/Rt,offsetY:ci/Lt,offsetR:Rn/Rt,offsetB:un/Lt,arrowX:as/Rt,arrowY:wn/Lt,scaleX:Rt,scaleY:Lt,align:Ti};U(In)}}),Ae=function(){W.current+=1;var Ke=W.current;Promise.resolve().then(function(){W.current===Ke&&De()})},je=function(){U(function(Ke){return(0,B.Z)((0,B.Z)({},Ke),{},{ready:!1})})};return(0,g.Z)(je,[we]),(0,g.Z)(function(){Ee||je()},[Ee]),[F.ready,F.offsetX,F.offsetY,F.offsetR,F.offsetB,F.arrowX,F.arrowY,F.scaleX,F.scaleY,F.align,Ae]}var si=K(62730);function Ge(Ee,Ie,ne,we,ke){(0,g.Z)(function(){if(Ee&&Ie&&ne){let W=function(){we(),ke()};var ee=Ie,Y=ne,C=ie(ee),Q=ie(Y),F=oe(Y),U=new Set([F].concat((0,si.Z)(C),(0,si.Z)(Q)));return U.forEach(function(re){re.addEventListener("scroll",W,{passive:!0})}),F.addEventListener("resize",W,{passive:!0}),we(),function(){U.forEach(function(re){re.removeEventListener("scroll",W),F.removeEventListener("resize",W)})}}},[Ee,Ie,ne])}var ft=K(48736);function $t(Ee,Ie,ne,we,ke,ee,Y,C){var Q=E.useRef(Ee);Q.current=Ee;var F=E.useRef(!1);E.useEffect(function(){if(Ie&&we&&(!ke||ee)){var W=function(){F.current=!1},re=function(dt){var Re;Q.current&&!Y(((Re=dt.composedPath)===null||Re===void 0||(Re=Re.call(dt))===null||Re===void 0?void 0:Re[0])||dt.target)&&!F.current&&C(!1)},le=oe(we);le.addEventListener("pointerdown",W,!0),le.addEventListener("mousedown",re,!0),le.addEventListener("contextmenu",re,!0);var ye=(0,l.A)(ne);if(ye&&(ye.addEventListener("mousedown",re,!0),ye.addEventListener("contextmenu",re,!0)),0)var De,Ae,je,Ue;return function(){le.removeEventListener("pointerdown",W,!0),le.removeEventListener("mousedown",re,!0),le.removeEventListener("contextmenu",re,!0),ye&&(ye.removeEventListener("mousedown",re,!0),ye.removeEventListener("contextmenu",re,!0))}}},[Ie,ne,we,ke,ee]);function U(){F.current=!0}return U}var ut=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function li(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:he.Z,Ie=E.forwardRef(function(ne,we){var ke=ne.prefixCls,ee=ke===void 0?"rc-trigger-popup":ke,Y=ne.children,C=ne.action,Q=C===void 0?"hover":C,F=ne.showAction,U=ne.hideAction,W=ne.popupVisible,re=ne.defaultPopupVisible,le=ne.onPopupVisibleChange,ye=ne.afterPopupVisibleChange,De=ne.mouseEnterDelay,Ae=ne.mouseLeaveDelay,je=Ae===void 0?.1:Ae,Ue=ne.focusDelay,Ke=ne.blurDelay,dt=ne.mask,Re=ne.maskClosable,tt=Re===void 0?!0:Re,Pt=ne.getPopupContainer,yt=ne.forceRender,Bt=ne.autoDestroy,jt=ne.destroyPopupOnHide,oi=ne.popup,ei=ne.popupClassName,Ht=ne.popupStyle,Qt=ne.popupPlacement,Et=ne.builtinPlacements,ht=Et===void 0?{}:Et,pt=ne.popupAlign,ti=ne.zIndex,Ot=ne.stretch,Xe=ne.getPopupClassNameFromAlign,vt=ne.fresh,Kt=ne.alignPoint,ai=ne.onPopupClick,St=ne.onPopupAlign,qt=ne.arrow,Ct=ne.popupMotion,He=ne.maskMotion,h=ne.popupTransitionName,m=ne.popupAnimation,y=ne.maskTransitionName,k=ne.maskAnimation,Z=ne.className,pe=ne.getTriggerDOMNode,be=(0,Se.Z)(ne,ut),ot=Bt||jt||!1,at=E.useState(!1),mt=(0,de.Z)(at,2),Nt=mt[0],Zt=mt[1];(0,g.Z)(function(){Zt((0,_.Z)())},[]);var bt=E.useRef({}),Vt=E.useContext(Le),Ft=E.useMemo(function(){return{registerSubPopup:function(vi,Hi){bt.current[vi]=Hi,Vt==null||Vt.registerSubPopup(vi,Hi)}}},[Vt]),et=(0,P.Z)(),xt=E.useState(null),Ve=(0,de.Z)(xt,2),Ze=Ve[0],Rt=Ve[1],Lt=E.useRef(null),ui=(0,X.Z)(function(ni){Lt.current=ni,(0,ce.Sh)(ni)&&Ze!==ni&&Rt(ni),Vt==null||Vt.registerSubPopup(et,ni)}),Tt=E.useState(null),It=(0,de.Z)(Tt,2),zt=It[0],ve=It[1],Ce=E.useRef(null),Qe=(0,X.Z)(function(ni){(0,ce.Sh)(ni)&&zt!==ni&&(ve(ni),Ce.current=ni)}),qe=E.Children.only(Y),rt=(qe==null?void 0:qe.props)||{},ct={},lt=(0,X.Z)(function(ni){var vi,Hi,rn=zt;return(rn==null?void 0:rn.contains(ni))||((vi=(0,l.A)(rn))===null||vi===void 0?void 0:vi.host)===ni||ni===rn||(Ze==null?void 0:Ze.contains(ni))||((Hi=(0,l.A)(Ze))===null||Hi===void 0?void 0:Hi.host)===ni||ni===Ze||Object.values(bt.current).some(function(qi){return(qi==null?void 0:qi.contains(ni))||ni===qi})}),gt=O(ee,Ct,m,h),Wt=O(ee,He,k,y),Mt=E.useState(re||!1),Jt=(0,de.Z)(Mt,2),Yt=Jt[0],mi=Jt[1],Ei=W!=null?W:Yt,Ti=(0,X.Z)(function(ni){W===void 0&&mi(ni)});(0,g.Z)(function(){mi(W||!1)},[W]);var gi=E.useRef(Ei);gi.current=Ei;var ci=E.useRef([]);ci.current=[];var Li=(0,X.Z)(function(ni){var vi;Ti(ni),((vi=ci.current[ci.current.length-1])!==null&&vi!==void 0?vi:Ei)!==ni&&(ci.current.push(ni),le==null||le(ni))}),Pi=E.useRef(),wi=function(){clearTimeout(Pi.current)},bi=function(vi){var Hi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;wi(),Hi===0?Li(vi):Pi.current=setTimeout(function(){Li(vi)},Hi*1e3)};E.useEffect(function(){return wi},[]);var Ni=E.useState(!1),Ri=(0,de.Z)(Ni,2),Fi=Ri[0],Ci=Ri[1];(0,g.Z)(function(ni){(!ni||Ei)&&Ci(!0)},[Ei]);var Ii=E.useState(null),on=(0,de.Z)(Ii,2),Vi=on[0],Ai=on[1],sn=E.useState(null),Yi=(0,de.Z)(sn,2),Zi=Yi[0],Ji=Yi[1],Ki=function(vi){Ji([vi.clientX,vi.clientY])},ii=Ut(Ei,Ze,Kt&&Zi!==null?Zi:zt,Qt,ht,pt,St),Dt=(0,de.Z)(ii,11),_i=Dt[0],Oi=Dt[1],Bi=Dt[2],gn=Dt[3],ln=Dt[4],Xi=Dt[5],hn=Dt[6],fn=Dt[7],_n=Dt[8],xn=Dt[9],Ui=Dt[10],vn=$e(Nt,Q,F,U),yn=(0,de.Z)(vn,2),pn=yn[0],dn=yn[1],pi=pn.has("click"),Pn=dn.has("click")||dn.has("contextMenu"),Tn=(0,X.Z)(function(){Fi||Ui()}),Gn=function(){gi.current&&Kt&&Pn&&bi(!1)};Ge(Ei,zt,Ze,Tn,Gn),(0,g.Z)(function(){Tn()},[Zi,Qt]),(0,g.Z)(function(){Ei&&!(ht!=null&&ht[Qt])&&Tn()},[JSON.stringify(pt)]);var On=E.useMemo(function(){var ni=N(ht,ee,xn,Kt);return p()(ni,Xe==null?void 0:Xe(xn))},[xn,Xe,ht,ee,Kt]);E.useImperativeHandle(we,function(){return{nativeElement:Ce.current,popupElement:Lt.current,forceAlign:Tn}});var qn=E.useState(0),Mn=(0,de.Z)(qn,2),Qn=Mn[0],Wi=Mn[1],Vn=E.useState(0),An=(0,de.Z)(Vn,2),as=An[0],Jn=An[1],jn=function(){if(Ot&&zt){var vi=zt.getBoundingClientRect();Wi(vi.width),Jn(vi.height)}},es=function(){jn(),Tn()},wn=function(vi){Ci(!1),Ui(),ye==null||ye(vi)},Rn=function(){return new Promise(function(vi){jn(),Ai(function(){return vi})})};(0,g.Z)(function(){Vi&&(Ui(),Vi(),Ai(null))},[Vi]);function un(ni,vi,Hi,rn){ct[ni]=function(qi){var ls;rn==null||rn(qi),bi(vi,Hi);for(var Zn=arguments.length,bn=new Array(Zn>1?Zn-1:0),ds=1;ds<Zn;ds++)bn[ds-1]=arguments[ds];(ls=rt[ni])===null||ls===void 0||ls.call.apply(ls,[rt,qi].concat(bn))}}(pi||Pn)&&(ct.onClick=function(ni){var vi;gi.current&&Pn?bi(!1):!gi.current&&pi&&(Ki(ni),bi(!0));for(var Hi=arguments.length,rn=new Array(Hi>1?Hi-1:0),qi=1;qi<Hi;qi++)rn[qi-1]=arguments[qi];(vi=rt.onClick)===null||vi===void 0||vi.call.apply(vi,[rt,ni].concat(rn))});var In=$t(Ei,Pn,zt,Ze,dt,tt,lt,bi),mn=pn.has("hover"),Nn=dn.has("hover"),en,tn;mn&&(un("onMouseEnter",!0,De,function(ni){Ki(ni)}),un("onPointerEnter",!0,De,function(ni){Ki(ni)}),en=function(vi){(Ei||Fi)&&Ze!==null&&Ze!==void 0&&Ze.contains(vi.target)&&bi(!0,De)},Kt&&(ct.onMouseMove=function(ni){var vi;(vi=rt.onMouseMove)===null||vi===void 0||vi.call(rt,ni)})),Nn&&(un("onMouseLeave",!1,je),un("onPointerLeave",!1,je),tn=function(){bi(!1,je)}),pn.has("focus")&&un("onFocus",!0,Ue),dn.has("focus")&&un("onBlur",!1,Ke),pn.has("contextMenu")&&(ct.onContextMenu=function(ni){var vi;gi.current&&dn.has("contextMenu")?bi(!1):(Ki(ni),bi(!0)),ni.preventDefault();for(var Hi=arguments.length,rn=new Array(Hi>1?Hi-1:0),qi=1;qi<Hi;qi++)rn[qi-1]=arguments[qi];(vi=rt.onContextMenu)===null||vi===void 0||vi.call.apply(vi,[rt,ni].concat(rn))}),Z&&(ct.className=p()(rt.className,Z));var Di=(0,B.Z)((0,B.Z)({},rt),ct),cn={},Wn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Wn.forEach(function(ni){be[ni]&&(cn[ni]=function(){for(var vi,Hi=arguments.length,rn=new Array(Hi),qi=0;qi<Hi;qi++)rn[qi]=arguments[qi];(vi=Di[ni])===null||vi===void 0||vi.call.apply(vi,[Di].concat(rn)),be[ni].apply(be,rn)})});var ts=E.cloneElement(qe,(0,B.Z)((0,B.Z)({},Di),cn)),os={x:Xi,y:hn},Hn=qt?(0,B.Z)({},qt!==!0?qt:{}):null;return E.createElement(E.Fragment,null,E.createElement(me.Z,{disabled:!Ei,ref:Qe,onResize:es},E.createElement(te,{getTriggerDOMNode:pe},ts)),E.createElement(Le.Provider,{value:Ft},E.createElement(q,{portal:Ee,ref:ui,prefixCls:ee,popup:oi,className:p()(ei,On),style:Ht,target:zt,onMouseEnter:en,onMouseLeave:tn,onPointerEnter:en,zIndex:ti,open:Ei,keepDom:Fi,fresh:vt,onClick:ai,onPointerDownCapture:In,mask:dt,motion:gt,maskMotion:Wt,onVisibleChanged:wn,onPrepare:Rn,forceRender:yt,autoDestroy:ot,getPopupContainer:Pt,align:xn,arrow:Hn,arrowPos:os,ready:_i,offsetX:Oi,offsetY:Bi,offsetR:gn,offsetB:ln,onAlign:Tn,stretch:Ot,targetWidth:Qn/fn,targetHeight:as/_n})))});return Ie}var We=li(he.Z)},28426:function(Xt,st,K){"use strict";var B=K(59301),de=K(93314),Se=K(99571),he=Object.defineProperty,j=Object.defineProperties,p=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,X=(E,A,M)=>A in E?he(E,A,{enumerable:!0,configurable:!0,writable:!0,value:M}):E[A]=M,P=(E,A)=>{for(var M in A||(A={}))ce.call(A,M)&&X(E,M,A[M]);if(me)for(var M of me(A))l.call(A,M)&&X(E,M,A[M]);return E},g=(E,A)=>j(E,p(A));const _=({img:E,buttonProps:A={},styles:M={},customText:H,ButtonText:V,ButtonClick:L,Buttonclass:I,ButtonTwo:w,imgStyles:R,loading:q=!1,className:se=""})=>B.createElement("section",{className:`tc animated fadeIn ${se}`,style:P({color:"#999",margin:"100px auto",visibility:q?"hidden":"visible"},M)},B.createElement("img",{src:E||de,style:g(P({},R),{pointerEvents:"none",userSelect:"none"})}),B.createElement("p",{className:"mt20 font14"},H||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),V&&B.createElement(Se.ZP,P({className:I,onClick:L},A),V),w&&w);st.Z=_},45677:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return I}});var B=K(59301),de={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},Se=K(99571),he=K(70557),j=K(75975),p=K(25399),me=K(51257),ce=K(81722),l=K(28426),X=K(346),P=K(44203),g=K(59301),_=Object.defineProperty,E=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,H=(w,R,q)=>R in w?_(w,R,{enumerable:!0,configurable:!0,writable:!0,value:q}):w[R]=q,V=(w,R)=>{for(var q in R||(R={}))A.call(R,q)&&H(w,q,R[q]);if(E)for(var q of E(R))M.call(R,q)&&H(w,q,R[q]);return w},L=(w,R,q)=>new Promise((se,te)=>{var ge=$e=>{try{xe(q.next($e))}catch(J){te(J)}},Le=$e=>{try{xe(q.throw($e))}catch(J){te(J)}},xe=$e=>$e.done?se($e.value):Promise.resolve($e.value).then(ge,Le);xe((q=q.apply(w,R)).next())}),I=({editOffice:w="view",data:R,issaver:q,onSaver:se,theme:te,type:ge,filename:Le,monacoEditor:xe,className:$e,style:J,close:D,onClose:N,hasMask:O,disabledDownload:oe,onImgDimensions:ie,showNodata:S,recordInfo:v})=>{const[z,ae]=(0,B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Te,Fe]=(0,B.useState)(""),[Ye,_t]=(0,B.useState)(),Ut=window.ENV==="build"?"/react/build":"",si=location.host.startsWith("localhost")?X.Z.PROXY_SERVER:X.Z.API_SERVER,ft=10*(1024*1024),$t=(0,B.useRef)();R!=null&&R.startsWith("/api")&&ge!=="txt"&&(R=X.Z.API_SERVER+R);const ut=ne=>ne.substring(ne.lastIndexOf("/")+1).split(".").pop();Le&&xe&&(xe.filename=Le),(0,B.useEffect)(()=>{var ne,we;const ke=(we=(ne=document.cookie)==null?void 0:ne.replace(/\s/g,""))==null?void 0:we.split(";");ke==null||ke.map(ee=>{let Y=ee.split("=");Y[0]==="_educoder_session"&&Fe(Y[1])})},[]),(0,B.useEffect)(()=>{ge==="office"&&(R.indexOf("bigfilescdn.")>-1||R.indexOf("bigfiles1")>-1?_t({url:R,fileType:ut(R),model:R.indexOf("model=edit")?"edit":"view"}):We())},[ge,R]);function li(ne){return L(this,null,function*(){ne.data.type==="pdfdata"&&(se(ne.data.data),window.removeEventListener("message",li,!1)),console.log("mess---:",ne.data)})}const We=()=>L(void 0,null,function*(){console.log("data:",R);let ne=R;R.startsWith("http")||(ne=location.origin+ne);let we=new URL(ne).pathname.split("/").pop();const ke=yield(0,ce.gJ)({attachment_id:we});ke.url=si+ke.url,_t(ke)}),Ee=()=>{if(R.startsWith("http")||R.startsWith("blob:")){Ie();return}(0,me.Sv)(Le||"educoder",R,Le)},Ie=()=>{v&&(0,P.fc)({id:v==null?void 0:v.id,watch_type:1,course_id:v==null?void 0:v.course_id}),(0,me.Nd)(Le||"educoder",decodeURIComponent(R))};return g.createElement("div",{style:V({},J||{}),className:`${O&&de.bgBlack} ${ge?de.wrp:"hide"}`},D&&g.createElement("div",{className:de.close,ref:$t},!!ie&&g.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>$t.current},g.createElement("span",{onClick:()=>{N(),ie()}},g.createElement("i",{className:"icon-yulanpizhu"}))),!oe&&g.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>$t.current},g.createElement("span",{onClick:Ie},g.createElement("i",{className:"icon-quxiaozhiding"}))),q&&g.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>$t.current},g.createElement("span",{className:"",onClick:()=>{const ne=document.getElementById("pdfiframe");window.addEventListener("message",li,!1),setTimeout(()=>{ne.contentWindow.postMessage("getData","*")},300)}},g.createElement("i",{className:"icon-baocun"}))),g.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>$t.current},g.createElement("span",{className:"",onClick:()=>{N()}},g.createElement("i",{className:"icon-guanbi1"})))),g.createElement("div",{className:`${de[$e]} ${$e} ${de.monaco} ${ge==="txt"?"show":"hide"}`},ge==="txt"&&g.createElement(g.Fragment,null,g.createElement(j.ZP,V({},xe)))),ge==="audio"&&g.createElement("audio",{src:`${(R==null?void 0:R.indexOf("http://"))>-1||(R==null?void 0:R.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${R}`,autoPlay:!0}),ge==="video"&&g.createElement(g.Fragment,null,(R==null?void 0:R.indexOf("http"))>-1?g.createElement("video",{controls:!0,src:`${R}`,autoPlay:!0}):g.createElement("video",{controls:!0,src:`data:video/mp4;base64,${R}`,autoPlay:!0})),ge==="office"&&Ye&&g.createElement("iframe",{src:`${Ut}/office.html?key=${Ye.key}&url=${btoa(Ye.url)}&callbackUrl=${si+(Ye.callbackUrl||"")}&fileType=${Ye.fileType}&title=${Ye.title||""}&model=${w}&officeServer=${X.Z.ONLYOFFICE}&disabledDownload=${!!oe}`}),ge==="html"&&g.createElement("iframe",{src:R+"&disposition=inline"}),ge==="pdf"&&g.createElement("iframe",{id:"pdfiframe",src:`${Ut}/js/pdfview/index.html?filename=${Le||"educoder.pdf"}&url=${encodeURIComponent(R)}&disabledDownload=${!!oe}&model=${w}`}),ge==="image"&&g.createElement("img",{src:`${(R==null?void 0:R.indexOf("http://"))>-1||(R==null?void 0:R.indexOf("https://"))>-1?"":"data:image/png;base64,"}${R}`}),(ge==="other"||ge==="download")&&g.createElement(g.Fragment,null,S?g.createElement(l.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:g.createElement(Se.ZP,{icon:g.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:Ee,disabled:oe},"\u4E0B\u8F7D")}):g.createElement(Se.ZP,{type:"primary",size:"middle",onClick:Ee,disabled:oe},g.createElement(he.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},3736:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return A}});var B=K(59301),de=K(6767),Se=K(75727),he=K(30647),j=K(79710),p=K(48790),me=K(56102),ce=K(84989),l={watermark:"watermark___hNYlv",videovideo:"videovideo___ovOkV",animate__loop:"animate__loop___mvL6s",upDown:"upDown___SlgHv",container:"container___g1WYG","video-container":"video-container___XPkWR","video-controls":"video-controls___to0Zq",hide:"hide___NA3DV","video-progress":"video-progress___gqHsd",seek:"seek___iZHBm","seek-tooltip":"seek-tooltip___uWyXx","bottom-controls":"bottom-controls___uoIBm","left-controls":"left-controls___mBEx4","right-controls":"right-controls___e9L6r",rateOverlay:"rateOverlay___HHBWe",controlText:"controlText___M_BWR","volume-controls":"volume-controls___fa3mE","fullscreen-button":"fullscreen-button___ur0es","fullscreen-button1":"fullscreen-button1___rfaXm","pip-button":"pip-button___GFO8W","playback-animation":"playback-animation___ndURq",volume:"volume___OTmpP",hidden:"hidden___o7GkT"},X=(M,H,V)=>new Promise((L,I)=>{var w=se=>{try{q(V.next(se))}catch(te){I(te)}},R=se=>{try{q(V.throw(se))}catch(te){I(te)}},q=se=>se.done?L(se.value):Promise.resolve(se.value).then(w,R);q((V=V.apply(M,H)).next())});function P(M){if(isNaN(M))return{minutes:"00",seconds:"00"};const H=new Date(M*1e3).toISOString().substr(11,8);return{hour:H.substr(0,2),minutes:H.substr(3,2),seconds:H.substr(6,2)}}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2}});function g(M,H){return M-H}function _(M){M.sort(g);let H=0;for(let V=0;V<M.length-1;V++){let L=Math.abs(M[V+1]-M[V]);L<21&&(H+=L)}return H}const E=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var A=(0,B.forwardRef)(({allow_skip:M,src:H,toLog:V,videoId:L,logWatchHistory:I,courseId:w=null,startTime:R,handlePause:q=()=>{},handlePlay:se=()=>{},handlePlayEnded:te=()=>{},autoPlay:ge=!1,onPlayEnded:Le=()=>{},isShowWaterMark:xe=!0},$e)=>{var J;H=H==null?void 0:H.replace("http://","https://");const N=((J=H==null?void 0:H.split("."))==null?void 0:J.pop())==="flv",O=(0,B.useRef)(),oe=(0,B.useRef)(),ie=(0,B.useRef)(),S=(0,B.useRef)(),v=(0,B.useRef)(),z=(0,B.useRef)(),ae=(0,B.useRef)(),Te=(0,B.useRef)(),Fe=(0,B.useRef)(),Ye=(0,B.useRef)(),_t=(0,B.useRef)(),Ut=(0,B.useRef)(),si=(0,B.useRef)(),Ge=(0,B.useRef)(),ft=navigator.userAgent.toLowerCase().match(E),$t=ft?ft[0]:"pc",ut=(0,B.useRef)(!1),li=(0,p.eY)();let We=0,Ee=0,Ie=0,ne=null,we=!1,ke=20,ee=1,Y=!1,C=!1,Q=[];(0,B.useImperativeHandle)($e,()=>({getLastUpdatedTime:()=>O.current.currentTime,getDuration:()=>O.current.duration})),de.ZP.config({maxCount:1,getContainer:()=>ie.current});const F=(0,B.useCallback)((Ae,je=!1)=>{let Ue={point:O.current.currentTime};ne?(Ue.log_id=ne,Ue.watch_duration=_(Q),Ue.total_duration=Ee):(w?(Ue.video_id=parseInt(L,10),Ue.course_id=w):Ue.video_id=L,Ue.duration=We,Ue.device=$t),je&&(Ue.ed="1");function Ke(){return X(this,null,function*(){Y=!0,ne=yield I==null?void 0:I(Ue),Y=!1,Ae&&Ae()})}Ke()},[L,w]);(0,B.useEffect)(()=>{O.current&&(S.current.style.display="none",v.current.style.display="block"),de.ZP.destroy();let Ae=null;return he.Z.isSupported&&N&&H&&(H==null?void 0:H.indexOf(".m3u8"))<0?(Ae=he.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:H,muted:!1}),O.current&&(Ae.attachMediaElement(O.current),Ae.load())):O.current.setAttribute("src",H),W(),()=>{Ae&&(Ae.unload(),Ae.pause(),Ae.destroy(),Ae=null)}},[O,N,H]);function U(){O.current.paused?(S.current.style.display="none",v.current.style.display="block"):(S.current.style.display="block",v.current.style.display="none")}function W(){_t.current.style.display="none",si.current.style.display="none",Ut.current.style.display="none",O.current.muted||O.current.volume===0?_t.current.style.display="block":O.current.volume>0&&O.current.volume<=.5?si.current.style.display="block":Ut.current.style.display="block"}(0,B.useEffect)(()=>{const Ae=document.getElementById("play"),je=document.querySelectorAll(".playback-icons use");function Ue(){se(),R&&!ut.current&&(O.current.currentTime=R),ut.current=!0,Q.push(O.current.currentTime),we||(we=!0,V&&F())}function Ke(){return X(this,null,function*(){U(),Q.push(O.current.currentTime),V&&F(()=>{ne=null,Ie=0,we=!1,Y=!1,C=!1,Q=[],Ee=0,ee=1},!0),Le()})}function dt(){z.current.value=Math.round(O.current.currentTime),ae.current.value=Math.round(O.current.currentTime)}function Re(){const ht=P(Math.round(O.current.currentTime));Fe.current.innerText=`${ht.hour>0?ht.hour+":":""}${ht.minutes}:${ht.seconds}`,Fe.current.setAttribute("datetime",`${ht.hour>0?" "+ht.hour+" ":""}${ht.minutes}m ${ht.seconds}s`)}function tt(){var ht,pt,ti,Ot,Xe,vt,Kt;const ai=Math.round((ht=O.current)==null?void 0:ht.duration);(ti=(pt=z.current)==null?void 0:pt.setAttribute)==null||ti.call(pt,"max",ai),(Xe=(Ot=ae.current)==null?void 0:Ot.setAttribute)==null||Xe.call(Ot,"max",ai);const St=P(ai);Te.current&&(Te.current.innerText=`${St.hour>0?St.hour+":":""}${St.minutes}:${St.seconds}`,(Kt=(vt=Te.current).setAttribute)==null||Kt.call(vt,"datetime",`${St.hour>0?" "+St.hour+" ":""}${St.minutes}m ${St.seconds}s`))}function Pt(){try{const ht=Math.round(O.current.duration);z.current.setAttribute("max",ht),ae.current.setAttribute("max",ht);const pt=P(ht);Te.current.innerText=`${pt.hour>0?pt.hour+":":""}${pt.minutes}:${pt.seconds}`,Te.current.setAttribute("datetime",`${pt.hour>0?" "+pt.hour+" ":""}${pt.minutes}m ${pt.seconds}s`),dt(),Re();const{width:ti,height:Ot,x:Xe,y:vt}=oe.current.getBoundingClientRect();if(Xe<0||vt<0,!C){let Kt=O.current.currentTime,ai=Kt-Ie;Math.abs(ai)<10?(Ee+=Math.abs(ai),Ie=Kt,Y||Ee-ee*ke>=0&&(ee++,Q.push(Ie),V&&F())):(Ie=Kt,V&&F())}}catch(ht){console.log("videoplaying:",ht)}}function yt(){C=!0}function Bt(){O.current.playing&&Q.push(O.current.currentTime,Ie),Ie=O.current.currentTime,C=!1}function jt(){We=O.current.duration,We<=20&&(ke=We/3),O.current.addEventListener("play",Ue)}function oi(ht){ht.preventDefault(),(0,ce.vp)()?(O.current.style.width="100%",O.current.style.height="100%"):O.current.style.cssText=""}function ei(){q()}function Ht(ht){if(!M){de.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const pt=ht.target.dataset.seek?ht.target.dataset.seek:ht.target.value;O.current.currentTime=pt,ae.current.value=pt,z.current.value=pt}function Qt(ht){const pt=Math.round(ht.offsetX/ht.target.clientWidth*parseInt(ht.target.getAttribute("max"),10));z.current.setAttribute("data-seek",pt);const ti=P(pt);Ye.current.textContent=`${ti.hour>0?ti.hour+":":""}${ti.minutes}:${ti.seconds}`;const Ot=O.current.getBoundingClientRect();Ye.current.style.left=`${ht.pageX-Ot.left}px`}function Et(ht){switch(ht.code){case"Space":ht.preventDefault(),ye();break;case"ArrowRight":if(ht.preventDefault(),!M){de.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(O.current.currentTime>=O.current.duration)break;O.current.currentTime=parseInt(O.current.currentTime)+5,dt();break;case"ArrowLeft":if(ht.preventDefault(),!M){de.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(O.current.currentTime===0)break;O.current.currentTime=parseInt(O.current.currentTime)-5,dt();break;case"ArrowUp":ht.preventDefault(),O.current.volume<1&&(O.current.volume=(parseInt(O.current.volume*10)+1)/10);break;case"ArrowDown":ht.preventDefault(),O.current.volume>0&&(O.current.volume=(parseInt(O.current.volume*10)-1)/10);break}}return ie.current.addEventListener((0,ce.gH)(),oi),O.current.addEventListener("canplay",jt),O.current.addEventListener("ended",Ke),O.current.addEventListener("seeking",yt),O.current.addEventListener("seeked",Bt),O.current.addEventListener("loadedmetadata",tt),z.current.addEventListener("mousemove",Qt),z.current.addEventListener("input",Ht),O.current.addEventListener("timeupdate",Pt),O.current.addEventListener("pause",ei),O.current.addEventListener("volumechange",W),document.addEventListener("keydown",Et),()=>{var ht,pt,ti,Ot,Xe,vt,Kt,ai,St,qt,Ct,He;(ht=O.current)==null||ht.removeEventListener("canplay",jt),(pt=O.current)==null||pt.removeEventListener("play",Ue),(ti=O.current)==null||ti.removeEventListener("ended",Ke),(Ot=O.current)==null||Ot.removeEventListener("seeking",yt),(Xe=O.current)==null||Xe.removeEventListener("seeked",Bt),(vt=z.current)==null||vt.removeEventListener("mousemove",Qt),(Kt=z.current)==null||Kt.removeEventListener("input",Ht),(ai=O.current)==null||ai.removeEventListener("timeupdate",Pt),(St=O.current)==null||St.removeEventListener("pause",ei),(qt=O.current)==null||qt.removeEventListener("loadedmetadata",tt),(Ct=O.current)==null||Ct.removeEventListener("volumechange",W),document.removeEventListener("keydown",Et),(He=O.current)!=null&&He.playing&&(Q.push(Ie,O.current.currentTime),V&&F())}},[O,H]),(0,B.useEffect)(()=>{if(O.current.onended=()=>{te(O)},O.current.oncontextmenu=()=>!1,(H==null?void 0:H.indexOf(".m3u8"))>-1){if(O.current.canPlayType("application/vnd.apple.mpegurl"))O.current.src=H;else if(j.ZP.isSupported()){var Ae=new j.ZP;Ae.loadSource(H),Ae.attachMedia(O.current)}}},[H]);const[re,le]=(0,B.useState)(1),ye=()=>{O.current.paused||O.current.ended?O.current.play():O.current.pause(),U()};function De(){O.current.muted=!O.current.muted,O.current.muted?(Ge.current.setAttribute("data-volume",volume.value),Ge.current.value=0):Ge.current.value=Ge.current.dataset.volume}return B.createElement("div",{style:{position:"relative"},ref:ie},B.createElement("div",{ref:oe,className:`${l.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${l.animate__loop}`},xe&&li?li.login:" "),B.createElement("div",{className:l.container},B.createElement("div",{className:l["video-container"],id:"video-container"},B.createElement("div",{className:l["playback-animation"],id:"playback-animation"},B.createElement("svg",{className:l["playback-icons"]},B.createElement("use",{className:"hidden",href:"#play-icon"}),B.createElement("use",{href:"#pause"}))),B.createElement("video",{className:l.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:O,autoPlay:ge}),B.createElement("div",{className:`${l["video-controls"]} `,id:"video-controls"},B.createElement("div",{className:l["bottom-controls"]},B.createElement("div",{className:l["left-controls"]},B.createElement("button",{"data-title":"\u64AD\u653E/\u6682\u505C",id:"play",onClick:ye},B.createElement("svg",{className:l["playback-icons"]},B.createElement("use",{ref:v,href:"#play-icon"}),B.createElement("use",{ref:S,style:{display:"none"},href:"#pause"}))),B.createElement("div",{className:l.time},B.createElement("time",{id:"time-elapsed",ref:Fe},"00:00"),B.createElement("span",null," / "),B.createElement("time",{id:"duration",ref:Te},"00:00"))),B.createElement("div",{className:l["right-controls"]},M&&B.createElement(Se.Z,{placement:"top",overlayClassName:l.rateOverlay,getPopupContainer:Ae=>Ae.parentNode,menu:{items:[{key:"1",label:B.createElement("span",{onClick:()=>{le(1),O.current.playbackRate=1}},"1.0x")},{key:"2",label:B.createElement("span",{onClick:()=>{le(1.5),O.current.playbackRate=1.5}},"1.5x")},{key:"3",label:B.createElement("span",{onClick:()=>{le(2),O.current.playbackRate=2}},"2.0x")}]}},B.createElement("div",{className:`${l.controlText} mr5`},"\u500D\u901F")),B.createElement(me.CopyToClipboard,{text:H,onCopy:()=>de.ZP.success("\u590D\u5236\u6210\u529F")},B.createElement("button",{"data-title":"\u590D\u5236\u94FE\u63A5"},B.createElement("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}}))),B.createElement("div",{className:l["volume-controls"]},B.createElement("button",{"data-title":"\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",className:l["volume-button"],id:"volume-button",onClick:De},B.createElement("i",{ref:_t,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),B.createElement("i",{ref:si,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),B.createElement("i",{ref:Ut,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})),B.createElement("input",{className:l.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:Ge,style:{display:"none"},onClick:W})),B.createElement("button",{"data-title":"\u5168\u5C4F/\u9000\u51FA\u5168\u5C4F",className:l["fullscreen-button"],onClick:()=>{(0,ce.vp)()?(0,ce.BU)():(0,ce.Dj)(ie.current)}},B.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),B.createElement("div",{className:l["video-progress"]},B.createElement("progress",{ref:ae,value:"0",min:"0"}),B.createElement("input",{className:l.seek,ref:z,value:"0",min:"0",type:"range",step:"1"}),B.createElement("div",{className:l["seek-tooltip"],ref:Ye,id:"seek-tooltip"},"00:00"))))),B.createElement("svg",{style:{display:"none"}},B.createElement("defs",null,B.createElement("symbol",{id:"pause",viewBox:"0 0 24 24"},B.createElement("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})),B.createElement("symbol",{id:"play-icon",viewBox:"0 0 24 24"},B.createElement("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})),B.createElement("symbol",{id:"volume-high",viewBox:"0 0 24 24"},B.createElement("path",{d:"M14.016 3.234q3.047 0.656 5.016 3.117t1.969 5.648-1.969 5.648-5.016 3.117v-2.063q2.203-0.656 3.586-2.484t1.383-4.219-1.383-4.219-3.586-2.484v-2.063zM16.5 12q0 2.813-2.484 4.031v-8.063q1.031 0.516 1.758 1.688t0.727 2.344zM3 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6z"})),B.createElement("symbol",{id:"volume-low",viewBox:"0 0 24 24"},B.createElement("path",{d:"M5.016 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6zM18.516 12q0 2.766-2.531 4.031v-8.063q1.031 0.516 1.781 1.711t0.75 2.32z"})),B.createElement("symbol",{id:"volume-mute",viewBox:"0 0 24 24"},B.createElement("path",{d:"M12 3.984v4.219l-2.109-2.109zM4.266 3l16.734 16.734-1.266 1.266-2.063-2.063q-1.547 1.313-3.656 1.828v-2.063q1.172-0.328 2.25-1.172l-4.266-4.266v6.75l-5.016-5.016h-3.984v-6h4.734l-4.734-4.734zM18.984 12q0-2.391-1.383-4.219t-3.586-2.484v-2.063q3.047 0.656 5.016 3.117t1.969 5.648q0 2.203-1.031 4.172l-1.5-1.547q0.516-1.266 0.516-2.625zM16.5 12q0 0.422-0.047 0.609l-2.438-2.438v-2.203q1.031 0.516 1.758 1.688t0.727 2.344z"})),B.createElement("symbol",{id:"fullscreen",viewBox:"0 0 24 24"},B.createElement("path",{d:"M14.016 5.016h4.969v4.969h-1.969v-3h-3v-1.969zM17.016 17.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 9.984v-4.969h4.969v1.969h-3v3h-1.969zM6.984 14.016v3h3v1.969h-4.969v-4.969h1.969z"})),B.createElement("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24"},B.createElement("path",{d:"M15.984 8.016h3v1.969h-4.969v-4.969h1.969v3zM14.016 18.984v-4.969h4.969v1.969h-3v3h-1.969zM8.016 8.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 15.984v-1.969h4.969v4.969h-1.969v-3h-3z"})),B.createElement("symbol",{id:"pip",viewBox:"0 0 24 24"},B.createElement("path",{d:"M21 19.031v-14.063h-18v14.063h18zM23.016 18.984q0 0.797-0.609 1.406t-1.406 0.609h-18q-0.797 0-1.406-0.609t-0.609-1.406v-14.016q0-0.797 0.609-1.383t1.406-0.586h18q0.797 0 1.406 0.586t0.609 1.383v14.016zM18.984 11.016v6h-7.969v-6h7.969z"})))))})},75975:function(Xt,st,K){"use strict";K.d(st,{SV:function(){return Y},ZP:function(){return ee}});var B=K(59301),de=K(76374);const Se={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},he={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},j={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"if",content:["if () {"," $0","}"].join(`
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"include <vector>",content:["#include <vector>"].join(`
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
`)},{label:"include <map>",content:["#include <map>"].join(`
`)},{label:"include <string>",content:["#include <string>"].join(`
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
`)}]},p={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},me={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join(`
`)}]};var ce=K(53184),l=K.n(ce),X=Object.defineProperty,P=Object.defineProperties,g=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,M=(C,Q,F)=>Q in C?X(C,Q,{enumerable:!0,configurable:!0,writable:!0,value:F}):C[Q]=F,H=(C,Q)=>{for(var F in Q||(Q={}))E.call(Q,F)&&M(C,F,Q[F]);if(_)for(var F of _(Q))A.call(Q,F)&&M(C,F,Q[F]);return C},V=(C,Q)=>P(C,g(Q)),L=(C,Q,F)=>new Promise((U,W)=>{var re=De=>{try{ye(F.next(De))}catch(Ae){W(Ae)}},le=De=>{try{ye(F.throw(De))}catch(Ae){W(Ae)}},ye=De=>De.done?U(De.value):Promise.resolve(De.value).then(re,le);ye((F=F.apply(C,Q)).next())});const I={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},w=(C,Q)=>Q.map(F=>({label:F,kind:C.languages.CompletionItemKind.Keyword,insertText:F})),R=C=>Object.keys(I.tables).map(Q=>({label:Q,kind:C.languages.CompletionItemKind.Variable,insertText:Q})),q=(C,Q)=>{const F=I.tables[C];return F?F.map(U=>({label:U,kind:Q.languages.CompletionItemKind.Field,insertText:U})):[]};function se(C,Q,F,U,W){let re=Q.getWordUntilPosition(F),le={startLineNumber:F.lineNumber,endLineNumber:F.lineNumber,startColumn:re.startColumn,endColumn:re.endColumn},ye=U.map(De=>({label:De,kind:C.languages.CompletionItemKind.Keyword,insertText:De,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le}));return W.map(De=>{ye.push(V(H({},De),{range:le}))}),ye}var te=C=>{I.languages.map(W=>(C.languages.registerDocumentFormattingEditProvider(W,{provideDocumentFormattingEdits(re,le,ye){return L(this,null,function*(){const De=l()(re.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1});return[{range:re.getFullModelRange(),text:De}]})}}),W));const Q=j.quickKey.map(W=>({label:W.label,kind:C.languages.CompletionItemKind.Method,insertText:W.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet})),F=p.quickKey.map(W=>({label:W.label,kind:C.languages.CompletionItemKind.Method,insertText:W.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet})),U=he.quickKey.map(W=>({label:W.label,kind:C.languages.CompletionItemKind.Method,insertText:W.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}));C.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(W,re){var le=W.getWordUntilPosition(re),ye={startLineNumber:re.lineNumber,endLineNumber:re.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn},De=W.getLineContent(re.lineNumber).substring(le.startColumn-2,le.endColumn);return{suggestions:[...j.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...j.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:De.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),C.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(W,re){var le=W.getWordUntilPosition(re),ye={startLineNumber:re.lineNumber,endLineNumber:re.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn};return{suggestions:[...Se.keywords.map(De=>({label:De,kind:C.languages.CompletionItemKind.Function,documentation:De,insertText:De,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),C.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(W,re){var le=W.getWordUntilPosition(re),ye={startLineNumber:re.lineNumber,endLineNumber:re.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn},De=W.getLineContent(re.lineNumber).substring(le.startColumn-2,le.endColumn);return{suggestions:[...he.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...he.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:De.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),C.languages.registerCompletionItemProvider("scala",{provideCompletionItems:function(W,re){var le=W.getWordUntilPosition(re),ye={startLineNumber:re.lineNumber,endLineNumber:re.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn},De=W.getLineContent(re.lineNumber).substring(le.startColumn-2,le.endColumn);return{suggestions:[...me.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...me.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:De.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),C.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(W,re){var le=W.getWordUntilPosition(re),ye={startLineNumber:re.lineNumber,endLineNumber:re.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn},De=W.getLineContent(re.lineNumber).substring(le.startColumn-2,le.endColumn);return{suggestions:[...p.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...p.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:De.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}})};const ge="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var Le=Object.defineProperty,xe=(C,Q,F)=>Q in C?Le(C,Q,{enumerable:!0,configurable:!0,writable:!0,value:F}):C[Q]=F,$e=(C,Q,F)=>xe(C,typeof Q!="symbol"?Q+"":Q,F);const J=class qo{constructor(Q,F,U){this.placeholder=Q,this.editor=F,this.monaco=U,F.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return qo.ID}getDomNode(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}dispose(){this.editor.removeContentWidget(this)}};$e(J,"ID","editor.widget.placeholderHint");var N=J,O=K(96236),oe=K(6767),ie=K(25399),S=K(89392),v=K(49535),z=K(56102),ae=Object.defineProperty,Te=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,Ye=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,si=(C,Q,F)=>Q in C?ae(C,Q,{enumerable:!0,configurable:!0,writable:!0,value:F}):C[Q]=F,Ge=(C,Q)=>{for(var F in Q||(Q={}))_t.call(Q,F)&&si(C,F,Q[F]);if(Ye)for(var F of Ye(Q))Ut.call(Q,F)&&si(C,F,Q[F]);return C},ft=(C,Q)=>Te(C,Fe(Q)),$t=(C,Q)=>{var F={};for(var U in C)_t.call(C,U)&&Q.indexOf(U)<0&&(F[U]=C[U]);if(C!=null&&Ye)for(var U of Ye(C))Q.indexOf(U)<0&&Ut.call(C,U)&&(F[U]=C[U]);return F},ut=(C,Q,F)=>new Promise((U,W)=>{var re=De=>{try{ye(F.next(De))}catch(Ae){W(Ae)}},le=De=>{try{ye(F.throw(De))}catch(Ae){W(Ae)}},ye=De=>De.done?U(De.value):Promise.resolve(De.value).then(re,le);ye((F=F.apply(C,Q)).next())});function li(C){return/^\d+$/.test(C)?`${C}px`:C}function We(){}let Ee=!1;const Ie={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale",solidity:"sol"};function ne(C=[]){let Q=C;if(Array.isArray(C)){for(let F=0;F<C.length;F++){let U=Ie[C[F]];if(U)return U}return Q[0]}return Ie[Q]||Q}let we=null;const ke=()=>ut(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(C){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",C)}});var ee=C=>{var Q=C,{width:F="100%",height:U="100%",value:W,language:re="javascript",style:le={},options:ye={},overrideServices:De={},theme:Ae="vs-dark",onEditBlur:je,isCopy:Ue=!1,onSave:Ke,autoHeight:dt=!1,forbidCopy:Re=!1,onChange:tt=We,editorDidMount:Pt=We,onFocus:yt=We,onBreakPoint:Bt=We,breakPointValue:jt=[],filename:oi="educoder.txt",errorLine:ei,errorContent:Ht="",highlightLine:Qt,openBreakPoint:Et=!1,placeholder:ht="",showMiniMap:pt=!0}=Q,ti=$t(Q,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"]);const Ot=(0,B.useRef)(),Xe=(0,B.useRef)({}),vt=(0,B.useRef)(),Kt=(0,B.useRef)(),ai=(0,B.useRef)([]),St=(0,B.useRef)(!1),qt=(0,B.useRef)(),Ct=(0,B.useRef)(),He=(0,B.useRef)(!1),[h,m]=(0,B.useState)(!1);function y(){let Ve;return Ot.current&&(Ve=new de.Z(Ze=>{for(let Rt of Ze)(Rt.target.offsetHeight>0||Rt.target.offsetWidth>0)&&Xe.current.instance.layout()}),Ve.observe(Ot.current)),Ve}function k(){oe.ZP.warning({content:decodeURIComponent(ge),key:"monaco-editor-tip"})}const Z=()=>{let Ve=Xe.current.instance;if(W!=null&&Ve&&h){const Ze=Ve.getModel();Ze&&W!==Ze.getValue()&&(Ee=!0,Ze.setValue(W),Ve.layout(),Ee=!1)}};(0,B.useEffect)(()=>{const Ve=v.Z.subscribe("formatDocument",Ze=>{var Rt;let Lt=Xe.current.instance;(Rt=Lt==null?void 0:Lt.getAction)==null||Rt.call(Lt,"editor.action.formatDocument").run()});return window.updateMonacoValue=Ze=>{tt(Ze)},Ve},[]),(0,B.useEffect)(()=>{var Ve;let Ze=Xe.current.instance;Kt.current&&clearTimeout(Kt.current),Kt.current=setTimeout(()=>{Z()},500),W&&(W!=null&&W.length)&&((Ve=Ze==null?void 0:Ze.updateOptions)==null||Ve.call(Ze,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(W.split(/\r\n|\r|\n/g).length))+3,5)}))},[W,h,Xe.current]),(0,B.useEffect)(()=>{if(ei&&Xe.current&&Xe.current.instance){let Ze=Xe.current.instance;Ze.changeViewZones(function(Rt){var Lt=document.createElement("div");Lt.style.padding="10px 20px",Lt.style.width="calc(100% - 20px)",Lt.className="my-error-line-wrp",Lt.innerHTML=Ht,Rt.addZone({afterLineNumber:ei||11,heightInLines:3,domNode:Lt})});var Ve={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ze.addOverlayWidget(Ve),Ze.revealPositionInCenter({lineNumber:20,column:1})}},[ei,Xe.current,h]);const pe=(Ve="",Ze)=>{if(!Ve||Ve.trim()==="")return!0;const Lt=Xe.current.instance.getModel().getLineTokens(Ze);let ui=!1;for(let Tt=0;Tt<2;Tt++)Lt.getStandardTokenType(Tt)===1&&(ui=!0);return ui};(0,B.useEffect)(()=>{var Ve;const Ze=(Ve=Xe.current)==null?void 0:Ve.instance;if(Ze&&h&&Re){const Rt=Ze.onDidBlurEditorWidget(()=>{He.current=!1}),Lt=Ze.onDidFocusEditorText(()=>{He.current=!0});return()=>{Rt.dispose(),Lt.dispose()}}},[Xe.current,h,Re]),(0,B.useEffect)(()=>{var Ve;if((Ve=Xe.current)!=null&&Ve.instance&&h&&Et){let Ze=Xe.current.instance,Rt=Ze.getModel();if(!Rt)return;(()=>{var lt;let gt=[],Wt=[];const Mt=Rt.getAllDecorations();for(let Yt of Mt)Yt.options.className==="highlighted-line"&&(gt.push((lt=Yt==null?void 0:Yt.range)==null?void 0:lt.startLineNumber),Wt.push(Yt==null?void 0:Yt.id));if(Qt===gt[0])return;Rt.deltaDecorations(Wt,[]);const Jt=Rt.getLineCount();Qt&&Qt<=Jt&&(Ze.deltaDecorations([],[{range:new we.Range(Qt,1,Qt,Rt.getLineMaxColumn(Qt)),options:{isWholeLine:!0,className:"highlighted-line"}}]),Ze.revealLineInCenter(Qt))})();const ui=(lt=!1)=>{var gt;let Wt=[],Mt=[];const Jt=Rt.getAllDecorations();for(let Yt of Jt)Yt.options.linesDecorationsClassName==="breakpoints-select"&&(Wt.push((gt=Yt==null?void 0:Yt.range)==null?void 0:gt.startLineNumber),Mt.push(Yt==null?void 0:Yt.id));if(lt)return{lines:Wt,ids:Mt};Bt(Wt)},Tt=lt=>ut(void 0,null,function*(){let gt={range:new we.Range(lt,1,lt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield Rt.deltaDecorations([],[gt]),ui()}),It=lt=>ut(void 0,null,function*(){let gt=[];const Wt=Ze.getLineDecorations(lt);for(let Mt of Wt)Mt.options.linesDecorationsClassName==="breakpoints-select"&&gt.push(Mt.id);yield Rt.deltaDecorations(gt,[]),ui()}),zt=lt=>{let gt=Ze.getLineDecorations(lt);for(let Wt of gt)if(Wt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,S.isEqual)(jt,ui(!0).lines)){Rt.deltaDecorations(ui(!0).ids,[]);const lt=jt.map(gt=>({range:new we.Range(gt,1,gt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));Rt.deltaDecorations([],lt)}const ve=Ze.onDidChangeModelContent(lt=>{let gt=Ze.getPosition();if(gt){let Wt=gt.lineNumber;clearTimeout(Ct.current),Ct.current=setTimeout(()=>{pe(Rt.getLineContent(Wt),Wt)?It(Wt):zt(Wt)?(It(Wt),Tt(Wt)):ui()},100)}}),Ce=Ze.onMouseDown(lt=>{var gt,Wt,Mt;if(lt.target.detail&&((Mt=(Wt=(gt=lt.target)==null?void 0:gt.element)==null?void 0:Wt.className)!=null&&Mt.includes("line-numbers"))){let Jt=lt.target.position.lineNumber;if(pe(Rt.getLineContent(Jt),Jt))return;zt(Jt)?It(Jt):Tt(Jt)}}),Qe=lt=>{let gt={range:new we.Range(lt,1,lt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};ai.current=Ze.deltaDecorations(ai.current,[gt])},qe=()=>{ai.current=Ze.deltaDecorations(ai.current,[])},rt=Ze.onMouseMove(lt=>{var gt,Wt,Mt;if(qe(),lt.target.detail&&((Mt=(Wt=(gt=lt.target)==null?void 0:gt.element)==null?void 0:Wt.className)!=null&&Mt.includes("line-numbers"))){let Jt=lt.target.position.lineNumber;if(pe(Rt.getLineContent(Jt),Jt))return;Qe(Jt)}}),ct=Ze.onMouseLeave(()=>{qe()});return()=>{ve.dispose(),Ce.dispose(),rt.dispose(),ct.dispose()}}},[Xe.current,h,jt,Qt,Et,re]),(0,B.useEffect)(()=>{var Ve;(Ve=Xe.current)!=null&&Ve.instance&&Et&&Xe.current.instance.setPosition({lineNumber:0,column:0})},[Qt]);function be(){let Ve=Xe.current.instance;if(Ve){const Ze=Ve.getSelection(),Rt=Xe.current.pastePos||{},Lt=new we.Range(Rt.startLineNumber||Ze.endLineNumber,Rt.startColumn||Ze.endColumn,Rt.endLineNumber||Ze.endLineNumber,Rt.endColumn||Ze.endColumn);setTimeout(()=>{Ve.executeEdits("",[{range:Lt,text:""}])},300)}}function ot(Ve){(window.navigator.platform.match("Mac")?Ve.metaKey:Ve.ctrlKey)&&Ve.keyCode==83&&(Ve.preventDefault(),Ke())}const at=()=>{if(dt&&Xe.current.instance){const Ve=Xe.current.instance.getContentHeight();et(Ve<U?U:Ve)}else et(U)};function mt(Ve){var Ze=document.createEvent("MouseEvents");Ze.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ve.dispatchEvent(Ze)}const Nt=Ve=>{if(!He.current)return;const{keyCode:Ze,ctrlKey:Rt,metaKey:Lt,target:ui,type:Tt}=Ve;return(Tt==="paste"||(Ze===67||Ze===86)&&(Lt||Rt))&&ui.nodeName==="TEXTAREA"&&(k(),Ve.preventDefault()),!1};function Zt(Ve,Ze){var Rt=window.URL||window.webkitURL||window,Lt=new Blob([Ze]),ui=document.createElementNS("http://www.w3.org/1999/xhtml","a");ui.href=Rt.createObjectURL(Lt),ui.download=Ve,mt(ui)}(0,B.useEffect)(()=>{at()},[at]),(0,B.useEffect)(()=>{Ot.current&&!h&&Promise.all([K.e(8909),K.e(6656)]).then(K.bind(K,71448)).then(Ve=>{try{we=Ve,Xe.current.instance=we.editor.create(Ot.current,{value:W,language:ne(re),theme:Ae,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:pt||!1}},De);const Ze=Xe.current.instance;let ui=[...O.BH._menuItems].find(ve=>ve[0]._debugName=="EditorContext")[1],Tt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],It=(ve,Ce)=>{var Qe,qe;let rt=ve._first;do Ce.includes((qe=(Qe=rt.element)==null?void 0:Qe.command)==null?void 0:qe.id)&&ve._remove(rt);while(rt=rt.next)};if(Pt(Ze,we),setTimeout(()=>{at(),Xe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Zt(oi||"educoder.txt",Ze.getValue())}})},500),Xe.current.subscription=Ze.onDidChangeModelContent(ve=>{St.current?clearTimeout(qt.current):(at(),tt(Ze.getValue(),ve)),qt.current=setTimeout(()=>{St.current=!1},500)}),window.Monaco||te(we,ne(re)),Re&&(It(ui,Tt),Ot.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Nt),window.removeEventListener("paste",Nt),window.addEventListener("keydown",Nt),window.addEventListener("paste",Nt)),window.Monaco=we,je&&Ze.onDidBlurEditorWidget(()=>{je(Ze.getValue())}),yt&&Ze.onDidFocusEditorText(()=>{Re&&ke(),yt(Ze.getValue())}),Re){ke();try{Ze.onDidPaste(ve=>{const Ce=Ze.getSelection(),Qe=Xe.current.pastePos||{},qe=new we.Range(Qe.startLineNumber||Ce.endLineNumber,Qe.startColumn||Ce.endColumn,Qe.endLineNumber||Ce.endLineNumber,Qe.endColumn||Ce.endColumn);Ze.executeEdits("",[{range:ve.range,text:""}])})}catch(ve){}}let zt=y();return ht&&typeof ht=="string"&&new N(ht,Ze,we),m(!0),()=>{const ve=Xe.current.instance;ve.dispose();const Ce=ve.getModel();Ce&&Ce.dispose(),Xe.current.subscription&&Xe.current.subscription.dispose(),zt.unobserve(Ot.current)}}catch(Ze){}})},[]),(0,B.useEffect)(()=>{if(Xe.current.instance&&h)return document.addEventListener("keydown",ot,!1),()=>{document.removeEventListener("keydown",ot)}},[Ke,h]),(0,B.useEffect)(()=>{let Ve=Xe.current.instance;if(Ve&&h){let Ze=ne(re);we.editor.setModelLanguage(Ve.getModel(),Ze)}},[re,h]),(0,B.useEffect)(()=>{Xe.current.instance&&h&&we.editor.setTheme(Ae)},[Ae,h]),(0,B.useEffect)(()=>{let Ve=Xe.current.instance;vt.current=ye,Ve&&h&&(Ve.updateOptions(Ge({},ye)),setTimeout(()=>{Ve.getModel().updateOptions(Ge({},ye))},200))},[JSON.stringify(ye),h]),(0,B.useEffect)(()=>{let Ve=Xe.current.instance;Ve&&h&&Ve.layout()},[F,U,h]);const[bt,Vt]=(0,B.useState)(li(F)),[Ft,et]=(0,B.useState)(li(U)),xt=ft(Ge({},le),{width:bt,height:Ft,position:"relative"});return B.createElement("div",{className:"my-monaco-editor",ref:Ot,style:xt},Ue&&B.createElement(z.CopyToClipboard,{text:W,onCopy:()=>oe.ZP.success("\u590D\u5236\u6210\u529F")},B.createElement(ie.Z,{title:"\u590D\u5236\u4EE3\u7801"},B.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},B.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function Y({width:C="100%",height:Q="100%",original:F,modified:U,language:W,options:re={}}){const le=(0,B.useRef)(),[ye,De]=(0,B.useState)(null);function Ae(dt){let Re;return le.current&&(Re=new de.Z(tt=>{for(let Pt of tt)(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&dt.layout()}),Re.observe(le.current)),Re}(0,B.useEffect)(()=>(le.current&&Promise.all([K.e(8909),K.e(9404)]).then(K.bind(K,2550)).then(dt=>{we=dt;const Re=we.editor.createDiffEditor(le.current,ft(Ge({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},re),{wordWrap:!0}));De(Re);let tt=Ae(Re);return()=>{Re.dispose();const Pt=Re.getModel();Pt&&Pt.dispose(),tt.unobserve(le.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,B.useEffect)(()=>{ye&&ye.setModel({original:we.editor.createModel(F,W),modified:we.editor.createModel(U,W)})},[F,U,W,ye]);const je=li(C),Ue=li(Q),Ke={width:je,height:Ue};return B.createElement("div",{className:"my-diff-editor",ref:le,style:Ke})}},37808:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return de}});var B=K(59301);function de(Se,he){const j=(0,B.useRef)();(0,B.useEffect)(()=>{j.current=Se}),(0,B.useEffect)(()=>{function p(){j.current()}if(he!==null){let me=setInterval(p,he);return()=>clearInterval(me)}},[he])}},62904:function(Xt,st,K){"use strict";K.r(st),K.d(st,{default:function(){return U},formatQuery:function(){return Q}});var B=K(59301),de=K(25690),Se=K(29787),he={bg:"bg___eq_Aq",container:"container___j770l",widthle:"widthle___ouh1T"},j=K(24334),p=K(3736),me=K(62957),ce=K(58018),l=K(71411),X=K(584),P={contentWrap:"contentWrap___xMJQi",title:"title___z4t4P",footer:"footer___CLzrT",footer_left:"footer_left___N2sZZ",footer_bfcs:"footer_bfcs___UmvUE",footer_bfcs_value:"footer_bfcs_value___yiYga",pingfen:"pingfen___aEEMe",fenshu:"fenshu___I6HCo",radioGroup:"radioGroup___RT1dL",wrap:"wrap___QZGSJ",introName:"introName___m17tA",rating:"rating___MXLBr",modalRating:"modalRating___aluwj",zdbf:"zdbf___9PNEF"},g=K(37808),_=K(69618),E=K(51257),A=K(59301),M=Object.defineProperty,H=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,I=(W,re,le)=>re in W?M(W,re,{enumerable:!0,configurable:!0,writable:!0,value:le}):W[re]=le,w=(W,re)=>{for(var le in re||(re={}))V.call(re,le)&&I(W,le,re[le]);if(H)for(var le of H(re))L.call(re,le)&&I(W,le,re[le]);return W},R=(W,re)=>{var le={};for(var ye in W)V.call(W,ye)&&re.indexOf(ye)<0&&(le[ye]=W[ye]);if(W!=null&&H)for(var ye of H(W))re.indexOf(ye)<0&&L.call(W,ye)&&(le[ye]=W[ye]);return le},q=(W,re,le)=>new Promise((ye,De)=>{var Ae=Ke=>{try{Ue(le.next(Ke))}catch(dt){De(dt)}},je=Ke=>{try{Ue(le.throw(Ke))}catch(dt){De(dt)}},Ue=Ke=>Ke.done?ye(Ke.value):Promise.resolve(Ke.value).then(Ae,je);Ue((le=le.apply(W,re)).next())});const se=W=>{var re=W,{videoDetail:le,globalSetting:ye,loading:De,dispatch:Ae}=re,je=R(re,["videoDetail","globalSetting","loading","dispatch"]);const{queryParams:Ue,selectParams:Ke,videoList:dt}=le,{subject_id:Re,videoId:tt}=Ue,{checkBoxValue:Pt,radioValue:yt}=Ke,Bt={videoId:tt},jt={query:Ue},oi=(0,B.useRef)(),ei=(0,B.useRef)(),Ht=(0,B.useRef)(),Qt=(0,B.useRef)(5),{video_item:Et}=le.detail||{};(0,g.Z)(()=>q(void 0,null,function*(){ei.current&&(console.log("videoRef lastUpdatedTime: ",oi.current.getLastUpdatedTime()),console.log(oi.current),yield ht())}),Qt.current*1e3);const ht=(St=!1)=>{const qt=St?{is_f:1}:{};return(0,_.DH)(w(w({},qt),{id:Bt.videoId,point:oi.current.getLastUpdatedTime(),total:oi.current.getDuration()}))},pt=St=>(St.ed==="1"&&(ei.current=!1,ht(!0)),!ei.current&&!St.ed&&(ei.current=!0,Qt.current=oi.current.getDuration()<=5?1:5,ht()),Ae({type:"userDetail/logWatchHistory",payload:St})),ti=()=>{ei.current=!1},Ot=()=>{ei.current=!0},Xe=()=>{Ht.current=5,me.default.confirm({width:600,centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u8BF7\u7ED9\u672C\u89C6\u9891\u8BC4\u5206",content:A.createElement("div",{className:"tc font14"},A.createElement(ce.Z,{defaultValue:Ht.current,onChange:St=>Ht.current=St,className:P.modalRating})),onOk:()=>q(void 0,null,function*(){if((yield(0,_.jK)({id:Bt.videoId,star:Ht.current})).status===0){const{course_id:qt}=(0,E.oP)();Ae({type:"videoDetail/getVideoDetail",payload:{id:Bt.videoId,videoId:Bt.videoId,course_id:qt,subject_id:Re}})}})})},vt=St=>{const qt=window.filterVideoSign,Ct=qt.findIndex(Z=>Z.id===tt);if(Ct===qt.length-1)return;const h=qt[Ct+1].id,m=qt[Ct+1].can_view,y=qt[Ct+1].link,k=qt[Ct+1].is_public;if(window.checkBoxValue){if(y){window.open(y);return}if(!m){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:A.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")});return}if(!k){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:A.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}Ae({type:"videoDetail/handleListItemClick",payload:{videoId:h}}),window.videoTimer=setTimeout(()=>{St.current.play()},2e3)}},Kt=(St,qt)=>{if(St==="checkBox"){const Ct=qt;window.checkBoxValue=Ct,Ae({type:"videoDetail/setSelectValue",payload:{radioValue:yt,checkBoxValue:Ct}});return}Ae({type:"videoDetail/setSelectValue",payload:{checkBoxValue:Pt,radioValue:qt.target.value}})},ai=()=>dt.findIndex(Ct=>Ct.id===tt)===dt.length-1?A.createElement("div",null,"\u5F53\u524D\u5DF2\u662F\u6700\u540E\u4E00\u4E2A\u89C6\u9891"):A.createElement("div",null,A.createElement(l.Z,{onChange:Ct=>{Kt("checkBox",Ct)},defaultChecked:Pt,size:"small"}),A.createElement("span",{className:P.zdbf},"\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u4E2A\u89C6\u9891"));return A.createElement("aside",{className:P.contentWrap},A.createElement("aside",{className:P.wrap},A.createElement("header",null),A.createElement("div",{className:P.title},Et==null?void 0:Et.name),!(Et!=null&&Et.can_edit)&&!(Et!=null&&Et.is_public)?A.createElement(X.Z,{description:"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85"}):A.createElement(p.Z,{ref:oi,startTime:Et==null?void 0:Et.last_point,src:Et!=null&&Et.is_link?Et==null?void 0:Et.link:(Et==null?void 0:Et.play_url)&&j.Base64.decode(Et==null?void 0:Et.play_url),videoId:Et==null?void 0:Et.video_id,logWatchHistory:pt,handlePause:ti,handlePlay:Ot,allow_skip:Et==null?void 0:Et.allow_skip,handlePlayEnded:vt,toLog:()=>{}}),A.createElement("div",{className:P.footer},A.createElement("div",{className:P.footer_left},A.createElement("div",{className:P.pingfen},"\u8BC4\u5206"),A.createElement(ce.Z,{value:Et==null?void 0:Et.star,disabled:!0,className:P.rating,style:{color:"#FFA100",fontSize:12,marginLeft:10}}),A.createElement("div",{className:P.fenshu},(Et==null?void 0:Et.star)||0,"\u5206")),!(Et!=null&&Et.can_edit)&&!(Et!=null&&Et.is_public)?null:A.createElement("div",null,A.createElement("div",{className:P.checkBox},ai()))),A.createElement("div",{className:"mt10"},(Et==null?void 0:Et.description)&&A.createElement("span",{className:P.introName},"\u7B80\u4ECB\uFF1A",Et.description))))};var te=(0,de.connect)(({videoDetail:W,loading:re,globalSetting:le})=>({videoDetail:W,globalSetting:le,loading:re}))(se),ge=K(6767),Le=K(18287),xe={flex_box_center:"flex_box_center___yWqSL",flex_space_between:"flex_space_between___LgFmv",flex_box_vertical_center:"flex_box_vertical_center____lt6U",flex_box_center_end:"flex_box_center_end___UqkaD",flex_box_column:"flex_box_column___V8XLF",list:"list___8tjfT",tree_style:"tree_style___ZzDvO",title:"title___IVfkQ",gray:"gray___RnyYk",brght:"brght___EWRNa",s1:"s1___dPBQg",s3:"s3___SRBBG",active:"active___hsNCX",tree_line:"tree_line___EGn30",tabs_style:"tabs_style___Nwkiq",tabs_item:"tabs_item___Vzu_U",tabs_item_active:"tabs_item_active___BcIwZ"},$e=K(81722),J=K(75736),D=K(346),N=K(59301),O=Object.defineProperty,oe=Object.defineProperties,ie=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,ae=(W,re,le)=>re in W?O(W,re,{enumerable:!0,configurable:!0,writable:!0,value:le}):W[re]=le,Te=(W,re)=>{for(var le in re||(re={}))v.call(re,le)&&ae(W,le,re[le]);if(S)for(var le of S(re))z.call(re,le)&&ae(W,le,re[le]);return W},Fe=(W,re)=>oe(W,ie(re)),Ye=(W,re)=>{var le={};for(var ye in W)v.call(W,ye)&&re.indexOf(ye)<0&&(le[ye]=W[ye]);if(W!=null&&S)for(var ye of S(W))re.indexOf(ye)<0&&z.call(W,ye)&&(le[ye]=W[ye]);return le},_t=(W,re,le)=>new Promise((ye,De)=>{var Ae=Ke=>{try{Ue(le.next(Ke))}catch(dt){De(dt)}},je=Ke=>{try{Ue(le.throw(Ke))}catch(dt){De(dt)}},Ue=Ke=>Ke.done?ye(Ke.value):Promise.resolve(Ke.value).then(Ae,je);Ue((le=le.apply(W,re)).next())});const Ut=[{name:"\u5B9E\u8DF5\u9879\u76EE",type:"Shixun",icon:N.createElement("i",{className:"iconfont icon-shixun2 font20"}),bq:N.createElement("span",{style:{border:"1px solid #FF9D18",color:"#FF9D18"},className:xe.s1},"\u5B9E\u8BAD")},{name:"\u89C6\u9891\u9879\u76EE",type:"VideoItem",icon:N.createElement("i",{className:"iconfont icon-shipin font20"}),bq:N.createElement("span",{style:{border:"1px solid #9B18FF",color:"#9B18FF"},className:xe.s1},"\u89C6\u9891")},{name:"\u6559\u5B66\u8BFE\u4EF6",type:"Attachment",icon:N.createElement("i",{className:"iconfont icon-jiaoxueanli font20"}),bq:N.createElement("span",{style:{border:"1px solid #3061D0",color:"#3061D0"},className:xe.s1},"\u8D44\u6599")},{name:"\u7A7A\u76EE\u5F55",type:"StageCatalog",icon:N.createElement("i",{className:"iconfont icon-kongbai font20"}),bq:N.createElement("span",null)}],si=W=>{var re=W,{dispatch:le,pathsDetail:ye,videoDetail:De,user:Ae}=re,je=Ye(re,["dispatch","pathsDetail","videoDetail","user"]);const{queryParams:Ue,stages:Ke,cust_seq:dt,active:Re}=De,{subject_id:tt,course_id:Pt}=Ue,yt=(0,de.useParams)(),[Bt]=(0,de.useSearchParams)(),[jt,oi]=(0,B.useState)([]),[ei,Ht]=(0,B.useState)([(Re==null?void 0:Re.id)||Number(yt.videoId)]),[Qt,Et]=(0,B.useState)("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"),ht=[".PDF",".DOC",".DOCX",".XLS",".XLSX",".PPT",".PPTX"];(0,B.useEffect)(()=>{le(tt?{type:"videoDetail/getStageData",payload:{subject_id:tt,page_type:"video"}}:{type:"videoDetail/getCourseStageData",payload:{coursesId:Pt}})},[]),(0,B.useEffect)(()=>{pt()},[De==null?void 0:De.stages]);const pt=()=>{let Ct=jt;Ke.forEach((He,h)=>{Ct.push({title:N.createElement("div",{title:He.stage_name,className:xe.title},He.stage_name),value:He==null?void 0:He.stage_id,key:He==null?void 0:He.stage_id,icon:N.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:ti(He.items||[])})}),oi(Ct)},ti=Ct=>{function He(h){var m;const y=h.children,k=Array.isArray(y)&&y.length>0,Z=h==null?void 0:h.id,{name:pe,item_type:be,id:ot}=h,at=(m=Ut.find(Zt=>Zt.type===be))==null?void 0:m.bq,mt=xe.brght,Nt=Re.id===ot?`${mt} ${xe.active}`:mt;return{title:N.createElement("div",{onClick:()=>Kt(h),className:mt,title:pe},at,N.createElement("div",{className:xe.s3},pe)),value:Z,key:Z,icon:N.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:k?y==null?void 0:y.map(Zt=>He(Zt)):[]}}return Ct==null?void 0:Ct.map(h=>He(h))},Ot=(Ct,He)=>_t(void 0,null,function*(){le({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF0C\u8BF7\u7A0D\u540E..."}});const h=He?yield(0,J.BK)({id:Ct}):yield(0,J.Ir)({id:Ct});if(le({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}}),h!=null&&h.game_identifier||h!=null&&h.identifier){(0,E.xg)(He?`/tasks/${h==null?void 0:h.identifier}/jupyter`:`/tasks/${h.game_identifier}`);return}(h==null?void 0:h.status)===2?vt(h==null?void 0:h.message):(h==null?void 0:h.status)===3&&Xe(h==null?void 0:h.message)}),Xe=Ct=>{me.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:N.createElement("div",{className:"tc font16"},"\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E",Ct,"\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")})},vt=Ct=>{Ct=Ct!=null&&Ct.includes(".json")?Ct:`${Ct}.json`,me.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:N.createElement("div",{className:"tc font16"},"\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"),onOk:()=>_t(void 0,null,function*(){const He=yield(0,$e.L8)({url:Ct});if(!He)return;ge.ZP.success("\u91CD\u7F6E\u6210\u529F\uFF0C\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF01");const h=yield(0,J.Ir)({id:He.shixun_identifier});if(h!=null&&h.game_identifier){(0,E.xg)(`/tasks/${h.game_identifier}`);return}(h==null?void 0:h.status)===2?vt(h==null?void 0:h.message):(h==null?void 0:h.status)===3&&Xe(h==null?void 0:h.message)})})},Kt=Ct=>{var He,h,m,y,k;if((Ct==null?void 0:Ct.item_type)==="StageCatalog")return;clearTimeout(window.videoTimer);const{id:Z,item_type:pe,identifier:be,is_jupyter:ot,url:at,link:mt}=Ct;if(pe==="VideoItem"&&!mt){if(!((He=Ae.userInfo)!=null&&He.admin)&&!((h=Ae.userInfo)!=null&&h.business)&&!Ct.can_view){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:N.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")});return}le({type:"videoDetail/handleListItemClick",payload:{videoId:Z}}),le({type:"videoDetail/getVideoDetail",payload:Fe(Te({id:Z},Ue),{videoId:Z}),callback:Nt=>{if(Nt&&Nt.video_item&&!Nt.video_item.can_edit&&!Ct.is_public){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:N.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}}});return}if(pe==="VideoItem"&&mt){Ct.link&&(0,_.DH)({is_f:1,id:Ct.id,point:0,total:0}),window.open(mt);return}if(pe==="Shixun"){Ot(be,ot);return}if(pe==="Attachment"){if(mt){(0,E.xg)(mt);return}let Nt=(y=Ct==null?void 0:Ct.name)==null?void 0:y.substr((m=Ct==null?void 0:Ct.name)==null?void 0:m.lastIndexOf("."));if(ht.includes(Nt.toUpperCase())){le({type:"videoDetail/handleListItemClick",payload:{attachmentId:Z}});return}else{if(!((k=ye.detail)!=null&&k.allow_download)){ge.ZP.info("\u6559\u5B66\u8BFE\u4EF6\u4E0D\u652F\u6301\u4E0B\u8F7D");return}(0,E.FH)(Ct.name,D.Z.API_SERVER+Ct.url);return}}window.open(D.Z.IMG_SERVER+at)},ai=Ct=>{let He=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],h=["","\u5341","\u767E","\u5343","\u4E07"];Ct=parseInt(Ct);let m=Z=>{let pe=Z.toString().split("").reverse(),be="";for(var ot=0;ot<pe.length;ot++)be=(ot==0&&pe[ot]==0||ot>0&&pe[ot]==0&&pe[ot-1]==0?"":He[pe[ot]]+(pe[ot]==0?h[0]:h[ot]))+be;return be},y=Math.floor(Ct/1e4),k=Ct%1e4;return k.toString().length<4&&(k="0"+k),y?m(y)+"\u4E07"+m(k):m(Ct)},St=(Ct,He,h,m)=>{var y;const{name:k,item_type:Z,id:pe}=Ct,be=`${He+1}-${h+1}-${m+1}`,ot=(y=Ut.find(Nt=>Nt.type===Z))==null?void 0:y.icon,at=xe.brght,mt=Re.id===pe?`${at} ${xe.active}`:at;return N.createElement("div",{key:be,onClick:()=>Kt(Ct),className:mt,style:{paddingLeft:52}},N.createElement("span",{className:xe.s1},ot),!!dt&&N.createElement("span",{className:xe.s2},be),N.createElement("span",{className:xe.s3},"\u203B ",k))},qt=(Ct,He,h)=>{var m;const{name:y,item_type:k,id:Z,children:pe}=Ct,be=`${He+1}-${h+1}`,ot=(m=Ut.find(Nt=>Nt.type===k))==null?void 0:m.icon,at=xe.brght,mt=Re.id===Z?`${at} ${xe.active}`:at;return N.createElement(B.Fragment,{key:be},N.createElement("div",{onClick:()=>Kt(Ct),className:mt},N.createElement("span",{className:xe.s1},ot),!!dt&&N.createElement("span",{className:xe.s2},be),N.createElement("span",{className:xe.s3},"\u203B ",y)),!!pe.length&&pe.map((Nt,Zt)=>St(Nt,He,h,Zt)))};return N.createElement("aside",{className:xe.list},N.createElement("div",{className:xe.tabs_style},N.createElement("div",{className:xe.tabs_item,onClick:()=>{Et("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55")}},"\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55",Qt=="\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"&&N.createElement("div",{className:xe.tabs_item_active}))),N.createElement("div",{className:xe.tree_style},(jt==null?void 0:jt.length)>0&&N.createElement(Le.default,{selectedKeys:ei,onSelect:(Ct,He)=>{Ht([...Ct])},blockNode:!0,treeData:jt,defaultExpandAll:!0,className:xe.tree_line})))};var Ge=(0,de.connect)(({user:W,videoDetail:re,loading:le,globalSetting:ye,pathsDetail:De})=>({user:W,videoDetail:re,globalSetting:ye,loading:le,pathsDetail:De}))(si),ft=K(45677),$t=K(59301),ut=Object.defineProperty,li=Object.defineProperties,We=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,we=(W,re,le)=>re in W?ut(W,re,{enumerable:!0,configurable:!0,writable:!0,value:le}):W[re]=le,ke=(W,re)=>{for(var le in re||(re={}))Ie.call(re,le)&&we(W,le,re[le]);if(Ee)for(var le of Ee(re))ne.call(re,le)&&we(W,le,re[le]);return W},ee=(W,re)=>li(W,We(re)),Y=(W,re)=>{var le={};for(var ye in W)Ie.call(W,ye)&&re.indexOf(ye)<0&&(le[ye]=W[ye]);if(W!=null&&Ee)for(var ye of Ee(W))re.indexOf(ye)<0&&ne.call(W,ye)&&(le[ye]=W[ye]);return le},C=(W,re,le)=>new Promise((ye,De)=>{var Ae=Ke=>{try{Ue(le.next(Ke))}catch(dt){De(dt)}},je=Ke=>{try{Ue(le.throw(Ke))}catch(dt){De(dt)}},Ue=Ke=>Ke.done?ye(Ke.value):Promise.resolve(Ke.value).then(Ae,je);Ue((le=le.apply(W,re)).next())});const Q=W=>{const{subject_id:re}=W;return{subject_id:re,course_id:re}},F=W=>{var re=W,{videoDetail:le,globalSetting:ye,loading:De,pathsDetail:Ae,dispatch:je}=re,Ue=Y(re,["videoDetail","globalSetting","loading","pathsDetail","dispatch"]),Ke,dt;const{queryParams:Re,videoList:tt,attachmentList:Pt,active:yt}=le,{subject_id:Bt,videoId:jt}=Re,oi={videoId:jt};(0,B.useEffect)(()=>{if(yt){const{item_type:Qt,id:Et}=yt;Qt==="VideoItem"&&je({type:"videoDetail/getVideoDetail",payload:ee(ke({},Re),{id:Et})})}},[yt.id]),console.log("---",yt),(0,B.useEffect)(()=>{Bt&&ei()},[]);function ei(){return C(this,null,function*(){const Qt=yield je({type:"pathsDetail/getPathsDetail",payload:{id:Bt}})})}(0,B.useEffect)(()=>{var Qt,Et;(0,E.Dk)((Et=(Qt=le.detail)==null?void 0:Qt.video_item)==null?void 0:Et.name)},[le]);let Ht={width:1200};return yt&&yt.item_type==="Attachment"&&yt.content_type==="application/pdf"&&(Ht={width:1250,marginLeft:(document.body.clientWidth-1200)/2}),$t.createElement(Se.Z,{spinning:!1},$t.createElement("section",{className:he.bg},$t.createElement("div",{className:he.container,style:Ht},$t.createElement(Ge,null),yt&&yt.item_type==="VideoItem"&&$t.createElement(te,null),yt&&yt.item_type==="Attachment"&&yt.content_type==="application/pdf"&&yt.url&&$t.createElement("div",{className:he.widthle},$t.createElement(ft.Z,{disabledDownload:!((Ke=Ae.detail)!=null&&Ke.allow_download),type:"pdf",filename:yt.name,data:D.Z.API_SERVER+yt.url,style:{position:"absolute",zIndex:1}})),yt&&yt.item_type==="Attachment"&&["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(yt.content_type)&&yt.url&&$t.createElement("div",{className:he.widthle},$t.createElement(ft.Z,{disabledDownload:!((dt=Ae.detail)!=null&&dt.allow_download),type:"office",data:D.Z.API_SERVER+yt.url,style:{position:"absolute",zIndex:1}})))))};var U=(0,de.connect)(({videoDetail:W,loading:re,globalSetting:le,pathsDetail:ye})=>({videoDetail:W,globalSetting:le,loading:re,pathsDetail:ye}))(F)},84989:function(Xt,st,K){"use strict";K.d(st,{BU:function(){return de},Dj:function(){return B},gH:function(){return Se},vp:function(){return he}});function B(j){try{j.mozRequestFullScreen?j.mozRequestFullScreen():j.webkitRequestFullScreen&&j.webkitRequestFullScreen()}catch(p){console.log(p,":e")}}function de(){window.top.document.webkitExitFullscreen?window.top.document.webkitExitFullscreen():document.exitFullscreen?window.top.document.exitFullscreen():document.msExitFullscreen?window.top.document.msExitFullscreen():document.mozCancelFullScreen&&window.top.document.mozCancelFullScreen()}const Se=()=>{if(document.webkitExitFullscreen)return"webkitfullscreenchange";if(document.exitFullscreen)return"fullscreenchange";if(document.msExitFullscreen)return"msfullscreenchange";if(document.mozCancelFullScreen)return"mozfullscreenchange"};function he(){var j=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement,p=document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",j),window.isFullScreen?window.isFullScreen:j!=null}},30647:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return Ct}});class B{static install(){Object.setPrototypeOf=Object.setPrototypeOf||function(h,m){return h.__proto__=m,h},Object.assign=Object.assign||function(h){if(h==null)throw new TypeError("Cannot convert undefined or null to object");let m=Object(h);for(let y=1;y<arguments.length;y++){let k=arguments[y];if(k!=null)for(let Z in k)k.hasOwnProperty(Z)&&(m[Z]=k[Z])}return m},typeof self.Promise!="function"&&K(3867).polyfill()}}B.install();var de=B,Se=K(86204),he=K.n(Se);class j{static e(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","error",y),j.ENABLE_ERROR&&(console.error?console.error(y):console.warn?console.warn(y):console.log(y))}static i(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","info",y),j.ENABLE_INFO&&(console.info?console.info(y):console.log(y))}static w(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","warn",y),j.ENABLE_WARN&&(console.warn?console.warn(y):console.log(y))}static d(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","debug",y),j.ENABLE_DEBUG&&(console.debug?console.debug(y):console.log(y))}static v(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","verbose",y),j.ENABLE_VERBOSE&&console.log(y)}}j.GLOBAL_TAG="flv.js",j.FORCE_GLOBAL_TAG=!1,j.ENABLE_ERROR=!0,j.ENABLE_INFO=!0,j.ENABLE_WARN=!0,j.ENABLE_DEBUG=!0,j.ENABLE_VERBOSE=!0,j.ENABLE_CALLBACK=!1,j.emitter=new(he());var p=j;class me{constructor(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(h){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=h,this._totalBytes+=h):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=h,this._totalBytes+=h):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=h,this._totalBytes+=h,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let h=(this._now()-this._lastCheckpoint)/1e3;return h==0&&(h=1),this._intervalBytes/h/1024}get lastSecondKBps(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}get averageKBps(){let h=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/h/1024}}var ce=me;class l{constructor(h){this._message=h}get name(){return"RuntimeException"}get message(){return this._message}toString(){return this.name+": "+this.message}}class X extends l{constructor(h){super(h)}get name(){return"IllegalStateException"}}class P extends l{constructor(h){super(h)}get name(){return"InvalidArgumentException"}}class g extends l{constructor(h){super(h)}get name(){return"NotImplementedException"}}const _={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},E={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};class A{constructor(h){this._type=h||"undefined",this._status=_.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}destroy(){this._status=_.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}isWorking(){return this._status===_.kConnecting||this._status===_.kBuffering}get type(){return this._type}get status(){return this._status}get needStashBuffer(){return this._needStash}get onContentLengthKnown(){return this._onContentLengthKnown}set onContentLengthKnown(h){this._onContentLengthKnown=h}get onURLRedirect(){return this._onURLRedirect}set onURLRedirect(h){this._onURLRedirect=h}get onDataArrival(){return this._onDataArrival}set onDataArrival(h){this._onDataArrival=h}get onError(){return this._onError}set onError(h){this._onError=h}get onComplete(){return this._onComplete}set onComplete(h){this._onComplete=h}open(h,m){throw new g("Unimplemented abstract function!")}abort(){throw new g("Unimplemented abstract function!")}}let M={};function H(){let He=self.navigator.userAgent.toLowerCase(),h=/(edge)\/([\w.]+)/.exec(He)||/(opr)[\/]([\w.]+)/.exec(He)||/(chrome)[ \/]([\w.]+)/.exec(He)||/(iemobile)[\/]([\w.]+)/.exec(He)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(He)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(He)||/(webkit)[ \/]([\w.]+)/.exec(He)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(He)||/(msie) ([\w.]+)/.exec(He)||He.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(He)||He.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(He)||[],m=/(ipad)/.exec(He)||/(ipod)/.exec(He)||/(windows phone)/.exec(He)||/(iphone)/.exec(He)||/(kindle)/.exec(He)||/(android)/.exec(He)||/(windows)/.exec(He)||/(mac)/.exec(He)||/(linux)/.exec(He)||/(cros)/.exec(He)||[],y={browser:h[5]||h[3]||h[1]||"",version:h[2]||h[4]||"0",majorVersion:h[4]||h[2]||"0",platform:m[0]||""},k={};if(y.browser){k[y.browser]=!0;let Z=y.majorVersion.split(".");k.version={major:parseInt(y.majorVersion,10),string:y.version},Z.length>1&&(k.version.minor=parseInt(Z[1],10)),Z.length>2&&(k.version.build=parseInt(Z[2],10))}if(y.platform&&(k[y.platform]=!0),(k.chrome||k.opr||k.safari)&&(k.webkit=!0),k.rv||k.iemobile){k.rv&&delete k.rv;let Z="msie";y.browser=Z,k[Z]=!0}if(k.edge){delete k.edge;let Z="msedge";y.browser=Z,k[Z]=!0}if(k.opr){let Z="opera";y.browser=Z,k[Z]=!0}if(k.safari&&k.android){let Z="android";y.browser=Z,k[Z]=!0}k.name=y.browser,k.platform=y.platform;for(let Z in M)M.hasOwnProperty(Z)&&delete M[Z];Object.assign(M,k)}H();var V=M;class L extends A{static isSupported(){try{let h=V.msedge&&V.version.minor>=15048,m=V.msedge?h:!0;return self.fetch&&self.ReadableStream&&m}catch(h){return!1}}constructor(h,m){super("fetch-stream-loader"),this.TAG="FetchStreamLoader",this._seekHandler=h,this._config=m,this._needStash=!0,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),super.destroy()}open(h,m){this._dataSource=h,this._range=m;let y=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(y=h.redirectedURL);let k=this._seekHandler.getConfig(y,m),Z=new self.Headers;if(typeof k.headers=="object"){let be=k.headers;for(let ot in be)be.hasOwnProperty(ot)&&Z.append(ot,be[ot])}let pe={method:"GET",headers:Z,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(let be in this._config.headers)Z.append(be,this._config.headers[be]);h.cors===!1&&(pe.mode="same-origin"),h.withCredentials&&(pe.credentials="include"),h.referrerPolicy&&(pe.referrerPolicy=h.referrerPolicy),this._status=_.kConnecting,self.fetch(k.url,pe).then(be=>{if(this._requestAbort){this._requestAbort=!1,this._status=_.kIdle;return}if(be.ok&&be.status>=200&&be.status<=299){if(be.url!==k.url&&this._onURLRedirect){let at=this._seekHandler.removeURLParameters(be.url);this._onURLRedirect(at)}let ot=be.headers.get("Content-Length");return ot!=null&&(this._contentLength=parseInt(ot),this._contentLength!==0&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,be.body.getReader())}else if(this._status=_.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:be.status,msg:be.statusText});else throw new l("FetchStreamLoader: Http code invalid, "+be.status+" "+be.statusText)}).catch(be=>{if(this._status=_.kError,this._onError)this._onError(E.EXCEPTION,{code:-1,msg:be.message});else throw be})}abort(){this._requestAbort=!0}_pump(h){return h.read().then(m=>{if(m.done)if(this._contentLength!==null&&this._receivedLength<this._contentLength){this._status=_.kError;let y=E.EARLY_EOF,k={code:-1,msg:"Fetch stream meet Early-EOF"};if(this._onError)this._onError(y,k);else throw new l(k.msg)}else this._status=_.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1);else{if(this._requestAbort===!0)return this._requestAbort=!1,this._status=_.kComplete,h.cancel();this._status=_.kBuffering;let y=m.value.buffer,k=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength,this._onDataArrival&&this._onDataArrival(y,k,this._receivedLength),this._pump(h)}}).catch(m=>{if(m.code===11&&V.msedge)return;this._status=_.kError;let y=0,k=null;if((m.code===19||m.message==="network error")&&(this._contentLength===null||this._contentLength!==null&&this._receivedLength<this._contentLength)?(y=E.EARLY_EOF,k={code:m.code,msg:"Fetch stream meet Early-EOF"}):(y=E.EXCEPTION,k={code:m.code,msg:m.message}),this._onError)this._onError(y,k);else throw new l(k.msg)})}}var I=L;class w extends A{static isSupported(){try{let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="moz-chunked-arraybuffer",h.responseType==="moz-chunked-arraybuffer"}catch(h){return p.w("MozChunkedLoader",h.message),!1}}constructor(h,m){super("xhr-moz-chunked-loader"),this.TAG="MozChunkedLoader",this._seekHandler=h,this._config=m,this._needStash=!0,this._xhr=null,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),super.destroy()}open(h,m){this._dataSource=h,this._range=m;let y=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(y=h.redirectedURL);let k=this._seekHandler.getConfig(y,m);this._requestURL=k.url;let Z=this._xhr=new XMLHttpRequest;if(Z.open("GET",k.url,!0),Z.responseType="moz-chunked-arraybuffer",Z.onreadystatechange=this._onReadyStateChange.bind(this),Z.onprogress=this._onProgress.bind(this),Z.onloadend=this._onLoadEnd.bind(this),Z.onerror=this._onXhrError.bind(this),h.withCredentials&&(Z.withCredentials=!0),typeof k.headers=="object"){let pe=k.headers;for(let be in pe)pe.hasOwnProperty(be)&&Z.setRequestHeader(be,pe[be])}if(typeof this._config.headers=="object"){let pe=this._config.headers;for(let be in pe)pe.hasOwnProperty(be)&&Z.setRequestHeader(be,pe[be])}this._status=_.kConnecting,Z.send()}abort(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=_.kComplete}_onReadyStateChange(h){let m=h.target;if(m.readyState===2){if(m.responseURL!=null&&m.responseURL!==this._requestURL&&this._onURLRedirect){let y=this._seekHandler.removeURLParameters(m.responseURL);this._onURLRedirect(y)}if(m.status!==0&&(m.status<200||m.status>299))if(this._status=_.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new l("MozChunkedLoader: Http code invalid, "+m.status+" "+m.statusText);else this._status=_.kBuffering}}_onProgress(h){if(this._status===_.kError)return;this._contentLength===null&&h.total!==null&&h.total!==0&&(this._contentLength=h.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));let m=h.target.response,y=this._range.from+this._receivedLength;this._receivedLength+=m.byteLength,this._onDataArrival&&this._onDataArrival(m,y,this._receivedLength)}_onLoadEnd(h){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===_.kError)return;this._status=_.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)}_onXhrError(h){this._status=_.kError;let m=0,y=null;if(this._contentLength&&h.loaded<this._contentLength?(m=E.EARLY_EOF,y={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(m=E.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new l(y.msg)}}var R=w;class q extends null{static isSupported(){try{if(typeof self.MSStream=="undefined"||typeof self.MSStreamReader=="undefined")return!1;let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="ms-stream",h.responseType==="ms-stream"}catch(h){return Log.w("MSStreamLoader",h.message),!1}}constructor(h,m){super("xhr-msstream-loader"),this.TAG="MSStreamLoader",this._seekHandler=h,this._config=m,this._needStash=!0,this._xhr=null,this._reader=null,this._totalRange=null,this._currentRange=null,this._currentRequestURL=null,this._currentRedirectedURL=null,this._contentLength=null,this._receivedLength=0,this._bufferLimit=16*1024*1024,this._lastTimeBufferSize=0,this._isReconnecting=!1}destroy(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),super.destroy()}open(h,m){this._internalOpen(h,m,!1)}_internalOpen(h,m,y){this._dataSource=h,y?this._currentRange=m:this._totalRange=m;let k=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?k=this._currentRedirectedURL:h.redirectedURL!=null&&(k=h.redirectedURL));let Z=this._seekHandler.getConfig(k,m);this._currentRequestURL=Z.url;let pe=this._reader=new self.MSStreamReader;pe.onprogress=this._msrOnProgress.bind(this),pe.onload=this._msrOnLoad.bind(this),pe.onerror=this._msrOnError.bind(this);let be=this._xhr=new XMLHttpRequest;if(be.open("GET",Z.url,!0),be.responseType="ms-stream",be.onreadystatechange=this._xhrOnReadyStateChange.bind(this),be.onerror=this._xhrOnError.bind(this),h.withCredentials&&(be.withCredentials=!0),typeof Z.headers=="object"){let ot=Z.headers;for(let at in ot)ot.hasOwnProperty(at)&&be.setRequestHeader(at,ot[at])}if(typeof this._config.headers=="object"){let ot=this._config.headers;for(let at in ot)ot.hasOwnProperty(at)&&be.setRequestHeader(at,ot[at])}this._isReconnecting?this._isReconnecting=!1:this._status=LoaderStatus.kConnecting,be.send()}abort(){this._internalAbort(),this._status=LoaderStatus.kComplete}_internalAbort(){this._reader&&(this._reader.readyState===1&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)}_xhrOnReadyStateChange(h){let m=h.target;if(m.readyState===2)if(m.status>=200&&m.status<=299){if(this._status=LoaderStatus.kBuffering,m.responseURL!=null){let k=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&k!==this._currentRedirectedURL&&(this._currentRedirectedURL=k,this._onURLRedirect&&this._onURLRedirect(k))}let y=m.getResponseHeader("Content-Length");if(y!=null&&this._contentLength==null){let k=parseInt(y);k>0&&(this._contentLength=k,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else if(this._status=LoaderStatus.kError,this._onError)this._onError(LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new RuntimeException("MSStreamLoader: Http code invalid, "+m.status+" "+m.statusText);else if(m.readyState===3&&m.status>=200&&m.status<=299){this._status=LoaderStatus.kBuffering;let y=m.response;this._reader.readAsArrayBuffer(y)}}_xhrOnError(h){this._status=LoaderStatus.kError;let m=LoaderErrors.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type};if(this._onError)this._onError(m,y);else throw new RuntimeException(y.msg)}_msrOnProgress(h){let y=h.target.result;if(y==null){this._doReconnectIfNeeded();return}let k=y.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=y.byteLength;let Z=this._totalRange.from+this._receivedLength;this._receivedLength+=k.byteLength,this._onDataArrival&&this._onDataArrival(k,Z,this._receivedLength),y.byteLength>=this._bufferLimit&&(Log.v(this.TAG,`MSStream buffer exceeded max size near ${Z+k.byteLength}, reconnecting...`),this._doReconnectIfNeeded())}_doReconnectIfNeeded(){if(this._contentLength==null||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();let h={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,h,!0)}}_msrOnLoad(h){this._status=LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}_msrOnError(h){this._status=LoaderStatus.kError;let m=0,y=null;if(this._contentLength&&this._receivedLength<this._contentLength?(m=LoaderErrors.EARLY_EOF,y={code:-1,msg:"MSStream meet Early-Eof"}):(m=LoaderErrors.EARLY_EOF,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new RuntimeException(y.msg)}}var se=null;class te extends A{static isSupported(){try{let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="arraybuffer",h.responseType==="arraybuffer"}catch(h){return p.w("RangeLoader",h.message),!1}}constructor(h,m){super("xhr-range-loader"),this.TAG="RangeLoader",this._seekHandler=h,this._config=m,this._needStash=!1,this._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],this._currentChunkSizeKB=384,this._currentSpeedNormalized=0,this._zeroSpeedChunkCount=0,this._xhr=null,this._speedSampler=new ce,this._requestAbort=!1,this._waitForTotalLength=!1,this._totalLengthReceived=!1,this._currentRequestURL=null,this._currentRedirectedURL=null,this._currentRequestRange=null,this._totalLength=null,this._contentLength=null,this._receivedLength=0,this._lastTimeLoaded=0}destroy(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),super.destroy()}get currentSpeed(){return this._speedSampler.lastSecondKBps}open(h,m){this._dataSource=h,this._range=m,this._status=_.kConnecting;let y=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(y=!0,this._totalLength=this._dataSource.filesize),!this._totalLengthReceived&&!y?(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1})):this._openSubRange()}_openSubRange(){let h=this._currentChunkSizeKB*1024,m=this._range.from+this._receivedLength,y=m+h;this._contentLength!=null&&y-this._range.from>=this._contentLength&&(y=this._range.from+this._contentLength-1),this._currentRequestRange={from:m,to:y},this._internalOpen(this._dataSource,this._currentRequestRange)}_internalOpen(h,m){this._lastTimeLoaded=0;let y=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?y=this._currentRedirectedURL:h.redirectedURL!=null&&(y=h.redirectedURL));let k=this._seekHandler.getConfig(y,m);this._currentRequestURL=k.url;let Z=this._xhr=new XMLHttpRequest;if(Z.open("GET",k.url,!0),Z.responseType="arraybuffer",Z.onreadystatechange=this._onReadyStateChange.bind(this),Z.onprogress=this._onProgress.bind(this),Z.onload=this._onLoad.bind(this),Z.onerror=this._onXhrError.bind(this),h.withCredentials&&(Z.withCredentials=!0),typeof k.headers=="object"){let pe=k.headers;for(let be in pe)pe.hasOwnProperty(be)&&Z.setRequestHeader(be,pe[be])}if(typeof this._config.headers=="object"){let pe=this._config.headers;for(let be in pe)pe.hasOwnProperty(be)&&Z.setRequestHeader(be,pe[be])}Z.send()}abort(){this._requestAbort=!0,this._internalAbort(),this._status=_.kComplete}_internalAbort(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}_onReadyStateChange(h){let m=h.target;if(m.readyState===2){if(m.responseURL!=null){let y=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&y!==this._currentRedirectedURL&&(this._currentRedirectedURL=y,this._onURLRedirect&&this._onURLRedirect(y))}if(m.status>=200&&m.status<=299){if(this._waitForTotalLength)return;this._status=_.kBuffering}else if(this._status=_.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new l("RangeLoader: Http code invalid, "+m.status+" "+m.statusText)}}_onProgress(h){if(this._status===_.kError)return;if(this._contentLength===null){let y=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,y=!0;let k=h.total;this._internalAbort(),k!=null&k!==0&&(this._totalLength=k)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,y){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}let m=h.loaded-this._lastTimeLoaded;this._lastTimeLoaded=h.loaded,this._speedSampler.addBytes(m)}_normalizeSpeed(h){let m=this._chunkSizeKBList,y=m.length-1,k=0,Z=0,pe=y;if(h<m[0])return m[0];for(;Z<=pe;){if(k=Z+Math.floor((pe-Z)/2),k===y||h>=m[k]&&h<m[k+1])return m[k];m[k]<h?Z=k+1:pe=k-1}}_onLoad(h){if(this._status===_.kError)return;if(this._waitForTotalLength){this._waitForTotalLength=!1;return}this._lastTimeLoaded=0;let m=this._speedSampler.lastSecondKBps;if(m===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(m=this._speedSampler.currentKBps)),m!==0){let pe=this._normalizeSpeed(m);this._currentSpeedNormalized!==pe&&(this._currentSpeedNormalized=pe,this._currentChunkSizeKB=pe)}let y=h.target.response,k=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength;let Z=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():Z=!0,this._onDataArrival&&this._onDataArrival(y,k,this._receivedLength),Z&&(this._status=_.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}_onXhrError(h){this._status=_.kError;let m=0,y=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(m=E.EARLY_EOF,y={code:-1,msg:"RangeLoader meet Early-Eof"}):(m=E.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new l(y.msg)}}var ge=te;class Le extends A{static isSupported(){try{return typeof self.WebSocket!="undefined"}catch(h){return!1}}constructor(){super("websocket-loader"),this.TAG="WebSocketLoader",this._needStash=!0,this._ws=null,this._requestAbort=!1,this._receivedLength=0}destroy(){this._ws&&this.abort(),super.destroy()}open(h){try{let m=this._ws=new self.WebSocket(h.url);m.binaryType="arraybuffer",m.onopen=this._onWebSocketOpen.bind(this),m.onclose=this._onWebSocketClose.bind(this),m.onmessage=this._onWebSocketMessage.bind(this),m.onerror=this._onWebSocketError.bind(this),this._status=_.kConnecting}catch(m){this._status=_.kError;let y={code:m.code,msg:m.message};if(this._onError)this._onError(E.EXCEPTION,y);else throw new l(y.msg)}}abort(){let h=this._ws;h&&(h.readyState===0||h.readyState===1)&&(this._requestAbort=!0,h.close()),this._ws=null,this._status=_.kComplete}_onWebSocketOpen(h){this._status=_.kBuffering}_onWebSocketClose(h){if(this._requestAbort===!0){this._requestAbort=!1;return}this._status=_.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)}_onWebSocketMessage(h){if(h.data instanceof ArrayBuffer)this._dispatchArrayBuffer(h.data);else if(h.data instanceof Blob){let m=new FileReader;m.onload=()=>{this._dispatchArrayBuffer(m.result)},m.readAsArrayBuffer(h.data)}else{this._status=_.kError;let m={code:-1,msg:"Unsupported WebSocket message type: "+h.data.constructor.name};if(this._onError)this._onError(E.EXCEPTION,m);else throw new l(m.msg)}}_dispatchArrayBuffer(h){let m=h,y=this._receivedLength;this._receivedLength+=m.byteLength,this._onDataArrival&&this._onDataArrival(m,y,this._receivedLength)}_onWebSocketError(h){this._status=_.kError;let m={code:h.code,msg:h.message};if(this._onError)this._onError(E.EXCEPTION,m);else throw new l(m.msg)}}var xe=Le;class $e{constructor(h){this._zeroStart=h||!1}getConfig(h,m){let y={};if(m.from!==0||m.to!==-1){let k;m.to!==-1?k=`bytes=${m.from.toString()}-${m.to.toString()}`:k=`bytes=${m.from.toString()}-`,y.Range=k}else this._zeroStart&&(y.Range="bytes=0-");return{url:h,headers:y}}removeURLParameters(h){return h}}var J=$e;class D{constructor(h,m){this._startName=h,this._endName=m}getConfig(h,m){let y=h;if(m.from!==0||m.to!==-1){let k=!0;y.indexOf("?")===-1&&(y+="?",k=!1),k&&(y+="&"),y+=`${this._startName}=${m.from.toString()}`,m.to!==-1&&(y+=`&${this._endName}=${m.to.toString()}`)}return{url:y,headers:{}}}removeURLParameters(h){let m=h.split("?")[0],y,k=h.indexOf("?");k!==-1&&(y=h.substring(k+1));let Z="";if(y!=null&&y.length>0){let pe=y.split("&");for(let be=0;be<pe.length;be++){let ot=pe[be].split("="),at=be>0;ot[0]!==this._startName&&ot[0]!==this._endName&&(at&&(Z+="&"),Z+=pe[be])}}return Z.length===0?m:m+"?"+Z}}var N=D;class O{constructor(h,m,y){this.TAG="IOController",this._config=m,this._extraData=y,this._stashInitialSize=1024*384,m.stashInitialSize!=null&&m.stashInitialSize>0&&(this._stashInitialSize=m.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=1024*1024*3,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,m.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=h,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(h.url),this._refTotalLength=h.filesize?h.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new ce,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}destroy(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}isWorking(){return this._loader&&this._loader.isWorking()&&!this._paused}isPaused(){return this._paused}get status(){return this._loader.status}get extraData(){return this._extraData}set extraData(h){this._extraData=h}get onDataArrival(){return this._onDataArrival}set onDataArrival(h){this._onDataArrival=h}get onSeeked(){return this._onSeeked}set onSeeked(h){this._onSeeked=h}get onError(){return this._onError}set onError(h){this._onError=h}get onComplete(){return this._onComplete}set onComplete(h){this._onComplete=h}get onRedirect(){return this._onRedirect}set onRedirect(h){this._onRedirect=h}get onRecoveredEarlyEof(){return this._onRecoveredEarlyEof}set onRecoveredEarlyEof(h){this._onRecoveredEarlyEof=h}get currentURL(){return this._dataSource.url}get hasRedirect(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null}get currentRedirectedURL(){return this._redirectedURL||this._dataSource.redirectedURL}get currentSpeed(){return this._loaderClass===ge?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}get loaderType(){return this._loader.type}_selectSeekHandler(){let h=this._config;if(h.seekType==="range")this._seekHandler=new J(this._config.rangeLoadZeroStart);else if(h.seekType==="param"){let m=h.seekParamStart||"bstart",y=h.seekParamEnd||"bend";this._seekHandler=new N(m,y)}else if(h.seekType==="custom"){if(typeof h.customSeekHandler!="function")throw new P("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new h.customSeekHandler}else throw new P(`Invalid seekType in config: ${h.seekType}`)}_selectLoader(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=xe;else if(I.isSupported())this._loaderClass=I;else if(R.isSupported())this._loaderClass=R;else if(ge.isSupported())this._loaderClass=ge;else throw new l("Your browser doesn't support xhr with arraybuffer responseType!")}_createLoader(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}open(h){this._currentRange={from:0,to:-1},h&&(this._currentRange.from=h),this._speedSampler.reset(),h||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}abort(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}pause(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}resume(){if(this._paused){this._paused=!1;let h=this._resumeFrom;this._resumeFrom=0,this._internalSeek(h,!0)}}seek(h){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(h,!0)}_internalSeek(h,m){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(m),this._loader.destroy(),this._loader=null;let y={from:h,to:-1};this._currentRange={from:y.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,y),this._onSeeked&&this._onSeeked()}updateUrl(h){if(!h||typeof h!="string"||h.length===0)throw new P("Url must be a non-empty string!");this._dataSource.url=h}_expandBuffer(h){let m=this._stashSize;for(;m+1024*1024*1<h;)m*=2;if(m+=1024*1024*1,m===this._bufferSize)return;let y=new ArrayBuffer(m);if(this._stashUsed>0){let k=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(y,0,m).set(k,0)}this._stashBuffer=y,this._bufferSize=m}_normalizeSpeed(h){let m=this._speedNormalizeList,y=m.length-1,k=0,Z=0,pe=y;if(h<m[0])return m[0];for(;Z<=pe;){if(k=Z+Math.floor((pe-Z)/2),k===y||h>=m[k]&&h<m[k+1])return m[k];m[k]<h?Z=k+1:pe=k-1}}_adjustStashSize(h){let m=0;this._config.isLive||h<512?m=h:h>=512&&h<=1024?m=Math.floor(h*1.5):m=h*2,m>8192&&(m=8192);let y=m*1024+1024*1024*1;this._bufferSize<y&&this._expandBuffer(y),this._stashSize=m*1024}_dispatchChunks(h,m){return this._currentRange.to=m+h.byteLength-1,this._onDataArrival(h,m)}_onURLRedirect(h){this._redirectedURL=h,this._onRedirect&&this._onRedirect(h)}_onContentLengthKnown(h){h&&this._fullRequestFlag&&(this._totalLength=h,this._fullRequestFlag=!1)}_onLoaderChunkArrival(h,m,y){if(!this._onDataArrival)throw new X("IOController: No existing consumer (onDataArrival) callback!");if(this._paused)return;this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(h.byteLength);let k=this._speedSampler.lastSecondKBps;if(k!==0){let Z=this._normalizeSpeed(k);this._speedNormalized!==Z&&(this._speedNormalized=Z,this._adjustStashSize(Z))}if(this._enableStash)if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=m),this._stashUsed+h.byteLength<=this._stashSize)new Uint8Array(this._stashBuffer,0,this._stashSize).set(new Uint8Array(h),this._stashUsed),this._stashUsed+=h.byteLength;else{let Z=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){let pe=this._stashBuffer.slice(0,this._stashUsed),be=this._dispatchChunks(pe,this._stashByteStart);if(be<pe.byteLength){if(be>0){let ot=new Uint8Array(pe,be);Z.set(ot,0),this._stashUsed=ot.byteLength,this._stashByteStart+=be}}else this._stashUsed=0,this._stashByteStart+=be;this._stashUsed+h.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+h.byteLength),Z=new Uint8Array(this._stashBuffer,0,this._bufferSize)),Z.set(new Uint8Array(h),this._stashUsed),this._stashUsed+=h.byteLength}else{let pe=this._dispatchChunks(h,m);if(pe<h.byteLength){let be=h.byteLength-pe;be>this._bufferSize&&(this._expandBuffer(be),Z=new Uint8Array(this._stashBuffer,0,this._bufferSize)),Z.set(new Uint8Array(h,pe),0),this._stashUsed+=be,this._stashByteStart=m+pe}}}else if(this._stashUsed===0){let Z=this._dispatchChunks(h,m);if(Z<h.byteLength){let pe=h.byteLength-Z;pe>this._bufferSize&&this._expandBuffer(pe),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(h,Z),0),this._stashUsed+=pe,this._stashByteStart=m+Z}}else{this._stashUsed+h.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+h.byteLength);let Z=new Uint8Array(this._stashBuffer,0,this._bufferSize);Z.set(new Uint8Array(h),this._stashUsed),this._stashUsed+=h.byteLength;let pe=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(pe<this._stashUsed&&pe>0){let be=new Uint8Array(this._stashBuffer,pe);Z.set(be,0)}this._stashUsed-=pe,this._stashByteStart+=pe}}_flushStashBuffer(h){if(this._stashUsed>0){let m=this._stashBuffer.slice(0,this._stashUsed),y=this._dispatchChunks(m,this._stashByteStart),k=m.byteLength-y;if(y<m.byteLength)if(h)p.w(this.TAG,`${k} bytes unconsumed data remain when flush buffer, dropped`);else{if(y>0){let Z=new Uint8Array(this._stashBuffer,0,this._bufferSize),pe=new Uint8Array(m,y);Z.set(pe,0),this._stashUsed=pe.byteLength,this._stashByteStart+=y}return 0}return this._stashUsed=0,this._stashByteStart=0,k}return 0}_onLoaderComplete(h,m){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}_onLoaderError(h,m){switch(p.e(this.TAG,`Loader error, code = ${m.code}, msg = ${m.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,h=E.UNRECOVERABLE_EARLY_EOF),h){case E.EARLY_EOF:{if(!this._config.isLive&&this._totalLength){let y=this._currentRange.to+1;y<this._totalLength&&(p.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(y,!1));return}h=E.UNRECOVERABLE_EARLY_EOF;break}case E.UNRECOVERABLE_EARLY_EOF:case E.CONNECTING_TIMEOUT:case E.HTTP_STATUS_CODE_INVALID:case E.EXCEPTION:break}if(this._onError)this._onError(h,m);else throw new l("IOException: "+m.msg)}}var oe=O;const ie={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:3*60,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:3*60,autoCleanupMinBackwardDuration:2*60,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function S(){return Object.assign({},ie)}class v{static supportMSEH264Playback(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}static supportNetworkStreamIO(){let h=new oe({},S()),m=h.loaderType;return h.destroy(),m=="fetch-stream-loader"||m=="xhr-moz-chunked-loader"}static getNetworkLoaderTypeName(){let h=new oe({},S()),m=h.loaderType;return h.destroy(),m}static supportNativeMediaPlayback(h){v.videoElement==null&&(v.videoElement=window.document.createElement("video"));let m=v.videoElement.canPlayType(h);return m==="probably"||m=="maybe"}static getFeatureList(){let h={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return h.mseFlvPlayback=v.supportMSEH264Playback(),h.networkStreamIO=v.supportNetworkStreamIO(),h.networkLoaderName=v.getNetworkLoaderTypeName(),h.mseLiveFlvPlayback=h.mseFlvPlayback&&h.networkStreamIO,h.nativeMP4H264Playback=v.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),h.nativeWebmVP8Playback=v.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),h.nativeWebmVP9Playback=v.supportNativeMediaPlayback('video/webm; codecs="vp9"'),h}}var z=v,Te={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"};class Fe{static get forceGlobalTag(){return p.FORCE_GLOBAL_TAG}static set forceGlobalTag(h){p.FORCE_GLOBAL_TAG=h,Fe._notifyChange()}static get globalTag(){return p.GLOBAL_TAG}static set globalTag(h){p.GLOBAL_TAG=h,Fe._notifyChange()}static get enableAll(){return p.ENABLE_VERBOSE&&p.ENABLE_DEBUG&&p.ENABLE_INFO&&p.ENABLE_WARN&&p.ENABLE_ERROR}static set enableAll(h){p.ENABLE_VERBOSE=h,p.ENABLE_DEBUG=h,p.ENABLE_INFO=h,p.ENABLE_WARN=h,p.ENABLE_ERROR=h,Fe._notifyChange()}static get enableDebug(){return p.ENABLE_DEBUG}static set enableDebug(h){p.ENABLE_DEBUG=h,Fe._notifyChange()}static get enableVerbose(){return p.ENABLE_VERBOSE}static set enableVerbose(h){p.ENABLE_VERBOSE=h,Fe._notifyChange()}static get enableInfo(){return p.ENABLE_INFO}static set enableInfo(h){p.ENABLE_INFO=h,Fe._notifyChange()}static get enableWarn(){return p.ENABLE_WARN}static set enableWarn(h){p.ENABLE_WARN=h,Fe._notifyChange()}static get enableError(){return p.ENABLE_ERROR}static set enableError(h){p.ENABLE_ERROR=h,Fe._notifyChange()}static getConfig(){return{globalTag:p.GLOBAL_TAG,forceGlobalTag:p.FORCE_GLOBAL_TAG,enableVerbose:p.ENABLE_VERBOSE,enableDebug:p.ENABLE_DEBUG,enableInfo:p.ENABLE_INFO,enableWarn:p.ENABLE_WARN,enableError:p.ENABLE_ERROR,enableCallback:p.ENABLE_CALLBACK}}static applyConfig(h){p.GLOBAL_TAG=h.globalTag,p.FORCE_GLOBAL_TAG=h.forceGlobalTag,p.ENABLE_VERBOSE=h.enableVerbose,p.ENABLE_DEBUG=h.enableDebug,p.ENABLE_INFO=h.enableInfo,p.ENABLE_WARN=h.enableWarn,p.ENABLE_ERROR=h.enableError,p.ENABLE_CALLBACK=h.enableCallback}static _notifyChange(){let h=Fe.emitter;if(h.listenerCount("change")>0){let m=Fe.getConfig();h.emit("change",m)}}static registerListener(h){Fe.emitter.addListener("change",h)}static removeListener(h){Fe.emitter.removeListener("change",h)}static addLogListener(h){p.emitter.addListener("log",h),p.emitter.listenerCount("log")>0&&(p.ENABLE_CALLBACK=!0,Fe._notifyChange())}static removeLogListener(h){p.emitter.removeListener("log",h),p.emitter.listenerCount("log")===0&&(p.ENABLE_CALLBACK=!1,Fe._notifyChange())}}Fe.emitter=new(he());var Ye=Fe;class _t{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let h=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,m=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&h&&m}isSeekable(){return this.hasKeyframesIndex===!0}getNearestKeyframe(h){if(this.keyframesIndex==null)return null;let m=this.keyframesIndex,y=this._search(m.times,h);return{index:y,milliseconds:m.times[y],fileposition:m.filepositions[y]}}_search(h,m){let y=0,k=h.length-1,Z=0,pe=0,be=k;for(m<h[0]&&(y=0,pe=be+1);pe<=be;)if(Z=pe+Math.floor((be-pe)/2),Z===k||m>=h[Z]&&m<h[Z+1]){y=Z;break}else h[Z]<m?pe=Z+1:be=Z-1;return y}}var Ut=_t;function si(He,h,m){let y=He;if(h+m<y.length){for(;m--;)if((y[++h]&192)!==128)return!1;return!0}else return!1}function Ge(He){let h=[],m=He,y=0,k=He.length;for(;y<k;){if(m[y]<128){h.push(String.fromCharCode(m[y])),++y;continue}else if(!(m[y]<192)){if(m[y]<224){if(si(m,y,1)){let Z=(m[y]&31)<<6|m[y+1]&63;if(Z>=128){h.push(String.fromCharCode(Z&65535)),y+=2;continue}}}else if(m[y]<240){if(si(m,y,2)){let Z=(m[y]&15)<<12|(m[y+1]&63)<<6|m[y+2]&63;if(Z>=2048&&(Z&63488)!==55296){h.push(String.fromCharCode(Z&65535)),y+=3;continue}}}else if(m[y]<248&&si(m,y,3)){let Z=(m[y]&7)<<18|(m[y+1]&63)<<12|(m[y+2]&63)<<6|m[y+3]&63;if(Z>65536&&Z<1114112){Z-=65536,h.push(String.fromCharCode(Z>>>10|55296)),h.push(String.fromCharCode(Z&1023|56320)),y+=4;continue}}}h.push("\uFFFD"),++y}return h.join("")}var ft=Ge;let $t=function(){let He=new ArrayBuffer(2);return new DataView(He).setInt16(0,256,!0),new Int16Array(He)[0]===256}();class ut{static parseScriptData(h,m,y){let k={};try{let Z=ut.parseValue(h,m,y),pe=ut.parseValue(h,m+Z.size,y-Z.size);k[Z.data]=pe.data}catch(Z){p.e("AMF",Z.toString())}return k}static parseObject(h,m,y){if(y<3)throw new X("Data not enough when parse ScriptDataObject");let k=ut.parseString(h,m,y),Z=ut.parseValue(h,m+k.size,y-k.size),pe=Z.objectEnd;return{data:{name:k.data,value:Z.data},size:k.size+Z.size,objectEnd:pe}}static parseVariable(h,m,y){return ut.parseObject(h,m,y)}static parseString(h,m,y){if(y<2)throw new X("Data not enough when parse String");let Z=new DataView(h,m,y).getUint16(0,!$t),pe;return Z>0?pe=ft(new Uint8Array(h,m+2,Z)):pe="",{data:pe,size:2+Z}}static parseLongString(h,m,y){if(y<4)throw new X("Data not enough when parse LongString");let Z=new DataView(h,m,y).getUint32(0,!$t),pe;return Z>0?pe=ft(new Uint8Array(h,m+4,Z)):pe="",{data:pe,size:4+Z}}static parseDate(h,m,y){if(y<10)throw new X("Data size invalid when parse Date");let k=new DataView(h,m,y),Z=k.getFloat64(0,!$t),pe=k.getInt16(8,!$t);return Z+=pe*60*1e3,{data:new Date(Z),size:10}}static parseValue(h,m,y){if(y<1)throw new X("Data not enough when parse Value");let k=new DataView(h,m,y),Z=1,pe=k.getUint8(0),be,ot=!1;try{switch(pe){case 0:be=k.getFloat64(1,!$t),Z+=8;break;case 1:{be=!!k.getUint8(1),Z+=1;break}case 2:{let at=ut.parseString(h,m+1,y-1);be=at.data,Z+=at.size;break}case 3:{be={};let at=0;for((k.getUint32(y-4,!$t)&16777215)===9&&(at=3);Z<y-4;){let mt=ut.parseObject(h,m+Z,y-Z-at);if(mt.objectEnd)break;be[mt.data.name]=mt.data.value,Z+=mt.size}Z<=y-3&&(k.getUint32(Z-1,!$t)&16777215)===9&&(Z+=3);break}case 8:{be={},Z+=4;let at=0;for((k.getUint32(y-4,!$t)&16777215)===9&&(at=3);Z<y-8;){let mt=ut.parseVariable(h,m+Z,y-Z-at);if(mt.objectEnd)break;be[mt.data.name]=mt.data.value,Z+=mt.size}Z<=y-3&&(k.getUint32(Z-1,!$t)&16777215)===9&&(Z+=3);break}case 9:be=void 0,Z=1,ot=!0;break;case 10:{be=[];let at=k.getUint32(1,!$t);Z+=4;for(let mt=0;mt<at;mt++){let Nt=ut.parseValue(h,m+Z,y-Z);be.push(Nt.data),Z+=Nt.size}break}case 11:{let at=ut.parseDate(h,m+1,y-1);be=at.data,Z+=at.size;break}case 12:{let at=ut.parseString(h,m+1,y-1);be=at.data,Z+=at.size;break}default:Z=y,p.w("AMF","Unsupported AMF value type "+pe)}}catch(at){p.e("AMF",at.toString())}return{data:be,size:Z,objectEnd:ot}}}var li=ut;class We{constructor(h){this.TAG="ExpGolomb",this._buffer=h,this._buffer_index=0,this._total_bytes=h.byteLength,this._total_bits=h.byteLength*8,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){let h=this._total_bytes-this._buffer_index;if(h<=0)throw new X("ExpGolomb: _fillCurrentWord() but no bytes available");let m=Math.min(4,h),y=new Uint8Array(4);y.set(this._buffer.subarray(this._buffer_index,this._buffer_index+m)),this._current_word=new DataView(y.buffer).getUint32(0,!1),this._buffer_index+=m,this._current_word_bits_left=m*8}readBits(h){if(h>32)throw new P("ExpGolomb: readBits() bits exceeded max 32bits!");if(h<=this._current_word_bits_left){let pe=this._current_word>>>32-h;return this._current_word<<=h,this._current_word_bits_left-=h,pe}let m=this._current_word_bits_left?this._current_word:0;m=m>>>32-this._current_word_bits_left;let y=h-this._current_word_bits_left;this._fillCurrentWord();let k=Math.min(y,this._current_word_bits_left),Z=this._current_word>>>32-k;return this._current_word<<=k,this._current_word_bits_left-=k,m=m<<k|Z,m}readBool(){return this.readBits(1)===1}readByte(){return this.readBits(8)}_skipLeadingZero(){let h;for(h=0;h<this._current_word_bits_left;h++)if(this._current_word&2147483648>>>h)return this._current_word<<=h,this._current_word_bits_left-=h,h;return this._fillCurrentWord(),h+this._skipLeadingZero()}readUEG(){let h=this._skipLeadingZero();return this.readBits(h+1)-1}readSEG(){let h=this.readUEG();return h&1?h+1>>>1:-1*(h>>>1)}}var Ee=We;class Ie{static _ebsp2rbsp(h){let m=h,y=m.byteLength,k=new Uint8Array(y),Z=0;for(let pe=0;pe<y;pe++)pe>=2&&m[pe]===3&&m[pe-1]===0&&m[pe-2]===0||(k[Z]=m[pe],Z++);return new Uint8Array(k.buffer,0,Z)}static parseSPS(h){let m=Ie._ebsp2rbsp(h),y=new Ee(m);y.readByte();let k=y.readByte();y.readByte();let Z=y.readByte();y.readUEG();let pe=Ie.getProfileString(k),be=Ie.getLevelString(Z),ot=1,at=420,mt=[0,420,422,444],Nt=8;if((k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128||k===138||k===144)&&(ot=y.readUEG(),ot===3&&y.readBits(1),ot<=3&&(at=mt[ot]),Nt=y.readUEG()+8,y.readUEG(),y.readBits(1),y.readBool())){let Mt=ot!==3?8:12;for(let Jt=0;Jt<Mt;Jt++)y.readBool()&&(Jt<6?Ie._skipScalingList(y,16):Ie._skipScalingList(y,64))}y.readUEG();let Zt=y.readUEG();if(Zt===0)y.readUEG();else if(Zt===1){y.readBits(1),y.readSEG(),y.readSEG();let Mt=y.readUEG();for(let Jt=0;Jt<Mt;Jt++)y.readSEG()}let bt=y.readUEG();y.readBits(1);let Vt=y.readUEG(),Ft=y.readUEG(),et=y.readBits(1);et===0&&y.readBits(1),y.readBits(1);let xt=0,Ve=0,Ze=0,Rt=0;y.readBool()&&(xt=y.readUEG(),Ve=y.readUEG(),Ze=y.readUEG(),Rt=y.readUEG());let ui=1,Tt=1,It=0,zt=!0,ve=0,Ce=0;if(y.readBool()){if(y.readBool()){let Mt=y.readByte(),Jt=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Yt=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Mt>0&&Mt<16?(ui=Jt[Mt-1],Tt=Yt[Mt-1]):Mt===255&&(ui=y.readByte()<<8|y.readByte(),Tt=y.readByte()<<8|y.readByte())}if(y.readBool()&&y.readBool(),y.readBool()&&(y.readBits(4),y.readBool()&&y.readBits(24)),y.readBool()&&(y.readUEG(),y.readUEG()),y.readBool()){let Mt=y.readBits(32),Jt=y.readBits(32);zt=y.readBool(),ve=Jt,Ce=Mt*2,It=ve/Ce}}let qe=1;(ui!==1||Tt!==1)&&(qe=ui/Tt);let rt=0,ct=0;if(ot===0)rt=1,ct=2-et;else{let Mt=ot===3?1:2,Jt=ot===1?2:1;rt=Mt,ct=Jt*(2-et)}let lt=(Vt+1)*16,gt=(2-et)*((Ft+1)*16);lt-=(xt+Ve)*rt,gt-=(Ze+Rt)*ct;let Wt=Math.ceil(lt*qe);return y.destroy(),y=null,{profile_string:pe,level_string:be,bit_depth:Nt,ref_frames:bt,chroma_format:at,chroma_format_string:Ie.getChromaFormatString(at),frame_rate:{fixed:zt,fps:It,fps_den:Ce,fps_num:ve},sar_ratio:{width:ui,height:Tt},codec_size:{width:lt,height:gt},present_size:{width:Wt,height:gt}}}static _skipScalingList(h,m){let y=8,k=8,Z=0;for(let pe=0;pe<m;pe++)k!==0&&(Z=h.readSEG(),k=(y+Z+256)%256),y=k===0?y:k}static getProfileString(h){switch(h){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}static getLevelString(h){return(h/10).toFixed(1)}static getChromaFormatString(h){switch(h){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}var ne=Ie,ke={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};function ee(He){return He>>>8&255|(He&255)<<8}function Y(He){return(He&4278190080)>>>24|(He&16711680)>>>8|(He&65280)<<8|(He&255)<<24}function C(He,h){return He[h]<<24|He[h+1]<<16|He[h+2]<<8|He[h+3]}class Q{constructor(h,m){this.TAG="FLVDemuxer",this._config=m,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=h.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=h.hasAudioTrack,this._hasVideo=h.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new Ut,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){let y=new ArrayBuffer(2);return new DataView(y).setInt16(0,256,!0),new Int16Array(y)[0]===256}()}destroy(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}static probe(h){let m=new Uint8Array(h),y={match:!1};if(m[0]!==70||m[1]!==76||m[2]!==86||m[3]!==1)return y;let k=(m[4]&4)>>>2!==0,Z=(m[4]&1)!==0,pe=C(m,5);return pe<9?y:{match:!0,consumed:pe,dataOffset:pe,hasAudioTrack:k,hasVideoTrack:Z}}bindDataSource(h){return h.onDataArrival=this.parseChunks.bind(this),this}get onTrackMetadata(){return this._onTrackMetadata}set onTrackMetadata(h){this._onTrackMetadata=h}get onMediaInfo(){return this._onMediaInfo}set onMediaInfo(h){this._onMediaInfo=h}get onMetaDataArrived(){return this._onMetaDataArrived}set onMetaDataArrived(h){this._onMetaDataArrived=h}get onScriptDataArrived(){return this._onScriptDataArrived}set onScriptDataArrived(h){this._onScriptDataArrived=h}get onError(){return this._onError}set onError(h){this._onError=h}get onDataAvailable(){return this._onDataAvailable}set onDataAvailable(h){this._onDataAvailable=h}get timestampBase(){return this._timestampBase}set timestampBase(h){this._timestampBase=h}get overridedDuration(){return this._duration}set overridedDuration(h){this._durationOverrided=!0,this._duration=h,this._mediaInfo.duration=h}set overridedHasAudio(h){this._hasAudioFlagOverrided=!0,this._hasAudio=h,this._mediaInfo.hasAudio=h}set overridedHasVideo(h){this._hasVideoFlagOverrided=!0,this._hasVideo=h,this._mediaInfo.hasVideo=h}resetMediaInfo(){this._mediaInfo=new Ut}_isInitialMetadataDispatched(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1}parseChunks(h,m){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new X("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let y=0,k=this._littleEndian;if(m===0)if(h.byteLength>13)y=Q.probe(h).dataOffset;else return 0;for(this._firstParse&&(this._firstParse=!1,m+y!==this._dataOffset&&p.w(this.TAG,"First time parsing but chunk byteStart invalid!"),new DataView(h,y).getUint32(0,!k)!==0&&p.w(this.TAG,"PrevTagSize0 !== 0 !!!"),y+=4);y<h.byteLength;){this._dispatch=!0;let Z=new DataView(h,y);if(y+11+4>h.byteLength)break;let pe=Z.getUint8(0),be=Z.getUint32(0,!k)&16777215;if(y+11+be+4>h.byteLength)break;if(pe!==8&&pe!==9&&pe!==18){p.w(this.TAG,`Unsupported tag type ${pe}, skipped`),y+=11+be+4;continue}let ot=Z.getUint8(4),at=Z.getUint8(5),mt=Z.getUint8(6),Nt=Z.getUint8(7),Zt=mt|at<<8|ot<<16|Nt<<24;(Z.getUint32(7,!k)&16777215)!==0&&p.w(this.TAG,"Meet tag which has StreamID != 0!");let Vt=y+11;switch(pe){case 8:this._parseAudioData(h,Vt,be,Zt);break;case 9:this._parseVideoData(h,Vt,be,Zt,m+y);break;case 18:this._parseScriptData(h,Vt,be);break}let Ft=Z.getUint32(11+be,!k);Ft!==11+be&&p.w(this.TAG,`Invalid PrevTagSize ${Ft}`),y+=11+be+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),y}_parseScriptData(h,m,y){let k=li.parseScriptData(h,m,y);if(k.hasOwnProperty("onMetaData")){if(k.onMetaData==null||typeof k.onMetaData!="object"){p.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&p.w(this.TAG,"Found another onMetaData tag!"),this._metadata=k;let Z=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},Z)),typeof Z.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=Z.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof Z.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=Z.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof Z.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=Z.audiodatarate),typeof Z.videodatarate=="number"&&(this._mediaInfo.videoDataRate=Z.videodatarate),typeof Z.width=="number"&&(this._mediaInfo.width=Z.width),typeof Z.height=="number"&&(this._mediaInfo.height=Z.height),typeof Z.duration=="number"){if(!this._durationOverrided){let pe=Math.floor(Z.duration*this._timescale);this._duration=pe,this._mediaInfo.duration=pe}}else this._mediaInfo.duration=0;if(typeof Z.framerate=="number"){let pe=Math.floor(Z.framerate*1e3);if(pe>0){let be=pe/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=be,this._referenceFrameRate.fps_num=pe,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=be}}if(typeof Z.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;let pe=Z.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(pe),Z.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=Z,p.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(k).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},k))}_parseKeyframesIndex(h){let m=[],y=[];for(let k=1;k<h.times.length;k++){let Z=this._timestampBase+Math.floor(h.times[k]*1e3);m.push(Z),y.push(h.filepositions[k])}return{times:m,filepositions:y}}_parseAudioData(h,m,y,k){if(y<=1){p.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");return}if(this._hasAudioFlagOverrided===!0&&this._hasAudio===!1)return;let Z=this._littleEndian,be=new DataView(h,m,y).getUint8(0),ot=be>>>4;if(ot!==2&&ot!==10){this._onError(ke.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+ot);return}let at=0,mt=(be&12)>>>2;if(mt>=0&&mt<=4)at=this._flvSoundRateTable[mt];else{this._onError(ke.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+mt);return}let Nt=(be&2)>>>1,Zt=be&1,bt=this._audioMetadata,Vt=this._audioTrack;if(bt||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),bt=this._audioMetadata={},bt.type="audio",bt.id=Vt.id,bt.timescale=this._timescale,bt.duration=this._duration,bt.audioSampleRate=at,bt.channelCount=Zt===0?1:2),ot===10){let Ft=this._parseAACAudioData(h,m+1,y-1);if(Ft==null)return;if(Ft.packetType===0){bt.config&&p.w(this.TAG,"Found another AudioSpecificConfig!");let et=Ft.data;bt.audioSampleRate=et.samplingRate,bt.channelCount=et.channelCount,bt.codec=et.codec,bt.originalCodec=et.originalCodec,bt.config=et.config,bt.refSampleDuration=1024/bt.audioSampleRate*bt.timescale,p.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",bt);let xt=this._mediaInfo;xt.audioCodec=bt.originalCodec,xt.audioSampleRate=bt.audioSampleRate,xt.audioChannelCount=bt.channelCount,xt.hasVideo?xt.videoCodec!=null&&(xt.mimeType='video/x-flv; codecs="'+xt.videoCodec+","+xt.audioCodec+'"'):xt.mimeType='video/x-flv; codecs="'+xt.audioCodec+'"',xt.isComplete()&&this._onMediaInfo(xt)}else if(Ft.packetType===1){let et=this._timestampBase+k,xt={unit:Ft.data,length:Ft.data.byteLength,dts:et,pts:et};Vt.samples.push(xt),Vt.length+=Ft.data.length}else p.e(this.TAG,`Flv: Unsupported AAC data type ${Ft.packetType}`)}else if(ot===2){if(!bt.codec){let Ve=this._parseMP3AudioData(h,m+1,y-1,!0);if(Ve==null)return;bt.audioSampleRate=Ve.samplingRate,bt.channelCount=Ve.channelCount,bt.codec=Ve.codec,bt.originalCodec=Ve.originalCodec,bt.refSampleDuration=1152/bt.audioSampleRate*bt.timescale,p.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",bt);let Ze=this._mediaInfo;Ze.audioCodec=bt.codec,Ze.audioSampleRate=bt.audioSampleRate,Ze.audioChannelCount=bt.channelCount,Ze.audioDataRate=Ve.bitRate,Ze.hasVideo?Ze.videoCodec!=null&&(Ze.mimeType='video/x-flv; codecs="'+Ze.videoCodec+","+Ze.audioCodec+'"'):Ze.mimeType='video/x-flv; codecs="'+Ze.audioCodec+'"',Ze.isComplete()&&this._onMediaInfo(Ze)}let Ft=this._parseMP3AudioData(h,m+1,y-1,!1);if(Ft==null)return;let et=this._timestampBase+k,xt={unit:Ft,length:Ft.byteLength,dts:et,pts:et};Vt.samples.push(xt),Vt.length+=Ft.length}}_parseAACAudioData(h,m,y){if(y<=1){p.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}let k={},Z=new Uint8Array(h,m,y);return k.packetType=Z[0],Z[0]===0?k.data=this._parseAACAudioSpecificConfig(h,m+1,y-1):k.data=Z.subarray(1),k}_parseAACAudioSpecificConfig(h,m,y){let k=new Uint8Array(h,m,y),Z=null,pe=0,be=0,ot=null,at=0,mt=null;if(pe=be=k[0]>>>3,at=(k[0]&7)<<1|k[1]>>>7,at<0||at>=this._mpegSamplingRates.length){this._onError(ke.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}let Nt=this._mpegSamplingRates[at],Zt=(k[1]&120)>>>3;if(Zt<0||Zt>=8){this._onError(ke.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}pe===5&&(mt=(k[1]&7)<<1|k[2]>>>7,ot=(k[2]&124)>>>2);let bt=self.navigator.userAgent.toLowerCase();return bt.indexOf("firefox")!==-1?at>=6?(pe=5,Z=new Array(4),mt=at-3):(pe=2,Z=new Array(2),mt=at):bt.indexOf("android")!==-1?(pe=2,Z=new Array(2),mt=at):(pe=5,mt=at,Z=new Array(4),at>=6?mt=at-3:Zt===1&&(pe=2,Z=new Array(2),mt=at)),Z[0]=pe<<3,Z[0]|=(at&15)>>>1,Z[1]=(at&15)<<7,Z[1]|=(Zt&15)<<3,pe===5&&(Z[1]|=(mt&15)>>>1,Z[2]=(mt&1)<<7,Z[2]|=8,Z[3]=0),{config:Z,samplingRate:Nt,channelCount:Zt,codec:"mp4a.40."+pe,originalCodec:"mp4a.40."+be}}_parseMP3AudioData(h,m,y,k){if(y<4){p.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}let Z=this._littleEndian,pe=new Uint8Array(h,m,y),be=null;if(k){if(pe[0]!==255)return;let ot=pe[1]>>>3&3,at=(pe[1]&6)>>1,mt=(pe[2]&240)>>>4,Nt=(pe[2]&12)>>>2,bt=(pe[3]>>>6&3)!==3?2:1,Vt=0,Ft=0,et=34,xt="mp3";switch(ot){case 0:Vt=this._mpegAudioV25SampleRateTable[Nt];break;case 2:Vt=this._mpegAudioV20SampleRateTable[Nt];break;case 3:Vt=this._mpegAudioV10SampleRateTable[Nt];break}switch(at){case 1:et=34,mt<this._mpegAudioL3BitRateTable.length&&(Ft=this._mpegAudioL3BitRateTable[mt]);break;case 2:et=33,mt<this._mpegAudioL2BitRateTable.length&&(Ft=this._mpegAudioL2BitRateTable[mt]);break;case 3:et=32,mt<this._mpegAudioL1BitRateTable.length&&(Ft=this._mpegAudioL1BitRateTable[mt]);break}be={bitRate:Ft,samplingRate:Vt,channelCount:bt,codec:xt,originalCodec:xt}}else be=pe;return be}_parseVideoData(h,m,y,k,Z){if(y<=1){p.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");return}if(this._hasVideoFlagOverrided===!0&&this._hasVideo===!1)return;let pe=new Uint8Array(h,m,y)[0],be=(pe&240)>>>4,ot=pe&15;if(ot!==7){this._onError(ke.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${ot}`);return}this._parseAVCVideoPacket(h,m+1,y-1,k,Z,be)}_parseAVCVideoPacket(h,m,y,k,Z,pe){if(y<4){p.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}let be=this._littleEndian,ot=new DataView(h,m,y),at=ot.getUint8(0),Nt=(ot.getUint32(0,!be)&16777215)<<8>>8;if(at===0)this._parseAVCDecoderConfigurationRecord(h,m+4,y-4);else if(at===1)this._parseAVCVideoData(h,m+4,y-4,k,Z,pe,Nt);else if(at!==2){this._onError(ke.FORMAT_ERROR,`Flv: Invalid video packet type ${at}`);return}}_parseAVCDecoderConfigurationRecord(h,m,y){if(y<7){p.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}let k=this._videoMetadata,Z=this._videoTrack,pe=this._littleEndian,be=new DataView(h,m,y);k?typeof k.avcc!="undefined"&&p.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),k=this._videoMetadata={},k.type="video",k.id=Z.id,k.timescale=this._timescale,k.duration=this._duration);let ot=be.getUint8(0),at=be.getUint8(1),mt=be.getUint8(2),Nt=be.getUint8(3);if(ot!==1||at===0){this._onError(ke.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(be.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(ke.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`);return}let Zt=be.getUint8(5)&31;if(Zt===0){this._onError(ke.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else Zt>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${Zt}`);let bt=6;for(let Ft=0;Ft<Zt;Ft++){let et=be.getUint16(bt,!pe);if(bt+=2,et===0)continue;let xt=new Uint8Array(h,m+bt,et);bt+=et;let Ve=ne.parseSPS(xt);if(Ft!==0)continue;k.codecWidth=Ve.codec_size.width,k.codecHeight=Ve.codec_size.height,k.presentWidth=Ve.present_size.width,k.presentHeight=Ve.present_size.height,k.profile=Ve.profile_string,k.level=Ve.level_string,k.bitDepth=Ve.bit_depth,k.chromaFormat=Ve.chroma_format,k.sarRatio=Ve.sar_ratio,k.frameRate=Ve.frame_rate,(Ve.frame_rate.fixed===!1||Ve.frame_rate.fps_num===0||Ve.frame_rate.fps_den===0)&&(k.frameRate=this._referenceFrameRate);let Ze=k.frameRate.fps_den,Rt=k.frameRate.fps_num;k.refSampleDuration=k.timescale*(Ze/Rt);let Lt=xt.subarray(1,4),ui="avc1.";for(let It=0;It<3;It++){let zt=Lt[It].toString(16);zt.length<2&&(zt="0"+zt),ui+=zt}k.codec=ui;let Tt=this._mediaInfo;Tt.width=k.codecWidth,Tt.height=k.codecHeight,Tt.fps=k.frameRate.fps,Tt.profile=k.profile,Tt.level=k.level,Tt.refFrames=Ve.ref_frames,Tt.chromaFormat=Ve.chroma_format_string,Tt.sarNum=k.sarRatio.width,Tt.sarDen=k.sarRatio.height,Tt.videoCodec=ui,Tt.hasAudio?Tt.audioCodec!=null&&(Tt.mimeType='video/x-flv; codecs="'+Tt.videoCodec+","+Tt.audioCodec+'"'):Tt.mimeType='video/x-flv; codecs="'+Tt.videoCodec+'"',Tt.isComplete()&&this._onMediaInfo(Tt)}let Vt=be.getUint8(bt);if(Vt===0){this._onError(ke.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");return}else Vt>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${Vt}`);bt++;for(let Ft=0;Ft<Vt;Ft++){let et=be.getUint16(bt,!pe);bt+=2,et!==0&&(bt+=et)}k.avcc=new Uint8Array(y),k.avcc.set(new Uint8Array(h,m,y),0),p.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",k)}_parseAVCVideoData(h,m,y,k,Z,pe,be){let ot=this._littleEndian,at=new DataView(h,m,y),mt=[],Nt=0,Zt=0;const bt=this._naluLengthSize;let Vt=this._timestampBase+k,Ft=pe===1;for(;Zt<y;){if(Zt+4>=y){p.w(this.TAG,`Malformed Nalu near timestamp ${Vt}, offset = ${Zt}, dataSize = ${y}`);break}let et=at.getUint32(Zt,!ot);if(bt===3&&(et>>>=8),et>y-bt){p.w(this.TAG,`Malformed Nalus near timestamp ${Vt}, NaluSize > DataSize!`);return}let xt=at.getUint8(Zt+bt)&31;xt===5&&(Ft=!0);let Ve=new Uint8Array(h,m+Zt,bt+et),Ze={type:xt,data:Ve};mt.push(Ze),Nt+=Ve.byteLength,Zt+=bt+et}if(mt.length){let et=this._videoTrack,xt={units:mt,length:Nt,isKeyframe:Ft,dts:Vt,cts:be,pts:Vt+be};Ft&&(xt.fileposition=Z),et.samples.push(xt),et.length+=Nt}}}var F=Q;class U{static init(){U.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]};for(let m in U.types)U.types.hasOwnProperty(m)&&(U.types[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);let h=U.constants={};h.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),h.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),h.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),h.STSC=h.STCO=h.STTS,h.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),h.HDLR_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]),h.HDLR_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]),h.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),h.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),h.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(h){let m=8,y=null,k=Array.prototype.slice.call(arguments,1),Z=k.length;for(let be=0;be<Z;be++)m+=k[be].byteLength;y=new Uint8Array(m),y[0]=m>>>24&255,y[1]=m>>>16&255,y[2]=m>>>8&255,y[3]=m&255,y.set(h,4);let pe=8;for(let be=0;be<Z;be++)y.set(k[be],pe),pe+=k[be].byteLength;return y}static generateInitSegment(h){let m=U.box(U.types.ftyp,U.constants.FTYP),y=U.moov(h),k=new Uint8Array(m.byteLength+y.byteLength);return k.set(m,0),k.set(y,m.byteLength),k}static moov(h){let m=U.mvhd(h.timescale,h.duration),y=U.trak(h),k=U.mvex(h);return U.box(U.types.moov,m,y,k)}static mvhd(h,m){return U.box(U.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,h>>>24&255,h>>>16&255,h>>>8&255,h&255,m>>>24&255,m>>>16&255,m>>>8&255,m&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]))}static trak(h){return U.box(U.types.trak,U.tkhd(h),U.mdia(h))}static tkhd(h){let m=h.id,y=h.duration,k=h.presentWidth,Z=h.presentHeight;return U.box(U.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255,0,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&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,k>>>8&255,k&255,0,0,Z>>>8&255,Z&255,0,0]))}static mdia(h){return U.box(U.types.mdia,U.mdhd(h),U.hdlr(h),U.minf(h))}static mdhd(h){let m=h.timescale,y=h.duration;return U.box(U.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255,85,196,0,0]))}static hdlr(h){let m=null;return h.type==="audio"?m=U.constants.HDLR_AUDIO:m=U.constants.HDLR_VIDEO,U.box(U.types.hdlr,m)}static minf(h){let m=null;return h.type==="audio"?m=U.box(U.types.smhd,U.constants.SMHD):m=U.box(U.types.vmhd,U.constants.VMHD),U.box(U.types.minf,m,U.dinf(),U.stbl(h))}static dinf(){return U.box(U.types.dinf,U.box(U.types.dref,U.constants.DREF))}static stbl(h){return U.box(U.types.stbl,U.stsd(h),U.box(U.types.stts,U.constants.STTS),U.box(U.types.stsc,U.constants.STSC),U.box(U.types.stsz,U.constants.STSZ),U.box(U.types.stco,U.constants.STCO))}static stsd(h){return h.type==="audio"?h.codec==="mp3"?U.box(U.types.stsd,U.constants.STSD_PREFIX,U.mp3(h)):U.box(U.types.stsd,U.constants.STSD_PREFIX,U.mp4a(h)):U.box(U.types.stsd,U.constants.STSD_PREFIX,U.avc1(h))}static mp3(h){let m=h.channelCount,y=h.audioSampleRate,k=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,m,0,16,0,0,0,0,y>>>8&255,y&255,0,0]);return U.box(U.types[".mp3"],k)}static mp4a(h){let m=h.channelCount,y=h.audioSampleRate,k=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,m,0,16,0,0,0,0,y>>>8&255,y&255,0,0]);return U.box(U.types.mp4a,k,U.esds(h))}static esds(h){let m=h.config||[],y=m.length,k=new Uint8Array([0,0,0,0,3,23+y,0,1,0,4,15+y,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([y]).concat(m).concat([6,1,2]));return U.box(U.types.esds,k)}static avc1(h){let m=h.avcc,y=h.codecWidth,k=h.codecHeight,Z=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,y>>>8&255,y&255,k>>>8&255,k&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return U.box(U.types.avc1,Z,U.box(U.types.avcC,m))}static mvex(h){return U.box(U.types.mvex,U.trex(h))}static trex(h){let m=h.id,y=new Uint8Array([0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return U.box(U.types.trex,y)}static moof(h,m){return U.box(U.types.moof,U.mfhd(h.sequenceNumber),U.traf(h,m))}static mfhd(h){let m=new Uint8Array([0,0,0,0,h>>>24&255,h>>>16&255,h>>>8&255,h&255]);return U.box(U.types.mfhd,m)}static traf(h,m){let y=h.id,k=U.box(U.types.tfhd,new Uint8Array([0,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&255])),Z=U.box(U.types.tfdt,new Uint8Array([0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255])),pe=U.sdtp(h),be=U.trun(h,pe.byteLength+16+16+8+16+8+8);return U.box(U.types.traf,k,Z,be,pe)}static sdtp(h){let m=h.samples||[],y=m.length,k=new Uint8Array(4+y);for(let Z=0;Z<y;Z++){let pe=m[Z].flags;k[Z+4]=pe.isLeading<<6|pe.dependsOn<<4|pe.isDependedOn<<2|pe.hasRedundancy}return U.box(U.types.sdtp,k)}static trun(h,m){let y=h.samples||[],k=y.length,Z=12+16*k,pe=new Uint8Array(Z);m+=8+Z,pe.set([0,0,15,1,k>>>24&255,k>>>16&255,k>>>8&255,k&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255],0);for(let be=0;be<k;be++){let ot=y[be].duration,at=y[be].size,mt=y[be].flags,Nt=y[be].cts;pe.set([ot>>>24&255,ot>>>16&255,ot>>>8&255,ot&255,at>>>24&255,at>>>16&255,at>>>8&255,at&255,mt.isLeading<<2|mt.dependsOn,mt.isDependedOn<<6|mt.hasRedundancy<<4|mt.isNonSync,0,0,Nt>>>24&255,Nt>>>16&255,Nt>>>8&255,Nt&255],12+16*be)}return U.box(U.types.trun,pe)}static mdat(h){return U.box(U.types.mdat,h)}}U.init();var W=U;class re{static getSilentFrame(h,m){if(h==="mp4a.40.2"){if(m===1)return new Uint8Array([0,200,0,128,35,128]);if(m===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(m===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(m===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(m===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(m===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])}else{if(m===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(m===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(m===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])}return null}}var le=re;class ye{constructor(h,m,y,k,Z){this.dts=h,this.pts=m,this.duration=y,this.originalDts=k,this.isSyncPoint=Z,this.fileposition=null}}class De{constructor(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}appendSyncPoint(h){h.isSyncPoint=!0,this.syncPoints.push(h)}}class Ae{constructor(){this._list=[]}clear(){this._list=[]}appendArray(h){let m=this._list;h.length!==0&&(m.length>0&&h[0].originalDts<m[m.length-1].originalDts&&this.clear(),Array.prototype.push.apply(m,h))}getLastSyncPointBeforeDts(h){if(this._list.length==0)return null;let m=this._list,y=0,k=m.length-1,Z=0,pe=0,be=k;for(h<m[0].dts&&(y=0,pe=be+1);pe<=be;)if(Z=pe+Math.floor((be-pe)/2),Z===k||h>=m[Z].dts&&h<m[Z+1].dts){y=Z;break}else m[Z].dts<h?pe=Z+1:be=Z-1;return this._list[y]}}class je{constructor(h){this._type=h,this._list=[],this._lastAppendLocation=-1}get type(){return this._type}get length(){return this._list.length}isEmpty(){return this._list.length===0}clear(){this._list=[],this._lastAppendLocation=-1}_searchNearestSegmentBefore(h){let m=this._list;if(m.length===0)return-2;let y=m.length-1,k=0,Z=0,pe=y,be=0;if(h<m[0].originalBeginDts)return be=-1,be;for(;Z<=pe;)if(k=Z+Math.floor((pe-Z)/2),k===y||h>m[k].lastSample.originalDts&&h<m[k+1].originalBeginDts){be=k;break}else m[k].originalBeginDts<h?Z=k+1:pe=k-1;return be}_searchNearestSegmentAfter(h){return this._searchNearestSegmentBefore(h)+1}append(h){let m=this._list,y=h,k=this._lastAppendLocation,Z=0;k!==-1&&k<m.length&&y.originalBeginDts>=m[k].lastSample.originalDts&&(k===m.length-1||k<m.length-1&&y.originalBeginDts<m[k+1].originalBeginDts)?Z=k+1:m.length>0&&(Z=this._searchNearestSegmentBefore(y.originalBeginDts)+1),this._lastAppendLocation=Z,this._list.splice(Z,0,y)}getLastSegmentBefore(h){let m=this._searchNearestSegmentBefore(h);return m>=0?this._list[m]:null}getLastSampleBefore(h){let m=this.getLastSegmentBefore(h);return m!=null?m.lastSample:null}getLastSyncPointBefore(h){let m=this._searchNearestSegmentBefore(h),y=this._list[m].syncPoints;for(;y.length===0&&m>0;)m--,y=this._list[m].syncPoints;return y.length>0?y[y.length-1]:null}}class Ue{constructor(h){this.TAG="MP4Remuxer",this._config=h,this._isLive=h.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new je("audio"),this._videoSegmentInfoList=new je("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(V.chrome&&(V.version.major<50||V.version.major===50&&V.version.build<2661)),this._fillSilentAfterSeek=V.msedge||V.msie,this._mp3UseMpegAudio=!V.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}destroy(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}bindDataSource(h){return h.onDataAvailable=this.remux.bind(this),h.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}get onInitSegment(){return this._onInitSegment}set onInitSegment(h){this._onInitSegment=h}get onMediaSegment(){return this._onMediaSegment}set onMediaSegment(h){this._onMediaSegment=h}insertDiscontinuity(){this._audioNextDts=this._videoNextDts=void 0}seek(h){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}remux(h,m){if(!this._onMediaSegment)throw new X("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(h,m),this._remuxVideo(m),this._remuxAudio(h)}_onTrackMetadataReceived(h,m){let y=null,k="mp4",Z=m.codec;if(h==="audio")this._audioMeta=m,m.codec==="mp3"&&this._mp3UseMpegAudio?(k="mpeg",Z="",y=new Uint8Array):y=W.generateInitSegment(m);else if(h==="video")this._videoMeta=m,y=W.generateInitSegment(m);else return;if(!this._onInitSegment)throw new X("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(h,{type:h,data:y.buffer,codec:Z,container:`${h}/${k}`,mediaDuration:m.duration})}_calculateDtsBase(h,m){this._dtsBaseInited||(h.samples&&h.samples.length&&(this._audioDtsBase=h.samples[0].dts),m.samples&&m.samples.length&&(this._videoDtsBase=m.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}flushStashedSamples(){let h=this._videoStashedLastSample,m=this._audioStashedLastSample,y={type:"video",id:1,sequenceNumber:0,samples:[],length:0};h!=null&&(y.samples.push(h),y.length=h.length);let k={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};m!=null&&(k.samples.push(m),k.length=m.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(y,!0),this._remuxAudio(k,!0)}_remuxAudio(h,m){if(this._audioMeta==null)return;let y=h,k=y.samples,Z,pe=-1,be=-1,ot=-1,at=this._audioMeta.refSampleDuration,mt=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,Nt=this._dtsBaseInited&&this._audioNextDts===void 0,Zt=!1;if(!k||k.length===0||k.length===1&&!m)return;let bt=0,Vt=null,Ft=0;mt?(bt=0,Ft=y.length):(bt=8,Ft=8+y.length);let et=null;if(k.length>1&&(et=k.pop(),Ft-=et.length),this._audioStashedLastSample!=null){let Tt=this._audioStashedLastSample;this._audioStashedLastSample=null,k.unshift(Tt),Ft+=Tt.length}et!=null&&(this._audioStashedLastSample=et);let xt=k[0].dts-this._dtsBase;if(this._audioNextDts)Z=xt-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())Z=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(Zt=!0);else{let Tt=this._audioSegmentInfoList.getLastSampleBefore(xt);if(Tt!=null){let It=xt-(Tt.originalDts+Tt.duration);It<=3&&(It=0);let zt=Tt.dts+Tt.duration+It;Z=xt-zt}else Z=0}if(Zt){let Tt=xt-Z,It=this._videoSegmentInfoList.getLastSegmentBefore(xt);if(It!=null&&It.beginDts<Tt){let zt=le.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(zt){let ve=It.beginDts,Ce=Tt-It.beginDts;p.v(this.TAG,`InsertPrefixSilentAudio: dts: ${ve}, duration: ${Ce}`),k.unshift({unit:zt,dts:ve,pts:ve}),Ft+=zt.byteLength}}else Zt=!1}let Ve=[];for(let Tt=0;Tt<k.length;Tt++){let It=k[Tt],zt=It.unit,ve=It.dts-this._dtsBase,Ce=ve-Z;pe===-1&&(pe=Ce);let Qe=0;Tt!==k.length-1?Qe=k[Tt+1].dts-this._dtsBase-Z-Ce:et!=null?Qe=et.dts-this._dtsBase-Z-Ce:Ve.length>=1?Qe=Ve[Ve.length-1].duration:Qe=Math.floor(at);let qe=!1,rt=null;if(Qe>at*1.5&&this._audioMeta.codec!=="mp3"&&this._fillAudioTimestampGap&&!V.safari){qe=!0;let ct=Math.abs(Qe-at),lt=Math.ceil(ct/at),gt=Ce+at;p.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
dts: ${Ce+Qe} ms, expected: ${Ce+Math.round(at)} ms, delta: ${Math.round(ct)} ms, generate: ${lt} frames`);let Wt=le.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);Wt==null&&(p.w(this.TAG,`Unable to generate silent frame for ${this._audioMeta.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),Wt=zt),rt=[];for(let Jt=0;Jt<lt;Jt++){let Yt=Math.round(gt);if(rt.length>0){let Ei=rt[rt.length-1];Ei.duration=Yt-Ei.dts}let mi={dts:Yt,pts:Yt,cts:0,unit:Wt,size:Wt.byteLength,duration:0,originalDts:ve,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};rt.push(mi),Ft+=mi.size,gt+=at}let Mt=rt[rt.length-1];Mt.duration=Ce+Qe-Mt.dts,Qe=Math.round(at)}Ve.push({dts:Ce,pts:Ce,cts:0,unit:It.unit,size:It.unit.byteLength,duration:Qe,originalDts:ve,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),qe&&Ve.push.apply(Ve,rt)}mt?Vt=new Uint8Array(Ft):(Vt=new Uint8Array(Ft),Vt[0]=Ft>>>24&255,Vt[1]=Ft>>>16&255,Vt[2]=Ft>>>8&255,Vt[3]=Ft&255,Vt.set(W.types.mdat,4));for(let Tt=0;Tt<Ve.length;Tt++){let It=Ve[Tt].unit;Vt.set(It,bt),bt+=It.byteLength}let Ze=Ve[Ve.length-1];be=Ze.dts+Ze.duration,this._audioNextDts=be;let Rt=new De;Rt.beginDts=pe,Rt.endDts=be,Rt.beginPts=pe,Rt.endPts=be,Rt.originalBeginDts=Ve[0].originalDts,Rt.originalEndDts=Ze.originalDts+Ze.duration,Rt.firstSample=new ye(Ve[0].dts,Ve[0].pts,Ve[0].duration,Ve[0].originalDts,!1),Rt.lastSample=new ye(Ze.dts,Ze.pts,Ze.duration,Ze.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(Rt),y.samples=Ve,y.sequenceNumber++;let Lt=null;mt?Lt=new Uint8Array:Lt=W.moof(y,pe),y.samples=[],y.length=0;let ui={type:"audio",data:this._mergeBoxes(Lt,Vt).buffer,sampleCount:Ve.length,info:Rt};mt&&Nt&&(ui.timestampOffset=pe),this._onMediaSegment("audio",ui)}_remuxVideo(h,m){if(this._videoMeta==null)return;let y=h,k=y.samples,Z,pe=-1,be=-1,ot=-1,at=-1;if(!k||k.length===0||k.length===1&&!m)return;let mt=8,Nt=null,Zt=8+h.length,bt=null;if(k.length>1&&(bt=k.pop(),Zt-=bt.length),this._videoStashedLastSample!=null){let Ze=this._videoStashedLastSample;this._videoStashedLastSample=null,k.unshift(Ze),Zt+=Ze.length}bt!=null&&(this._videoStashedLastSample=bt);let Vt=k[0].dts-this._dtsBase;if(this._videoNextDts)Z=Vt-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())Z=0;else{let Ze=this._videoSegmentInfoList.getLastSampleBefore(Vt);if(Ze!=null){let Rt=Vt-(Ze.originalDts+Ze.duration);Rt<=3&&(Rt=0);let Lt=Ze.dts+Ze.duration+Rt;Z=Vt-Lt}else Z=0}let Ft=new De,et=[];for(let Ze=0;Ze<k.length;Ze++){let Rt=k[Ze],Lt=Rt.dts-this._dtsBase,ui=Rt.isKeyframe,Tt=Lt-Z,It=Rt.cts,zt=Tt+It;pe===-1&&(pe=Tt,ot=zt);let ve=0;if(Ze!==k.length-1?ve=k[Ze+1].dts-this._dtsBase-Z-Tt:bt!=null?ve=bt.dts-this._dtsBase-Z-Tt:et.length>=1?ve=et[et.length-1].duration:ve=Math.floor(this._videoMeta.refSampleDuration),ui){let Ce=new ye(Tt,zt,ve,Rt.dts,!0);Ce.fileposition=Rt.fileposition,Ft.appendSyncPoint(Ce)}et.push({dts:Tt,pts:zt,cts:It,units:Rt.units,size:Rt.length,isKeyframe:ui,duration:ve,originalDts:Lt,flags:{isLeading:0,dependsOn:ui?2:1,isDependedOn:ui?1:0,hasRedundancy:0,isNonSync:ui?0:1}})}Nt=new Uint8Array(Zt),Nt[0]=Zt>>>24&255,Nt[1]=Zt>>>16&255,Nt[2]=Zt>>>8&255,Nt[3]=Zt&255,Nt.set(W.types.mdat,4);for(let Ze=0;Ze<et.length;Ze++){let Rt=et[Ze].units;for(;Rt.length;){let ui=Rt.shift().data;Nt.set(ui,mt),mt+=ui.byteLength}}let xt=et[et.length-1];if(be=xt.dts+xt.duration,at=xt.pts+xt.duration,this._videoNextDts=be,Ft.beginDts=pe,Ft.endDts=be,Ft.beginPts=ot,Ft.endPts=at,Ft.originalBeginDts=et[0].originalDts,Ft.originalEndDts=xt.originalDts+xt.duration,Ft.firstSample=new ye(et[0].dts,et[0].pts,et[0].duration,et[0].originalDts,et[0].isKeyframe),Ft.lastSample=new ye(xt.dts,xt.pts,xt.duration,xt.originalDts,xt.isKeyframe),this._isLive||this._videoSegmentInfoList.append(Ft),y.samples=et,y.sequenceNumber++,this._forceFirstIDR){let Ze=et[0].flags;Ze.dependsOn=2,Ze.isNonSync=0}let Ve=W.moof(y,pe);y.samples=[],y.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(Ve,Nt).buffer,sampleCount:et.length,info:Ft})}_mergeBoxes(h,m){let y=new Uint8Array(h.byteLength+m.byteLength);return y.set(h,0),y.set(m,h.byteLength),y}}var Ke=Ue,Re={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"};class tt{constructor(h,m){this.TAG="TransmuxingController",this._emitter=new(he()),this._config=m,h.segments||(h.segments=[{duration:h.duration,filesize:h.filesize,url:h.url}]),typeof h.cors!="boolean"&&(h.cors=!0),typeof h.withCredentials!="boolean"&&(h.withCredentials=!1),this._mediaDataSource=h,this._currentSegmentIndex=0;let y=0;this._mediaDataSource.segments.forEach(k=>{k.timestampBase=y,y+=k.duration,k.cors=h.cors,k.withCredentials=h.withCredentials,m.referrerPolicy&&(k.referrerPolicy=m.referrerPolicy)}),!isNaN(y)&&this._mediaDataSource.duration!==y&&(this._mediaDataSource.duration=y),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}destroy(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null}on(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}start(){this._loadSegment(0),this._enableStatisticsReporter()}_loadSegment(h,m){this._currentSegmentIndex=h;let y=this._mediaDataSource.segments[h],k=this._ioctl=new oe(y,this._config,h);k.onError=this._onIOException.bind(this),k.onSeeked=this._onIOSeeked.bind(this),k.onComplete=this._onIOComplete.bind(this),k.onRedirect=this._onIORedirect.bind(this),k.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),m?this._demuxer.bindDataSource(this._ioctl):k.onDataArrival=this._onInitChunkArrival.bind(this),k.open(m)}stop(){this._internalAbort(),this._disableStatisticsReporter()}_internalAbort(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}pause(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}resume(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}seek(h){if(this._mediaInfo==null||!this._mediaInfo.isSeekable())return;let m=this._searchSegmentIndexContains(h);if(m===this._currentSegmentIndex){let y=this._mediaInfo.segments[m];if(y==null)this._pendingSeekTime=h;else{let k=y.getNearestKeyframe(h);this._remuxer.seek(k.milliseconds),this._ioctl.seek(k.fileposition),this._pendingResolveSeekPoint=k.milliseconds}}else{let y=this._mediaInfo.segments[m];if(y==null)this._pendingSeekTime=h,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(m);else{let k=y.getNearestKeyframe(h);this._internalAbort(),this._remuxer.seek(h),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[m].timestampBase,this._loadSegment(m,k.fileposition),this._pendingResolveSeekPoint=k.milliseconds,this._reportSegmentMediaInfo(m)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(h){let m=this._mediaDataSource.segments,y=m.length-1;for(let k=0;k<m.length;k++)if(h<m[k].timestampBase){y=k-1;break}return y}_onInitChunkArrival(h,m){let y=null,k=0;if(m>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,k=this._demuxer.parseChunks(h,m);else if((y=F.probe(h)).match){this._demuxer=new F(y,this._config),this._remuxer||(this._remuxer=new Ke(this._config));let Z=this._mediaDataSource;Z.duration!=null&&!isNaN(Z.duration)&&(this._demuxer.overridedDuration=Z.duration),typeof Z.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=Z.hasAudio),typeof Z.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=Z.hasVideo),this._demuxer.timestampBase=Z.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),k=this._demuxer.parseChunks(h,m)}else y=null,p.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(()=>{this._internalAbort()}),this._emitter.emit(Re.DEMUX_ERROR,ke.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),k=0;return k}_onMediaInfo(h){this._mediaInfo==null&&(this._mediaInfo=Object.assign({},h),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,Ut.prototype));let m=Object.assign({},h);Object.setPrototypeOf(m,Ut.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=m,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(()=>{let y=this._pendingSeekTime;this._pendingSeekTime=null,this.seek(y)})}_onMetaDataArrived(h){this._emitter.emit(Re.METADATA_ARRIVED,h)}_onScriptDataArrived(h){this._emitter.emit(Re.SCRIPTDATA_ARRIVED,h)}_onIOSeeked(){this._remuxer.insertDiscontinuity()}_onIOComplete(h){let y=h+1;y<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(y)):(this._remuxer.flushStashedSamples(),this._emitter.emit(Re.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(h){let m=this._ioctl.extraData;this._mediaDataSource.segments[m].redirectedURL=h}_onIORecoveredEarlyEof(){this._emitter.emit(Re.RECOVERED_EARLY_EOF)}_onIOException(h,m){p.e(this.TAG,`IOException: type = ${h}, code = ${m.code}, msg = ${m.msg}`),this._emitter.emit(Re.IO_ERROR,h,m),this._disableStatisticsReporter()}_onDemuxException(h,m){p.e(this.TAG,`DemuxException: type = ${h}, info = ${m}`),this._emitter.emit(Re.DEMUX_ERROR,h,m)}_onRemuxerInitSegmentArrival(h,m){this._emitter.emit(Re.INIT_SEGMENT,h,m)}_onRemuxerMediaSegmentArrival(h,m){if(this._pendingSeekTime==null&&(this._emitter.emit(Re.MEDIA_SEGMENT,h,m),this._pendingResolveSeekPoint!=null&&h==="video")){let y=m.info.syncPoints,k=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,V.safari&&y.length>0&&y[0].originalDts===k&&(k=y[0].pts),this._emitter.emit(Re.RECOMMEND_SEEKPOINT,k)}}_enableStatisticsReporter(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}_disableStatisticsReporter(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}_reportSegmentMediaInfo(h){let m=this._mediaInfo.segments[h],y=Object.assign({},m);y.duration=this._mediaInfo.duration,y.segmentCount=this._mediaInfo.segmentCount,delete y.segments,delete y.keyframesIndex,this._emitter.emit(Re.MEDIA_INFO,y)}_reportStatisticsInfo(){let h={};h.url=this._ioctl.currentURL,h.hasRedirect=this._ioctl.hasRedirect,h.hasRedirect&&(h.redirectedURL=this._ioctl.currentRedirectedURL),h.speed=this._ioctl.currentSpeed,h.loaderType=this._ioctl.loaderType,h.currentSegmentIndex=this._currentSegmentIndex,h.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(Re.STATISTICS_INFO,h)}}var Pt=tt,Bt=function(He){let h="TransmuxingWorker",m=null,y=Ft.bind(this);de.install(),He.addEventListener("message",function(et){switch(et.data.cmd){case"init":m=new Pt(et.data.param[0],et.data.param[1]),m.on(Re.IO_ERROR,Zt.bind(this)),m.on(Re.DEMUX_ERROR,bt.bind(this)),m.on(Re.INIT_SEGMENT,k.bind(this)),m.on(Re.MEDIA_SEGMENT,Z.bind(this)),m.on(Re.LOADING_COMPLETE,pe.bind(this)),m.on(Re.RECOVERED_EARLY_EOF,be.bind(this)),m.on(Re.MEDIA_INFO,ot.bind(this)),m.on(Re.METADATA_ARRIVED,at.bind(this)),m.on(Re.SCRIPTDATA_ARRIVED,mt.bind(this)),m.on(Re.STATISTICS_INFO,Nt.bind(this)),m.on(Re.RECOMMEND_SEEKPOINT,Vt.bind(this));break;case"destroy":m&&(m.destroy(),m=null),He.postMessage({msg:"destroyed"});break;case"start":m.start();break;case"stop":m.stop();break;case"seek":m.seek(et.data.param);break;case"pause":m.pause();break;case"resume":m.resume();break;case"logging_config":{let xt=et.data.param;Ye.applyConfig(xt),xt.enableCallback===!0?Ye.addLogListener(y):Ye.removeLogListener(y);break}}});function k(et,xt){let Ve={msg:Re.INIT_SEGMENT,data:{type:et,data:xt}};He.postMessage(Ve,[xt.data])}function Z(et,xt){let Ve={msg:Re.MEDIA_SEGMENT,data:{type:et,data:xt}};He.postMessage(Ve,[xt.data])}function pe(){let et={msg:Re.LOADING_COMPLETE};He.postMessage(et)}function be(){let et={msg:Re.RECOVERED_EARLY_EOF};He.postMessage(et)}function ot(et){let xt={msg:Re.MEDIA_INFO,data:et};He.postMessage(xt)}function at(et){let xt={msg:Re.METADATA_ARRIVED,data:et};He.postMessage(xt)}function mt(et){let xt={msg:Re.SCRIPTDATA_ARRIVED,data:et};He.postMessage(xt)}function Nt(et){let xt={msg:Re.STATISTICS_INFO,data:et};He.postMessage(xt)}function Zt(et,xt){He.postMessage({msg:Re.IO_ERROR,data:{type:et,info:xt}})}function bt(et,xt){He.postMessage({msg:Re.DEMUX_ERROR,data:{type:et,info:xt}})}function Vt(et){He.postMessage({msg:Re.RECOMMEND_SEEKPOINT,data:et})}function Ft(et,xt){He.postMessage({msg:"logcat_callback",data:{type:et,logcat:xt}})}};class jt{constructor(h,m){if(this.TAG="Transmuxer",this._emitter=new(he()),m.enableWorker&&typeof Worker!="undefined")try{let y=K(82059);this._worker=y(Bt),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[h,m]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},Ye.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:Ye.getConfig()})}catch(y){p.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new Pt(h,m)}else this._controller=new Pt(h,m);if(this._controller){let y=this._controller;y.on(Re.IO_ERROR,this._onIOError.bind(this)),y.on(Re.DEMUX_ERROR,this._onDemuxError.bind(this)),y.on(Re.INIT_SEGMENT,this._onInitSegment.bind(this)),y.on(Re.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),y.on(Re.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),y.on(Re.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),y.on(Re.MEDIA_INFO,this._onMediaInfo.bind(this)),y.on(Re.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),y.on(Re.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),y.on(Re.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),y.on(Re.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),Ye.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}on(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}hasWorker(){return this._worker!=null}open(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}close(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}seek(h){this._worker?this._worker.postMessage({cmd:"seek",param:h}):this._controller.seek(h)}pause(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}resume(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}_onInitSegment(h,m){Promise.resolve().then(()=>{this._emitter.emit(Re.INIT_SEGMENT,h,m)})}_onMediaSegment(h,m){Promise.resolve().then(()=>{this._emitter.emit(Re.MEDIA_SEGMENT,h,m)})}_onLoadingComplete(){Promise.resolve().then(()=>{this._emitter.emit(Re.LOADING_COMPLETE)})}_onRecoveredEarlyEof(){Promise.resolve().then(()=>{this._emitter.emit(Re.RECOVERED_EARLY_EOF)})}_onMediaInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Re.MEDIA_INFO,h)})}_onMetaDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Re.METADATA_ARRIVED,h)})}_onScriptDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Re.SCRIPTDATA_ARRIVED,h)})}_onStatisticsInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Re.STATISTICS_INFO,h)})}_onIOError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Re.IO_ERROR,h,m)})}_onDemuxError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Re.DEMUX_ERROR,h,m)})}_onRecommendSeekpoint(h){Promise.resolve().then(()=>{this._emitter.emit(Re.RECOMMEND_SEEKPOINT,h)})}_onLoggingConfigChanged(h){this._worker&&this._worker.postMessage({cmd:"logging_config",param:h})}_onWorkerMessage(h){let m=h.data,y=m.data;if(m.msg==="destroyed"||this._workerDestroying){this._workerDestroying=!1,this._worker.terminate(),this._worker=null;return}switch(m.msg){case Re.INIT_SEGMENT:case Re.MEDIA_SEGMENT:this._emitter.emit(m.msg,y.type,y.data);break;case Re.LOADING_COMPLETE:case Re.RECOVERED_EARLY_EOF:this._emitter.emit(m.msg);break;case Re.MEDIA_INFO:Object.setPrototypeOf(y,Ut.prototype),this._emitter.emit(m.msg,y);break;case Re.METADATA_ARRIVED:case Re.SCRIPTDATA_ARRIVED:case Re.STATISTICS_INFO:this._emitter.emit(m.msg,y);break;case Re.IO_ERROR:case Re.DEMUX_ERROR:this._emitter.emit(m.msg,y.type,y.info);break;case Re.RECOMMEND_SEEKPOINT:this._emitter.emit(m.msg,y);break;case"logcat_callback":p.emitter.emit("log",y.type,y.logcat);break;default:break}}}var oi=jt,Ht={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};class Qt{constructor(h){this.TAG="MSEController",this._config=h,this._emitter=new(he()),this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new Ae}destroy(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}on(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaSource)throw new X("MediaSource has been attached to an HTMLMediaElement!");let m=this._mediaSource=new window.MediaSource;m.addEventListener("sourceopen",this.e.onSourceOpen),m.addEventListener("sourceended",this.e.onSourceEnded),m.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=h,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),h.src=this._mediaSourceObjectURL}detachMediaElement(){if(this._mediaSource){let h=this._mediaSource;for(let m in this._sourceBuffers){let y=this._pendingSegments[m];y.splice(0,y.length),this._pendingSegments[m]=null,this._pendingRemoveRanges[m]=null,this._lastInitSegments[m]=null;let k=this._sourceBuffers[m];if(k){if(h.readyState!=="closed"){try{h.removeSourceBuffer(k)}catch(Z){p.e(this.TAG,Z.message)}k.removeEventListener("error",this.e.onSourceBufferError),k.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[m]=null,this._sourceBuffers[m]=null}}if(h.readyState==="open")try{h.endOfStream()}catch(m){p.e(this.TAG,m.message)}h.removeEventListener("sourceopen",this.e.onSourceOpen),h.removeEventListener("sourceended",this.e.onSourceEnded),h.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}appendInitSegment(h,m){if(!this._mediaSource||this._mediaSource.readyState!=="open"){this._pendingSourceBufferInit.push(h),this._pendingSegments[h.type].push(h);return}let y=h,k=`${y.container}`;y.codec&&y.codec.length>0&&(k+=`;codecs=${y.codec}`);let Z=!1;if(p.v(this.TAG,"Received Initialization Segment, mimeType: "+k),this._lastInitSegments[y.type]=y,k!==this._mimeTypes[y.type]){if(this._mimeTypes[y.type])p.v(this.TAG,`Notice: ${y.type} mimeType changed, origin: ${this._mimeTypes[y.type]}, target: ${k}`);else{Z=!0;try{let pe=this._sourceBuffers[y.type]=this._mediaSource.addSourceBuffer(k);pe.addEventListener("error",this.e.onSourceBufferError),pe.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(pe){p.e(this.TAG,pe.message),this._emitter.emit(Ht.ERROR,{code:pe.code,msg:pe.message});return}}this._mimeTypes[y.type]=k}m||this._pendingSegments[y.type].push(y),Z||this._sourceBuffers[y.type]&&!this._sourceBuffers[y.type].updating&&this._doAppendSegments(),V.safari&&y.container==="audio/mpeg"&&y.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=y.mediaDuration/1e3,this._updateMediaSourceDuration())}appendMediaSegment(h){let m=h;this._pendingSegments[m.type].push(m),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();let y=this._sourceBuffers[m.type];y&&!y.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()}seek(h){for(let m in this._sourceBuffers){if(!this._sourceBuffers[m])continue;let y=this._sourceBuffers[m];if(this._mediaSource.readyState==="open")try{y.abort()}catch(Z){p.e(this.TAG,Z.message)}this._idrList.clear();let k=this._pendingSegments[m];if(k.splice(0,k.length),this._mediaSource.readyState!=="closed"){for(let Z=0;Z<y.buffered.length;Z++){let pe=y.buffered.start(Z),be=y.buffered.end(Z);this._pendingRemoveRanges[m].push({start:pe,end:be})}if(y.updating||this._doRemoveRanges(),V.safari){let Z=this._lastInitSegments[m];Z&&(this._pendingSegments[m].push(Z),y.updating||this._doAppendSegments())}}}}endOfStream(){let h=this._mediaSource,m=this._sourceBuffers;if(!h||h.readyState!=="open"){h&&h.readyState==="closed"&&this._hasPendingSegments()&&(this._hasPendingEos=!0);return}m.video&&m.video.updating||m.audio&&m.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,h.endOfStream())}getNearestKeyframe(h){return this._idrList.getLastSyncPointBeforeDts(h)}_needCleanupSourceBuffer(){if(!this._config.autoCleanupSourceBuffer)return!1;let h=this._mediaElement.currentTime;for(let m in this._sourceBuffers){let y=this._sourceBuffers[m];if(y){let k=y.buffered;if(k.length>=1&&h-k.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}_doCleanupSourceBuffer(){let h=this._mediaElement.currentTime;for(let m in this._sourceBuffers){let y=this._sourceBuffers[m];if(y){let k=y.buffered,Z=!1;for(let pe=0;pe<k.length;pe++){let be=k.start(pe),ot=k.end(pe);if(be<=h&&h<ot+3){if(h-be>=this._config.autoCleanupMaxBackwardDuration){Z=!0;let at=h-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[m].push({start:be,end:at})}}else ot<h&&(Z=!0,this._pendingRemoveRanges[m].push({start:be,end:ot}))}Z&&!y.updating&&this._doRemoveRanges()}}}_updateMediaSourceDuration(){let h=this._sourceBuffers;if(this._mediaElement.readyState===0||this._mediaSource.readyState!=="open"||h.video&&h.video.updating||h.audio&&h.audio.updating)return;let m=this._mediaSource.duration,y=this._pendingMediaDuration;y>0&&(isNaN(m)||y>m)&&(p.v(this.TAG,`Update MediaSource duration from ${m} to ${y}`),this._mediaSource.duration=y),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}_doRemoveRanges(){for(let h in this._pendingRemoveRanges){if(!this._sourceBuffers[h]||this._sourceBuffers[h].updating)continue;let m=this._sourceBuffers[h],y=this._pendingRemoveRanges[h];for(;y.length&&!m.updating;){let k=y.shift();m.remove(k.start,k.end)}}}_doAppendSegments(){let h=this._pendingSegments;for(let m in h)if(!(!this._sourceBuffers[m]||this._sourceBuffers[m].updating)&&h[m].length>0){let y=h[m].shift();if(y.timestampOffset){let k=this._sourceBuffers[m].timestampOffset,Z=y.timestampOffset/1e3;Math.abs(k-Z)>.1&&(p.v(this.TAG,`Update MPEG audio timestampOffset from ${k} to ${Z}`),this._sourceBuffers[m].timestampOffset=Z),delete y.timestampOffset}if(!y.data||y.data.byteLength===0)continue;try{this._sourceBuffers[m].appendBuffer(y.data),this._isBufferFull=!1,m==="video"&&y.hasOwnProperty("info")&&this._idrList.appendArray(y.info.syncPoints)}catch(k){this._pendingSegments[m].unshift(y),k.code===22?(this._isBufferFull||this._emitter.emit(Ht.BUFFER_FULL),this._isBufferFull=!0):(p.e(this.TAG,k.message),this._emitter.emit(Ht.ERROR,{code:k.code,msg:k.message}))}}}_onSourceOpen(){if(p.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0){let h=this._pendingSourceBufferInit;for(;h.length;){let m=h.shift();this.appendInitSegment(m,!0)}}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(Ht.SOURCE_OPEN)}_onSourceEnded(){p.v(this.TAG,"MediaSource onSourceEnded")}_onSourceClose(){p.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}_hasPendingSegments(){let h=this._pendingSegments;return h.video.length>0||h.audio.length>0}_hasPendingRemoveRanges(){let h=this._pendingRemoveRanges;return h.video.length>0||h.audio.length>0}_onSourceBufferUpdateEnd(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(Ht.UPDATE_END)}_onSourceBufferError(h){p.e(this.TAG,`SourceBuffer Error: ${h}`)}}var Et=Qt;const ht={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},pt={NETWORK_EXCEPTION:E.EXCEPTION,NETWORK_STATUS_CODE_INVALID:E.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:E.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:E.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:ke.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:ke.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:ke.CODEC_UNSUPPORTED};class ti{constructor(h,m){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(he()),this._config=S(),typeof m=="object"&&Object.assign(this._config,m),h.type.toLowerCase()!=="flv")throw new P("FlvPlayer requires an flv MediaDataSource input!");h.isLive===!0&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=h,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;let y=V.chrome&&(V.version.major<50||V.version.major===50&&V.version.build<2661);this._alwaysSeekKeyframe=!!(y||V.msedge||V.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}destroy(){this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(h,m){h===Te.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Te.MEDIA_INFO,this.mediaInfo)}):h===Te.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Te.STATISTICS_INFO,this.statisticsInfo)}),this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaElement=h,h.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),h.addEventListener("seeking",this.e.onvSeeking),h.addEventListener("canplay",this.e.onvCanPlay),h.addEventListener("stalled",this.e.onvStalled),h.addEventListener("progress",this.e.onvProgress),this._msectl=new Et(this._config),this._msectl.on(Ht.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(Ht.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(Ht.SOURCE_OPEN,()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())}),this._msectl.on(Ht.ERROR,m=>{this._emitter.emit(Te.ERROR,ht.MEDIA_ERROR,pt.MEDIA_MSE_ERROR,m)}),this._msectl.attachMediaElement(h),this._pendingSeekTime!=null)try{h.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(m){}}detachMediaElement(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}load(){if(!this._mediaElement)throw new X("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new X("FlvPlayer.load() has been called, please call unload() first!");if(!this._hasPendingLoad){if(this._config.deferLoadAfterSourceOpen&&this._mseSourceOpened===!1){this._hasPendingLoad=!0;return}this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new oi(this._mediaDataSource,this._config),this._transmuxer.on(Re.INIT_SEGMENT,(h,m)=>{this._msectl.appendInitSegment(m)}),this._transmuxer.on(Re.MEDIA_SEGMENT,(h,m)=>{if(this._msectl.appendMediaSegment(m),this._config.lazyLoad&&!this._config.isLive){let y=this._mediaElement.currentTime;m.info.endDts>=(y+this._config.lazyLoadMaxDuration)*1e3&&this._progressChecker==null&&(p.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}}),this._transmuxer.on(Re.LOADING_COMPLETE,()=>{this._msectl.endOfStream(),this._emitter.emit(Te.LOADING_COMPLETE)}),this._transmuxer.on(Re.RECOVERED_EARLY_EOF,()=>{this._emitter.emit(Te.RECOVERED_EARLY_EOF)}),this._transmuxer.on(Re.IO_ERROR,(h,m)=>{this._emitter.emit(Te.ERROR,ht.NETWORK_ERROR,h,m)}),this._transmuxer.on(Re.DEMUX_ERROR,(h,m)=>{this._emitter.emit(Te.ERROR,ht.MEDIA_ERROR,h,{code:-1,msg:m})}),this._transmuxer.on(Re.MEDIA_INFO,h=>{this._mediaInfo=h,this._emitter.emit(Te.MEDIA_INFO,Object.assign({},h))}),this._transmuxer.on(Re.METADATA_ARRIVED,h=>{this._emitter.emit(Te.METADATA_ARRIVED,h)}),this._transmuxer.on(Re.SCRIPTDATA_ARRIVED,h=>{this._emitter.emit(Te.SCRIPTDATA_ARRIVED,h)}),this._transmuxer.on(Re.STATISTICS_INFO,h=>{this._statisticsInfo=this._fillStatisticsInfo(h),this._emitter.emit(Te.STATISTICS_INFO,Object.assign({},this._statisticsInfo))}),this._transmuxer.on(Re.RECOMMEND_SEEKPOINT,h=>{this._mediaElement&&!this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h/1e3)}),this._transmuxer.open()}}unload(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}play(){return this._mediaElement.play()}pause(){this._mediaElement.pause()}get type(){return this._type}get buffered(){return this._mediaElement.buffered}get duration(){return this._mediaElement.duration}get volume(){return this._mediaElement.volume}set volume(h){this._mediaElement.volume=h}get muted(){return this._mediaElement.muted}set muted(h){this._mediaElement.muted=h}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(h){this._mediaElement?this._internalSeek(h):this._pendingSeekTime=h}get mediaInfo(){return Object.assign({},this._mediaInfo)}get statisticsInfo(){return this._statisticsInfo==null&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}_fillStatisticsInfo(h){if(h.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return h;let m=!0,y=0,k=0;if(this._mediaElement.getVideoPlaybackQuality){let Z=this._mediaElement.getVideoPlaybackQuality();y=Z.totalVideoFrames,k=Z.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,k=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=k),h}_onmseUpdateEnd(){if(!this._config.lazyLoad||this._config.isLive)return;let h=this._mediaElement.buffered,m=this._mediaElement.currentTime,y=0,k=0;for(let Z=0;Z<h.length;Z++){let pe=h.start(Z),be=h.end(Z);if(pe<=m&&m<be){y=pe,k=be;break}}k>=m+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(p.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}_onmseBufferFull(){p.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._progressChecker==null&&this._suspendTransmuxer()}_suspendTransmuxer(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker==null&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}_checkProgressAndResume(){let h=this._mediaElement.currentTime,m=this._mediaElement.buffered,y=!1;for(let k=0;k<m.length;k++){let Z=m.start(k),pe=m.end(k);if(h>=Z&&h<pe){h>=pe-this._config.lazyLoadRecoverDuration&&(y=!0);break}}y&&(window.clearInterval(this._progressChecker),this._progressChecker=null,y&&(p.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}_isTimepointBuffered(h){let m=this._mediaElement.buffered;for(let y=0;y<m.length;y++){let k=m.start(y),Z=m.end(y);if(h>=k&&h<Z)return!0}return!1}_internalSeek(h){let m=this._isTimepointBuffered(h),y=!1,k=0;if(h<1&&this._mediaElement.buffered.length>0){let Z=this._mediaElement.buffered.start(0);(Z<1&&h<Z||V.safari)&&(y=!0,k=V.safari?.1:Z)}if(y)this._requestSetTime=!0,this._mediaElement.currentTime=k;else if(m){if(!this._alwaysSeekKeyframe)this._requestSetTime=!0,this._mediaElement.currentTime=h;else{let Z=this._msectl.getNearestKeyframe(Math.floor(h*1e3));this._requestSetTime=!0,Z!=null?this._mediaElement.currentTime=Z.dts/1e3:this._mediaElement.currentTime=h}this._progressChecker!=null&&this._checkProgressAndResume()}else this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(h),this._transmuxer.seek(Math.floor(h*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h)}_checkAndApplyUnbufferedSeekpoint(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){let h=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(h)||(this._progressChecker!=null&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(h),this._transmuxer.seek(Math.floor(h*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_checkAndResumeStuckPlayback(h){let m=this._mediaElement;if(h||!this._receivedCanPlay||m.readyState<2){let y=m.buffered;y.length>0&&m.currentTime<y.start(0)&&(p.w(this.TAG,`Playback seems stuck at ${m.currentTime}, seek to ${y.start(0)}`),this._requestSetTime=!0,this._mediaElement.currentTime=y.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}_onvLoadedMetadata(h){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}_onvSeeking(h){let m=this._mediaElement.currentTime,y=this._mediaElement.buffered;if(this._requestSetTime){this._requestSetTime=!1;return}if(m<1&&y.length>0){let k=y.start(0);if(k<1&&m<k||V.safari){this._requestSetTime=!0,this._mediaElement.currentTime=V.safari?.1:k;return}}if(this._isTimepointBuffered(m)){if(this._alwaysSeekKeyframe){let k=this._msectl.getNearestKeyframe(Math.floor(m*1e3));k!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=k.dts/1e3)}this._progressChecker!=null&&this._checkProgressAndResume();return}this._seekpointRecord={seekPoint:m,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_onvCanPlay(h){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}_onvStalled(h){this._checkAndResumeStuckPlayback(!0)}_onvProgress(h){this._checkAndResumeStuckPlayback()}}var Ot=ti;class Xe{constructor(h,m){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(he()),this._config=S(),typeof m=="object"&&Object.assign(this._config,m),h.type.toLowerCase()==="flv")throw new P("NativePlayer does't support flv MediaDataSource input!");if(h.hasOwnProperty("segments"))throw new P(`NativePlayer(${h.type}) doesn't support multipart playback!`);this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=h,this._mediaElement=null}destroy(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(h,m){h===Te.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Te.MEDIA_INFO,this.mediaInfo)}):h===Te.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Te.STATISTICS_INFO,this.statisticsInfo)}),this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaElement=h,h.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{h.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(m){}}detachMediaElement(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}load(){if(!this._mediaElement)throw new X("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}unload(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}play(){return this._mediaElement.play()}pause(){this._mediaElement.pause()}get type(){return this._type}get buffered(){return this._mediaElement.buffered}get duration(){return this._mediaElement.duration}get volume(){return this._mediaElement.volume}set volume(h){this._mediaElement.volume=h}get muted(){return this._mediaElement.muted}set muted(h){this._mediaElement.muted=h}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(h){this._mediaElement?this._mediaElement.currentTime=h:this._pendingSeekTime=h}get mediaInfo(){let m={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(m.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(m.width=this._mediaElement.videoWidth,m.height=this._mediaElement.videoHeight)),m}get statisticsInfo(){let h={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return h;let m=!0,y=0,k=0;if(this._mediaElement.getVideoPlaybackQuality){let Z=this._mediaElement.getVideoPlaybackQuality();y=Z.totalVideoFrames,k=Z.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,k=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=k),h}_onvLoadedMetadata(h){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(Te.MEDIA_INFO,this.mediaInfo)}_reportStatisticsInfo(){this._emitter.emit(Te.STATISTICS_INFO,this.statisticsInfo)}}var vt=Xe;de.install();function Kt(He,h){let m=He;if(m==null||typeof m!="object")throw new P("MediaDataSource must be an javascript object!");if(!m.hasOwnProperty("type"))throw new P("MediaDataSource must has type field to indicate video file type!");switch(m.type){case"flv":return new Ot(m,h);default:return new vt(m,h)}}function ai(){return z.supportMSEH264Playback()}function St(){return z.getFeatureList()}let qt={};qt.createPlayer=Kt,qt.isSupported=ai,qt.getFeatureList=St,qt.BaseLoader=A,qt.LoaderStatus=_,qt.LoaderErrors=E,qt.Events=Te,qt.ErrorTypes=ht,qt.ErrorDetails=pt,qt.FlvPlayer=Ot,qt.NativePlayer=vt,qt.LoggingControl=Ye,Object.defineProperty(qt,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var Ct=qt},25769:function(Xt,st,K){"use strict";var B=K(98040),de={"text/plain":"Text","text/html":"Url",default:"Text"},Se="Copy to clipboard: #{key}, Enter";function he(p){var me=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,me)}function j(p,me){var ce,l,X,P,g,_,E=!1;me||(me={}),ce=me.debug||!1;try{X=B(),P=document.createRange(),g=document.getSelection(),_=document.createElement("span"),_.textContent=p,_.ariaHidden="true",_.style.all="unset",_.style.position="fixed",_.style.top=0,_.style.clip="rect(0, 0, 0, 0)",_.style.whiteSpace="pre",_.style.webkitUserSelect="text",_.style.MozUserSelect="text",_.style.msUserSelect="text",_.style.userSelect="text",_.addEventListener("copy",function(M){if(M.stopPropagation(),me.format)if(M.preventDefault(),typeof M.clipboardData=="undefined"){ce&&console.warn("unable to use e.clipboardData"),ce&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var H=de[me.format]||de.default;window.clipboardData.setData(H,p)}else M.clipboardData.clearData(),M.clipboardData.setData(me.format,p);me.onCopy&&(M.preventDefault(),me.onCopy(M.clipboardData))}),document.body.appendChild(_),P.selectNodeContents(_),g.addRange(P);var A=document.execCommand("copy");if(!A)throw new Error("copy command was unsuccessful");E=!0}catch(M){ce&&console.error("unable to copy using execCommand: ",M),ce&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(me.format||"text",p),me.onCopy&&me.onCopy(window.clipboardData),E=!0}catch(H){ce&&console.error("unable to copy using clipboardData: ",H),ce&&console.error("falling back to prompt"),l=he("message"in me?me.message:Se),window.prompt(l,p)}}finally{g&&(typeof g.removeRange=="function"?g.removeRange(P):g.removeAllRanges()),_&&document.body.removeChild(_),X()}return E}Xt.exports=j},3867:function(Xt,st,K){var B=K(97671);(function(de,Se){Xt.exports=Se()})(this,function(){"use strict";function de(C){var Q=typeof C;return C!==null&&(Q==="object"||Q==="function")}function Se(C){return typeof C=="function"}var he=void 0;Array.isArray?he=Array.isArray:he=function(C){return Object.prototype.toString.call(C)==="[object Array]"};var j=he,p=0,me=void 0,ce=void 0,l=function(Q,F){R[p]=Q,R[p+1]=F,p+=2,p===2&&(ce?ce(q):te())};function X(C){ce=C}function P(C){l=C}var g=typeof window!="undefined"?window:void 0,_=g||{},E=_.MutationObserver||_.WebKitMutationObserver,A=typeof self=="undefined"&&typeof B!="undefined"&&{}.toString.call(B)==="[object process]",M=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function H(){return function(){return B.nextTick(q)}}function V(){return typeof me!="undefined"?function(){me(q)}:w()}function L(){var C=0,Q=new E(q),F=document.createTextNode("");return Q.observe(F,{characterData:!0}),function(){F.data=C=++C%2}}function I(){var C=new MessageChannel;return C.port1.onmessage=q,function(){return C.port2.postMessage(0)}}function w(){var C=setTimeout;return function(){return C(q,1)}}var R=new Array(1e3);function q(){for(var C=0;C<p;C+=2){var Q=R[C],F=R[C+1];Q(F),R[C]=void 0,R[C+1]=void 0}p=0}function se(){try{var C=Function("return this")().require("vertx");return me=C.runOnLoop||C.runOnContext,V()}catch(Q){return w()}}var te=void 0;A?te=H():E?te=L():M?te=I():g===void 0?te=se():te=w();function ge(C,Q){var F=this,U=new this.constructor($e);U[xe]===void 0&&ut(U);var W=F._state;if(W){var re=arguments[W-1];l(function(){return si(W,U,re,F._result)})}else _t(F,U,C,Q);return U}function Le(C){var Q=this;if(C&&typeof C=="object"&&C.constructor===Q)return C;var F=new Q($e);return ae(F,C),F}var xe=Math.random().toString(36).substring(2);function $e(){}var J=void 0,D=1,N=2;function O(){return new TypeError("You cannot resolve a promise with itself")}function oe(){return new TypeError("A promises callback cannot return that same promise.")}function ie(C,Q,F,U){try{C.call(Q,F,U)}catch(W){return W}}function S(C,Q,F){l(function(U){var W=!1,re=ie(F,Q,function(le){W||(W=!0,Q!==le?ae(U,le):Fe(U,le))},function(le){W||(W=!0,Ye(U,le))},"Settle: "+(U._label||" unknown promise"));!W&&re&&(W=!0,Ye(U,re))},C)}function v(C,Q){Q._state===D?Fe(C,Q._result):Q._state===N?Ye(C,Q._result):_t(Q,void 0,function(F){return ae(C,F)},function(F){return Ye(C,F)})}function z(C,Q,F){Q.constructor===C.constructor&&F===ge&&Q.constructor.resolve===Le?v(C,Q):F===void 0?Fe(C,Q):Se(F)?S(C,Q,F):Fe(C,Q)}function ae(C,Q){if(C===Q)Ye(C,O());else if(de(Q)){var F=void 0;try{F=Q.then}catch(U){Ye(C,U);return}z(C,Q,F)}else Fe(C,Q)}function Te(C){C._onerror&&C._onerror(C._result),Ut(C)}function Fe(C,Q){C._state===J&&(C._result=Q,C._state=D,C._subscribers.length!==0&&l(Ut,C))}function Ye(C,Q){C._state===J&&(C._state=N,C._result=Q,l(Te,C))}function _t(C,Q,F,U){var W=C._subscribers,re=W.length;C._onerror=null,W[re]=Q,W[re+D]=F,W[re+N]=U,re===0&&C._state&&l(Ut,C)}function Ut(C){var Q=C._subscribers,F=C._state;if(Q.length!==0){for(var U=void 0,W=void 0,re=C._result,le=0;le<Q.length;le+=3)U=Q[le],W=Q[le+F],U?si(F,U,W,re):W(re);C._subscribers.length=0}}function si(C,Q,F,U){var W=Se(F),re=void 0,le=void 0,ye=!0;if(W){try{re=F(U)}catch(De){ye=!1,le=De}if(Q===re){Ye(Q,oe());return}}else re=U;Q._state!==J||(W&&ye?ae(Q,re):ye===!1?Ye(Q,le):C===D?Fe(Q,re):C===N&&Ye(Q,re))}function Ge(C,Q){try{Q(function(U){ae(C,U)},function(U){Ye(C,U)})}catch(F){Ye(C,F)}}var ft=0;function $t(){return ft++}function ut(C){C[xe]=ft++,C._state=void 0,C._result=void 0,C._subscribers=[]}function li(){return new Error("Array Methods must be provided an Array")}var We=function(){function C(Q,F){this._instanceConstructor=Q,this.promise=new Q($e),this.promise[xe]||ut(this.promise),j(F)?(this.length=F.length,this._remaining=F.length,this._result=new Array(this.length),this.length===0?Fe(this.promise,this._result):(this.length=this.length||0,this._enumerate(F),this._remaining===0&&Fe(this.promise,this._result))):Ye(this.promise,li())}return C.prototype._enumerate=function(F){for(var U=0;this._state===J&&U<F.length;U++)this._eachEntry(F[U],U)},C.prototype._eachEntry=function(F,U){var W=this._instanceConstructor,re=W.resolve;if(re===Le){var le=void 0,ye=void 0,De=!1;try{le=F.then}catch(je){De=!0,ye=je}if(le===ge&&F._state!==J)this._settledAt(F._state,U,F._result);else if(typeof le!="function")this._remaining--,this._result[U]=F;else if(W===ee){var Ae=new W($e);De?Ye(Ae,ye):z(Ae,F,le),this._willSettleAt(Ae,U)}else this._willSettleAt(new W(function(je){return je(F)}),U)}else this._willSettleAt(re(F),U)},C.prototype._settledAt=function(F,U,W){var re=this.promise;re._state===J&&(this._remaining--,F===N?Ye(re,W):this._result[U]=W),this._remaining===0&&Fe(re,this._result)},C.prototype._willSettleAt=function(F,U){var W=this;_t(F,void 0,function(re){return W._settledAt(D,U,re)},function(re){return W._settledAt(N,U,re)})},C}();function Ee(C){return new We(this,C).promise}function Ie(C){var Q=this;return j(C)?new Q(function(F,U){for(var W=C.length,re=0;re<W;re++)Q.resolve(C[re]).then(F,U)}):new Q(function(F,U){return U(new TypeError("You must pass an array to race."))})}function ne(C){var Q=this,F=new Q($e);return Ye(F,C),F}function we(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ke(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var ee=function(){function C(Q){this[xe]=$t(),this._result=this._state=void 0,this._subscribers=[],$e!==Q&&(typeof Q!="function"&&we(),this instanceof C?Ge(this,Q):ke())}return C.prototype.catch=function(F){return this.then(null,F)},C.prototype.finally=function(F){var U=this,W=U.constructor;return Se(F)?U.then(function(re){return W.resolve(F()).then(function(){return re})},function(re){return W.resolve(F()).then(function(){throw re})}):U.then(F,F)},C}();ee.prototype.then=ge,ee.all=Ee,ee.race=Ie,ee.resolve=Le,ee.reject=ne,ee._setScheduler=X,ee._setAsap=P,ee._asap=l;function Y(){var C=void 0;if(typeof K.g!="undefined")C=K.g;else if(typeof self!="undefined")C=self;else try{C=Function("return this")()}catch(U){throw new Error("polyfill failed because global object is unavailable in this environment")}var Q=C.Promise;if(Q){var F=null;try{F=Object.prototype.toString.call(Q.resolve())}catch(U){}if(F==="[object Promise]"&&!Q.cast)return}C.Promise=ee}return ee.polyfill=Y,ee.Promise=ee,ee})},86204:function(Xt){"use strict";var st=typeof Reflect=="object"?Reflect:null,K=st&&typeof st.apply=="function"?st.apply:function(I,w,R){return Function.prototype.apply.call(I,w,R)},B;st&&typeof st.ownKeys=="function"?B=st.ownKeys:Object.getOwnPropertySymbols?B=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:B=function(I){return Object.getOwnPropertyNames(I)};function de(L){console&&console.warn&&console.warn(L)}var Se=Number.isNaN||function(I){return I!==I};function he(){he.init.call(this)}Xt.exports=he,Xt.exports.once=M,he.EventEmitter=he,he.prototype._events=void 0,he.prototype._eventsCount=0,he.prototype._maxListeners=void 0;var j=10;function p(L){if(typeof L!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof L)}Object.defineProperty(he,"defaultMaxListeners",{enumerable:!0,get:function(){return j},set:function(L){if(typeof L!="number"||L<0||Se(L))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+L+".");j=L}}),he.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},he.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||Se(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function me(L){return L._maxListeners===void 0?he.defaultMaxListeners:L._maxListeners}he.prototype.getMaxListeners=function(){return me(this)},he.prototype.emit=function(I){for(var w=[],R=1;R<arguments.length;R++)w.push(arguments[R]);var q=I==="error",se=this._events;if(se!==void 0)q=q&&se.error===void 0;else if(!q)return!1;if(q){var te;if(w.length>0&&(te=w[0]),te instanceof Error)throw te;var ge=new Error("Unhandled error."+(te?" ("+te.message+")":""));throw ge.context=te,ge}var Le=se[I];if(Le===void 0)return!1;if(typeof Le=="function")K(Le,this,w);else for(var xe=Le.length,$e=_(Le,xe),R=0;R<xe;++R)K($e[R],this,w);return!0};function ce(L,I,w,R){var q,se,te;if(p(w),se=L._events,se===void 0?(se=L._events=Object.create(null),L._eventsCount=0):(se.newListener!==void 0&&(L.emit("newListener",I,w.listener?w.listener:w),se=L._events),te=se[I]),te===void 0)te=se[I]=w,++L._eventsCount;else if(typeof te=="function"?te=se[I]=R?[w,te]:[te,w]:R?te.unshift(w):te.push(w),q=me(L),q>0&&te.length>q&&!te.warned){te.warned=!0;var ge=new Error("Possible EventEmitter memory leak detected. "+te.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");ge.name="MaxListenersExceededWarning",ge.emitter=L,ge.type=I,ge.count=te.length,de(ge)}return L}he.prototype.addListener=function(I,w){return ce(this,I,w,!1)},he.prototype.on=he.prototype.addListener,he.prototype.prependListener=function(I,w){return ce(this,I,w,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function X(L,I,w){var R={fired:!1,wrapFn:void 0,target:L,type:I,listener:w},q=l.bind(R);return q.listener=w,R.wrapFn=q,q}he.prototype.once=function(I,w){return p(w),this.on(I,X(this,I,w)),this},he.prototype.prependOnceListener=function(I,w){return p(w),this.prependListener(I,X(this,I,w)),this},he.prototype.removeListener=function(I,w){var R,q,se,te,ge;if(p(w),q=this._events,q===void 0)return this;if(R=q[I],R===void 0)return this;if(R===w||R.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete q[I],q.removeListener&&this.emit("removeListener",I,R.listener||w));else if(typeof R!="function"){for(se=-1,te=R.length-1;te>=0;te--)if(R[te]===w||R[te].listener===w){ge=R[te].listener,se=te;break}if(se<0)return this;se===0?R.shift():E(R,se),R.length===1&&(q[I]=R[0]),q.removeListener!==void 0&&this.emit("removeListener",I,ge||w)}return this},he.prototype.off=he.prototype.removeListener,he.prototype.removeAllListeners=function(I){var w,R,q;if(R=this._events,R===void 0)return this;if(R.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):R[I]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete R[I]),this;if(arguments.length===0){var se=Object.keys(R),te;for(q=0;q<se.length;++q)te=se[q],te!=="removeListener"&&this.removeAllListeners(te);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(w=R[I],typeof w=="function")this.removeListener(I,w);else if(w!==void 0)for(q=w.length-1;q>=0;q--)this.removeListener(I,w[q]);return this};function P(L,I,w){var R=L._events;if(R===void 0)return[];var q=R[I];return q===void 0?[]:typeof q=="function"?w?[q.listener||q]:[q]:w?A(q):_(q,q.length)}he.prototype.listeners=function(I){return P(this,I,!0)},he.prototype.rawListeners=function(I){return P(this,I,!1)},he.listenerCount=function(L,I){return typeof L.listenerCount=="function"?L.listenerCount(I):g.call(L,I)},he.prototype.listenerCount=g;function g(L){var I=this._events;if(I!==void 0){var w=I[L];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}he.prototype.eventNames=function(){return this._eventsCount>0?B(this._events):[]};function _(L,I){for(var w=new Array(I),R=0;R<I;++R)w[R]=L[R];return w}function E(L,I){for(;I+1<L.length;I++)L[I]=L[I+1];L.pop()}function A(L){for(var I=new Array(L.length),w=0;w<I.length;++w)I[w]=L[w].listener||L[w];return I}function M(L,I){return new Promise(function(w,R){function q(te){L.removeListener(I,se),R(te)}function se(){typeof L.removeListener=="function"&&L.removeListener("error",q),w([].slice.call(arguments))}V(L,I,se,{once:!0}),I!=="error"&&H(L,q,{once:!0})})}function H(L,I,w){typeof L.on=="function"&&V(L,"error",I,w)}function V(L,I,w,R){if(typeof L.on=="function")R.once?L.once(I,w):L.on(I,w);else if(typeof L.addEventListener=="function")L.addEventListener(I,function q(se){R.once&&L.removeEventListener(I,q),w(se)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof L)}},24334:function(Xt,st,K){var B,de;(function(Se,he){Xt.exports=he(Se)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof K.g!="undefined"?K.g:this,function(Se){"use strict";Se=Se||{};var he=Se.Base64,j="2.6.4",p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",me=function(D){for(var N={},O=0,oe=D.length;O<oe;O++)N[D.charAt(O)]=O;return N}(p),ce=String.fromCharCode,l=function(D){if(D.length<2){var N=D.charCodeAt(0);return N<128?D:N<2048?ce(192|N>>>6)+ce(128|N&63):ce(224|N>>>12&15)+ce(128|N>>>6&63)+ce(128|N&63)}else{var N=65536+(D.charCodeAt(0)-55296)*1024+(D.charCodeAt(1)-56320);return ce(240|N>>>18&7)+ce(128|N>>>12&63)+ce(128|N>>>6&63)+ce(128|N&63)}},X=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,P=function(D){return D.replace(X,l)},g=function(D){var N=[0,2,1][D.length%3],O=D.charCodeAt(0)<<16|(D.length>1?D.charCodeAt(1):0)<<8|(D.length>2?D.charCodeAt(2):0),oe=[p.charAt(O>>>18),p.charAt(O>>>12&63),N>=2?"=":p.charAt(O>>>6&63),N>=1?"=":p.charAt(O&63)];return oe.join("")},_=Se.btoa&&typeof Se.btoa=="function"?function(D){return Se.btoa(D)}:function(D){if(D.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return D.replace(/[\s\S]{1,3}/g,g)},E=function(D){return _(P(String(D)))},A=function(D){return D.replace(/[+\/]/g,function(N){return N=="+"?"-":"_"}).replace(/=/g,"")},M=function(D,N){return N?A(E(D)):E(D)},H=function(D){return M(D,!0)},V;Se.Uint8Array&&(V=function(D,N){for(var O="",oe=0,ie=D.length;oe<ie;oe+=3){var S=D[oe],v=D[oe+1],z=D[oe+2],ae=S<<16|v<<8|z;O+=p.charAt(ae>>>18)+p.charAt(ae>>>12&63)+(typeof v!="undefined"?p.charAt(ae>>>6&63):"=")+(typeof z!="undefined"?p.charAt(ae&63):"=")}return N?A(O):O});var L=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,I=function(D){switch(D.length){case 4:var N=(7&D.charCodeAt(0))<<18|(63&D.charCodeAt(1))<<12|(63&D.charCodeAt(2))<<6|63&D.charCodeAt(3),O=N-65536;return ce((O>>>10)+55296)+ce((O&1023)+56320);case 3:return ce((15&D.charCodeAt(0))<<12|(63&D.charCodeAt(1))<<6|63&D.charCodeAt(2));default:return ce((31&D.charCodeAt(0))<<6|63&D.charCodeAt(1))}},w=function(D){return D.replace(L,I)},R=function(D){var N=D.length,O=N%4,oe=(N>0?me[D.charAt(0)]<<18:0)|(N>1?me[D.charAt(1)]<<12:0)|(N>2?me[D.charAt(2)]<<6:0)|(N>3?me[D.charAt(3)]:0),ie=[ce(oe>>>16),ce(oe>>>8&255),ce(oe&255)];return ie.length-=[0,0,2,1][O],ie.join("")},q=Se.atob&&typeof Se.atob=="function"?function(D){return Se.atob(D)}:function(D){return D.replace(/\S{1,4}/g,R)},se=function(D){return q(String(D).replace(/[^A-Za-z0-9\+\/]/g,""))},te=function(D){return w(q(D))},ge=function(D){return String(D).replace(/[-_]/g,function(N){return N=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},Le=function(D){return te(ge(D))},xe;Se.Uint8Array&&(xe=function(D){return Uint8Array.from(se(ge(D)),function(N){return N.charCodeAt(0)})});var $e=function(){var D=Se.Base64;return Se.Base64=he,D};if(Se.Base64={VERSION:j,atob:se,btoa:_,fromBase64:Le,toBase64:M,utob:P,encode:M,encodeURI:H,btou:w,decode:Le,noConflict:$e,fromUint8Array:V,toUint8Array:xe},typeof Object.defineProperty=="function"){var J=function(D){return{value:D,enumerable:!1,writable:!0,configurable:!0}};Se.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",J(function(){return Le(this)})),Object.defineProperty(String.prototype,"toBase64",J(function(D){return M(this,D)})),Object.defineProperty(String.prototype,"toBase64URI",J(function(){return M(this,!0)}))}}return Se.Meteor&&(Base64=Se.Base64),Xt.exports?Xt.exports.Base64=Se.Base64:(B=[],de=function(){return Se.Base64}.apply(st,B),de!==void 0&&(Xt.exports=de)),{Base64:Se.Base64}})},53184:function(Xt,st,K){"use strict";var B,de;function Se(he,j,p){var me=function(ce,l){return he.js_beautify(ce,l)};return me.js=he.js_beautify,me.css=j.css_beautify,me.html=p.html_beautify,me.js_beautify=he.js_beautify,me.css_beautify=j.css_beautify,me.html_beautify=p.html_beautify,me}B=[K(58553),K(87804),K(40998)],de=function(he,j,p){return Se(he,j,p)}.apply(st,B),de!==void 0&&(Xt.exports=de)},87804:function(Xt,st){var K,B;(function(){var de;(function(){"use strict";var he=[,,function(ce){function l(g){this.__parent=g,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var _=this.__items.length-1;_>=0;_--)if(this.__items[_].match(g))return!0;return!1},l.prototype.set_indent=function(g,_){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=_||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},l.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(g){this.__items.push(g);var _=g.lastIndexOf(`
`);_!==-1?this.__character_count=g.length-_:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function X(g,_){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),_=_||"",g.indent_level>0&&(_=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=_,this.__base_string_length=_.length}X.prototype.get_indent_size=function(g,_){var E=this.__base_string_length;return _=_||0,g<0&&(E=0),E+=g*this.__indent_size,E+=_,E},X.prototype.get_indent_string=function(g,_){var E=this.__base_string;return _=_||0,g<0&&(g=0,E=""),_+=g*this.__indent_size,this.__ensure_cache(_),E+=this.__cache[_],E},X.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},X.prototype.__add_column=function(){var g=this.__cache.length,_=0,E="";this.__indent_size&&g>=this.__indent_size&&(_=Math.floor(g/this.__indent_size),g-=_*this.__indent_size,E=new Array(_+1).join(this.__indent_string)),g&&(E+=new Array(g+1).join(" ")),this.__cache.push(E)};function P(g,_){this.__indent_cache=new X(g,_),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}P.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},P.prototype.get_line_number=function(){return this.__lines.length},P.prototype.get_indent_string=function(g,_){return this.__indent_cache.get_indent_string(g,_)},P.prototype.get_indent_size=function(g,_){return this.__indent_cache.get_indent_size(g,_)},P.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},P.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},P.prototype.get_code=function(g){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var E=this.__lines.join(`
`);return g!==`
`&&(E=E.replace(/[\n]/g,g)),E},P.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},P.prototype.set_indent=function(g,_){return g=g||0,_=_||0,this.next_line.set_indent(g,_),this.__lines.length>1?(this.current_line.set_indent(g,_),!0):(this.current_line.set_indent(),!1)},P.prototype.add_raw_token=function(g){for(var _=0;_<g.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},P.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},P.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},P.prototype.remove_indent=function(g){for(var _=this.__lines.length;g<_;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},P.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},P.prototype.just_added_newline=function(){return this.current_line.is_empty()},P.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},P.prototype.ensure_empty_line_above=function(g,_){for(var E=this.__lines.length-2;E>=0;){var A=this.__lines[E];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==_){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},ce.exports.Output=P},,,,function(ce){function l(g,_){this.raw_options=X(g,_),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(g,_){var E=this.raw_options[g],A=_||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(A=E.concat()):typeof E=="string"&&(A=E.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,_){var E=this.raw_options[g],A=E===void 0?!!_:!!E;return A},l.prototype._get_characters=function(g,_){var E=this.raw_options[g],A=_||"";return typeof E=="string"&&(A=E.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,_){var E=this.raw_options[g];_=parseInt(_,10),isNaN(_)&&(_=0);var A=parseInt(E,10);return isNaN(A)&&(A=_),A},l.prototype._get_selection=function(g,_,E){var A=this._get_selection_list(g,_,E);if(A.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A[0]},l.prototype._get_selection_list=function(g,_,E){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[_[0]],!this._is_valid_selection(E,_))throw new Error("Invalid Default Value!");var A=this._get_array(g,E);if(!this._is_valid_selection(A,_))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A},l.prototype._is_valid_selection=function(g,_){return g.length&&_.length&&!g.some(function(E){return _.indexOf(E)===-1})};function X(g,_){var E={};g=P(g);var A;for(A in g)A!==_&&(E[A]=g[A]);if(_&&g[_])for(A in g[_])E[A]=g[_][A];return E}function P(g){var _={},E;for(E in g){var A=E.replace(/-/g,"_");_[A]=g[E]}return _}ce.exports.Options=l,ce.exports.normalizeOpts=P,ce.exports.mergeOpts=X},,function(ce){var l=RegExp.prototype.hasOwnProperty("sticky");function X(P){this.__input=P||"",this.__input_length=this.__input.length,this.__position=0}X.prototype.restart=function(){this.__position=0},X.prototype.back=function(){this.__position>0&&(this.__position-=1)},X.prototype.hasNext=function(){return this.__position<this.__input_length},X.prototype.next=function(){var P=null;return this.hasNext()&&(P=this.__input.charAt(this.__position),this.__position+=1),P},X.prototype.peek=function(P){var g=null;return P=P||0,P+=this.__position,P>=0&&P<this.__input_length&&(g=this.__input.charAt(P)),g},X.prototype.__match=function(P,g){P.lastIndex=g;var _=P.exec(this.__input);return _&&!(l&&P.sticky)&&_.index!==g&&(_=null),_},X.prototype.test=function(P,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(P,g):!1},X.prototype.testChar=function(P,g){var _=this.peek(g);return P.lastIndex=0,_!==null&&P.test(_)},X.prototype.match=function(P){var g=this.__match(P,this.__position);return g?this.__position+=g[0].length:g=null,g},X.prototype.read=function(P,g,_){var E="",A;return P&&(A=this.match(P),A&&(E+=A[0])),g&&(A||!P)&&(E+=this.readUntil(g,_)),E},X.prototype.readUntil=function(P,g){var _="",E=this.__position;P.lastIndex=this.__position;var A=P.exec(this.__input);return A?(E=A.index,g&&(E+=A[0].length)):E=this.__input_length,_=this.__input.substring(this.__position,E),this.__position=E,_},X.prototype.readUntilAfter=function(P){return this.readUntil(P,!0)},X.prototype.get_regexp=function(P,g){var _=null,E="g";return g&&l&&(E="y"),typeof P=="string"&&P!==""?_=new RegExp(P,E):P&&(_=new RegExp(P.source,E)),_},X.prototype.get_literal_regexp=function(P){return RegExp(P.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},X.prototype.peekUntilAfter=function(P){var g=this.__position,_=this.readUntilAfter(P);return this.__position=g,_},X.prototype.lookBack=function(P){var g=this.__position-1;return g>=P.length&&this.__input.substring(g-P.length,g).toLowerCase()===P},ce.exports.InputScanner=X},,,,,function(ce){function l(X,P){X=typeof X=="string"?X:X.source,P=typeof P=="string"?P:P.source,this.__directives_block_pattern=new RegExp(X+/ beautify( \w+[:]\w+)+ /.source+P,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(X+/\sbeautify\signore:end\s/.source+P,"g")}l.prototype.get_directives=function(X){if(!X.match(this.__directives_block_pattern))return null;var P={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(X);g;)P[g[1]]=g[2],g=this.__directive_pattern.exec(X);return P},l.prototype.readIgnored=function(X){return X.readUntilAfter(this.__directives_end_ignore_pattern)},ce.exports.Directives=l},,function(ce,l,X){var P=X(16).Beautifier,g=X(17).Options;function _(E,A){var M=new P(E,A);return M.beautify()}ce.exports=_,ce.exports.defaultOptions=function(){return new g}},function(ce,l,X){var P=X(17).Options,g=X(2).Output,_=X(8).InputScanner,E=X(13).Directives,A=new E(/\/\*/,/\*\//),M=/\r\n|[\r\n]/,H=/\r\n|[\r\n]/g,V=/\s/,L=/(?:\s|\n)+/g,I=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function R(q,se){this._source_text=q||"",this._options=new P(se),this._ch=null,this._input=null,this.NESTED_AT_RULE={page:!0,"font-face":!0,keyframes:!0,media:!0,supports:!0,document:!0},this.CONDITIONAL_GROUP_RULE={media:!0,supports:!0,document:!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}R.prototype.eatString=function(q){var se="";for(this._ch=this._input.next();this._ch;){if(se+=this._ch,this._ch==="\\")se+=this._input.next();else if(q.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return se},R.prototype.eatWhitespace=function(q){for(var se=V.test(this._input.peek()),te=0;V.test(this._input.peek());)this._ch=this._input.next(),q&&this._ch===`
`&&(te===0||te<this._options.max_preserve_newlines)&&(te++,this._output.add_new_line(!0));return se},R.prototype.foundNestedPseudoClass=function(){for(var q=0,se=1,te=this._input.peek(se);te;){if(te==="{")return!0;if(te==="(")q+=1;else if(te===")"){if(q===0)return!1;q-=1}else if(te===";"||te==="}")return!1;se++,te=this._input.peek(se)}return!1},R.prototype.print_string=function(q){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(q)},R.prototype.preserveSingleSpace=function(q){q&&(this._output.space_before_token=!0)},R.prototype.indent=function(){this._indentLevel++},R.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},R.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var q=this._source_text,se=this._options.eol;se==="auto"&&(se=`
`,q&&M.test(q||"")&&(se=q.match(M)[0])),q=q.replace(H,`
`);var te=q.match(/^[\t ]*/)[0];this._output=new g(this._options,te),this._input=new _(q),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ge=0,Le=!1,xe=!1,$e=!1,J=!1,D=!1,N=this._ch,O=!1,oe,ie,S;oe=this._input.read(L),ie=oe!=="",S=N,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),N=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var v=this._input.read(I),z=A.get_directives(v);z&&z.ignore==="start"&&(v+=A.readIgnored(this._input)),this.print_string(v),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(w)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(ie),this.print_string(this._ch);var ae=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ae.match(/[ :]$/)&&(ae=this.eatString(": ").replace(/\s+$/,""),this.print_string(ae),this._output.space_before_token=!0),ge===0&&ae.indexOf(":")!==-1&&(xe=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(ie),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Te=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Te.match(/[ :]$/)&&(Te=this.eatString(": ").replace(/\s+$/,""),this.print_string(Te),this._output.space_before_token=!0),ge===0&&Te.indexOf(":")!==-1?(xe=!0,this.indent()):Te in this.NESTED_AT_RULE?(this._nestedLevel+=1,Te in this.CONDITIONAL_GROUP_RULE&&($e=!0)):ge===0&&!xe&&(J=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(ie),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")xe&&(xe=!1,this.outdent()),J=!1,$e?($e=!1,Le=this._indentLevel>=this._nestedLevel):Le=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&Le&&this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(S==="("?this._output.space_before_token=!1:S!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),S==="{"&&this._output.trim(!0),xe&&(this.outdent(),xe=!1),this.print_string(this._ch),Le=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&this._input.peek()!=="}"&&this._output.add_new_line(!0),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var Fe=0;Fe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Fe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Fe])){O=!0;break}(Le||$e)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!J&&ge===0?(this.print_string(":"),xe||(xe=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Ye=S==='"'||S==="'";this.preserveSingleSpace(Ye||ie),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")O=!1,ge===0?(xe&&(this.outdent(),xe=!1),J=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),ge++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),ge&&(ge--,this.outdent()));else{var _t=!1;this._input.lookBack("with")&&(_t=!0),this.preserveSingleSpace(ie||_t),this.print_string(this._ch),xe&&S==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),D=!0):(this.eatWhitespace(),ge++,this.indent())}else if(this._ch===")")ge&&(ge--,this.outdent()),D&&this._input.peek()===";"&&this._options.selector_separator_newline&&(D=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!xe||D)&&ge===0&&!J?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!xe&&ge===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&V.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(ie),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),V.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Ut=S==='"'||S==="'";this.preserveSingleSpace(Ut||ie),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&O&&this._output.add_new_line()}var si=this._output.get_code(se);return si},ce.exports.Beautifier=R},function(ce,l,X){var P=X(6).Options;function g(_){P.call(this,_,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var E=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||E;var A=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var M=0;M<A.length;M++)A[M]!=="expand"?this.brace_style="collapse":this.brace_style=A[M]}g.prototype=new P,ce.exports.Options=g}],j={};function p(ce){var l=j[ce];if(l!==void 0)return l.exports;var X=j[ce]={exports:{}};return he[ce](X,X.exports,p),X.exports}var me=p(15);de=me})();var Se=de;K=[],B=function(){return{css_beautify:Se}}.apply(st,K),B!==void 0&&(Xt.exports=B)})()},40998:function(Xt,st,K){var B,de;(function(){var Se;(function(){"use strict";var me=[,,function(P){function g(A){this.__parent=A,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}g.prototype.clone_empty=function(){var A=new g(this.__parent);return A.set_indent(this.__indent_count,this.__alignment_count),A},g.prototype.item=function(A){return A<0?this.__items[this.__items.length+A]:this.__items[A]},g.prototype.has_match=function(A){for(var M=this.__items.length-1;M>=0;M--)if(this.__items[M].match(A))return!0;return!1},g.prototype.set_indent=function(A,M){this.is_empty()&&(this.__indent_count=A||0,this.__alignment_count=M||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},g.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},g.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},g.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var A=this.__parent.current_line;return A.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),A.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),A.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,A.__items[0]===" "&&(A.__items.splice(0,1),A.__character_count-=1),!0}return!1},g.prototype.is_empty=function(){return this.__items.length===0},g.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},g.prototype.push=function(A){this.__items.push(A);var M=A.lastIndexOf(`
`);M!==-1?this.__character_count=A.length-M:this.__character_count+=A.length},g.prototype.pop=function(){var A=null;return this.is_empty()||(A=this.__items.pop(),this.__character_count-=A.length),A},g.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},g.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},g.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},g.prototype.toString=function(){var A="";return this.is_empty()?this.__parent.indent_empty_lines&&(A=this.__parent.get_indent_string(this.__indent_count)):(A=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),A+=this.__items.join("")),A};function _(A,M){this.__cache=[""],this.__indent_size=A.indent_size,this.__indent_string=A.indent_char,A.indent_with_tabs||(this.__indent_string=new Array(A.indent_size+1).join(A.indent_char)),M=M||"",A.indent_level>0&&(M=new Array(A.indent_level+1).join(this.__indent_string)),this.__base_string=M,this.__base_string_length=M.length}_.prototype.get_indent_size=function(A,M){var H=this.__base_string_length;return M=M||0,A<0&&(H=0),H+=A*this.__indent_size,H+=M,H},_.prototype.get_indent_string=function(A,M){var H=this.__base_string;return M=M||0,A<0&&(A=0,H=""),M+=A*this.__indent_size,this.__ensure_cache(M),H+=this.__cache[M],H},_.prototype.__ensure_cache=function(A){for(;A>=this.__cache.length;)this.__add_column()},_.prototype.__add_column=function(){var A=this.__cache.length,M=0,H="";this.__indent_size&&A>=this.__indent_size&&(M=Math.floor(A/this.__indent_size),A-=M*this.__indent_size,H=new Array(M+1).join(this.__indent_string)),A&&(H+=new Array(A+1).join(" ")),this.__cache.push(H)};function E(A,M){this.__indent_cache=new _(A,M),this.raw=!1,this._end_with_newline=A.end_with_newline,this.indent_size=A.indent_size,this.wrap_line_length=A.wrap_line_length,this.indent_empty_lines=A.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new g(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}E.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},E.prototype.get_line_number=function(){return this.__lines.length},E.prototype.get_indent_string=function(A,M){return this.__indent_cache.get_indent_string(A,M)},E.prototype.get_indent_size=function(A,M){return this.__indent_cache.get_indent_size(A,M)},E.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},E.prototype.add_new_line=function(A){return this.is_empty()||!A&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},E.prototype.get_code=function(A){this.trim(!0);var M=this.current_line.pop();M&&(M[M.length-1]===`
`&&(M=M.replace(/\n+$/g,"")),this.current_line.push(M)),this._end_with_newline&&this.__add_outputline();var H=this.__lines.join(`
`);return A!==`
`&&(H=H.replace(/[\n]/g,A)),H},E.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},E.prototype.set_indent=function(A,M){return A=A||0,M=M||0,this.next_line.set_indent(A,M),this.__lines.length>1?(this.current_line.set_indent(A,M),!0):(this.current_line.set_indent(),!1)},E.prototype.add_raw_token=function(A){for(var M=0;M<A.newlines;M++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(A.whitespace_before),this.current_line.push(A.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},E.prototype.add_token=function(A){this.__add_space_before_token(),this.current_line.push(A),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},E.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},E.prototype.remove_indent=function(A){for(var M=this.__lines.length;A<M;)this.__lines[A]._remove_indent(),A++;this.current_line._remove_wrap_indent()},E.prototype.trim=function(A){for(A=A===void 0?!1:A,this.current_line.trim();A&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},E.prototype.just_added_newline=function(){return this.current_line.is_empty()},E.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},E.prototype.ensure_empty_line_above=function(A,M){for(var H=this.__lines.length-2;H>=0;){var V=this.__lines[H];if(V.is_empty())break;if(V.item(0).indexOf(A)!==0&&V.item(-1)!==M){this.__lines.splice(H+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}H--}},P.exports.Output=E},function(P){function g(_,E,A,M){this.type=_,this.text=E,this.comments_before=null,this.newlines=A||0,this.whitespace_before=M||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}P.exports.Token=g},,,function(P){function g(A,M){this.raw_options=_(A,M),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}g.prototype._get_array=function(A,M){var H=this.raw_options[A],V=M||[];return typeof H=="object"?H!==null&&typeof H.concat=="function"&&(V=H.concat()):typeof H=="string"&&(V=H.split(/[^a-zA-Z0-9_\/\-]+/)),V},g.prototype._get_boolean=function(A,M){var H=this.raw_options[A],V=H===void 0?!!M:!!H;return V},g.prototype._get_characters=function(A,M){var H=this.raw_options[A],V=M||"";return typeof H=="string"&&(V=H.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),V},g.prototype._get_number=function(A,M){var H=this.raw_options[A];M=parseInt(M,10),isNaN(M)&&(M=0);var V=parseInt(H,10);return isNaN(V)&&(V=M),V},g.prototype._get_selection=function(A,M,H){var V=this._get_selection_list(A,M,H);if(V.length!==1)throw new Error("Invalid Option Value: The option '"+A+`' can only be one of the following values:
`+M+`
You passed in: '`+this.raw_options[A]+"'");return V[0]},g.prototype._get_selection_list=function(A,M,H){if(!M||M.length===0)throw new Error("Selection list cannot be empty.");if(H=H||[M[0]],!this._is_valid_selection(H,M))throw new Error("Invalid Default Value!");var V=this._get_array(A,H);if(!this._is_valid_selection(V,M))throw new Error("Invalid Option Value: The option '"+A+`' can contain only the following values:
`+M+`
You passed in: '`+this.raw_options[A]+"'");return V},g.prototype._is_valid_selection=function(A,M){return A.length&&M.length&&!A.some(function(H){return M.indexOf(H)===-1})};function _(A,M){var H={};A=E(A);var V;for(V in A)V!==M&&(H[V]=A[V]);if(M&&A[M])for(V in A[M])H[V]=A[M][V];return H}function E(A){var M={},H;for(H in A){var V=H.replace(/-/g,"_");M[V]=A[H]}return M}P.exports.Options=g,P.exports.normalizeOpts=E,P.exports.mergeOpts=_},,function(P){var g=RegExp.prototype.hasOwnProperty("sticky");function _(E){this.__input=E||"",this.__input_length=this.__input.length,this.__position=0}_.prototype.restart=function(){this.__position=0},_.prototype.back=function(){this.__position>0&&(this.__position-=1)},_.prototype.hasNext=function(){return this.__position<this.__input_length},_.prototype.next=function(){var E=null;return this.hasNext()&&(E=this.__input.charAt(this.__position),this.__position+=1),E},_.prototype.peek=function(E){var A=null;return E=E||0,E+=this.__position,E>=0&&E<this.__input_length&&(A=this.__input.charAt(E)),A},_.prototype.__match=function(E,A){E.lastIndex=A;var M=E.exec(this.__input);return M&&!(g&&E.sticky)&&M.index!==A&&(M=null),M},_.prototype.test=function(E,A){return A=A||0,A+=this.__position,A>=0&&A<this.__input_length?!!this.__match(E,A):!1},_.prototype.testChar=function(E,A){var M=this.peek(A);return E.lastIndex=0,M!==null&&E.test(M)},_.prototype.match=function(E){var A=this.__match(E,this.__position);return A?this.__position+=A[0].length:A=null,A},_.prototype.read=function(E,A,M){var H="",V;return E&&(V=this.match(E),V&&(H+=V[0])),A&&(V||!E)&&(H+=this.readUntil(A,M)),H},_.prototype.readUntil=function(E,A){var M="",H=this.__position;E.lastIndex=this.__position;var V=E.exec(this.__input);return V?(H=V.index,A&&(H+=V[0].length)):H=this.__input_length,M=this.__input.substring(this.__position,H),this.__position=H,M},_.prototype.readUntilAfter=function(E){return this.readUntil(E,!0)},_.prototype.get_regexp=function(E,A){var M=null,H="g";return A&&g&&(H="y"),typeof E=="string"&&E!==""?M=new RegExp(E,H):E&&(M=new RegExp(E.source,H)),M},_.prototype.get_literal_regexp=function(E){return RegExp(E.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(E){var A=this.__position,M=this.readUntilAfter(E);return this.__position=A,M},_.prototype.lookBack=function(E){var A=this.__position-1;return A>=E.length&&this.__input.substring(A-E.length,A).toLowerCase()===E},P.exports.InputScanner=_},function(P,g,_){var E=_(8).InputScanner,A=_(3).Token,M=_(10).TokenStream,H=_(11).WhitespacePattern,V={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},L=function(I,w){this._input=new E(I),this._options=w||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new H(this._input)};L.prototype.tokenize=function(){this._input.restart(),this.__tokens=new M,this._reset();for(var I,w=new A(V.START,""),R=null,q=[],se=new M;w.type!==V.EOF;){for(I=this._get_next_token(w,R);this._is_comment(I);)se.add(I),I=this._get_next_token(w,R);se.isEmpty()||(I.comments_before=se,se=new M),I.parent=R,this._is_opening(I)?(q.push(R),R=I):R&&this._is_closing(I,R)&&(I.opened=R,R.closed=I,R=q.pop(),I.parent=R),I.previous=w,w.next=I,this.__tokens.add(I),w=I}return this.__tokens},L.prototype._is_first_token=function(){return this.__tokens.isEmpty()},L.prototype._reset=function(){},L.prototype._get_next_token=function(I,w){this._readWhitespace();var R=this._input.read(/.+/g);return R?this._create_token(V.RAW,R):this._create_token(V.EOF,"")},L.prototype._is_comment=function(I){return!1},L.prototype._is_opening=function(I){return!1},L.prototype._is_closing=function(I,w){return!1},L.prototype._create_token=function(I,w){var R=new A(I,w,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return R},L.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=L,P.exports.TOKEN=V},function(P){function g(_){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=_}g.prototype.restart=function(){this.__position=0},g.prototype.isEmpty=function(){return this.__tokens_length===0},g.prototype.hasNext=function(){return this.__position<this.__tokens_length},g.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__tokens[this.__position],this.__position+=1),_},g.prototype.peek=function(_){var E=null;return _=_||0,_+=this.__position,_>=0&&_<this.__tokens_length&&(E=this.__tokens[_]),E},g.prototype.add=function(_){this.__parent_token&&(_.parent=this.__parent_token),this.__tokens.push(_),this.__tokens_length+=1},P.exports.TokenStream=g},function(P,g,_){var E=_(12).Pattern;function A(M,H){E.call(this,M,H),H?this._line_regexp=this._input.get_regexp(H._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}A.prototype=new E,A.prototype.__set_whitespace_patterns=function(M,H){M+="\\t ",H+="\\n\\r",this._match_pattern=this._input.get_regexp("["+M+H+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+H+"]")},A.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var M=this._input.read(this._match_pattern);if(M===" ")this.whitespace_before_token=" ";else if(M){var H=this.__split(this._newline_regexp,M);this.newline_count=H.length-1,this.whitespace_before_token=H[this.newline_count]}return M},A.prototype.matching=function(M,H){var V=this._create();return V.__set_whitespace_patterns(M,H),V._update(),V},A.prototype._create=function(){return new A(this._input,this)},A.prototype.__split=function(M,H){M.lastIndex=0;for(var V=0,L=[],I=M.exec(H);I;)L.push(H.substring(V,I.index)),V=I.index+I[0].length,I=M.exec(H);return V<H.length?L.push(H.substring(V,H.length)):L.push(""),L},P.exports.WhitespacePattern=A},function(P){function g(_,E){this._input=_,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,E&&(this._starting_pattern=this._input.get_regexp(E._starting_pattern,!0),this._match_pattern=this._input.get_regexp(E._match_pattern,!0),this._until_pattern=this._input.get_regexp(E._until_pattern),this._until_after=E._until_after)}g.prototype.read=function(){var _=this._input.read(this._starting_pattern);return(!this._starting_pattern||_)&&(_+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),_},g.prototype.read_match=function(){return this._input.match(this._match_pattern)},g.prototype.until_after=function(_){var E=this._create();return E._until_after=!0,E._until_pattern=this._input.get_regexp(_),E._update(),E},g.prototype.until=function(_){var E=this._create();return E._until_after=!1,E._until_pattern=this._input.get_regexp(_),E._update(),E},g.prototype.starting_with=function(_){var E=this._create();return E._starting_pattern=this._input.get_regexp(_,!0),E._update(),E},g.prototype.matching=function(_){var E=this._create();return E._match_pattern=this._input.get_regexp(_,!0),E._update(),E},g.prototype._create=function(){return new g(this._input,this)},g.prototype._update=function(){},P.exports.Pattern=g},function(P){function g(_,E){_=typeof _=="string"?_:_.source,E=typeof E=="string"?E:E.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+E,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+E,"g")}g.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var E={};this.__directive_pattern.lastIndex=0;for(var A=this.__directive_pattern.exec(_);A;)E[A[1]]=A[2],A=this.__directive_pattern.exec(_);return E},g.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=g},function(P,g,_){var E=_(12).Pattern,A={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function M(H,V){E.call(this,H,V),this.__template_pattern=null,this._disabled=Object.assign({},A),this._excluded=Object.assign({},A),V&&(this.__template_pattern=this._input.get_regexp(V.__template_pattern),this._excluded=Object.assign(this._excluded,V._excluded),this._disabled=Object.assign(this._disabled,V._disabled));var L=new E(H);this.__patterns={handlebars_comment:L.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:L.starting_with(/{{{/).until_after(/}}}/),handlebars:L.starting_with(/{{/).until_after(/}}/),php:L.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:L.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:L.starting_with(/{%/).until_after(/%}/),django_value:L.starting_with(/{{/).until_after(/}}/),django_comment:L.starting_with(/{#/).until_after(/#}/),smarty:L.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:L.starting_with(/{\*/).until_after(/\*}/),smarty_literal:L.starting_with(/{literal}/).until_after(/{\/literal}/)}}M.prototype=new E,M.prototype._create=function(){return new M(this._input,this)},M.prototype._update=function(){this.__set_templated_pattern()},M.prototype.disable=function(H){var V=this._create();return V._disabled[H]=!0,V._update(),V},M.prototype.read_options=function(H){var V=this._create();for(var L in A)V._disabled[L]=H.templating.indexOf(L)===-1;return V._update(),V},M.prototype.exclude=function(H){var V=this._create();return V._excluded[H]=!0,V._update(),V},M.prototype.read=function(){var H="";this._match_pattern?H=this._input.read(this._starting_pattern):H=this._input.read(this._starting_pattern,this.__template_pattern);for(var V=this._read_template();V;)this._match_pattern?V+=this._input.read(this._match_pattern):V+=this._input.readUntil(this.__template_pattern),H+=V,V=this._read_template();return this._until_after&&(H+=this._input.readUntilAfter(this._until_pattern)),H},M.prototype.__set_templated_pattern=function(){var H=[];this._disabled.php||H.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||H.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(H.push(this.__patterns.django._starting_pattern.source),H.push(this.__patterns.django_value._starting_pattern.source),H.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||H.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&H.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+H.join("|")+")")},M.prototype._read_template=function(){var H="",V=this._input.peek();if(V==="<"){var L=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&L==="?"&&(H=H||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&L==="%"&&(H=H||this.__patterns.erb.read())}else V==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(H=H||this.__patterns.handlebars_comment.read(),H=H||this.__patterns.handlebars_unescaped.read(),H=H||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(H=H||this.__patterns.django_value.read()),this._excluded.django||(H=H||this.__patterns.django_comment.read(),H=H||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(H=H||this.__patterns.smarty_comment.read(),H=H||this.__patterns.smarty_literal.read(),H=H||this.__patterns.smarty.read()));return H},P.exports.TemplatablePattern=M},,,,function(P,g,_){var E=_(19).Beautifier,A=_(20).Options;function M(H,V,L,I){var w=new E(H,V,L,I);return w.beautify()}P.exports=M,P.exports.defaultOptions=function(){return new A}},function(P,g,_){var E=_(20).Options,A=_(2).Output,M=_(21).Tokenizer,H=_(21).TOKEN,V=/\r\n|[\r\n]/,L=/\r\n|[\r\n]/g,I=function(J,D){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=J.max_preserve_newlines,this.preserve_newlines=J.preserve_newlines,this._output=new A(J,D)};I.prototype.current_line_has_match=function(J){return this._output.current_line.has_match(J)},I.prototype.set_space_before_token=function(J,D){this._output.space_before_token=J,this._output.non_breaking_space=D},I.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},I.prototype.add_raw_token=function(J){this._output.add_raw_token(J)},I.prototype.print_preserved_newlines=function(J){var D=0;J.type!==H.TEXT&&J.previous.type!==H.TEXT&&(D=J.newlines?1:0),this.preserve_newlines&&(D=J.newlines<this.max_preserve_newlines+1?J.newlines:this.max_preserve_newlines+1);for(var N=0;N<D;N++)this.print_newline(N>0);return D!==0},I.prototype.traverse_whitespace=function(J){return J.whitespace_before||J.newlines?(this.print_preserved_newlines(J)||(this._output.space_before_token=!0),!0):!1},I.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},I.prototype.print_newline=function(J){this._output.add_new_line(J)},I.prototype.print_token=function(J){J.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(J.text))},I.prototype.indent=function(){this.indent_level++},I.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},I.prototype.get_full_indent=function(J){return J=this.indent_level+(J||0),J<1?"":this._output.get_indent_string(J)};var w=function(J){for(var D=null,N=J.next;N.type!==H.EOF&&J.closed!==N;){if(N.type===H.ATTRIBUTE&&N.text==="type"){N.next&&N.next.type===H.EQUALS&&N.next.next&&N.next.next.type===H.VALUE&&(D=N.next.next.text);break}N=N.next}return D},R=function(J,D){var N=null,O=null;return D.closed?(J==="script"?N="text/javascript":J==="style"&&(N="text/css"),N=w(D)||N,N.search("text/css")>-1?O="css":N.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?O="javascript":N.search(/(text|application|dojo)\/(x-)?(html)/)>-1?O="html":N.search(/test\/null/)>-1&&(O="null"),O):null};function q(J,D){return D.indexOf(J)!==-1}function se(J,D,N){this.parent=J||null,this.tag=D?D.tag_name:"",this.indent_level=N||0,this.parser_token=D||null}function te(J){this._printer=J,this._current_frame=null}te.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},te.prototype.record_tag=function(J){var D=new se(this._current_frame,J,this._printer.indent_level);this._current_frame=D},te.prototype._try_pop_frame=function(J){var D=null;return J&&(D=J.parser_token,this._printer.indent_level=J.indent_level,this._current_frame=J.parent),D},te.prototype._get_frame=function(J,D){for(var N=this._current_frame;N&&J.indexOf(N.tag)===-1;){if(D&&D.indexOf(N.tag)!==-1){N=null;break}N=N.parent}return N},te.prototype.try_pop=function(J,D){var N=this._get_frame([J],D);return this._try_pop_frame(N)},te.prototype.indent_to_tag=function(J){var D=this._get_frame(J);D&&(this._printer.indent_level=D.indent_level)};function ge(J,D,N,O){this._source_text=J||"",D=D||{},this._js_beautify=N,this._css_beautify=O,this._tag_stack=null;var oe=new E(D,"html");this._options=oe,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}ge.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var J=this._source_text,D=this._options.eol;this._options.eol==="auto"&&(D=`
`,J&&V.test(J)&&(D=J.match(V)[0])),J=J.replace(L,`
`);var N=J.match(/^[\t ]*/)[0],O={text:"",type:""},oe=new Le(this._options),ie=new I(this._options,N),S=new M(J,this._options).tokenize();this._tag_stack=new te(ie);for(var v=null,z=S.next();z.type!==H.EOF;)z.type===H.TAG_OPEN||z.type===H.COMMENT?(v=this._handle_tag_open(ie,z,oe,O,S),oe=v):z.type===H.ATTRIBUTE||z.type===H.EQUALS||z.type===H.VALUE||z.type===H.TEXT&&!oe.tag_complete?v=this._handle_inside_tag(ie,z,oe,O):z.type===H.TAG_CLOSE?v=this._handle_tag_close(ie,z,oe):z.type===H.TEXT?v=this._handle_text(ie,z,oe):z.type===H.CONTROL_FLOW_OPEN?v=this._handle_control_flow_open(ie,z):z.type===H.CONTROL_FLOW_CLOSE?v=this._handle_control_flow_close(ie,z):ie.add_raw_token(z),O=v,z=S.next();var ae=ie._output.get_code(D);return ae},ge.prototype._handle_control_flow_open=function(J,D){var N={text:D.text,type:D.type};return J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),D.newlines?J.print_preserved_newlines(D):J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),J.print_token(D),J.indent(),N},ge.prototype._handle_control_flow_close=function(J,D){var N={text:D.text,type:D.type};return J.deindent(),D.newlines?J.print_preserved_newlines(D):J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),J.print_token(D),N},ge.prototype._handle_tag_close=function(J,D,N){var O={text:D.text,type:D.type};return J.alignment_size=0,N.tag_complete=!0,J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),N.is_unformatted?J.add_raw_token(D):(N.tag_start_char==="<"&&(J.set_space_before_token(D.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&N.has_wrapped_attrs&&J.print_newline(!1)),J.print_token(D)),N.indent_content&&!(N.is_unformatted||N.is_content_unformatted)&&(J.indent(),N.indent_content=!1),!N.is_inline_element&&!(N.is_unformatted||N.is_content_unformatted)&&J.set_wrap_point(),O},ge.prototype._handle_inside_tag=function(J,D,N,O){var oe=N.has_wrapped_attrs,ie={text:D.text,type:D.type};return J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),N.is_unformatted?J.add_raw_token(D):N.tag_start_char==="{"&&D.type===H.TEXT?J.print_preserved_newlines(D)?(D.newlines=0,J.add_raw_token(D)):J.print_token(D):(D.type===H.ATTRIBUTE?J.set_space_before_token(!0):(D.type===H.EQUALS||D.type===H.VALUE&&D.previous.type===H.EQUALS)&&J.set_space_before_token(!1),D.type===H.ATTRIBUTE&&N.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(J.traverse_whitespace(D),oe=oe||D.newlines!==0),this._is_wrap_attributes_force&&N.attr_count>=this._options.wrap_attributes_min_attrs&&(O.type!==H.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(J.print_newline(!1),oe=!0)),J.print_token(D),oe=oe||J.previous_token_wrapped(),N.has_wrapped_attrs=oe),ie},ge.prototype._handle_text=function(J,D,N){var O={text:D.text,type:"TK_CONTENT"};return N.custom_beautifier_name?this._print_custom_beatifier_text(J,D,N):N.is_unformatted||N.is_content_unformatted?J.add_raw_token(D):(J.traverse_whitespace(D),J.print_token(D)),O},ge.prototype._print_custom_beatifier_text=function(J,D,N){var O=this;if(D.text!==""){var oe=D.text,ie,S=1,v="",z="";N.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?ie=this._js_beautify:N.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?ie=this._css_beautify:N.custom_beautifier_name==="html"&&(ie=function(Ut,si){var Ge=new ge(Ut,si,O._js_beautify,O._css_beautify);return Ge.beautify()}),this._options.indent_scripts==="keep"?S=0:this._options.indent_scripts==="separate"&&(S=-J.indent_level);var ae=J.get_full_indent(S);if(oe=oe.replace(/\n[ \t]*$/,""),N.custom_beautifier_name!=="html"&&oe[0]==="<"&&oe.match(/^(<!--|<!\[CDATA\[)/)){var Te=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(oe);if(!Te){J.add_raw_token(D);return}v=ae+Te[1]+`
`,oe=Te[4],Te[5]&&(z=ae+Te[5]),oe=oe.replace(/\n[ \t]*$/,""),(Te[2]||Te[3].indexOf(`
`)!==-1)&&(Te=Te[3].match(/[ \t]+$/),Te&&(D.whitespace_before=Te[0]))}if(oe)if(ie){var Fe=function(){this.eol=`
`};Fe.prototype=this._options.raw_options;var Ye=new Fe;oe=ie(ae+oe,Ye)}else{var _t=D.whitespace_before;_t&&(oe=oe.replace(new RegExp(`
(`+_t+")?","g"),`
`)),oe=ae+oe.replace(/\n/g,`
`+ae)}v&&(oe?oe=v+oe+`
`+z:oe=v+z),J.print_newline(!1),oe&&(D.text=oe,D.whitespace_before="",D.newlines=0,J.add_raw_token(D),J.print_newline(!0))}},ge.prototype._handle_tag_open=function(J,D,N,O,oe){var ie=this._get_tag_open_token(D);if((N.is_unformatted||N.is_content_unformatted)&&!N.is_empty_element&&D.type===H.TAG_OPEN&&!ie.is_start_tag?(J.add_raw_token(D),ie.start_tag_token=this._tag_stack.try_pop(ie.tag_name)):(J.traverse_whitespace(D),this._set_tag_position(J,D,ie,N,O),ie.is_inline_element||J.set_wrap_point(),J.print_token(D)),ie.is_start_tag&&this._is_wrap_attributes_force){var S=0,v;do v=oe.peek(S),v.type===H.ATTRIBUTE&&(ie.attr_count+=1),S+=1;while(v.type!==H.EOF&&v.type!==H.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(ie.alignment_size=D.text.length+1),!ie.tag_complete&&!ie.is_unformatted&&(J.alignment_size=ie.alignment_size),ie};var Le=function(J,D,N){if(this.parent=D||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!N)this.tag_complete=!0;else{var O;this.tag_start_char=N.text[0],this.text=N.text,this.tag_start_char==="<"?(O=N.text.match(/^<([^\s>]*)/),this.tag_check=O?O[1]:""):(O=N.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=O?O[1]:"",(N.text.startsWith("{{#>")||N.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&N.next!==null?this.tag_check=N.next.text.split(" ")[0]:this.tag_check=N.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),N.type===H.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||N.closed&&N.closed.text==="/>";var oe=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(oe=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!J.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(oe)))}};ge.prototype._get_tag_open_token=function(J){var D=new Le(this._options,this._tag_stack.get_parser_token(),J);return D.alignment_size=this._options.wrap_attributes_indent_size,D.is_end_tag=D.is_end_tag||q(D.tag_check,this._options.void_elements),D.is_empty_element=D.tag_complete||D.is_start_tag&&D.is_end_tag,D.is_unformatted=!D.tag_complete&&q(D.tag_check,this._options.unformatted),D.is_content_unformatted=!D.is_empty_element&&q(D.tag_check,this._options.content_unformatted),D.is_inline_element=q(D.tag_name,this._options.inline)||this._options.inline_custom_elements&&D.tag_name.includes("-")||D.tag_start_char==="{",D},ge.prototype._set_tag_position=function(J,D,N,O,oe){if(N.is_empty_element||(N.is_end_tag?N.start_tag_token=this._tag_stack.try_pop(N.tag_name):(this._do_optional_end_element(N)&&(N.is_inline_element||J.print_newline(!1)),this._tag_stack.record_tag(N),(N.tag_name==="script"||N.tag_name==="style")&&!(N.is_unformatted||N.is_content_unformatted)&&(N.custom_beautifier_name=R(N.tag_check,D)))),q(N.tag_check,this._options.extra_liners)&&(J.print_newline(!1),J._output.just_added_blankline()||J.print_newline(!0)),N.is_empty_element){if(N.tag_start_char==="{"&&N.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),N.indent_content=!0;var ie=J.current_line_has_match(/{{#if/);ie||J.print_newline(!1)}N.tag_name==="!--"&&oe.type===H.TAG_CLOSE&&O.is_end_tag&&N.text.indexOf(`
`)===-1||(N.is_inline_element||N.is_unformatted||J.print_newline(!1),this._calcluate_parent_multiline(J,N))}else if(N.is_end_tag){var S=!1;S=N.start_tag_token&&N.start_tag_token.multiline_content,S=S||!N.is_inline_element&&!(O.is_inline_element||O.is_unformatted)&&!(oe.type===H.TAG_CLOSE&&N.start_tag_token===O)&&oe.type!=="TK_CONTENT",(N.is_content_unformatted||N.is_unformatted)&&(S=!1),S&&J.print_newline(!1)}else N.indent_content=!N.custom_beautifier_name,N.tag_start_char==="<"&&(N.tag_name==="html"?N.indent_content=this._options.indent_inner_html:N.tag_name==="head"?N.indent_content=this._options.indent_head_inner_html:N.tag_name==="body"&&(N.indent_content=this._options.indent_body_inner_html)),!(N.is_inline_element||N.is_unformatted)&&(oe.type!=="TK_CONTENT"||N.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,N)},ge.prototype._calcluate_parent_multiline=function(J,D){D.parent&&J._output.just_added_newline()&&!((D.is_inline_element||D.is_unformatted)&&D.parent.is_inline_element)&&(D.parent.multiline_content=!0)};var xe=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","menu","nav","ol","p","pre","section","table","ul"],$e=["a","audio","del","ins","map","noscript","video"];ge.prototype._do_optional_end_element=function(J){var D=null;if(!(J.is_empty_element||!J.is_start_tag||!J.parent)){if(J.tag_name==="body")D=D||this._tag_stack.try_pop("head");else if(J.tag_name==="li")D=D||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(J.tag_name==="dd"||J.tag_name==="dt")D=D||this._tag_stack.try_pop("dt",["dl"]),D=D||this._tag_stack.try_pop("dd",["dl"]);else if(J.parent.tag_name==="p"&&xe.indexOf(J.tag_name)!==-1){var N=J.parent.parent;(!N||$e.indexOf(N.tag_name)===-1)&&(D=D||this._tag_stack.try_pop("p"))}else J.tag_name==="rp"||J.tag_name==="rt"?(D=D||this._tag_stack.try_pop("rt",["ruby","rtc"]),D=D||this._tag_stack.try_pop("rp",["ruby","rtc"])):J.tag_name==="optgroup"?D=D||this._tag_stack.try_pop("optgroup",["select"]):J.tag_name==="option"?D=D||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):J.tag_name==="colgroup"?D=D||this._tag_stack.try_pop("caption",["table"]):J.tag_name==="thead"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"])):J.tag_name==="tbody"||J.tag_name==="tfoot"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"]),D=D||this._tag_stack.try_pop("thead",["table"]),D=D||this._tag_stack.try_pop("tbody",["table"])):J.tag_name==="tr"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"]),D=D||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(J.tag_name==="th"||J.tag_name==="td")&&(D=D||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),D=D||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return J.parent=this._tag_stack.get_parser_token(),D}},P.exports.Beautifier=ge},function(P,g,_){var E=_(6).Options;function A(M){E.call(this,M,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}A.prototype=new E,P.exports.Options=A},function(P,g,_){var E=_(9).Tokenizer,A=_(9).TOKEN,M=_(13).Directives,H=_(14).TemplatablePattern,V=_(12).Pattern,L={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",CONTROL_FLOW_OPEN:"TK_CONTROL_FLOW_OPEN",CONTROL_FLOW_CLOSE:"TK_CONTROL_FLOW_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:A.START,RAW:A.RAW,EOF:A.EOF},I=new M(/<\!--/,/-->/),w=function(R,q){E.call(this,R,q),this._current_tag_name="";var se=new H(this._input).read_options(this._options),te=new V(this._input);if(this.__patterns={word:se.until(/[\n\r\t <]/),word_control_flow_close_excluded:se.until(/[\n\r\t <}]/),single_quote:se.until_after(/'/),double_quote:se.until_after(/"/),attribute:se.until(/[\n\r\t =>]|\/>/),element_name:se.until(/[\n\r\t >\/]/),angular_control_flow_start:te.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:te.starting_with(/{{!--/).until_after(/--}}/),handlebars:te.starting_with(/{{/).until_after(/}}/),handlebars_open:te.until(/[\n\r\t }]/),handlebars_raw_close:te.until(/}}/),comment:te.starting_with(/<!--/).until_after(/-->/),cdata:te.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:te.starting_with(/<!\[/).until_after(/]>/),processing:te.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"),this.__patterns.word_control_flow_close_excluded=this.__patterns.word_control_flow_close_excluded.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var ge=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=te.matching(ge).until_after(ge)}};w.prototype=new E,w.prototype._is_comment=function(R){return!1},w.prototype._is_opening=function(R){return R.type===L.TAG_OPEN||R.type===L.CONTROL_FLOW_OPEN},w.prototype._is_closing=function(R,q){return R.type===L.TAG_CLOSE&&q&&((R.text===">"||R.text==="/>")&&q.text[0]==="<"||R.text==="}}"&&q.text[0]==="{"&&q.text[1]==="{")||R.type===L.CONTROL_FLOW_CLOSE&&R.text==="}"&&q.text.endsWith("{")},w.prototype._reset=function(){this._current_tag_name=""},w.prototype._get_next_token=function(R,q){var se=null;this._readWhitespace();var te=this._input.peek();return te===null?this._create_token(L.EOF,""):(se=se||this._read_open_handlebars(te,q),se=se||this._read_attribute(te,R,q),se=se||this._read_close(te,q),se=se||this._read_script_and_style(te,R),se=se||this._read_control_flows(te,q),se=se||this._read_raw_content(te,R,q),se=se||this._read_content_word(te,q),se=se||this._read_comment_or_cdata(te),se=se||this._read_processing(te),se=se||this._read_open(te,q),se=se||this._create_token(L.UNKNOWN,this._input.next()),se)},w.prototype._read_comment_or_cdata=function(R){var q=null,se=null,te=null;if(R==="<"){var ge=this._input.peek(1);ge==="!"&&(se=this.__patterns.comment.read(),se?(te=I.get_directives(se),te&&te.ignore==="start"&&(se+=I.readIgnored(this._input))):se=this.__patterns.cdata.read()),se&&(q=this._create_token(L.COMMENT,se),q.directives=te)}return q},w.prototype._read_processing=function(R){var q=null,se=null,te=null;if(R==="<"){var ge=this._input.peek(1);(ge==="!"||ge==="?")&&(se=this.__patterns.conditional_comment.read(),se=se||this.__patterns.processing.read()),se&&(q=this._create_token(L.COMMENT,se),q.directives=te)}return q},w.prototype._read_open=function(R,q){var se=null,te=null;return(!q||q.type===L.CONTROL_FLOW_OPEN)&&R==="<"&&(se=this._input.next(),this._input.peek()==="/"&&(se+=this._input.next()),se+=this.__patterns.element_name.read(),te=this._create_token(L.TAG_OPEN,se)),te},w.prototype._read_open_handlebars=function(R,q){var se=null,te=null;return(!q||q.type===L.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&R==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(se=this.__patterns.handlebars_comment.read(),se=se||this.__patterns.handlebars.read(),te=this._create_token(L.COMMENT,se)):(se=this.__patterns.handlebars_open.read(),te=this._create_token(L.TAG_OPEN,se))),te},w.prototype._read_control_flows=function(R,q){var se="",te=null;if(!this._options.templating.includes("angular"))return te;if(R==="@"){if(se=this.__patterns.angular_control_flow_start.read(),se==="")return te;for(var ge=se.endsWith("(")?1:0,Le=0;!(se.endsWith("{")&&ge===Le);){var xe=this._input.next();if(xe===null)break;xe==="("?ge++:xe===")"&&Le++,se+=xe}te=this._create_token(L.CONTROL_FLOW_OPEN,se)}else R==="}"&&q&&q.type===L.CONTROL_FLOW_OPEN&&(se=this._input.next(),te=this._create_token(L.CONTROL_FLOW_CLOSE,se));return te},w.prototype._read_close=function(R,q){var se=null,te=null;return q&&q.type===L.TAG_OPEN&&(q.text[0]==="<"&&(R===">"||R==="/"&&this._input.peek(1)===">")?(se=this._input.next(),R==="/"&&(se+=this._input.next()),te=this._create_token(L.TAG_CLOSE,se)):q.text[0]==="{"&&R==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),te=this._create_token(L.TAG_CLOSE,"}}"))),te},w.prototype._read_attribute=function(R,q,se){var te=null,ge="";if(se&&se.text[0]==="<")if(R==="=")te=this._create_token(L.EQUALS,this._input.next());else if(R==='"'||R==="'"){var Le=this._input.next();R==='"'?Le+=this.__patterns.double_quote.read():Le+=this.__patterns.single_quote.read(),te=this._create_token(L.VALUE,Le)}else ge=this.__patterns.attribute.read(),ge&&(q.type===L.EQUALS?te=this._create_token(L.VALUE,ge):te=this._create_token(L.ATTRIBUTE,ge));return te},w.prototype._is_content_unformatted=function(R){return this._options.void_elements.indexOf(R)===-1&&(this._options.content_unformatted.indexOf(R)!==-1||this._options.unformatted.indexOf(R)!==-1)},w.prototype._read_raw_content=function(R,q,se){var te="";if(se&&se.text[0]==="{")te=this.__patterns.handlebars_raw_close.read();else if(q.type===L.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var ge=q.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ge)&&(te=this._input.readUntil(new RegExp("</"+ge+"[\\n\\r\\t ]*?>","ig")))}return te?this._create_token(L.TEXT,te):null},w.prototype._read_script_and_style=function(R,q){if(q.type===L.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var se=q.opened.text.substr(1).toLowerCase();if(se==="script"||se==="style"){var te=this._read_comment_or_cdata(R);if(te)return te.type=L.TEXT,te;var ge=this._input.readUntil(new RegExp("</"+se+"[\\n\\r\\t ]*?>","ig"));if(ge)return this._create_token(L.TEXT,ge)}}return null},w.prototype._read_content_word=function(R,q){var se="";return this._options.unformatted_content_delimiter&&R===this._options.unformatted_content_delimiter[0]&&(se=this.__patterns.unformatted_content_delimiter.read()),se||(se=q&&q.type===L.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),se?this._create_token(L.TEXT,se):null},P.exports.Tokenizer=w,P.exports.TOKEN=L}],ce={};function l(P){var g=ce[P];if(g!==void 0)return g.exports;var _=ce[P]={exports:{}};return me[P](_,_.exports,l),_.exports}var X=l(18);Se=X})();var he=Se;if(1)B=[K,K(58553),K(87804)],de=function(me){var ce=K(58553),l=K(87804);return{html_beautify:function(X,P){return he(X,P,ce.js_beautify,l.css_beautify)}}}.apply(st,B),de!==void 0&&(Xt.exports=de);else var j,p})()},58553:function(Xt,st){var K,B;(function(){var de;(function(){"use strict";var he=[function(ce,l,X){var P=X(1).Beautifier,g=X(5).Options;function _(E,A){var M=new P(E,A);return M.beautify()}ce.exports=_,ce.exports.defaultOptions=function(){return new g}},function(ce,l,X){var P=X(2).Output,g=X(3).Token,_=X(4),E=X(5).Options,A=X(7).Tokenizer,M=X(7).line_starters,H=X(7).positionable_operators,V=X(7).TOKEN;function L(v,z){return z.indexOf(v)!==-1}function I(v){return v.replace(/^\s+/g,"")}function w(v){for(var z={},ae=0;ae<v.length;ae++)z[v[ae].replace(/-/g,"_")]=v[ae];return z}function R(v,z){return v&&v.type===V.RESERVED&&v.text===z}function q(v,z){return v&&v.type===V.RESERVED&&L(v.text,z)}var se=["case","return","do","if","throw","else","await","break","continue","async"],te=["before-newline","after-newline","preserve-newline"],ge=w(te),Le=[ge.before_newline,ge.preserve_newline],xe={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function $e(v,z){z.multiline_frame||z.mode===xe.ForInitializer||z.mode===xe.Conditional||v.remove_indent(z.start_line_index)}function J(v){v=v.replace(_.allLineBreaks,`
`);for(var z=[],ae=v.indexOf(`
`);ae!==-1;)z.push(v.substring(0,ae)),v=v.substring(ae+1),ae=v.indexOf(`
`);return v.length&&z.push(v),z}function D(v){return v===xe.ArrayLiteral}function N(v){return L(v,[xe.Expression,xe.ForInitializer,xe.Conditional])}function O(v,z){for(var ae=0;ae<v.length;ae++){var Te=v[ae].trim();if(Te.charAt(0)!==z)return!1}return!0}function oe(v,z){for(var ae=0,Te=v.length,Fe;ae<Te;ae++)if(Fe=v[ae],Fe&&Fe.indexOf(z)!==0)return!1;return!0}function ie(v,z){z=z||{},this._source_text=v||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new E(z)}ie.prototype.create_flags=function(v,z){var ae=0;v&&(ae=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>ae&&(ae=v.line_indent_level));var Te={mode:z,parent:v,last_token:v?v.last_token:new g(V.START_BLOCK,""),last_word:v?v.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:ae,alignment:0,line_indent_level:v?v.line_indent_level:ae,start_line_index:this._output.get_line_number(),ternary_depth:0};return Te},ie.prototype._reset=function(v){var z=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new P(this._options,z),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(xe.BlockStatement);var ae=new A(v,this._options);return this._tokens=ae.tokenize(),v},ie.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,z=this._reset(this._source_text),ae=this._options.eol;this._options.eol==="auto"&&(ae=`
`,z&&_.lineBreak.test(z||"")&&(ae=z.match(_.lineBreak)[0]));for(var Te=this._tokens.next();Te;)this.handle_token(Te),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Te,Te=this._tokens.next();return v=this._output.get_code(ae),v},ie.prototype.handle_token=function(v,z){v.type===V.START_EXPR?this.handle_start_expr(v):v.type===V.END_EXPR?this.handle_end_expr(v):v.type===V.START_BLOCK?this.handle_start_block(v):v.type===V.END_BLOCK?this.handle_end_block(v):v.type===V.WORD?this.handle_word(v):v.type===V.RESERVED?this.handle_word(v):v.type===V.SEMICOLON?this.handle_semicolon(v):v.type===V.STRING?this.handle_string(v):v.type===V.EQUALS?this.handle_equals(v):v.type===V.OPERATOR?this.handle_operator(v):v.type===V.COMMA?this.handle_comma(v):v.type===V.BLOCK_COMMENT?this.handle_block_comment(v,z):v.type===V.COMMENT?this.handle_comment(v,z):v.type===V.DOT?this.handle_dot(v):v.type===V.EOF?this.handle_eof(v):v.type===V.UNKNOWN?this.handle_unknown(v,z):this.handle_unknown(v,z)},ie.prototype.handle_whitespace_and_comments=function(v,z){var ae=v.newlines,Te=this._options.keep_array_indentation&&D(this._flags.mode);if(v.comments_before)for(var Fe=v.comments_before.next();Fe;)this.handle_whitespace_and_comments(Fe,z),this.handle_token(Fe,z),Fe=v.comments_before.next();if(Te)for(var Ye=0;Ye<ae;Ye+=1)this.print_newline(Ye>0,z);else if(this._options.max_preserve_newlines&&ae>this._options.max_preserve_newlines&&(ae=this._options.max_preserve_newlines),this._options.preserve_newlines&&ae>1){this.print_newline(!1,z);for(var _t=1;_t<ae;_t+=1)this.print_newline(!0,z)}};var S=["async","break","continue","return","throw","yield"];ie.prototype.allow_wrap_or_preserved_newline=function(v,z){if(z=z===void 0?!1:z,!this._output.just_added_newline()){var ae=this._options.preserve_newlines&&v.newlines||z,Te=L(this._flags.last_token.text,H)||L(v.text,H);if(Te){var Fe=L(this._flags.last_token.text,H)&&L(this._options.operator_position,Le)||L(v.text,H);ae=ae&&Fe}if(ae)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(q(this._flags.last_token,S))return;this._output.set_wrap_point()}}},ie.prototype.print_newline=function(v,z){if(!z&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==V.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var ae=this._tokens.peek();this._flags.mode===xe.Statement&&!(this._flags.if_block&&R(ae,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},ie.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||D(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(v.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},ie.prototype.print_token=function(v){if(this._output.raw){this._output.add_raw_token(v);return}if(this._options.comma_first&&v.previous&&v.previous.type===V.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var z=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(z),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(v),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(v),this._output.non_breaking_space=!0,this._output.add_token(v.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},ie.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ie.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},ie.prototype.set_mode=function(v){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,v),this._flags=this.create_flags(this._previous_flags,v),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ie.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===xe.Statement&&$e(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},ie.prototype.start_of_object_property=function(){return this._flags.parent.mode===xe.ObjectLiteral&&this._flags.mode===xe.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"]))},ie.prototype.start_of_statement=function(v){var z=!1;return z=z||q(this._flags.last_token,["var","let","const"])&&v.type===V.WORD,z=z||R(this._flags.last_token,"do"),z=z||!(this._flags.parent.mode===xe.ObjectLiteral&&this._flags.mode===xe.Statement)&&q(this._flags.last_token,S)&&!v.newlines,z=z||R(this._flags.last_token,"else")&&!(R(v,"if")&&!v.comments_before),z=z||this._flags.last_token.type===V.END_EXPR&&(this._previous_flags.mode===xe.ForInitializer||this._previous_flags.mode===xe.Conditional),z=z||this._flags.last_token.type===V.WORD&&this._flags.mode===xe.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==V.WORD&&v.type!==V.RESERVED,z=z||this._flags.mode===xe.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"])),z?(this.set_mode(xe.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,q(v,["do","for","if","while"])),!0):!1},ie.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var z=xe.Expression;if(v.text==="["){if(this._flags.last_token.type===V.WORD||this._flags.last_token.text===")"){q(this._flags.last_token,M)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(z),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}z=xe.ArrayLiteral,D(this._flags.mode)&&(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline()),L(this._flags.last_token.type,[V.START_EXPR,V.END_EXPR,V.WORD,V.OPERATOR,V.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===V.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,z=xe.ForInitializer):L(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,z=xe.Conditional):L(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&v.whitespace_before===""?this._output.space_before_token=!1:(L(this._flags.last_token.text,M)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===V.WORD){this._output.space_before_token=!1;var ae=this._tokens.peek(-3);if(this._options.space_after_named_function&&ae){var Te=this._tokens.peek(-4);q(ae,["async","function"])||ae.text==="*"&&q(Te,["async","function"])?this._output.space_before_token=!0:this._flags.mode===xe.ObjectLiteral?(ae.text==="{"||ae.text===","||ae.text==="*"&&(Te.text==="{"||Te.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(v);(this._flags.last_token.type===V.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(L(this._last_last_text,["function","yield"])||this._flags.mode===xe.ObjectLiteral&&L(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===V.START_BLOCK?this.print_newline():(this._flags.last_token.type===V.END_EXPR||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===V.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(z),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},ie.prototype.handle_end_expr=function(v){for(;this._flags.mode===xe.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&D(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===V.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(v),this.restore_mode(),$e(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===xe.Conditional&&(this._previous_flags.mode=xe.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},ie.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var z=this._tokens.peek(),ae=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===V.END_EXPR?(this.set_mode(xe.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(xe.BlockStatement):ae&&(L(ae.text,[":",","])&&L(z.type,[V.STRING,V.WORD,V.RESERVED])||L(z.text,["get","set","..."])&&L(ae.type,[V.WORD,V.RESERVED]))?L(this._last_last_text,["class","interface"])&&!L(ae.text,[":",","])?this.set_mode(xe.BlockStatement):this.set_mode(xe.ObjectLiteral):this._flags.last_token.type===V.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(xe.BlockStatement):L(this._flags.last_token.type,[V.EQUALS,V.START_EXPR,V.COMMA,V.OPERATOR])||q(this._flags.last_token,["return","throw","import","default"])?this.set_mode(xe.ObjectLiteral):this.set_mode(xe.BlockStatement),this._flags.last_token&&q(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Te=!z.comments_before&&z.text==="}",Fe=Te&&this._flags.last_word==="function"&&this._flags.last_token.type===V.END_EXPR;if(this._options.brace_preserve_inline){var Ye=0,_t=null;this._flags.inline_frame=!0;do if(Ye+=1,_t=this._tokens.peek(Ye-1),_t.newlines){this._flags.inline_frame=!1;break}while(_t.type!==V.EOF&&!(_t.type===V.END_BLOCK&&_t.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==V.OPERATOR&&(Fe||this._flags.last_token.type===V.EQUALS||q(this._flags.last_token,se)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(D(this._previous_flags.mode)&&(this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.COMMA)&&((this._flags.last_token.type===V.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(v),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==V.OPERATOR&&this._flags.last_token.type!==V.START_EXPR&&(L(this._flags.last_token.type,[V.START_BLOCK,V.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!Te&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},ie.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===xe.Statement;)this.restore_mode();var z=this._flags.last_token.type===V.START_BLOCK;this._flags.inline_frame&&!z?this._output.space_before_token=!0:this._options.brace_style==="expand"?z||this.print_newline():z||(D(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(v)},ie.prototype.handle_word=function(v){if(v.type===V.RESERVED){if(L(v.text,["set","get"])&&this._flags.mode!==xe.ObjectLiteral)v.type=V.WORD;else if(v.text==="import"&&L(this._tokens.peek().text,["(","."]))v.type=V.WORD;else if(L(v.text,["as","from"])&&!this._flags.import_block)v.type=V.WORD;else if(this._flags.mode===xe.ObjectLiteral){var z=this._tokens.peek();z.text===":"&&(v.type=V.WORD)}}if(this.start_of_statement(v)?q(this._flags.last_token,["var","let","const"])&&v.type===V.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!N(this._flags.mode)&&(this._flags.last_token.type!==V.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==V.EQUALS&&(this._options.preserve_newlines||!q(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(R(v,"while")){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&R(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===xe.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&q(v,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(v),this._flags.in_case=!0;return}if((this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR)&&!this.start_of_object_property()&&!(L(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===xe.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(v),R(v,"function")){(L(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(L(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===V.OPERATOR))&&!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD?q(this._flags.last_token,["get","set","new","export"])||q(this._flags.last_token,S)?this._output.space_before_token=!0:R(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===V.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||D(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var ae="NONE";if(this._flags.last_token.type===V.END_BLOCK?this._previous_flags.inline_frame?ae="SPACE":q(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?ae="NEWLINE":(ae="SPACE",this._output.space_before_token=!0):ae="NEWLINE":this._flags.last_token.type===V.SEMICOLON&&this._flags.mode===xe.BlockStatement?ae="NEWLINE":this._flags.last_token.type===V.SEMICOLON&&N(this._flags.mode)?ae="SPACE":this._flags.last_token.type===V.STRING?ae="NEWLINE":this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD||this._flags.last_token.text==="*"&&(L(this._last_last_text,["function","yield"])||this._flags.mode===xe.ObjectLiteral&&L(this._last_last_text,["{",","]))?ae="SPACE":this._flags.last_token.type===V.START_BLOCK?this._flags.inline_frame?ae="SPACE":ae="NEWLINE":this._flags.last_token.type===V.END_EXPR&&(this._output.space_before_token=!0,ae="NEWLINE"),q(v,M)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ae="SPACE":ae="NEWLINE"),q(v,["else","catch","finally"]))if((!(this._flags.last_token.type===V.END_BLOCK&&this._previous_flags.mode===xe.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var Te=this._output.current_line;Te.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ae==="NEWLINE"?q(this._flags.last_token,se)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&q(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==V.END_EXPR?(this._flags.last_token.type!==V.START_EXPR||!q(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(R(v,"if")&&R(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):q(v,M)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&D(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ae==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===V.WORD||v.previous.type===V.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===V.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&R(v,"from")&&(this._flags.import_block=!1))},ie.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var z=this._tokens.peek();this._flags.mode===xe.Statement&&!(this._flags.if_block&&R(z,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},ie.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===V.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===V.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},ie.prototype.handle_equals=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0},ie.prototype.handle_comma=function(v){this.handle_whitespace_and_comments(v,!0),this.print_token(v),this._output.space_before_token=!0,this._flags.declaration_statement?(N(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)):this._flags.mode===xe.ObjectLiteral||this._flags.mode===xe.Statement&&this._flags.parent.mode===xe.ObjectLiteral?(this._flags.mode===xe.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},ie.prototype.handle_operator=function(v){var z=v.text==="*"&&(q(this._flags.last_token,["function","yield"])||L(this._flags.last_token.type,[V.START_BLOCK,V.COMMA,V.END_BLOCK,V.SEMICOLON])),ae=L(v.text,["-","+"])&&(L(this._flags.last_token.type,[V.START_BLOCK,V.START_EXPR,V.EQUALS,V.OPERATOR])||L(this._flags.last_token.text,M)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var Te=!z;this.handle_whitespace_and_comments(v,Te)}if(v.text==="*"&&this._flags.last_token.type===V.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(L(v.text,["-","+"])&&this.start_of_object_property()){this.print_token(v);return}if(this._flags.last_token.type===V.OPERATOR&&L(this._options.operator_position,Le)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==V.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var Fe=!0,Ye=!0,_t=!1;if(v.text===":"?this._flags.ternary_depth===0?Fe=!1:(this._flags.ternary_depth-=1,_t=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!ae&&!z&&this._options.preserve_newlines&&L(v.text,H)){var Ut=v.text===":",si=Ut&&_t,Ge=Ut&&!_t;switch(this._options.operator_position){case ge.before_newline:this._output.space_before_token=!Ge,this.print_token(v),(!Ut||si)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case ge.after_newline:this._output.space_before_token=!0,!Ut||si?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(v):this._output.space_before_token=!1,this.print_token(v),this._output.space_before_token=!0;return;case ge.preserve_newline:Ge||this.allow_wrap_or_preserved_newline(v),Fe=!(this._output.just_added_newline()||Ge),this._output.space_before_token=Fe,this.print_token(v),this._output.space_before_token=!0;return}}if(z){this.allow_wrap_or_preserved_newline(v),Fe=!1;var ft=this._tokens.peek();Ye=ft&&L(ft.type,[V.WORD,V.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),Fe=this._flags.last_token.type===V.START_BLOCK,Ye=!1;else if(L(v.text,["--","++","!","~"])||ae){if((this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),Fe=!1,Ye=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var $t=q(this._flags.last_token,se)&&v.newlines;$t&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline($t,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(Fe=!0),this._flags.last_token.type===V.RESERVED?Fe=!0:this._flags.last_token.type===V.END_EXPR?Fe=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===V.OPERATOR&&(Fe=L(v.text,["--","-","++","+"])&&L(this._flags.last_token.text,["--","-","++","+"]),L(v.text,["+","-"])&&L(this._flags.last_token.text,["--","++"])&&(Ye=!0)),(this._flags.mode===xe.BlockStatement&&!this._flags.inline_frame||this._flags.mode===xe.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Fe,this.print_token(v),this._output.space_before_token=Ye},ie.prototype.handle_block_comment=function(v,z){if(this._output.raw){this._output.add_raw_token(v),v.directives&&v.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(v.directives){this.print_newline(!1,z),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!_.newline.test(v.text)&&!v.newlines){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0;return}else this.print_block_commment(v,z)},ie.prototype.print_block_commment=function(v,z){var ae=J(v.text),Te,Fe=!1,Ye=!1,_t=v.whitespace_before,Ut=_t.length;if(this.print_newline(!1,z),this.print_token_line_indentation(v),this._output.add_token(ae[0]),this.print_newline(!1,z),ae.length>1){for(ae=ae.slice(1),Fe=O(ae,"*"),Ye=oe(ae,_t),Fe&&(this._flags.alignment=1),Te=0;Te<ae.length;Te++)Fe?(this.print_token_line_indentation(v),this._output.add_token(I(ae[Te]))):Ye&&ae[Te]?(this.print_token_line_indentation(v),this._output.add_token(ae[Te].substring(Ut))):(this._output.current_line.set_indent(-1),this._output.add_token(ae[Te])),this.print_newline(!1,z);this._flags.alignment=0}},ie.prototype.handle_comment=function(v,z){v.newlines?this.print_newline(!1,z):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,z)},ie.prototype.handle_dot=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),q(this._flags.last_token,se)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(v,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(v)},ie.prototype.handle_unknown=function(v,z){this.print_token(v),v.text[v.text.length-1]===`
`&&this.print_newline(!1,z)},ie.prototype.handle_eof=function(v){for(;this._flags.mode===xe.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},ce.exports.Beautifier=ie},function(ce){function l(g){this.__parent=g,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var _=this.__items.length-1;_>=0;_--)if(this.__items[_].match(g))return!0;return!1},l.prototype.set_indent=function(g,_){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=_||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},l.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(g){this.__items.push(g);var _=g.lastIndexOf(`
`);_!==-1?this.__character_count=g.length-_:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function X(g,_){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),_=_||"",g.indent_level>0&&(_=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=_,this.__base_string_length=_.length}X.prototype.get_indent_size=function(g,_){var E=this.__base_string_length;return _=_||0,g<0&&(E=0),E+=g*this.__indent_size,E+=_,E},X.prototype.get_indent_string=function(g,_){var E=this.__base_string;return _=_||0,g<0&&(g=0,E=""),_+=g*this.__indent_size,this.__ensure_cache(_),E+=this.__cache[_],E},X.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},X.prototype.__add_column=function(){var g=this.__cache.length,_=0,E="";this.__indent_size&&g>=this.__indent_size&&(_=Math.floor(g/this.__indent_size),g-=_*this.__indent_size,E=new Array(_+1).join(this.__indent_string)),g&&(E+=new Array(g+1).join(" ")),this.__cache.push(E)};function P(g,_){this.__indent_cache=new X(g,_),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}P.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},P.prototype.get_line_number=function(){return this.__lines.length},P.prototype.get_indent_string=function(g,_){return this.__indent_cache.get_indent_string(g,_)},P.prototype.get_indent_size=function(g,_){return this.__indent_cache.get_indent_size(g,_)},P.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},P.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},P.prototype.get_code=function(g){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var E=this.__lines.join(`
`);return g!==`
`&&(E=E.replace(/[\n]/g,g)),E},P.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},P.prototype.set_indent=function(g,_){return g=g||0,_=_||0,this.next_line.set_indent(g,_),this.__lines.length>1?(this.current_line.set_indent(g,_),!0):(this.current_line.set_indent(),!1)},P.prototype.add_raw_token=function(g){for(var _=0;_<g.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},P.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},P.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},P.prototype.remove_indent=function(g){for(var _=this.__lines.length;g<_;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},P.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},P.prototype.just_added_newline=function(){return this.current_line.is_empty()},P.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},P.prototype.ensure_empty_line_above=function(g,_){for(var E=this.__lines.length-2;E>=0;){var A=this.__lines[E];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==_){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},ce.exports.Output=P},function(ce){function l(X,P,g,_){this.type=X,this.text=P,this.comments_before=null,this.newlines=g||0,this.whitespace_before=_||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}ce.exports.Token=l},function(ce,l){var X="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",P="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",_="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",E="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",A="(?:"+E+"|["+X+g+"])",M="(?:"+E+"|["+P+g+_+"])*";l.identifier=new RegExp(A+M,"g"),l.identifierStart=new RegExp(A),l.identifierMatch=new RegExp("(?:"+E+"|["+P+g+_+"])+");var H=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;l.newline=/[\n\r\u2028\u2029]/,l.lineBreak=new RegExp(`\r
|`+l.newline.source),l.allLineBreaks=new RegExp(l.lineBreak.source,"g")},function(ce,l,X){var P=X(6).Options,g=["before-newline","after-newline","preserve-newline"];function _(E){P.call(this,E,"js");var A=this.raw_options.brace_style||null;A==="expand-strict"?this.raw_options.brace_style="expand":A==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var M=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var H=0;H<M.length;H++)M[H]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=M[H];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",g),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}_.prototype=new P,ce.exports.Options=_},function(ce){function l(g,_){this.raw_options=X(g,_),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(g,_){var E=this.raw_options[g],A=_||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(A=E.concat()):typeof E=="string"&&(A=E.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,_){var E=this.raw_options[g],A=E===void 0?!!_:!!E;return A},l.prototype._get_characters=function(g,_){var E=this.raw_options[g],A=_||"";return typeof E=="string"&&(A=E.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,_){var E=this.raw_options[g];_=parseInt(_,10),isNaN(_)&&(_=0);var A=parseInt(E,10);return isNaN(A)&&(A=_),A},l.prototype._get_selection=function(g,_,E){var A=this._get_selection_list(g,_,E);if(A.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A[0]},l.prototype._get_selection_list=function(g,_,E){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[_[0]],!this._is_valid_selection(E,_))throw new Error("Invalid Default Value!");var A=this._get_array(g,E);if(!this._is_valid_selection(A,_))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A},l.prototype._is_valid_selection=function(g,_){return g.length&&_.length&&!g.some(function(E){return _.indexOf(E)===-1})};function X(g,_){var E={};g=P(g);var A;for(A in g)A!==_&&(E[A]=g[A]);if(_&&g[_])for(A in g[_])E[A]=g[_][A];return E}function P(g){var _={},E;for(E in g){var A=E.replace(/-/g,"_");_[A]=g[E]}return _}ce.exports.Options=l,ce.exports.normalizeOpts=P,ce.exports.mergeOpts=X},function(ce,l,X){var P=X(8).InputScanner,g=X(9).Tokenizer,_=X(9).TOKEN,E=X(13).Directives,A=X(4),M=X(12).Pattern,H=X(14).TemplatablePattern;function V(O,oe){return oe.indexOf(O)!==-1}var L={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:_.START,RAW:_.RAW,EOF:_.EOF},I=new E(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,R=/[0-9]/,q=/[^\d\.]/,se=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),te=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";te=te.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),te="\\?\\.(?!\\d) "+te,te=te.replace(/ /g,"|");var ge=new RegExp(te),Le="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),xe=Le.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),$e=new RegExp("^(?:"+xe.join("|")+")$"),J,D=function(O,oe){g.call(this,O,oe),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var ie=new M(this._input),S=new H(this._input).read_options(this._options);this.__patterns={template:S,identifier:S.starting_with(A.identifier).matching(A.identifierMatch),number:ie.matching(w),punct:ie.matching(ge),comment:ie.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:ie.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:ie.matching(/<!--/),html_comment_end:ie.matching(/-->/),include:ie.starting_with(/#include/).until_after(A.lineBreak),shebang:ie.starting_with(/#!/).until_after(A.lineBreak),xml:ie.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:S.until(/['\\\n\r\u2028\u2029]/),double_quote:S.until(/["\\\n\r\u2028\u2029]/),template_text:S.until(/[`\\$]/),template_expression:S.until(/[`}\\]/)}};D.prototype=new g,D.prototype._is_comment=function(O){return O.type===L.COMMENT||O.type===L.BLOCK_COMMENT||O.type===L.UNKNOWN},D.prototype._is_opening=function(O){return O.type===L.START_BLOCK||O.type===L.START_EXPR},D.prototype._is_closing=function(O,oe){return(O.type===L.END_BLOCK||O.type===L.END_EXPR)&&oe&&(O.text==="]"&&oe.text==="["||O.text===")"&&oe.text==="("||O.text==="}"&&oe.text==="{")},D.prototype._reset=function(){J=!1},D.prototype._get_next_token=function(O,oe){var ie=null;this._readWhitespace();var S=this._input.peek();return S===null?this._create_token(L.EOF,""):(ie=ie||this._read_non_javascript(S),ie=ie||this._read_string(S),ie=ie||this._read_pair(S,this._input.peek(1)),ie=ie||this._read_word(O),ie=ie||this._read_singles(S),ie=ie||this._read_comment(S),ie=ie||this._read_regexp(S,O),ie=ie||this._read_xml(S,O),ie=ie||this._read_punctuation(),ie=ie||this._create_token(L.UNKNOWN,this._input.next()),ie)},D.prototype._read_word=function(O){var oe;if(oe=this.__patterns.identifier.read(),oe!=="")return oe=oe.replace(A.allLineBreaks,`
`),!(O.type===L.DOT||O.type===L.RESERVED&&(O.text==="set"||O.text==="get"))&&$e.test(oe)?(oe==="in"||oe==="of")&&(O.type===L.WORD||O.type===L.STRING)?this._create_token(L.OPERATOR,oe):this._create_token(L.RESERVED,oe):this._create_token(L.WORD,oe);if(oe=this.__patterns.number.read(),oe!=="")return this._create_token(L.WORD,oe)},D.prototype._read_singles=function(O){var oe=null;return O==="("||O==="["?oe=this._create_token(L.START_EXPR,O):O===")"||O==="]"?oe=this._create_token(L.END_EXPR,O):O==="{"?oe=this._create_token(L.START_BLOCK,O):O==="}"?oe=this._create_token(L.END_BLOCK,O):O===";"?oe=this._create_token(L.SEMICOLON,O):O==="."&&q.test(this._input.peek(1))?oe=this._create_token(L.DOT,O):O===","&&(oe=this._create_token(L.COMMA,O)),oe&&this._input.next(),oe},D.prototype._read_pair=function(O,oe){var ie=null;return O==="#"&&oe==="{"&&(ie=this._create_token(L.START_BLOCK,O+oe)),ie&&(this._input.next(),this._input.next()),ie},D.prototype._read_punctuation=function(){var O=this.__patterns.punct.read();if(O!=="")return O==="="?this._create_token(L.EQUALS,O):O==="?."?this._create_token(L.DOT,O):this._create_token(L.OPERATOR,O)},D.prototype._read_non_javascript=function(O){var oe="";if(O==="#"){if(this._is_first_token()&&(oe=this.__patterns.shebang.read(),oe))return this._create_token(L.UNKNOWN,oe.trim()+`
`);if(oe=this.__patterns.include.read(),oe)return this._create_token(L.UNKNOWN,oe.trim()+`
`);O=this._input.next();var ie="#";if(this._input.hasNext()&&this._input.testChar(R)){do O=this._input.next(),ie+=O;while(this._input.hasNext()&&O!=="#"&&O!=="=");return O==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(ie+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(ie+="{}",this._input.next(),this._input.next())),this._create_token(L.WORD,ie)}this._input.back()}else if(O==="<"&&this._is_first_token()){if(oe=this.__patterns.html_comment_start.read(),oe){for(;this._input.hasNext()&&!this._input.testChar(A.newline);)oe+=this._input.next();return J=!0,this._create_token(L.COMMENT,oe)}}else if(J&&O==="-"&&(oe=this.__patterns.html_comment_end.read(),oe))return J=!1,this._create_token(L.COMMENT,oe);return null},D.prototype._read_comment=function(O){var oe=null;if(O==="/"){var ie="";if(this._input.peek(1)==="*"){ie=this.__patterns.block_comment.read();var S=I.get_directives(ie);S&&S.ignore==="start"&&(ie+=I.readIgnored(this._input)),ie=ie.replace(A.allLineBreaks,`
`),oe=this._create_token(L.BLOCK_COMMENT,ie),oe.directives=S}else this._input.peek(1)==="/"&&(ie=this.__patterns.comment.read(),oe=this._create_token(L.COMMENT,ie))}return oe},D.prototype._read_string=function(O){if(O==="`"||O==="'"||O==='"'){var oe=this._input.next();return this.has_char_escapes=!1,O==="`"?oe+=this._read_string_recursive("`",!0,"${"):oe+=this._read_string_recursive(O),this.has_char_escapes&&this._options.unescape_strings&&(oe=N(oe)),this._input.peek()===O&&(oe+=this._input.next()),oe=oe.replace(A.allLineBreaks,`
`),this._create_token(L.STRING,oe)}return null},D.prototype._allow_regexp_or_xml=function(O){return O.type===L.RESERVED&&V(O.text,["return","case","throw","else","do","typeof","yield"])||O.type===L.END_EXPR&&O.text===")"&&O.opened.previous.type===L.RESERVED&&V(O.opened.previous.text,["if","while","for"])||V(O.type,[L.COMMENT,L.START_EXPR,L.START_BLOCK,L.START,L.END_BLOCK,L.OPERATOR,L.EQUALS,L.EOF,L.SEMICOLON,L.COMMA])},D.prototype._read_regexp=function(O,oe){if(O==="/"&&this._allow_regexp_or_xml(oe)){for(var ie=this._input.next(),S=!1,v=!1;this._input.hasNext()&&(S||v||this._input.peek()!==O)&&!this._input.testChar(A.newline);)ie+=this._input.peek(),S?S=!1:(S=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===O&&(ie+=this._input.next(),ie+=this._input.read(A.identifier)),this._create_token(L.STRING,ie)}return null},D.prototype._read_xml=function(O,oe){if(this._options.e4x&&O==="<"&&this._allow_regexp_or_xml(oe)){var ie="",S=this.__patterns.xml.read_match();if(S){for(var v=S[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),z=v.indexOf("{")===0,ae=0;S;){var Te=!!S[1],Fe=S[2],Ye=!!S[S.length-1]||Fe.slice(0,8)==="![CDATA[";if(!Ye&&(Fe===v||z&&Fe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Te?--ae:++ae),ie+=S[0],ae<=0)break;S=this.__patterns.xml.read_match()}return S||(ie+=this._input.match(/[\s\S]*/g)[0]),ie=ie.replace(A.allLineBreaks,`
`),this._create_token(L.STRING,ie)}}return null};function N(O){for(var oe="",ie=0,S=new P(O),v=null;S.hasNext();)if(v=S.match(/([\s]|[^\\]|\\\\)+/g),v&&(oe+=v[0]),S.peek()==="\\"){if(S.next(),S.peek()==="x")v=S.match(/x([0-9A-Fa-f]{2})/g);else if(S.peek()==="u")v=S.match(/u([0-9A-Fa-f]{4})/g),v||(v=S.match(/u\{([0-9A-Fa-f]+)\}/g));else{oe+="\\",S.hasNext()&&(oe+=S.next());continue}if(!v||(ie=parseInt(v[1],16),ie>126&&ie<=255&&v[0].indexOf("x")===0))return O;ie>=0&&ie<32||ie>1114111?oe+="\\"+v[0]:ie===34||ie===39||ie===92?oe+="\\"+String.fromCharCode(ie):oe+=String.fromCharCode(ie)}return oe}D.prototype._read_string_recursive=function(O,oe,ie){var S,v;O==="'"?v=this.__patterns.single_quote:O==='"'?v=this.__patterns.double_quote:O==="`"?v=this.__patterns.template_text:O==="}"&&(v=this.__patterns.template_expression);for(var z=v.read(),ae="";this._input.hasNext();){if(ae=this._input.next(),ae===O||!oe&&A.newline.test(ae)){this._input.back();break}else ae==="\\"&&this._input.hasNext()?(S=this._input.peek(),S==="x"||S==="u"?this.has_char_escapes=!0:S==="\r"&&this._input.peek(1)===`
`&&this._input.next(),ae+=this._input.next()):ie&&(ie==="${"&&ae==="$"&&this._input.peek()==="{"&&(ae+=this._input.next()),ie===ae&&(O==="`"?ae+=this._read_string_recursive("}",oe,"`"):ae+=this._read_string_recursive("`",oe,"${"),this._input.hasNext()&&(ae+=this._input.next())));ae+=v.read(),z+=ae}return z},ce.exports.Tokenizer=D,ce.exports.TOKEN=L,ce.exports.positionable_operators=se.slice(),ce.exports.line_starters=Le.slice()},function(ce){var l=RegExp.prototype.hasOwnProperty("sticky");function X(P){this.__input=P||"",this.__input_length=this.__input.length,this.__position=0}X.prototype.restart=function(){this.__position=0},X.prototype.back=function(){this.__position>0&&(this.__position-=1)},X.prototype.hasNext=function(){return this.__position<this.__input_length},X.prototype.next=function(){var P=null;return this.hasNext()&&(P=this.__input.charAt(this.__position),this.__position+=1),P},X.prototype.peek=function(P){var g=null;return P=P||0,P+=this.__position,P>=0&&P<this.__input_length&&(g=this.__input.charAt(P)),g},X.prototype.__match=function(P,g){P.lastIndex=g;var _=P.exec(this.__input);return _&&!(l&&P.sticky)&&_.index!==g&&(_=null),_},X.prototype.test=function(P,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(P,g):!1},X.prototype.testChar=function(P,g){var _=this.peek(g);return P.lastIndex=0,_!==null&&P.test(_)},X.prototype.match=function(P){var g=this.__match(P,this.__position);return g?this.__position+=g[0].length:g=null,g},X.prototype.read=function(P,g,_){var E="",A;return P&&(A=this.match(P),A&&(E+=A[0])),g&&(A||!P)&&(E+=this.readUntil(g,_)),E},X.prototype.readUntil=function(P,g){var _="",E=this.__position;P.lastIndex=this.__position;var A=P.exec(this.__input);return A?(E=A.index,g&&(E+=A[0].length)):E=this.__input_length,_=this.__input.substring(this.__position,E),this.__position=E,_},X.prototype.readUntilAfter=function(P){return this.readUntil(P,!0)},X.prototype.get_regexp=function(P,g){var _=null,E="g";return g&&l&&(E="y"),typeof P=="string"&&P!==""?_=new RegExp(P,E):P&&(_=new RegExp(P.source,E)),_},X.prototype.get_literal_regexp=function(P){return RegExp(P.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},X.prototype.peekUntilAfter=function(P){var g=this.__position,_=this.readUntilAfter(P);return this.__position=g,_},X.prototype.lookBack=function(P){var g=this.__position-1;return g>=P.length&&this.__input.substring(g-P.length,g).toLowerCase()===P},ce.exports.InputScanner=X},function(ce,l,X){var P=X(8).InputScanner,g=X(3).Token,_=X(10).TokenStream,E=X(11).WhitespacePattern,A={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},M=function(H,V){this._input=new P(H),this._options=V||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new E(this._input)};M.prototype.tokenize=function(){this._input.restart(),this.__tokens=new _,this._reset();for(var H,V=new g(A.START,""),L=null,I=[],w=new _;V.type!==A.EOF;){for(H=this._get_next_token(V,L);this._is_comment(H);)w.add(H),H=this._get_next_token(V,L);w.isEmpty()||(H.comments_before=w,w=new _),H.parent=L,this._is_opening(H)?(I.push(L),L=H):L&&this._is_closing(H,L)&&(H.opened=L,L.closed=H,L=I.pop(),H.parent=L),H.previous=V,V.next=H,this.__tokens.add(H),V=H}return this.__tokens},M.prototype._is_first_token=function(){return this.__tokens.isEmpty()},M.prototype._reset=function(){},M.prototype._get_next_token=function(H,V){this._readWhitespace();var L=this._input.read(/.+/g);return L?this._create_token(A.RAW,L):this._create_token(A.EOF,"")},M.prototype._is_comment=function(H){return!1},M.prototype._is_opening=function(H){return!1},M.prototype._is_closing=function(H,V){return!1},M.prototype._create_token=function(H,V){var L=new g(H,V,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return L},M.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},ce.exports.Tokenizer=M,ce.exports.TOKEN=A},function(ce){function l(X){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=X}l.prototype.restart=function(){this.__position=0},l.prototype.isEmpty=function(){return this.__tokens_length===0},l.prototype.hasNext=function(){return this.__position<this.__tokens_length},l.prototype.next=function(){var X=null;return this.hasNext()&&(X=this.__tokens[this.__position],this.__position+=1),X},l.prototype.peek=function(X){var P=null;return X=X||0,X+=this.__position,X>=0&&X<this.__tokens_length&&(P=this.__tokens[X]),P},l.prototype.add=function(X){this.__parent_token&&(X.parent=this.__parent_token),this.__tokens.push(X),this.__tokens_length+=1},ce.exports.TokenStream=l},function(ce,l,X){var P=X(12).Pattern;function g(_,E){P.call(this,_,E),E?this._line_regexp=this._input.get_regexp(E._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new P,g.prototype.__set_whitespace_patterns=function(_,E){_+="\\t ",E+="\\n\\r",this._match_pattern=this._input.get_regexp("["+_+E+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+E+"]")},g.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var _=this._input.read(this._match_pattern);if(_===" ")this.whitespace_before_token=" ";else if(_){var E=this.__split(this._newline_regexp,_);this.newline_count=E.length-1,this.whitespace_before_token=E[this.newline_count]}return _},g.prototype.matching=function(_,E){var A=this._create();return A.__set_whitespace_patterns(_,E),A._update(),A},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(_,E){_.lastIndex=0;for(var A=0,M=[],H=_.exec(E);H;)M.push(E.substring(A,H.index)),A=H.index+H[0].length,H=_.exec(E);return A<E.length?M.push(E.substring(A,E.length)):M.push(""),M},ce.exports.WhitespacePattern=g},function(ce){function l(X,P){this._input=X,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,P&&(this._starting_pattern=this._input.get_regexp(P._starting_pattern,!0),this._match_pattern=this._input.get_regexp(P._match_pattern,!0),this._until_pattern=this._input.get_regexp(P._until_pattern),this._until_after=P._until_after)}l.prototype.read=function(){var X=this._input.read(this._starting_pattern);return(!this._starting_pattern||X)&&(X+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),X},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(X){var P=this._create();return P._until_after=!0,P._until_pattern=this._input.get_regexp(X),P._update(),P},l.prototype.until=function(X){var P=this._create();return P._until_after=!1,P._until_pattern=this._input.get_regexp(X),P._update(),P},l.prototype.starting_with=function(X){var P=this._create();return P._starting_pattern=this._input.get_regexp(X,!0),P._update(),P},l.prototype.matching=function(X){var P=this._create();return P._match_pattern=this._input.get_regexp(X,!0),P._update(),P},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},ce.exports.Pattern=l},function(ce){function l(X,P){X=typeof X=="string"?X:X.source,P=typeof P=="string"?P:P.source,this.__directives_block_pattern=new RegExp(X+/ beautify( \w+[:]\w+)+ /.source+P,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(X+/\sbeautify\signore:end\s/.source+P,"g")}l.prototype.get_directives=function(X){if(!X.match(this.__directives_block_pattern))return null;var P={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(X);g;)P[g[1]]=g[2],g=this.__directive_pattern.exec(X);return P},l.prototype.readIgnored=function(X){return X.readUntilAfter(this.__directives_end_ignore_pattern)},ce.exports.Directives=l},function(ce,l,X){var P=X(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function _(E,A){P.call(this,E,A),this.__template_pattern=null,this._disabled=Object.assign({},g),this._excluded=Object.assign({},g),A&&(this.__template_pattern=this._input.get_regexp(A.__template_pattern),this._excluded=Object.assign(this._excluded,A._excluded),this._disabled=Object.assign(this._disabled,A._disabled));var M=new P(E);this.__patterns={handlebars_comment:M.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:M.starting_with(/{{{/).until_after(/}}}/),handlebars:M.starting_with(/{{/).until_after(/}}/),php:M.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:M.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:M.starting_with(/{%/).until_after(/%}/),django_value:M.starting_with(/{{/).until_after(/}}/),django_comment:M.starting_with(/{#/).until_after(/#}/),smarty:M.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:M.starting_with(/{\*/).until_after(/\*}/),smarty_literal:M.starting_with(/{literal}/).until_after(/{\/literal}/)}}_.prototype=new P,_.prototype._create=function(){return new _(this._input,this)},_.prototype._update=function(){this.__set_templated_pattern()},_.prototype.disable=function(E){var A=this._create();return A._disabled[E]=!0,A._update(),A},_.prototype.read_options=function(E){var A=this._create();for(var M in g)A._disabled[M]=E.templating.indexOf(M)===-1;return A._update(),A},_.prototype.exclude=function(E){var A=this._create();return A._excluded[E]=!0,A._update(),A},_.prototype.read=function(){var E="";this._match_pattern?E=this._input.read(this._starting_pattern):E=this._input.read(this._starting_pattern,this.__template_pattern);for(var A=this._read_template();A;)this._match_pattern?A+=this._input.read(this._match_pattern):A+=this._input.readUntil(this.__template_pattern),E+=A,A=this._read_template();return this._until_after&&(E+=this._input.readUntilAfter(this._until_pattern)),E},_.prototype.__set_templated_pattern=function(){var E=[];this._disabled.php||E.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||E.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(E.push(this.__patterns.django._starting_pattern.source),E.push(this.__patterns.django_value._starting_pattern.source),E.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||E.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&E.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+E.join("|")+")")},_.prototype._read_template=function(){var E="",A=this._input.peek();if(A==="<"){var M=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&M==="?"&&(E=E||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&M==="%"&&(E=E||this.__patterns.erb.read())}else A==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(E=E||this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars_unescaped.read(),E=E||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(E=E||this.__patterns.django_value.read()),this._excluded.django||(E=E||this.__patterns.django_comment.read(),E=E||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(E=E||this.__patterns.smarty_comment.read(),E=E||this.__patterns.smarty_literal.read(),E=E||this.__patterns.smarty.read()));return E},ce.exports.TemplatablePattern=_}],j={};function p(ce){var l=j[ce];if(l!==void 0)return l.exports;var X=j[ce]={exports:{}};return he[ce](X,X.exports,p),X.exports}var me=p(0);de=me})();var Se=de;K=[],B=function(){return{js_beautify:Se}}.apply(st,K),B!==void 0&&(Xt.exports=B)})()},75918:function(Xt,st,K){"use strict";K.d(st,{Wi:function(){return p},Z0:function(){return me},aU:function(){return j},eZ:function(){return l},wY:function(){return ce}});var B=K(4348),de=K(69323),Se=K(13268),he=function(X,P,g,_){function E(A){return A instanceof g?A:new g(function(M){M(A)})}return new(g||(g=Promise))(function(A,M){function H(I){try{L(_.next(I))}catch(w){M(w)}}function V(I){try{L(_.throw(I))}catch(w){M(w)}}function L(I){I.done?A(I.value):E(I.value).then(H,V)}L((_=_.apply(X,P||[])).next())})};class j extends de.JT{constructor(P,g="",_="",E=!0,A){super(),this._onDidChange=this._register(new B.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=P,this._label=g,this._cssClass=_,this._enabled=E,this._actionCallback=A}get id(){return this._id}get label(){return this._label}set label(P){this._setLabel(P)}_setLabel(P){this._label!==P&&(this._label=P,this._onDidChange.fire({label:P}))}get tooltip(){return this._tooltip||""}set tooltip(P){this._setTooltip(P)}_setTooltip(P){this._tooltip!==P&&(this._tooltip=P,this._onDidChange.fire({tooltip:P}))}get class(){return this._cssClass}set class(P){this._setClass(P)}_setClass(P){this._cssClass!==P&&(this._cssClass=P,this._onDidChange.fire({class:P}))}get enabled(){return this._enabled}set enabled(P){this._setEnabled(P)}_setEnabled(P){this._enabled!==P&&(this._enabled=P,this._onDidChange.fire({enabled:P}))}get checked(){return this._checked}set checked(P){this._setChecked(P)}_setChecked(P){this._checked!==P&&(this._checked=P,this._onDidChange.fire({checked:P}))}run(P,g){return he(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(P))})}}class p extends de.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new B.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new B.Q5),this.onDidRun=this._onDidRun.event}run(P,g){return he(this,void 0,void 0,function*(){if(!P.enabled)return;this._onBeforeRun.fire({action:P});let _;try{yield this.runAction(P,g)}catch(E){_=E}this._onDidRun.fire({action:P,error:_})})}runAction(P,g){return he(this,void 0,void 0,function*(){yield P.run(g)})}}class me extends j{constructor(P){super(me.ID,P,P?"separator text":"separator"),this.checked=!1,this.enabled=!1}}me.ID="vs.actions.separator";class ce{constructor(P,g,_,E){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=P,this.label=g,this.class=E,this._actions=_}get actions(){return this._actions}dispose(){}run(){return he(this,void 0,void 0,function*(){})}}class l extends j{constructor(){super(l.ID,Se.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Xt,st,K){"use strict";K.d(st,{ok:function(){return B}});function B(de,Se){if(!de)throw new Error(Se?`Assertion failed (${Se})`:"Assertion Failed")}},52615:function(Xt,st,K){"use strict";K.d(st,{CM:function(){return j},JL:function(){return p},dT:function(){return ce},fK:function(){return he},lA:function(){return me}});var B=K(4348);class de{constructor(){this._icons=new Map,this._onDidRegister=new B.Q5}add(X){const P=this._icons.get(X.id);P?X.description?P.description=X.description:console.error(`Duplicate registration of codicon ${X.id}`):(this._icons.set(X.id,X),this._onDidRegister.fire(X))}get(X){return this._icons.get(X)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Se=new de,he=Se;function j(l,X){return new me(l,X)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(X,P)=>` ${P} `).trim():""}class me{constructor(X,P,g){this.id=X,this.definition=P,this.description=g,Se.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var ce;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const X=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function P(E){if(E instanceof me)return["codicon","codicon-"+E.id];const A=X.exec(E.id);if(!A)return P(me.error);let[,M,H]=A;const V=["codicon","codicon-"+M];return H&&V.push("codicon-modifier-"+H.substr(1)),V}l.asClassNameArray=P;function g(E){return P(E).join(" ")}l.asClassName=g;function _(E){return"."+P(E).join(".")}l.asCSSSelector=_})(ce||(ce={})),function(l){l.add=new l("add",{fontCharacter:"\\ea60"}),l.plus=new l("plus",l.add.definition),l.gistNew=new l("gist-new",l.add.definition),l.repoCreate=new l("repo-create",l.add.definition),l.lightbulb=new l("lightbulb",{fontCharacter:"\\ea61"}),l.lightBulb=new l("light-bulb",{fontCharacter:"\\ea61"}),l.repo=new l("repo",{fontCharacter:"\\ea62"}),l.repoDelete=new l("repo-delete",{fontCharacter:"\\ea62"}),l.gistFork=new l("gist-fork",{fontCharacter:"\\ea63"}),l.repoForked=new l("repo-forked",{fontCharacter:"\\ea63"}),l.gitPullRequest=new l("git-pull-request",{fontCharacter:"\\ea64"}),l.gitPullRequestAbandoned=new l("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),l.recordKeys=new l("record-keys",{fontCharacter:"\\ea65"}),l.keyboard=new l("keyboard",{fontCharacter:"\\ea65"}),l.tag=new l("tag",{fontCharacter:"\\ea66"}),l.tagAdd=new l("tag-add",{fontCharacter:"\\ea66"}),l.tagRemove=new l("tag-remove",{fontCharacter:"\\ea66"}),l.person=new l("person",{fontCharacter:"\\ea67"}),l.personFollow=new l("person-follow",{fontCharacter:"\\ea67"}),l.personOutline=new l("person-outline",{fontCharacter:"\\ea67"}),l.personFilled=new l("person-filled",{fontCharacter:"\\ea67"}),l.gitBranch=new l("git-branch",{fontCharacter:"\\ea68"}),l.gitBranchCreate=new l("git-branch-create",{fontCharacter:"\\ea68"}),l.gitBranchDelete=new l("git-branch-delete",{fontCharacter:"\\ea68"}),l.sourceControl=new l("source-control",{fontCharacter:"\\ea68"}),l.mirror=new l("mirror",{fontCharacter:"\\ea69"}),l.mirrorPublic=new l("mirror-public",{fontCharacter:"\\ea69"}),l.star=new l("star",{fontCharacter:"\\ea6a"}),l.starAdd=new l("star-add",{fontCharacter:"\\ea6a"}),l.starDelete=new l("star-delete",{fontCharacter:"\\ea6a"}),l.starEmpty=new l("star-empty",{fontCharacter:"\\ea6a"}),l.comment=new l("comment",{fontCharacter:"\\ea6b"}),l.commentAdd=new l("comment-add",{fontCharacter:"\\ea6b"}),l.alert=new l("alert",{fontCharacter:"\\ea6c"}),l.warning=new l("warning",{fontCharacter:"\\ea6c"}),l.search=new l("search",{fontCharacter:"\\ea6d"}),l.searchSave=new l("search-save",{fontCharacter:"\\ea6d"}),l.logOut=new l("log-out",{fontCharacter:"\\ea6e"}),l.signOut=new l("sign-out",{fontCharacter:"\\ea6e"}),l.logIn=new l("log-in",{fontCharacter:"\\ea6f"}),l.signIn=new l("sign-in",{fontCharacter:"\\ea6f"}),l.eye=new l("eye",{fontCharacter:"\\ea70"}),l.eyeUnwatch=new l("eye-unwatch",{fontCharacter:"\\ea70"}),l.eyeWatch=new l("eye-watch",{fontCharacter:"\\ea70"}),l.circleFilled=new l("circle-filled",{fontCharacter:"\\ea71"}),l.primitiveDot=new l("primitive-dot",{fontCharacter:"\\ea71"}),l.closeDirty=new l("close-dirty",{fontCharacter:"\\ea71"}),l.debugBreakpoint=new l("debug-breakpoint",{fontCharacter:"\\ea71"}),l.debugBreakpointDisabled=new l("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),l.debugHint=new l("debug-hint",{fontCharacter:"\\ea71"}),l.primitiveSquare=new l("primitive-square",{fontCharacter:"\\ea72"}),l.edit=new l("edit",{fontCharacter:"\\ea73"}),l.pencil=new l("pencil",{fontCharacter:"\\ea73"}),l.info=new l("info",{fontCharacter:"\\ea74"}),l.issueOpened=new l("issue-opened",{fontCharacter:"\\ea74"}),l.gistPrivate=new l("gist-private",{fontCharacter:"\\ea75"}),l.gitForkPrivate=new l("git-fork-private",{fontCharacter:"\\ea75"}),l.lock=new l("lock",{fontCharacter:"\\ea75"}),l.mirrorPrivate=new l("mirror-private",{fontCharacter:"\\ea75"}),l.close=new l("close",{fontCharacter:"\\ea76"}),l.removeClose=new l("remove-close",{fontCharacter:"\\ea76"}),l.x=new l("x",{fontCharacter:"\\ea76"}),l.repoSync=new l("repo-sync",{fontCharacter:"\\ea77"}),l.sync=new l("sync",{fontCharacter:"\\ea77"}),l.clone=new l("clone",{fontCharacter:"\\ea78"}),l.desktopDownload=new l("desktop-download",{fontCharacter:"\\ea78"}),l.beaker=new l("beaker",{fontCharacter:"\\ea79"}),l.microscope=new l("microscope",{fontCharacter:"\\ea79"}),l.vm=new l("vm",{fontCharacter:"\\ea7a"}),l.deviceDesktop=new l("device-desktop",{fontCharacter:"\\ea7a"}),l.file=new l("file",{fontCharacter:"\\ea7b"}),l.fileText=new l("file-text",{fontCharacter:"\\ea7b"}),l.more=new l("more",{fontCharacter:"\\ea7c"}),l.ellipsis=new l("ellipsis",{fontCharacter:"\\ea7c"}),l.kebabHorizontal=new l("kebab-horizontal",{fontCharacter:"\\ea7c"}),l.mailReply=new l("mail-reply",{fontCharacter:"\\ea7d"}),l.reply=new l("reply",{fontCharacter:"\\ea7d"}),l.organization=new l("organization",{fontCharacter:"\\ea7e"}),l.organizationFilled=new l("organization-filled",{fontCharacter:"\\ea7e"}),l.organizationOutline=new l("organization-outline",{fontCharacter:"\\ea7e"}),l.newFile=new l("new-file",{fontCharacter:"\\ea7f"}),l.fileAdd=new l("file-add",{fontCharacter:"\\ea7f"}),l.newFolder=new l("new-folder",{fontCharacter:"\\ea80"}),l.fileDirectoryCreate=new l("file-directory-create",{fontCharacter:"\\ea80"}),l.trash=new l("trash",{fontCharacter:"\\ea81"}),l.trashcan=new l("trashcan",{fontCharacter:"\\ea81"}),l.history=new l("history",{fontCharacter:"\\ea82"}),l.clock=new l("clock",{fontCharacter:"\\ea82"}),l.folder=new l("folder",{fontCharacter:"\\ea83"}),l.fileDirectory=new l("file-directory",{fontCharacter:"\\ea83"}),l.symbolFolder=new l("symbol-folder",{fontCharacter:"\\ea83"}),l.logoGithub=new l("logo-github",{fontCharacter:"\\ea84"}),l.markGithub=new l("mark-github",{fontCharacter:"\\ea84"}),l.github=new l("github",{fontCharacter:"\\ea84"}),l.terminal=new l("terminal",{fontCharacter:"\\ea85"}),l.console=new l("console",{fontCharacter:"\\ea85"}),l.repl=new l("repl",{fontCharacter:"\\ea85"}),l.zap=new l("zap",{fontCharacter:"\\ea86"}),l.symbolEvent=new l("symbol-event",{fontCharacter:"\\ea86"}),l.error=new l("error",{fontCharacter:"\\ea87"}),l.stop=new l("stop",{fontCharacter:"\\ea87"}),l.variable=new l("variable",{fontCharacter:"\\ea88"}),l.symbolVariable=new l("symbol-variable",{fontCharacter:"\\ea88"}),l.array=new l("array",{fontCharacter:"\\ea8a"}),l.symbolArray=new l("symbol-array",{fontCharacter:"\\ea8a"}),l.symbolModule=new l("symbol-module",{fontCharacter:"\\ea8b"}),l.symbolPackage=new l("symbol-package",{fontCharacter:"\\ea8b"}),l.symbolNamespace=new l("symbol-namespace",{fontCharacter:"\\ea8b"}),l.symbolObject=new l("symbol-object",{fontCharacter:"\\ea8b"}),l.symbolMethod=new l("symbol-method",{fontCharacter:"\\ea8c"}),l.symbolFunction=new l("symbol-function",{fontCharacter:"\\ea8c"}),l.symbolConstructor=new l("symbol-constructor",{fontCharacter:"\\ea8c"}),l.symbolBoolean=new l("symbol-boolean",{fontCharacter:"\\ea8f"}),l.symbolNull=new l("symbol-null",{fontCharacter:"\\ea8f"}),l.symbolNumeric=new l("symbol-numeric",{fontCharacter:"\\ea90"}),l.symbolNumber=new l("symbol-number",{fontCharacter:"\\ea90"}),l.symbolStructure=new l("symbol-structure",{fontCharacter:"\\ea91"}),l.symbolStruct=new l("symbol-struct",{fontCharacter:"\\ea91"}),l.symbolParameter=new l("symbol-parameter",{fontCharacter:"\\ea92"}),l.symbolTypeParameter=new l("symbol-type-parameter",{fontCharacter:"\\ea92"}),l.symbolKey=new l("symbol-key",{fontCharacter:"\\ea93"}),l.symbolText=new l("symbol-text",{fontCharacter:"\\ea93"}),l.symbolReference=new l("symbol-reference",{fontCharacter:"\\ea94"}),l.goToFile=new l("go-to-file",{fontCharacter:"\\ea94"}),l.symbolEnum=new l("symbol-enum",{fontCharacter:"\\ea95"}),l.symbolValue=new l("symbol-value",{fontCharacter:"\\ea95"}),l.symbolRuler=new l("symbol-ruler",{fontCharacter:"\\ea96"}),l.symbolUnit=new l("symbol-unit",{fontCharacter:"\\ea96"}),l.activateBreakpoints=new l("activate-breakpoints",{fontCharacter:"\\ea97"}),l.archive=new l("archive",{fontCharacter:"\\ea98"}),l.arrowBoth=new l("arrow-both",{fontCharacter:"\\ea99"}),l.arrowDown=new l("arrow-down",{fontCharacter:"\\ea9a"}),l.arrowLeft=new l("arrow-left",{fontCharacter:"\\ea9b"}),l.arrowRight=new l("arrow-right",{fontCharacter:"\\ea9c"}),l.arrowSmallDown=new l("arrow-small-down",{fontCharacter:"\\ea9d"}),l.arrowSmallLeft=new l("arrow-small-left",{fontCharacter:"\\ea9e"}),l.arrowSmallRight=new l("arrow-small-right",{fontCharacter:"\\ea9f"}),l.arrowSmallUp=new l("arrow-small-up",{fontCharacter:"\\eaa0"}),l.arrowUp=new l("arrow-up",{fontCharacter:"\\eaa1"}),l.bell=new l("bell",{fontCharacter:"\\eaa2"}),l.bold=new l("bold",{fontCharacter:"\\eaa3"}),l.book=new l("book",{fontCharacter:"\\eaa4"}),l.bookmark=new l("bookmark",{fontCharacter:"\\eaa5"}),l.debugBreakpointConditionalUnverified=new l("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),l.debugBreakpointConditional=new l("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),l.debugBreakpointConditionalDisabled=new l("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),l.debugBreakpointDataUnverified=new l("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),l.debugBreakpointData=new l("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),l.debugBreakpointDataDisabled=new l("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),l.debugBreakpointLogUnverified=new l("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),l.debugBreakpointLog=new l("debug-breakpoint-log",{fontCharacter:"\\eaab"}),l.debugBreakpointLogDisabled=new l("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),l.briefcase=new l("briefcase",{fontCharacter:"\\eaac"}),l.broadcast=new l("broadcast",{fontCharacter:"\\eaad"}),l.browser=new l("browser",{fontCharacter:"\\eaae"}),l.bug=new l("bug",{fontCharacter:"\\eaaf"}),l.calendar=new l("calendar",{fontCharacter:"\\eab0"}),l.caseSensitive=new l("case-sensitive",{fontCharacter:"\\eab1"}),l.check=new l("check",{fontCharacter:"\\eab2"}),l.checklist=new l("checklist",{fontCharacter:"\\eab3"}),l.chevronDown=new l("chevron-down",{fontCharacter:"\\eab4"}),l.dropDownButton=new l("drop-down-button",l.chevronDown.definition),l.chevronLeft=new l("chevron-left",{fontCharacter:"\\eab5"}),l.chevronRight=new l("chevron-right",{fontCharacter:"\\eab6"}),l.chevronUp=new l("chevron-up",{fontCharacter:"\\eab7"}),l.chromeClose=new l("chrome-close",{fontCharacter:"\\eab8"}),l.chromeMaximize=new l("chrome-maximize",{fontCharacter:"\\eab9"}),l.chromeMinimize=new l("chrome-minimize",{fontCharacter:"\\eaba"}),l.chromeRestore=new l("chrome-restore",{fontCharacter:"\\eabb"}),l.circleOutline=new l("circle-outline",{fontCharacter:"\\eabc"}),l.debugBreakpointUnverified=new l("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),l.circleSlash=new l("circle-slash",{fontCharacter:"\\eabd"}),l.circuitBoard=new l("circuit-board",{fontCharacter:"\\eabe"}),l.clearAll=new l("clear-all",{fontCharacter:"\\eabf"}),l.clippy=new l("clippy",{fontCharacter:"\\eac0"}),l.closeAll=new l("close-all",{fontCharacter:"\\eac1"}),l.cloudDownload=new l("cloud-download",{fontCharacter:"\\eac2"}),l.cloudUpload=new l("cloud-upload",{fontCharacter:"\\eac3"}),l.code=new l("code",{fontCharacter:"\\eac4"}),l.collapseAll=new l("collapse-all",{fontCharacter:"\\eac5"}),l.colorMode=new l("color-mode",{fontCharacter:"\\eac6"}),l.commentDiscussion=new l("comment-discussion",{fontCharacter:"\\eac7"}),l.compareChanges=new l("compare-changes",{fontCharacter:"\\eafd"}),l.creditCard=new l("credit-card",{fontCharacter:"\\eac9"}),l.dash=new l("dash",{fontCharacter:"\\eacc"}),l.dashboard=new l("dashboard",{fontCharacter:"\\eacd"}),l.database=new l("database",{fontCharacter:"\\eace"}),l.debugContinue=new l("debug-continue",{fontCharacter:"\\eacf"}),l.debugDisconnect=new l("debug-disconnect",{fontCharacter:"\\ead0"}),l.debugPause=new l("debug-pause",{fontCharacter:"\\ead1"}),l.debugRestart=new l("debug-restart",{fontCharacter:"\\ead2"}),l.debugStart=new l("debug-start",{fontCharacter:"\\ead3"}),l.debugStepInto=new l("debug-step-into",{fontCharacter:"\\ead4"}),l.debugStepOut=new l("debug-step-out",{fontCharacter:"\\ead5"}),l.debugStepOver=new l("debug-step-over",{fontCharacter:"\\ead6"}),l.debugStop=new l("debug-stop",{fontCharacter:"\\ead7"}),l.debug=new l("debug",{fontCharacter:"\\ead8"}),l.deviceCameraVideo=new l("device-camera-video",{fontCharacter:"\\ead9"}),l.deviceCamera=new l("device-camera",{fontCharacter:"\\eada"}),l.deviceMobile=new l("device-mobile",{fontCharacter:"\\eadb"}),l.diffAdded=new l("diff-added",{fontCharacter:"\\eadc"}),l.diffIgnored=new l("diff-ignored",{fontCharacter:"\\eadd"}),l.diffModified=new l("diff-modified",{fontCharacter:"\\eade"}),l.diffRemoved=new l("diff-removed",{fontCharacter:"\\eadf"}),l.diffRenamed=new l("diff-renamed",{fontCharacter:"\\eae0"}),l.diff=new l("diff",{fontCharacter:"\\eae1"}),l.discard=new l("discard",{fontCharacter:"\\eae2"}),l.editorLayout=new l("editor-layout",{fontCharacter:"\\eae3"}),l.emptyWindow=new l("empty-window",{fontCharacter:"\\eae4"}),l.exclude=new l("exclude",{fontCharacter:"\\eae5"}),l.extensions=new l("extensions",{fontCharacter:"\\eae6"}),l.eyeClosed=new l("eye-closed",{fontCharacter:"\\eae7"}),l.fileBinary=new l("file-binary",{fontCharacter:"\\eae8"}),l.fileCode=new l("file-code",{fontCharacter:"\\eae9"}),l.fileMedia=new l("file-media",{fontCharacter:"\\eaea"}),l.filePdf=new l("file-pdf",{fontCharacter:"\\eaeb"}),l.fileSubmodule=new l("file-submodule",{fontCharacter:"\\eaec"}),l.fileSymlinkDirectory=new l("file-symlink-directory",{fontCharacter:"\\eaed"}),l.fileSymlinkFile=new l("file-symlink-file",{fontCharacter:"\\eaee"}),l.fileZip=new l("file-zip",{fontCharacter:"\\eaef"}),l.files=new l("files",{fontCharacter:"\\eaf0"}),l.filter=new l("filter",{fontCharacter:"\\eaf1"}),l.flame=new l("flame",{fontCharacter:"\\eaf2"}),l.foldDown=new l("fold-down",{fontCharacter:"\\eaf3"}),l.foldUp=new l("fold-up",{fontCharacter:"\\eaf4"}),l.fold=new l("fold",{fontCharacter:"\\eaf5"}),l.folderActive=new l("folder-active",{fontCharacter:"\\eaf6"}),l.folderOpened=new l("folder-opened",{fontCharacter:"\\eaf7"}),l.gear=new l("gear",{fontCharacter:"\\eaf8"}),l.gift=new l("gift",{fontCharacter:"\\eaf9"}),l.gistSecret=new l("gist-secret",{fontCharacter:"\\eafa"}),l.gist=new l("gist",{fontCharacter:"\\eafb"}),l.gitCommit=new l("git-commit",{fontCharacter:"\\eafc"}),l.gitCompare=new l("git-compare",{fontCharacter:"\\eafd"}),l.gitMerge=new l("git-merge",{fontCharacter:"\\eafe"}),l.githubAction=new l("github-action",{fontCharacter:"\\eaff"}),l.githubAlt=new l("github-alt",{fontCharacter:"\\eb00"}),l.globe=new l("globe",{fontCharacter:"\\eb01"}),l.grabber=new l("grabber",{fontCharacter:"\\eb02"}),l.graph=new l("graph",{fontCharacter:"\\eb03"}),l.gripper=new l("gripper",{fontCharacter:"\\eb04"}),l.heart=new l("heart",{fontCharacter:"\\eb05"}),l.home=new l("home",{fontCharacter:"\\eb06"}),l.horizontalRule=new l("horizontal-rule",{fontCharacter:"\\eb07"}),l.hubot=new l("hubot",{fontCharacter:"\\eb08"}),l.inbox=new l("inbox",{fontCharacter:"\\eb09"}),l.issueClosed=new l("issue-closed",{fontCharacter:"\\eba4"}),l.issueReopened=new l("issue-reopened",{fontCharacter:"\\eb0b"}),l.issues=new l("issues",{fontCharacter:"\\eb0c"}),l.italic=new l("italic",{fontCharacter:"\\eb0d"}),l.jersey=new l("jersey",{fontCharacter:"\\eb0e"}),l.json=new l("json",{fontCharacter:"\\eb0f"}),l.kebabVertical=new l("kebab-vertical",{fontCharacter:"\\eb10"}),l.key=new l("key",{fontCharacter:"\\eb11"}),l.law=new l("law",{fontCharacter:"\\eb12"}),l.lightbulbAutofix=new l("lightbulb-autofix",{fontCharacter:"\\eb13"}),l.linkExternal=new l("link-external",{fontCharacter:"\\eb14"}),l.link=new l("link",{fontCharacter:"\\eb15"}),l.listOrdered=new l("list-ordered",{fontCharacter:"\\eb16"}),l.listUnordered=new l("list-unordered",{fontCharacter:"\\eb17"}),l.liveShare=new l("live-share",{fontCharacter:"\\eb18"}),l.loading=new l("loading",{fontCharacter:"\\eb19"}),l.location=new l("location",{fontCharacter:"\\eb1a"}),l.mailRead=new l("mail-read",{fontCharacter:"\\eb1b"}),l.mail=new l("mail",{fontCharacter:"\\eb1c"}),l.markdown=new l("markdown",{fontCharacter:"\\eb1d"}),l.megaphone=new l("megaphone",{fontCharacter:"\\eb1e"}),l.mention=new l("mention",{fontCharacter:"\\eb1f"}),l.milestone=new l("milestone",{fontCharacter:"\\eb20"}),l.mortarBoard=new l("mortar-board",{fontCharacter:"\\eb21"}),l.move=new l("move",{fontCharacter:"\\eb22"}),l.multipleWindows=new l("multiple-windows",{fontCharacter:"\\eb23"}),l.mute=new l("mute",{fontCharacter:"\\eb24"}),l.noNewline=new l("no-newline",{fontCharacter:"\\eb25"}),l.note=new l("note",{fontCharacter:"\\eb26"}),l.octoface=new l("octoface",{fontCharacter:"\\eb27"}),l.openPreview=new l("open-preview",{fontCharacter:"\\eb28"}),l.package_=new l("package",{fontCharacter:"\\eb29"}),l.paintcan=new l("paintcan",{fontCharacter:"\\eb2a"}),l.pin=new l("pin",{fontCharacter:"\\eb2b"}),l.play=new l("play",{fontCharacter:"\\eb2c"}),l.run=new l("run",{fontCharacter:"\\eb2c"}),l.plug=new l("plug",{fontCharacter:"\\eb2d"}),l.preserveCase=new l("preserve-case",{fontCharacter:"\\eb2e"}),l.preview=new l("preview",{fontCharacter:"\\eb2f"}),l.project=new l("project",{fontCharacter:"\\eb30"}),l.pulse=new l("pulse",{fontCharacter:"\\eb31"}),l.question=new l("question",{fontCharacter:"\\eb32"}),l.quote=new l("quote",{fontCharacter:"\\eb33"}),l.radioTower=new l("radio-tower",{fontCharacter:"\\eb34"}),l.reactions=new l("reactions",{fontCharacter:"\\eb35"}),l.references=new l("references",{fontCharacter:"\\eb36"}),l.refresh=new l("refresh",{fontCharacter:"\\eb37"}),l.regex=new l("regex",{fontCharacter:"\\eb38"}),l.remoteExplorer=new l("remote-explorer",{fontCharacter:"\\eb39"}),l.remote=new l("remote",{fontCharacter:"\\eb3a"}),l.remove=new l("remove",{fontCharacter:"\\eb3b"}),l.replaceAll=new l("replace-all",{fontCharacter:"\\eb3c"}),l.replace=new l("replace",{fontCharacter:"\\eb3d"}),l.repoClone=new l("repo-clone",{fontCharacter:"\\eb3e"}),l.repoForcePush=new l("repo-force-push",{fontCharacter:"\\eb3f"}),l.repoPull=new l("repo-pull",{fontCharacter:"\\eb40"}),l.repoPush=new l("repo-push",{fontCharacter:"\\eb41"}),l.report=new l("report",{fontCharacter:"\\eb42"}),l.requestChanges=new l("request-changes",{fontCharacter:"\\eb43"}),l.rocket=new l("rocket",{fontCharacter:"\\eb44"}),l.rootFolderOpened=new l("root-folder-opened",{fontCharacter:"\\eb45"}),l.rootFolder=new l("root-folder",{fontCharacter:"\\eb46"}),l.rss=new l("rss",{fontCharacter:"\\eb47"}),l.ruby=new l("ruby",{fontCharacter:"\\eb48"}),l.saveAll=new l("save-all",{fontCharacter:"\\eb49"}),l.saveAs=new l("save-as",{fontCharacter:"\\eb4a"}),l.save=new l("save",{fontCharacter:"\\eb4b"}),l.screenFull=new l("screen-full",{fontCharacter:"\\eb4c"}),l.screenNormal=new l("screen-normal",{fontCharacter:"\\eb4d"}),l.searchStop=new l("search-stop",{fontCharacter:"\\eb4e"}),l.server=new l("server",{fontCharacter:"\\eb50"}),l.settingsGear=new l("settings-gear",{fontCharacter:"\\eb51"}),l.settings=new l("settings",{fontCharacter:"\\eb52"}),l.shield=new l("shield",{fontCharacter:"\\eb53"}),l.smiley=new l("smiley",{fontCharacter:"\\eb54"}),l.sortPrecedence=new l("sort-precedence",{fontCharacter:"\\eb55"}),l.splitHorizontal=new l("split-horizontal",{fontCharacter:"\\eb56"}),l.splitVertical=new l("split-vertical",{fontCharacter:"\\eb57"}),l.squirrel=new l("squirrel",{fontCharacter:"\\eb58"}),l.starFull=new l("star-full",{fontCharacter:"\\eb59"}),l.starHalf=new l("star-half",{fontCharacter:"\\eb5a"}),l.symbolClass=new l("symbol-class",{fontCharacter:"\\eb5b"}),l.symbolColor=new l("symbol-color",{fontCharacter:"\\eb5c"}),l.symbolConstant=new l("symbol-constant",{fontCharacter:"\\eb5d"}),l.symbolEnumMember=new l("symbol-enum-member",{fontCharacter:"\\eb5e"}),l.symbolField=new l("symbol-field",{fontCharacter:"\\eb5f"}),l.symbolFile=new l("symbol-file",{fontCharacter:"\\eb60"}),l.symbolInterface=new l("symbol-interface",{fontCharacter:"\\eb61"}),l.symbolKeyword=new l("symbol-keyword",{fontCharacter:"\\eb62"}),l.symbolMisc=new l("symbol-misc",{fontCharacter:"\\eb63"}),l.symbolOperator=new l("symbol-operator",{fontCharacter:"\\eb64"}),l.symbolProperty=new l("symbol-property",{fontCharacter:"\\eb65"}),l.wrench=new l("wrench",{fontCharacter:"\\eb65"}),l.wrenchSubaction=new l("wrench-subaction",{fontCharacter:"\\eb65"}),l.symbolSnippet=new l("symbol-snippet",{fontCharacter:"\\eb66"}),l.tasklist=new l("tasklist",{fontCharacter:"\\eb67"}),l.telescope=new l("telescope",{fontCharacter:"\\eb68"}),l.textSize=new l("text-size",{fontCharacter:"\\eb69"}),l.threeBars=new l("three-bars",{fontCharacter:"\\eb6a"}),l.thumbsdown=new l("thumbsdown",{fontCharacter:"\\eb6b"}),l.thumbsup=new l("thumbsup",{fontCharacter:"\\eb6c"}),l.tools=new l("tools",{fontCharacter:"\\eb6d"}),l.triangleDown=new l("triangle-down",{fontCharacter:"\\eb6e"}),l.triangleLeft=new l("triangle-left",{fontCharacter:"\\eb6f"}),l.triangleRight=new l("triangle-right",{fontCharacter:"\\eb70"}),l.triangleUp=new l("triangle-up",{fontCharacter:"\\eb71"}),l.twitter=new l("twitter",{fontCharacter:"\\eb72"}),l.unfold=new l("unfold",{fontCharacter:"\\eb73"}),l.unlock=new l("unlock",{fontCharacter:"\\eb74"}),l.unmute=new l("unmute",{fontCharacter:"\\eb75"}),l.unverified=new l("unverified",{fontCharacter:"\\eb76"}),l.verified=new l("verified",{fontCharacter:"\\eb77"}),l.versions=new l("versions",{fontCharacter:"\\eb78"}),l.vmActive=new l("vm-active",{fontCharacter:"\\eb79"}),l.vmOutline=new l("vm-outline",{fontCharacter:"\\eb7a"}),l.vmRunning=new l("vm-running",{fontCharacter:"\\eb7b"}),l.watch=new l("watch",{fontCharacter:"\\eb7c"}),l.whitespace=new l("whitespace",{fontCharacter:"\\eb7d"}),l.wholeWord=new l("whole-word",{fontCharacter:"\\eb7e"}),l.window=new l("window",{fontCharacter:"\\eb7f"}),l.wordWrap=new l("word-wrap",{fontCharacter:"\\eb80"}),l.zoomIn=new l("zoom-in",{fontCharacter:"\\eb81"}),l.zoomOut=new l("zoom-out",{fontCharacter:"\\eb82"}),l.listFilter=new l("list-filter",{fontCharacter:"\\eb83"}),l.listFlat=new l("list-flat",{fontCharacter:"\\eb84"}),l.listSelection=new l("list-selection",{fontCharacter:"\\eb85"}),l.selection=new l("selection",{fontCharacter:"\\eb85"}),l.listTree=new l("list-tree",{fontCharacter:"\\eb86"}),l.debugBreakpointFunctionUnverified=new l("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),l.debugBreakpointFunction=new l("debug-breakpoint-function",{fontCharacter:"\\eb88"}),l.debugBreakpointFunctionDisabled=new l("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),l.debugStackframeActive=new l("debug-stackframe-active",{fontCharacter:"\\eb89"}),l.debugStackframeDot=new l("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),l.debugStackframe=new l("debug-stackframe",{fontCharacter:"\\eb8b"}),l.debugStackframeFocused=new l("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),l.debugBreakpointUnsupported=new l("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),l.symbolString=new l("symbol-string",{fontCharacter:"\\eb8d"}),l.debugReverseContinue=new l("debug-reverse-continue",{fontCharacter:"\\eb8e"}),l.debugStepBack=new l("debug-step-back",{fontCharacter:"\\eb8f"}),l.debugRestartFrame=new l("debug-restart-frame",{fontCharacter:"\\eb90"}),l.callIncoming=new l("call-incoming",{fontCharacter:"\\eb92"}),l.callOutgoing=new l("call-outgoing",{fontCharacter:"\\eb93"}),l.menu=new l("menu",{fontCharacter:"\\eb94"}),l.expandAll=new l("expand-all",{fontCharacter:"\\eb95"}),l.feedback=new l("feedback",{fontCharacter:"\\eb96"}),l.groupByRefType=new l("group-by-ref-type",{fontCharacter:"\\eb97"}),l.ungroupByRefType=new l("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),l.account=new l("account",{fontCharacter:"\\eb99"}),l.bellDot=new l("bell-dot",{fontCharacter:"\\eb9a"}),l.debugConsole=new l("debug-console",{fontCharacter:"\\eb9b"}),l.library=new l("library",{fontCharacter:"\\eb9c"}),l.output=new l("output",{fontCharacter:"\\eb9d"}),l.runAll=new l("run-all",{fontCharacter:"\\eb9e"}),l.syncIgnored=new l("sync-ignored",{fontCharacter:"\\eb9f"}),l.pinned=new l("pinned",{fontCharacter:"\\eba0"}),l.githubInverted=new l("github-inverted",{fontCharacter:"\\eba1"}),l.debugAlt=new l("debug-alt",{fontCharacter:"\\eb91"}),l.serverProcess=new l("server-process",{fontCharacter:"\\eba2"}),l.serverEnvironment=new l("server-environment",{fontCharacter:"\\eba3"}),l.pass=new l("pass",{fontCharacter:"\\eba4"}),l.stopCircle=new l("stop-circle",{fontCharacter:"\\eba5"}),l.playCircle=new l("play-circle",{fontCharacter:"\\eba6"}),l.record=new l("record",{fontCharacter:"\\eba7"}),l.debugAltSmall=new l("debug-alt-small",{fontCharacter:"\\eba8"}),l.vmConnect=new l("vm-connect",{fontCharacter:"\\eba9"}),l.cloud=new l("cloud",{fontCharacter:"\\ebaa"}),l.merge=new l("merge",{fontCharacter:"\\ebab"}),l.exportIcon=new l("export",{fontCharacter:"\\ebac"}),l.graphLeft=new l("graph-left",{fontCharacter:"\\ebad"}),l.magnet=new l("magnet",{fontCharacter:"\\ebae"}),l.notebook=new l("notebook",{fontCharacter:"\\ebaf"}),l.redo=new l("redo",{fontCharacter:"\\ebb0"}),l.checkAll=new l("check-all",{fontCharacter:"\\ebb1"}),l.pinnedDirty=new l("pinned-dirty",{fontCharacter:"\\ebb2"}),l.passFilled=new l("pass-filled",{fontCharacter:"\\ebb3"}),l.circleLargeFilled=new l("circle-large-filled",{fontCharacter:"\\ebb4"}),l.circleLargeOutline=new l("circle-large-outline",{fontCharacter:"\\ebb5"}),l.combine=new l("combine",{fontCharacter:"\\ebb6"}),l.gather=new l("gather",{fontCharacter:"\\ebb6"}),l.table=new l("table",{fontCharacter:"\\ebb7"}),l.variableGroup=new l("variable-group",{fontCharacter:"\\ebb8"}),l.typeHierarchy=new l("type-hierarchy",{fontCharacter:"\\ebb9"}),l.typeHierarchySub=new l("type-hierarchy-sub",{fontCharacter:"\\ebba"}),l.typeHierarchySuper=new l("type-hierarchy-super",{fontCharacter:"\\ebbb"}),l.gitPullRequestCreate=new l("git-pull-request-create",{fontCharacter:"\\ebbc"}),l.runAbove=new l("run-above",{fontCharacter:"\\ebbd"}),l.runBelow=new l("run-below",{fontCharacter:"\\ebbe"}),l.notebookTemplate=new l("notebook-template",{fontCharacter:"\\ebbf"}),l.debugRerun=new l("debug-rerun",{fontCharacter:"\\ebc0"}),l.workspaceTrusted=new l("workspace-trusted",{fontCharacter:"\\ebc1"}),l.workspaceUntrusted=new l("workspace-untrusted",{fontCharacter:"\\ebc2"}),l.workspaceUnspecified=new l("workspace-unspecified",{fontCharacter:"\\ebc3"}),l.terminalCmd=new l("terminal-cmd",{fontCharacter:"\\ebc4"}),l.terminalDebian=new l("terminal-debian",{fontCharacter:"\\ebc5"}),l.terminalLinux=new l("terminal-linux",{fontCharacter:"\\ebc6"}),l.terminalPowershell=new l("terminal-powershell",{fontCharacter:"\\ebc7"}),l.terminalTmux=new l("terminal-tmux",{fontCharacter:"\\ebc8"}),l.terminalUbuntu=new l("terminal-ubuntu",{fontCharacter:"\\ebc9"}),l.terminalBash=new l("terminal-bash",{fontCharacter:"\\ebca"}),l.arrowSwap=new l("arrow-swap",{fontCharacter:"\\ebcb"}),l.copy=new l("copy",{fontCharacter:"\\ebcc"}),l.personAdd=new l("person-add",{fontCharacter:"\\ebcd"}),l.filterFilled=new l("filter-filled",{fontCharacter:"\\ebce"}),l.wand=new l("wand",{fontCharacter:"\\ebcf"}),l.debugLineByLine=new l("debug-line-by-line",{fontCharacter:"\\ebd0"}),l.inspect=new l("inspect",{fontCharacter:"\\ebd1"}),l.layers=new l("layers",{fontCharacter:"\\ebd2"}),l.layersDot=new l("layers-dot",{fontCharacter:"\\ebd3"}),l.layersActive=new l("layers-active",{fontCharacter:"\\ebd4"}),l.compass=new l("compass",{fontCharacter:"\\ebd5"}),l.compassDot=new l("compass-dot",{fontCharacter:"\\ebd6"}),l.compassActive=new l("compass-active",{fontCharacter:"\\ebd7"}),l.azure=new l("azure",{fontCharacter:"\\ebd8"}),l.issueDraft=new l("issue-draft",{fontCharacter:"\\ebd9"}),l.gitPullRequestClosed=new l("git-pull-request-closed",{fontCharacter:"\\ebda"}),l.gitPullRequestDraft=new l("git-pull-request-draft",{fontCharacter:"\\ebdb"}),l.debugAll=new l("debug-all",{fontCharacter:"\\ebdc"}),l.debugCoverage=new l("debug-coverage",{fontCharacter:"\\ebdd"}),l.runErrors=new l("run-errors",{fontCharacter:"\\ebde"}),l.folderLibrary=new l("folder-library",{fontCharacter:"\\ebdf"}),l.debugContinueSmall=new l("debug-continue-small",{fontCharacter:"\\ebe0"}),l.beakerStop=new l("beaker-stop",{fontCharacter:"\\ebe1"}),l.graphLine=new l("graph-line",{fontCharacter:"\\ebe2"}),l.graphScatter=new l("graph-scatter",{fontCharacter:"\\ebe3"}),l.pieChart=new l("pie-chart",{fontCharacter:"\\ebe4"}),l.bracket=new l("bracket",l.json.definition),l.bracketDot=new l("bracket-dot",{fontCharacter:"\\ebe5"}),l.bracketError=new l("bracket-error",{fontCharacter:"\\ebe6"}),l.lockSmall=new l("lock-small",{fontCharacter:"\\ebe7"}),l.azureDevops=new l("azure-devops",{fontCharacter:"\\ebe8"}),l.verifiedFilled=new l("verified-filled",{fontCharacter:"\\ebe9"})}(me||(me={}))},79881:function(Xt,st,K){"use strict";K.d(st,{B8:function(){return P},Cp:function(){return he},F0:function(){return ce},L6:function(){return X},VV:function(){return me},b1:function(){return l},dL:function(){return Se},ri:function(){return j}});class B{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(_){setTimeout(()=>{throw _.stack?new Error(_.message+`
`+_.stack):_},0)}}emit(_){this.listeners.forEach(E=>{E(_)})}onUnexpectedError(_){this.unexpectedErrorHandler(_),this.emit(_)}onUnexpectedExternalError(_){this.unexpectedErrorHandler(_)}}const de=new B;function Se(g){me(g)||de.onUnexpectedError(g)}function he(g){me(g)||de.onUnexpectedExternalError(g)}function j(g){if(g instanceof Error){let{name:_,message:E}=g;const A=g.stacktrace||g.stack;return{$isError:!0,name:_,message:E,stack:A}}return g}const p="Canceled";function me(g){return g instanceof Error&&g.name===p&&g.message===p}function ce(){const g=new Error(p);return g.name=g.message,g}function l(g){return g?new Error(`Illegal argument: ${g}`):new Error("Illegal argument")}function X(g){return g?new Error(`Illegal state: ${g}`):new Error("Illegal state")}class P extends Error{constructor(_){super("NotSupported"),_&&(this.message=_)}}},4348:function(Xt,st,K){"use strict";K.d(st,{D0:function(){return P},E7:function(){return g},K3:function(){return X},Q5:function(){return l},ZD:function(){return _},ju:function(){return j}});var B=K(79881),de=K(69323),Se=K(34502),he=K(95830),j;(function(E){E.None=()=>de.JT.None;function A(N){return(O,oe=null,ie)=>{let S=!1,v;return v=N(z=>{if(!S)return v?v.dispose():S=!0,O.call(oe,z)},null,ie),S&&v.dispose(),v}}E.once=A;function M(N,O){return R((oe,ie=null,S)=>N(v=>oe.call(ie,O(v)),null,S))}E.map=M;function H(N,O){return R((oe,ie=null,S)=>N(v=>{O(v),oe.call(ie,v)},null,S))}E.forEach=H;function V(N,O){return R((oe,ie=null,S)=>N(v=>O(v)&&oe.call(ie,v),null,S))}E.filter=V;function L(N){return N}E.signal=L;function I(...N){return(O,oe=null,ie)=>(0,de.F8)(...N.map(S=>S(v=>O.call(oe,v),null,ie)))}E.any=I;function w(N,O,oe){let ie=oe;return M(N,S=>(ie=O(ie,S),ie))}E.reduce=w;function R(N){let O;const oe=new l({onFirstListenerAdd(){O=N(oe.fire,oe)},onLastListenerRemove(){O.dispose()}});return oe.event}function q(N,O,oe=100,ie=!1,S){let v,z,ae,Te=0;const Fe=new l({leakWarningThreshold:S,onFirstListenerAdd(){v=N(Ye=>{Te++,z=O(z,Ye),ie&&!ae&&(Fe.fire(z),z=void 0),clearTimeout(ae),ae=setTimeout(()=>{const _t=z;z=void 0,ae=void 0,(!ie||Te>1)&&Fe.fire(_t),Te=0},oe)})},onLastListenerRemove(){v.dispose()}});return Fe.event}E.debounce=q;function se(N,O=(oe,ie)=>oe===ie){let oe=!0,ie;return V(N,S=>{const v=oe||!O(S,ie);return oe=!1,ie=S,v})}E.latch=se;function te(N,O){return[E.filter(N,O),E.filter(N,oe=>!O(oe))]}E.split=te;function ge(N,O=!1,oe=[]){let ie=oe.slice(),S=N(ae=>{ie?ie.push(ae):z.fire(ae)});const v=()=>{ie&&ie.forEach(ae=>z.fire(ae)),ie=null},z=new l({onFirstListenerAdd(){S||(S=N(ae=>z.fire(ae)))},onFirstListenerDidAdd(){ie&&(O?setTimeout(v):v())},onLastListenerRemove(){S&&S.dispose(),S=null}});return z.event}E.buffer=ge;class Le{constructor(O){this.event=O}map(O){return new Le(M(this.event,O))}forEach(O){return new Le(H(this.event,O))}filter(O){return new Le(V(this.event,O))}reduce(O,oe){return new Le(w(this.event,O,oe))}latch(){return new Le(se(this.event))}debounce(O,oe=100,ie=!1,S){return new Le(q(this.event,O,oe,ie,S))}on(O,oe,ie){return this.event(O,oe,ie)}once(O,oe,ie){return A(this.event)(O,oe,ie)}}function xe(N){return new Le(N)}E.chain=xe;function $e(N,O,oe=ie=>ie){const ie=(...ae)=>z.fire(oe(...ae)),S=()=>N.on(O,ie),v=()=>N.removeListener(O,ie),z=new l({onFirstListenerAdd:S,onLastListenerRemove:v});return z.event}E.fromNodeEventEmitter=$e;function J(N,O,oe=ie=>ie){const ie=(...ae)=>z.fire(oe(...ae)),S=()=>N.addEventListener(O,ie),v=()=>N.removeEventListener(O,ie),z=new l({onFirstListenerAdd:S,onLastListenerRemove:v});return z.event}E.fromDOMEventEmitter=J;function D(N){return new Promise(O=>A(N)(O))}E.toPromise=D})(j||(j={}));class p{constructor(A){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${A}_${p._idPool++}`}start(A){this._stopWatch=new he.G(!0),this._listenerCount=A}stop(){if(this._stopWatch){const A=this._stopWatch.elapsed();this._elapsedOverall+=A,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${A.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let me=-1;class ce{constructor(A,M=Math.random().toString(18).slice(2,5)){this.customThreshold=A,this.name=M,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(A){let M=me;if(typeof this.customThreshold=="number"&&(M=this.customThreshold),M<=0||A<M)return;this._stacks||(this._stacks=new Map);const H=new Error().stack.split(`
`).slice(3).join(`
`),V=this._stacks.get(H)||0;if(this._stacks.set(H,V+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=M*.5;let L,I=0;for(const[w,R]of this._stacks)(!L||I<R)&&(L=w,I=R);console.warn(`[${this.name}] potential listener LEAK detected, having ${A} listeners already. MOST frequent listener (${I}):`),console.warn(L)}return()=>{const L=this._stacks.get(H)||0;this._stacks.set(H,L-1)}}}class l{constructor(A){var M;this._disposed=!1,this._options=A,this._leakageMon=me>0?new ce(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((M=this._options)===null||M===void 0)&&M._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(A,M,H)=>{var V;this._listeners||(this._listeners=new Se.S);const L=this._listeners.isEmpty();L&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const I=this._listeners.push(M?[A,M]:A);L&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,A,M);const w=(V=this._leakageMon)===null||V===void 0?void 0:V.check(this._listeners.size),R=(0,de.OF)(()=>{w&&w(),this._disposed||(I(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return H instanceof de.SL?H.add(R):Array.isArray(H)&&H.push(R),R}),this._event}fire(A){var M,H;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Se.S);for(let V of this._listeners)this._deliveryQueue.push([V,A]);for((M=this._perfMon)===null||M===void 0||M.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[V,L]=this._deliveryQueue.shift();try{typeof V=="function"?V.call(void 0,L):V[0].call(V[1],L)}catch(I){(0,B.dL)(I)}}(H=this._perfMon)===null||H===void 0||H.stop()}}dispose(){var A,M,H,V,L;this._disposed||(this._disposed=!0,(A=this._listeners)===null||A===void 0||A.clear(),(M=this._deliveryQueue)===null||M===void 0||M.clear(),(V=(H=this._options)===null||H===void 0?void 0:H.onLastListenerRemove)===null||V===void 0||V.call(H),(L=this._leakageMon)===null||L===void 0||L.dispose())}}class X extends l{constructor(A){super(A),this._isPaused=0,this._eventQueue=new Se.S,this._mergeFn=A==null?void 0:A.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const A=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(A))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(A){this._listeners&&(this._isPaused!==0?this._eventQueue.push(A):super.fire(A))}}class P extends X{constructor(A){var M;super(A),this._delay=(M=A.delay)!==null&&M!==void 0?M:100}fire(A){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(A)}}class g{constructor(){this.buffers=[]}wrapEvent(A){return(M,H,V)=>A(L=>{const I=this.buffers[this.buffers.length-1];I?I.push(()=>M.call(H,L)):M.call(H,L)},void 0,V)}bufferEvents(A){const M=[];this.buffers.push(M);const H=A();return this.buffers.pop(),M.forEach(V=>V()),H}}class _{constructor(){this.listening=!1,this.inputEvent=j.None,this.inputEventListener=de.JT.None,this.emitter=new l({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(A){this.inputEvent=A,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=A(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Xt,st,K){"use strict";K.d(st,{I:function(){return B}});function B(de){const Se=this;let he=!1,j;return function(){return he||(he=!0,j=de.apply(Se,arguments)),j}}},88226:function(Xt,st,K){"use strict";K.d(st,{$:function(){return B}});var B;(function(de){function Se(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}de.is=Se;const he=Object.freeze([]);function j(){return he}de.empty=j;function*p(I){yield I}de.single=p;function me(I){return I||he}de.from=me;function ce(I){return!I||I[Symbol.iterator]().next().done===!0}de.isEmpty=ce;function l(I){return I[Symbol.iterator]().next().value}de.first=l;function X(I,w){for(const R of I)if(w(R))return!0;return!1}de.some=X;function P(I,w){for(const R of I)if(w(R))return R}de.find=P;function*g(I,w){for(const R of I)w(R)&&(yield R)}de.filter=g;function*_(I,w){let R=0;for(const q of I)yield w(q,R++)}de.map=_;function*E(...I){for(const w of I)for(const R of w)yield R}de.concat=E;function*A(I){for(const w of I)for(const R of w)yield R}de.concatNested=A;function M(I,w,R){let q=R;for(const se of I)q=w(q,se);return q}de.reduce=M;function*H(I,w,R=I.length){for(w<0&&(w+=I.length),R<0?R+=I.length:R>I.length&&(R=I.length);w<R;w++)yield I[w]}de.slice=H;function V(I,w=Number.POSITIVE_INFINITY){const R=[];if(w===0)return[R,I];const q=I[Symbol.iterator]();for(let se=0;se<w;se++){const te=q.next();if(te.done)return[R,de.empty()];R.push(te.value)}return[R,{[Symbol.iterator](){return q}}]}de.consume=V;function L(I,w,R=(q,se)=>q===se){const q=I[Symbol.iterator](),se=w[Symbol.iterator]();for(;;){const te=q.next(),ge=se.next();if(te.done!==ge.done)return!1;if(te.done)return!0;if(!R(te.value,ge.value))return!1}}de.equals=L})(B||(B={}))},69323:function(Xt,st,K){"use strict";K.d(st,{B9:function(){return _},F8:function(){return E},JT:function(){return H},Jz:function(){return L},OF:function(){return A},SL:function(){return M},Wf:function(){return g},XK:function(){return V},dk:function(){return X}});var B=K(17845),de=K(88226);const Se=!1;let he=null;function j(I){he=I}if(Se){const I="__is_disposable_tracked__";j(new class{trackDisposable(w){const R=new Error("Potentially leaked disposable").stack;setTimeout(()=>{w[I]||console.log(R)},3e3)}setParent(w,R){if(w&&w!==H.None)try{w[I]=!0}catch(q){}}markAsDisposed(w){if(w&&w!==H.None)try{w[I]=!0}catch(R){}}markAsSingleton(w){}})}function p(I){return he==null||he.trackDisposable(I),I}function me(I){he==null||he.markAsDisposed(I)}function ce(I,w){he==null||he.setParent(I,w)}function l(I,w){if(he)for(const R of I)he.setParent(R,w)}function X(I){return he==null||he.markAsSingleton(I),I}class P extends Error{constructor(w){super(`Encountered errors while disposing of store. Errors: [${w.join(", ")}]`),this.errors=w}}function g(I){return typeof I.dispose=="function"&&I.dispose.length===0}function _(I){if(de.$.is(I)){let w=[];for(const R of I)if(R)try{R.dispose()}catch(q){w.push(q)}if(w.length===1)throw w[0];if(w.length>1)throw new P(w);return Array.isArray(I)?[]:I}else if(I)return I.dispose(),I}function E(...I){const w=A(()=>_(I));return l(I,w),w}function A(I){const w=p({dispose:(0,B.I)(()=>{me(w),I()})});return w}class M{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(me(this),this._isDisposed=!0,this.clear())}clear(){try{_(this._toDispose.values())}finally{this._toDispose.clear()}}add(w){if(!w)return w;if(w===this)throw new Error("Cannot register a disposable on itself!");return ce(w,this),this._isDisposed?M.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(w),w}}M.DISABLE_DISPOSED_WARNING=!1;class H{constructor(){this._store=new M,p(this),ce(this._store,this)}dispose(){me(this),this._store.dispose()}_register(w){if(w===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(w)}}H.None=Object.freeze({dispose(){}});class V{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(w){var R;this._isDisposed||w===this._value||((R=this._value)===null||R===void 0||R.dispose(),w&&ce(w,this),this._value=w)}clear(){this.value=void 0}dispose(){var w;this._isDisposed=!0,me(this),(w=this._value)===null||w===void 0||w.dispose(),this._value=void 0}clearAndLeak(){const w=this._value;return this._value=void 0,w&&ce(w,null),w}}class L{constructor(w){this.object=w}dispose(){}}},34502:function(Xt,st,K){"use strict";K.d(st,{S:function(){return de}});class B{constructor(he){this.element=he,this.next=B.Undefined,this.prev=B.Undefined}}B.Undefined=new B(void 0);class de{constructor(){this._first=B.Undefined,this._last=B.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===B.Undefined}clear(){let he=this._first;for(;he!==B.Undefined;){const j=he.next;he.prev=B.Undefined,he.next=B.Undefined,he=j}this._first=B.Undefined,this._last=B.Undefined,this._size=0}unshift(he){return this._insert(he,!1)}push(he){return this._insert(he,!0)}_insert(he,j){const p=new B(he);if(this._first===B.Undefined)this._first=p,this._last=p;else if(j){const ce=this._last;this._last=p,p.prev=ce,ce.next=p}else{const ce=this._first;this._first=p,p.next=ce,ce.prev=p}this._size+=1;let me=!1;return()=>{me||(me=!0,this._remove(p))}}shift(){if(this._first!==B.Undefined){const he=this._first.element;return this._remove(this._first),he}}pop(){if(this._last!==B.Undefined){const he=this._last.element;return this._remove(this._last),he}}_remove(he){if(he.prev!==B.Undefined&&he.next!==B.Undefined){const j=he.prev;j.next=he.next,he.next.prev=j}else he.prev===B.Undefined&&he.next===B.Undefined?(this._first=B.Undefined,this._last=B.Undefined):he.next===B.Undefined?(this._last=this._last.prev,this._last.next=B.Undefined):he.prev===B.Undefined&&(this._first=this._first.next,this._first.prev=B.Undefined);this._size-=1}*[Symbol.iterator](){let he=this._first;for(;he!==B.Undefined;)yield he.element,he=he.next}}},23345:function(Xt,st,K){"use strict";K.d(st,{$L:function(){return q},ED:function(){return L},IJ:function(){return w},OS:function(){return Le},WE:function(){return te},dz:function(){return I},gn:function(){return se},li:function(){return A},r:function(){return J},tY:function(){return R},xS:function(){return ge}});var B=K(97671),de;const Se="en";let he=!1,j=!1,p=!1,me=!1,ce=!1,l=!1,X=!1,P,g=null,_=null,E;const A=typeof self=="object"?self:typeof K.g=="object"?K.g:{};let M;typeof A.vscode!="undefined"&&typeof A.vscode.process!="undefined"?M=A.vscode.process:typeof B!="undefined"&&(M=B);const H=typeof((de=M==null?void 0:M.versions)===null||de===void 0?void 0:de.electron)=="string"&&M.type==="renderer";if(typeof navigator=="object"&&!H)E=navigator.userAgent,he=E.indexOf("Windows")>=0,j=E.indexOf("Macintosh")>=0,X=(E.indexOf("Macintosh")>=0||E.indexOf("iPad")>=0||E.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=E.indexOf("Linux")>=0,l=!0,P=navigator.language,g=P;else if(typeof M=="object"){he=M.platform==="win32",j=M.platform==="darwin",p=M.platform==="linux",me=p&&!!M.env.SNAP&&!!M.env.SNAP_REVISION,P=Se,g=Se;const D=M.env.VSCODE_NLS_CONFIG;if(D)try{const N=JSON.parse(D),O=N.availableLanguages["*"];P=N.locale,g=O||Se,_=N._translationsConfigFile}catch(N){}ce=!0}else console.error("Unable to resolve platform.");let V=0;j?V=1:he?V=3:p&&(V=2);const L=he,I=j,w=p,R=ce,q=l,se=X,te=E,ge=function(){if(A.setImmediate)return A.setImmediate.bind(A);if(typeof A.postMessage=="function"&&!A.importScripts){let O=[];A.addEventListener("message",ie=>{if(ie.data&&ie.data.vscodeSetImmediateId)for(let S=0,v=O.length;S<v;S++){const z=O[S];if(z.id===ie.data.vscodeSetImmediateId){O.splice(S,1),z.callback();return}}});let oe=0;return ie=>{const S=++oe;O.push({id:S,callback:ie}),A.postMessage({vscodeSetImmediateId:S},"*")}}if(typeof(M==null?void 0:M.nextTick)=="function")return M.nextTick.bind(M);const N=Promise.resolve();return O=>N.then(O)}(),Le=j||X?2:he?1:3;let xe=!0,$e=!1;function J(){if(!$e){$e=!0;const D=new Uint8Array(2);D[0]=1,D[1]=2,xe=new Uint16Array(D.buffer)[0]===513}return xe}},95830:function(Xt,st,K){"use strict";K.d(st,{G:function(){return Se}});var B=K(23345);const de=B.li.performance&&typeof B.li.performance.now=="function";class Se{constructor(j){this._highResolution=de&&j,this._startTime=this._now(),this._stopTime=-1}static create(j=!0){return new Se(j)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?B.li.performance.now():Date.now()}}},82983:function(Xt,st,K){"use strict";K.d(st,{$i:function(){return Te},C8:function(){return si},GF:function(){return P},HO:function(){return oe},IO:function(){return g},K7:function(){return Ut},Kw:function(){return $t},LC:function(){return A},Mh:function(){return ge},P1:function(){return Le},PJ:function(){return ut},Qe:function(){return Fe},R1:function(){return X},RP:function(){return z},S6:function(){return li},TT:function(){return L},Ut:function(){return S},V8:function(){return M},WU:function(){return Se},YK:function(){return $e},YU:function(){return he},ZG:function(){return xe},ZH:function(){return D},ab:function(){return Ye},c1:function(){return Ge},df:function(){return q},ec:function(){return j},fi:function(){return We},fy:function(){return p},j3:function(){return me},j_:function(){return w},m5:function(){return B},mK:function(){return R},mr:function(){return _},oH:function(){return ne},oL:function(){return ce},ok:function(){return te},ow:function(){return H},qq:function(){return se},qu:function(){return V},rL:function(){return J},uS:function(){return ft},un:function(){return l},uq:function(){return E},vH:function(){return O},xe:function(){return _t},zY:function(){return I}});function B(Y){return!Y||typeof Y!="string"?!0:Y.trim().length===0}const de=/{(\d+)}/g;function Se(Y,...C){return C.length===0?Y:Y.replace(de,function(Q,F){const U=parseInt(F,10);return isNaN(U)||U<0||U>=C.length?Q:C[U]})}function he(Y){return Y.replace(/[<>&]/g,function(C){switch(C){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return C}})}function j(Y){return Y.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(Y,C=" "){const Q=me(Y,C);return ce(Q,C)}function me(Y,C){if(!Y||!C)return Y;const Q=C.length;if(Q===0||Y.length===0)return Y;let F=0;for(;Y.indexOf(C,F)===F;)F=F+Q;return Y.substring(F)}function ce(Y,C){if(!Y||!C)return Y;const Q=C.length,F=Y.length;if(Q===0||F===0)return Y;let U=F,W=-1;for(;W=Y.lastIndexOf(C,U-1),!(W===-1||W+Q!==U);){if(W===0)return"";U=W}return Y.substring(0,U)}function l(Y){return Y.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function X(Y){return Y.replace(/\*/g,"")}function P(Y,C,Q={}){if(!Y)throw new Error("Cannot create regex from empty string");C||(Y=j(Y)),Q.wholeWord&&(/\B/.test(Y.charAt(0))||(Y="\\b"+Y),/\B/.test(Y.charAt(Y.length-1))||(Y=Y+"\\b"));let F="";return Q.global&&(F+="g"),Q.matchCase||(F+="i"),Q.multiline&&(F+="m"),Q.unicode&&(F+="u"),new RegExp(Y,F)}function g(Y){return Y.source==="^"||Y.source==="^$"||Y.source==="$"||Y.source==="^\\s*$"?!1:!!(Y.exec("")&&Y.lastIndex===0)}function _(Y){return(Y.global?"g":"")+(Y.ignoreCase?"i":"")+(Y.multiline?"m":"")+(Y.unicode?"u":"")}function E(Y){return Y.split(/\r\n|\r|\n/)}function A(Y){for(let C=0,Q=Y.length;C<Q;C++){const F=Y.charCodeAt(C);if(F!==32&&F!==9)return C}return-1}function M(Y,C=0,Q=Y.length){for(let F=C;F<Q;F++){const U=Y.charCodeAt(F);if(U!==32&&U!==9)return Y.substring(C,F)}return Y.substring(C,Q)}function H(Y,C=Y.length-1){for(let Q=C;Q>=0;Q--){const F=Y.charCodeAt(Q);if(F!==32&&F!==9)return Q}return-1}function V(Y,C){return Y<C?-1:Y>C?1:0}function L(Y,C,Q=0,F=Y.length,U=0,W=C.length){for(;Q<F&&U<W;Q++,U++){let ye=Y.charCodeAt(Q),De=C.charCodeAt(U);if(ye<De)return-1;if(ye>De)return 1}const re=F-Q,le=W-U;return re<le?-1:re>le?1:0}function I(Y,C){return w(Y,C,0,Y.length,0,C.length)}function w(Y,C,Q=0,F=Y.length,U=0,W=C.length){for(;Q<F&&U<W;Q++,U++){let ye=Y.charCodeAt(Q),De=C.charCodeAt(U);if(ye===De)continue;if(ye>=128||De>=128)return L(Y.toLowerCase(),C.toLowerCase(),Q,F,U,W);R(ye)&&(ye-=32),R(De)&&(De-=32);const Ae=ye-De;if(Ae!==0)return Ae}const re=F-Q,le=W-U;return re<le?-1:re>le?1:0}function R(Y){return Y>=97&&Y<=122}function q(Y){return Y>=65&&Y<=90}function se(Y,C){return Y.length===C.length&&w(Y,C)===0}function te(Y,C){const Q=C.length;return C.length>Y.length?!1:w(Y,C,0,Q)===0}function ge(Y,C){let Q,F=Math.min(Y.length,C.length);for(Q=0;Q<F;Q++)if(Y.charCodeAt(Q)!==C.charCodeAt(Q))return Q;return F}function Le(Y,C){let Q,F=Math.min(Y.length,C.length);const U=Y.length-1,W=C.length-1;for(Q=0;Q<F;Q++)if(Y.charCodeAt(U-Q)!==C.charCodeAt(W-Q))return Q;return F}function xe(Y){return 55296<=Y&&Y<=56319}function $e(Y){return 56320<=Y&&Y<=57343}function J(Y,C){return(Y-55296<<10)+(C-56320)+65536}function D(Y,C,Q){const F=Y.charCodeAt(Q);if(xe(F)&&Q+1<C){const U=Y.charCodeAt(Q+1);if($e(U))return J(F,U)}return F}function N(Y,C){const Q=Y.charCodeAt(C-1);if($e(Q)&&C>1){const F=Y.charCodeAt(C-2);if(xe(F))return J(F,Q)}return Q}function O(Y,C){const Q=Ee.getInstance(),F=C,U=Y.length,W=D(Y,U,C);C+=W>=65536?2:1;let re=Q.getGraphemeBreakType(W);for(;C<U;){const le=D(Y,U,C),ye=Q.getGraphemeBreakType(le);if(We(re,ye))break;C+=le>=65536?2:1,re=ye}return C-F}function oe(Y,C){const Q=Ee.getInstance(),F=C,U=N(Y,C);C-=U>=65536?2:1;let W=Q.getGraphemeBreakType(U);for(;C>0;){const re=N(Y,C),le=Q.getGraphemeBreakType(re);if(We(le,W))break;C-=re>=65536?2:1,W=le}return F-C}const ie=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function S(Y){return ie.test(Y)}const v=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function z(Y){return v.test(Y)}const ae=/^[\t\n\r\x20-\x7E]*$/;function Te(Y){return ae.test(Y)}const Fe=/[\u2028\u2029]/;function Ye(Y){return Fe.test(Y)}function _t(Y){for(let C=0,Q=Y.length;C<Q;C++)if(Ut(Y.charCodeAt(C)))return!0;return!1}function Ut(Y){return Y=+Y,Y>=11904&&Y<=55215||Y>=63744&&Y<=64255||Y>=65281&&Y<=65374}function si(Y){return Y>=127462&&Y<=127487||Y===8986||Y===8987||Y===9200||Y===9203||Y>=9728&&Y<=10175||Y===11088||Y===11093||Y>=127744&&Y<=128591||Y>=128640&&Y<=128764||Y>=128992&&Y<=129003||Y>=129280&&Y<=129535||Y>=129648&&Y<=129750}const Ge="\uFEFF";function ft(Y){return!!(Y&&Y.length>0&&Y.charCodeAt(0)===65279)}function $t(Y,C=!1){return Y?(C&&(Y=Y.replace(/\\./g,"")),Y.toLowerCase()!==Y):!1}function ut(Y){return Y=Y%(2*26),Y<26?String.fromCharCode(97+Y):String.fromCharCode(65+Y-26)}function li(Y){return Ee.getInstance().getGraphemeBreakType(Y)}function We(Y,C){return Y===0?C!==5&&C!==7:Y===2&&C===3?!1:Y===4||Y===2||Y===3||C===4||C===2||C===3?!0:!(Y===8&&(C===8||C===9||C===11||C===12)||(Y===11||Y===9)&&(C===9||C===10)||(Y===12||Y===10)&&C===10||C===5||C===13||C===7||Y===1||Y===13&&C===14||Y===6&&C===6)}class Ee{constructor(){this._data=Ie()}static getInstance(){return Ee._INSTANCE||(Ee._INSTANCE=new Ee),Ee._INSTANCE}getGraphemeBreakType(C){if(C<32)return C===10?3:C===13?2:4;if(C<127)return 0;const Q=this._data,F=Q.length/3;let U=1;for(;U<=F;)if(C<Q[3*U])U=2*U;else if(C>Q[3*U+1])U=2*U+1;else return Q[3*U+2];return 0}}Ee._INSTANCE=null;function Ie(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function ne(Y,C){if(Y===0)return 0;const Q=we(Y,C);if(Q!==void 0)return Q;const F=N(C,Y);return Y-=ke(F),Y}function we(Y,C){let Q=N(C,Y);for(Y-=ke(Q);ee(Q)||Q===65039||Q===8419;){if(Y===0)return;Q=N(C,Y),Y-=ke(Q)}if(si(Q)){if(Y>=0){const F=N(C,Y);F===8205&&(Y-=ke(F))}return Y}}function ke(Y){return Y>=65536?2:1}function ee(Y){return 127995<=Y&&Y<=127999}},72999:function(Xt,st,K){"use strict";K.d(st,{$E:function(){return A},$K:function(){return me},D8:function(){return g},HD:function(){return de},IU:function(){return M},Jp:function(){return ce},Kn:function(){return Se},cW:function(){return X},f6:function(){return H},hj:function(){return he},jn:function(){return j},kJ:function(){return B},mf:function(){return P},o8:function(){return p},p_:function(){return l},vE:function(){return V}});function B(L){return Array.isArray(L)}function de(L){return typeof L=="string"}function Se(L){return typeof L=="object"&&L!==null&&!Array.isArray(L)&&!(L instanceof RegExp)&&!(L instanceof Date)}function he(L){return typeof L=="number"&&!isNaN(L)}function j(L){return L===!0||L===!1}function p(L){return typeof L=="undefined"}function me(L){return!ce(L)}function ce(L){return p(L)||L===null}function l(L,I){if(!L)throw new Error(I?`Unexpected type, expected '${I}'`:"Unexpected type")}function X(L){if(ce(L))throw new Error("Assertion Failed: argument is undefined or null");return L}function P(L){return typeof L=="function"}function g(L,I){const w=Math.min(L.length,I.length);for(let R=0;R<w;R++)_(L[R],I[R])}function _(L,I){if(de(I)){if(typeof L!==I)throw new Error(`argument does not match constraint: typeof ${I}`)}else if(P(I)){try{if(L instanceof I)return}catch(w){}if(!ce(L)&&L.constructor===I||I.length===1&&I.call(void 0,L)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function E(L){let I=[],w=Object.getPrototypeOf(L);for(;Object.prototype!==w;)I=I.concat(Object.getOwnPropertyNames(w)),w=Object.getPrototypeOf(w);return I}function A(L){const I=[];for(const w of E(L))typeof L[w]=="function"&&I.push(w);return I}function M(L,I){const w=q=>function(){const se=Array.prototype.slice.call(arguments,0);return I(q,se)};let R={};for(const q of L)R[q]=w(q);return R}function H(L){return L===null?void 0:L}function V(L,I="Unreachable"){throw new Error(I)}},13268:function(Xt,st,K){"use strict";K.d(st,{N:function(){return de}});function B(Se,he){let j;return he.length===0?j=Se:j=Se.replace(/\{(\d+)\}/g,function(p,me){const ce=me[0];return typeof he[ce]!="undefined"?he[ce]:p}),j}function de(Se,he,...j){return B(he,j)}},96236:function(Xt,st,K){"use strict";K.d(st,{BH:function(){return M},NZ:function(){return H},U8:function(){return V},co:function(){return A},eH:function(){return E},vr:function(){return _}});var B=K(75918),de=K(52615),Se=K(4348),he=K(88226),j=K(69323),p=K(34502),me=K(35884),ce=K(90689),l=K(16925),X=K(49055),P=function(L,I,w,R){var q=arguments.length,se=q<3?I:R===null?R=Object.getOwnPropertyDescriptor(I,w):R,te;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")se=Reflect.decorate(L,I,w,R);else for(var ge=L.length-1;ge>=0;ge--)(te=L[ge])&&(se=(q<3?te(se):q>3?te(I,w,se):te(I,w))||se);return q>3&&se&&Object.defineProperty(I,w,se),se},g=function(L,I){return function(w,R){I(w,R,L)}};function _(L){return L.command!==void 0}class E{constructor(I){this.id=E._idPool++,this._debugName=I}}E._idPool=0,E.CommandPalette=new E("CommandPalette"),E.EditorContext=new E("EditorContext"),E.SimpleEditorContext=new E("SimpleEditorContext"),E.EditorContextCopy=new E("EditorContextCopy"),E.EditorContextPeek=new E("EditorContextPeek"),E.MenubarEditMenu=new E("MenubarEditMenu"),E.MenubarCopy=new E("MenubarCopy"),E.MenubarGoMenu=new E("MenubarGoMenu"),E.MenubarSelectionMenu=new E("MenubarSelectionMenu"),E.InlineCompletionsActions=new E("InlineCompletionsActions");const A=(0,l.yh)("menuService"),M=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Se.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:L=>L===E.CommandPalette}}addCommand(L){return this.addCommands(he.$.single(L))}addCommands(L){for(const I of L)this._commands.set(I.id,I);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,j.OF)(()=>{let I=!1;for(const w of L)I=this._commands.delete(w.id)||I;I&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(L){return this._commands.get(L)}getCommands(){const L=new Map;return this._commands.forEach((I,w)=>L.set(w,I)),L}appendMenuItem(L,I){return this.appendMenuItems(he.$.single({id:L,item:I}))}appendMenuItems(L){const I=new Set,w=new p.S;for(const{id:R,item:q}of L){let se=this._menuItems.get(R);se||(se=new p.S,this._menuItems.set(R,se)),w.push(se.push(q)),I.add(R)}return this._onDidChangeMenu.fire(I),(0,j.OF)(()=>{if(w.size>0){for(let R of w)R();this._onDidChangeMenu.fire(I),w.clear()}})}getMenuItems(L){let I;return this._menuItems.has(L)?I=[...this._menuItems.get(L)]:I=[],L===E.CommandPalette&&this._appendImplicitItems(I),I}_appendImplicitItems(L){const I=new Set;for(const w of L)_(w)&&(I.add(w.command.id),w.alt&&I.add(w.alt.id));this._commands.forEach((w,R)=>{I.has(R)||L.push({command:w})})}};class H extends B.wY{constructor(I,w,R,q){super(`submenuitem.${I.submenu.id}`,typeof I.title=="string"?I.title:I.title.value,[],"submenu"),this.item=I,this._menuService=w,this._contextKeyService=R,this._options=q}get actions(){const I=[],w=this._menuService.createMenu(this.item.submenu,this._contextKeyService),R=w.getActions(this._options);w.dispose();for(const[,q]of R)q.length>0&&(I.push(...q),I.push(new B.Z0));return I.length&&I.pop(),I}}let V=class Qo{constructor(I,w,R,q,se){var te,ge;if(this._commandService=se,this.id=I.id,this.label=R!=null&&R.renderShortTitle&&I.shortTitle?typeof I.shortTitle=="string"?I.shortTitle:I.shortTitle.value:typeof I.title=="string"?I.title:I.title.value,this.tooltip=(ge=typeof I.tooltip=="string"?I.tooltip:(te=I.tooltip)===null||te===void 0?void 0:te.value)!==null&&ge!==void 0?ge:"",this.enabled=!I.precondition||q.contextMatchesRules(I.precondition),this.checked=void 0,I.toggled){const Le=I.toggled.condition?I.toggled:{condition:I.toggled};this.checked=q.contextMatchesRules(Le.condition),this.checked&&Le.tooltip&&(this.tooltip=typeof Le.tooltip=="string"?Le.tooltip:Le.tooltip.value),Le.title&&(this.label=typeof Le.title=="string"?Le.title:Le.title.value)}this.item=I,this.alt=w?new Qo(w,void 0,R,q,se):void 0,this._options=R,X.kS.isThemeIcon(I.icon)&&(this.class=de.dT.asClassName(I.icon))}dispose(){}run(...I){var w,R;let q=[];return!((w=this._options)===null||w===void 0)&&w.arg&&(q=[...q,this._options.arg]),!((R=this._options)===null||R===void 0)&&R.shouldForwardArgs&&(q=[...q,...I]),this._commandService.executeCommand(this.id,...q)}};V=P([g(3,ce.i6),g(4,me.H)],V)},35884:function(Xt,st,K){"use strict";K.d(st,{H:function(){return me},P:function(){return ce}});var B=K(4348),de=K(88226),Se=K(69323),he=K(34502),j=K(72999),p=K(16925);const me=(0,p.yh)("commandService"),ce=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new B.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,X){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!X)throw new Error("invalid command");return this.registerCommand({id:l,handler:X})}if(l.description){const A=[];for(let H of l.description.args)A.push(H.constraint);const M=l.handler;l.handler=function(H,...V){return(0,j.D8)(V,A),M(H,...V)}}const{id:P}=l;let g=this._commands.get(P);g||(g=new he.S,this._commands.set(P,g));let _=g.unshift(l),E=(0,Se.OF)(()=>{_();const A=this._commands.get(P);A!=null&&A.isEmpty()&&this._commands.delete(P)});return this._onDidRegisterCommand.fire(P),E}registerCommandAlias(l,X){return ce.registerCommand(l,(P,...g)=>P.get(me).executeCommand(X,...g))}getCommand(l){const X=this._commands.get(l);if(!(!X||X.isEmpty()))return de.$.first(X)}getCommands(){const l=new Map;for(const X of this._commands.keys()){const P=this.getCommand(X);P&&l.set(X,P)}return l}};ce.registerCommand("noop",()=>{})},90689:function(Xt,st,K){"use strict";K.d(st,{Ao:function(){return me},Eq:function(){return J},Fb:function(){return ce},K8:function(){return O},i6:function(){return $e},uy:function(){return xe}});var B=K(23345),de=K(82983),Se=K(16925);let he=B.WE||"";const j=new Map;j.set("false",!1),j.set("true",!0),j.set("isMac",B.dz),j.set("isLinux",B.IJ),j.set("isWindows",B.ED),j.set("isWeb",B.$L),j.set("isMacNative",B.dz&&!B.$L),j.set("isEdge",he.indexOf("Edg/")>=0),j.set("isFirefox",he.indexOf("Firefox")>=0),j.set("isChrome",he.indexOf("Chrome")>=0),j.set("isSafari",he.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class me{static has(S){return g.create(S)}static equals(S,v){return _.create(S,v)}static regex(S,v){return q.create(S,v)}static not(S){return H.create(S)}static and(...S){return ge.create(S,null)}static or(...S){return Le.create(S,null,!0)}static deserialize(S,v=!1){if(S)return this._deserializeOrExpression(S,v)}static _deserializeOrExpression(S,v){let z=S.split("||");return Le.create(z.map(ae=>this._deserializeAndExpression(ae,v)),null,!0)}static _deserializeAndExpression(S,v){let z=S.split("&&");return ge.create(z.map(ae=>this._deserializeOne(ae,v)),null)}static _deserializeOne(S,v){if(S=S.trim(),S.indexOf("!=")>=0){let z=S.split("!=");return M.create(z[0].trim(),this._deserializeValue(z[1],v))}if(S.indexOf("==")>=0){let z=S.split("==");return _.create(z[0].trim(),this._deserializeValue(z[1],v))}if(S.indexOf("=~")>=0){let z=S.split("=~");return q.create(z[0].trim(),this._deserializeRegexValue(z[1],v))}if(S.indexOf(" in ")>=0){let z=S.split(" in ");return E.create(z[0].trim(),z[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(S)){const z=S.split(">=");return I.create(z[0].trim(),z[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(S)){const z=S.split(">");return L.create(z[0].trim(),z[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(S)){const z=S.split("<=");return R.create(z[0].trim(),z[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(S)){const z=S.split("<");return w.create(z[0].trim(),z[1].trim())}return/^\!\s*/.test(S)?H.create(S.substr(1).trim()):g.create(S)}static _deserializeValue(S,v){if(S=S.trim(),S==="true")return!0;if(S==="false")return!1;let z=/^'([^']*)'$/.exec(S);return z?z[1].trim():S}static _deserializeRegexValue(S,v){if((0,de.m5)(S)){if(v)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let z=S.indexOf("/"),ae=S.lastIndexOf("/");if(z===ae||z<0){if(v)throw new Error(`bad regexp-value '${S}', missing /-enclosure`);return console.warn(`bad regexp-value '${S}', missing /-enclosure`),null}let Te=S.slice(z+1,ae),Fe=S[ae+1]==="i"?"i":"";try{return new RegExp(Te,Fe)}catch(Ye){if(v)throw new Error(`bad regexp-value '${S}', parse error: ${Ye}`);return console.warn(`bad regexp-value '${S}', parse error: ${Ye}`),null}}}function ce(ie,S){const v=ie?ie.substituteConstants():void 0,z=S?S.substituteConstants():void 0;return!v&&!z?!0:!v||!z?!1:v.equals(z)}function l(ie,S){return ie.cmp(S)}class X{constructor(){this.type=0}cmp(S){return this.type-S.type}equals(S){return S.type===this.type}substituteConstants(){return this}evaluate(S){return!1}serialize(){return"false"}keys(){return[]}negate(){return P.INSTANCE}}X.INSTANCE=new X;class P{constructor(){this.type=1}cmp(S){return this.type-S.type}equals(S){return S.type===this.type}substituteConstants(){return this}evaluate(S){return!0}serialize(){return"true"}keys(){return[]}negate(){return X.INSTANCE}}P.INSTANCE=new P;class g{constructor(S,v){this.key=S,this.negated=v,this.type=2}static create(S,v=null){const z=j.get(S);return typeof z=="boolean"?z?P.INSTANCE:X.INSTANCE:new g(S,v)}cmp(S){return S.type!==this.type?this.type-S.type:D(this.key,S.key)}equals(S){return S.type===this.type?this.key===S.key:!1}substituteConstants(){const S=j.get(this.key);return typeof S=="boolean"?S?P.INSTANCE:X.INSTANCE:this}evaluate(S){return!!S.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=H.create(this.key,this)),this.negated}}class _{constructor(S,v,z){this.key=S,this.value=v,this.negated=z,this.type=4}static create(S,v,z=null){if(typeof v=="boolean")return v?g.create(S,z):H.create(S,z);const ae=j.get(S);return typeof ae=="boolean"?v===(ae?"true":"false")?P.INSTANCE:X.INSTANCE:new _(S,v,z)}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){const S=j.get(this.key);if(typeof S=="boolean"){const v=S?"true":"false";return this.value===v?P.INSTANCE:X.INSTANCE}return this}evaluate(S){return S.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=M.create(this.key,this.value,this)),this.negated}}class E{constructor(S,v){this.key=S,this.valueKey=v,this.type=10,this.negated=null}static create(S,v){return new E(S,v)}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.valueKey,S.key,S.valueKey)}equals(S){return S.type===this.type?this.key===S.key&&this.valueKey===S.valueKey:!1}substituteConstants(){return this}evaluate(S){const v=S.getValue(this.valueKey),z=S.getValue(this.key);return Array.isArray(v)?v.indexOf(z)>=0:typeof z=="string"&&typeof v=="object"&&v!==null?p.call(v,z):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=A.create(this)),this.negated}}class A{constructor(S){this._actual=S,this.type=11}static create(S){return new A(S)}cmp(S){return S.type!==this.type?this.type-S.type:this._actual.cmp(S._actual)}equals(S){return S.type===this.type?this._actual.equals(S._actual):!1}substituteConstants(){return this}evaluate(S){return!this._actual.evaluate(S)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class M{constructor(S,v,z){this.key=S,this.value=v,this.negated=z,this.type=5}static create(S,v,z=null){if(typeof v=="boolean")return v?H.create(S,z):g.create(S,z);const ae=j.get(S);return typeof ae=="boolean"?v===(ae?"true":"false")?X.INSTANCE:P.INSTANCE:new M(S,v,z)}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){const S=j.get(this.key);if(typeof S=="boolean"){const v=S?"true":"false";return this.value===v?X.INSTANCE:P.INSTANCE}return this}evaluate(S){return S.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class H{constructor(S,v){this.key=S,this.negated=v,this.type=3}static create(S,v=null){const z=j.get(S);return typeof z=="boolean"?z?X.INSTANCE:P.INSTANCE:new H(S,v)}cmp(S){return S.type!==this.type?this.type-S.type:D(this.key,S.key)}equals(S){return S.type===this.type?this.key===S.key:!1}substituteConstants(){const S=j.get(this.key);return typeof S=="boolean"?S?X.INSTANCE:P.INSTANCE:this}evaluate(S){return!S.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this)),this.negated}}function V(ie,S){if(typeof ie=="string"){const v=parseFloat(ie);isNaN(v)||(ie=v)}return typeof ie=="string"||typeof ie=="number"?S(ie):X.INSTANCE}class L{constructor(S,v,z){this.key=S,this.value=v,this.negated=z,this.type=12}static create(S,v,z=null){return V(v,ae=>new L(S,ae,z))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=R.create(this.key,this.value,this)),this.negated}}class I{constructor(S,v,z){this.key=S,this.value=v,this.negated=z,this.type=13}static create(S,v,z=null){return V(v,ae=>new I(S,ae,z))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=w.create(this.key,this.value,this)),this.negated}}class w{constructor(S,v,z){this.key=S,this.value=v,this.negated=z,this.type=14}static create(S,v,z=null){return V(v,ae=>new w(S,ae,z))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=I.create(this.key,this.value,this)),this.negated}}class R{constructor(S,v,z){this.key=S,this.value=v,this.negated=z,this.type=15}static create(S,v,z=null){return V(v,ae=>new R(S,ae,z))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=L.create(this.key,this.value,this)),this.negated}}class q{constructor(S,v){this.key=S,this.regexp=v,this.type=7,this.negated=null}static create(S,v){return new q(S,v)}cmp(S){if(S.type!==this.type)return this.type-S.type;if(this.key<S.key)return-1;if(this.key>S.key)return 1;const v=this.regexp?this.regexp.source:"",z=S.regexp?S.regexp.source:"";return v<z?-1:v>z?1:0}equals(S){if(S.type===this.type){const v=this.regexp?this.regexp.source:"",z=S.regexp?S.regexp.source:"";return this.key===S.key&&v===z}return!1}substituteConstants(){return this}evaluate(S){let v=S.getValue(this.key);return this.regexp?this.regexp.test(v):!1}serialize(){const S=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${S}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=se.create(this)),this.negated}}class se{constructor(S){this._actual=S,this.type=8}static create(S){return new se(S)}cmp(S){return S.type!==this.type?this.type-S.type:this._actual.cmp(S._actual)}equals(S){return S.type===this.type?this._actual.equals(S._actual):!1}substituteConstants(){return this}evaluate(S){return!this._actual.evaluate(S)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function te(ie){let S=null;for(let v=0,z=ie.length;v<z;v++){const ae=ie[v].substituteConstants();if(ie[v]!==ae&&S===null){S=[];for(let Te=0;Te<v;Te++)S[Te]=ie[Te]}S!==null&&(S[v]=ae)}return S===null?ie:S}class ge{constructor(S,v){this.expr=S,this.negated=v,this.type=6}static create(S,v){return ge._normalizeArr(S,v)}cmp(S){if(S.type!==this.type)return this.type-S.type;if(this.expr.length<S.expr.length)return-1;if(this.expr.length>S.expr.length)return 1;for(let v=0,z=this.expr.length;v<z;v++){const ae=l(this.expr[v],S.expr[v]);if(ae!==0)return ae}return 0}equals(S){if(S.type===this.type){if(this.expr.length!==S.expr.length)return!1;for(let v=0,z=this.expr.length;v<z;v++)if(!this.expr[v].equals(S.expr[v]))return!1;return!0}return!1}substituteConstants(){const S=te(this.expr);return S===this.expr?this:ge.create(S,this.negated)}evaluate(S){for(let v=0,z=this.expr.length;v<z;v++)if(!this.expr[v].evaluate(S))return!1;return!0}static _normalizeArr(S,v){const z=[];let ae=!1;for(const Te of S)if(Te){if(Te.type===1){ae=!0;continue}if(Te.type===0)return X.INSTANCE;if(Te.type===6){z.push(...Te.expr);continue}z.push(Te)}if(z.length===0&&ae)return P.INSTANCE;if(z.length!==0){if(z.length===1)return z[0];z.sort(l);for(let Te=1;Te<z.length;Te++)z[Te-1].equals(z[Te])&&(z.splice(Te,1),Te--);if(z.length===1)return z[0];for(;z.length>1;){const Te=z[z.length-1];if(Te.type!==9)break;z.pop();const Fe=z.pop(),Ye=z.length===0,_t=Le.create(Te.expr.map(Ut=>ge.create([Ut,Fe],null)),null,Ye);_t&&(z.push(_t),z.sort(l))}return z.length===1?z[0]:new ge(z,v)}}serialize(){return this.expr.map(S=>S.serialize()).join(" && ")}keys(){const S=[];for(let v of this.expr)S.push(...v.keys());return S}negate(){if(!this.negated){const S=[];for(let v of this.expr)S.push(v.negate());this.negated=Le.create(S,this,!0)}return this.negated}}class Le{constructor(S,v){this.expr=S,this.negated=v,this.type=9}static create(S,v,z){return Le._normalizeArr(S,v,z)}cmp(S){if(S.type!==this.type)return this.type-S.type;if(this.expr.length<S.expr.length)return-1;if(this.expr.length>S.expr.length)return 1;for(let v=0,z=this.expr.length;v<z;v++){const ae=l(this.expr[v],S.expr[v]);if(ae!==0)return ae}return 0}equals(S){if(S.type===this.type){if(this.expr.length!==S.expr.length)return!1;for(let v=0,z=this.expr.length;v<z;v++)if(!this.expr[v].equals(S.expr[v]))return!1;return!0}return!1}substituteConstants(){const S=te(this.expr);return S===this.expr?this:Le.create(S,this.negated,!1)}evaluate(S){for(let v=0,z=this.expr.length;v<z;v++)if(this.expr[v].evaluate(S))return!0;return!1}static _normalizeArr(S,v,z){let ae=[],Te=!1;if(S){for(let Fe=0,Ye=S.length;Fe<Ye;Fe++){const _t=S[Fe];if(_t){if(_t.type===0){Te=!0;continue}if(_t.type===1)return P.INSTANCE;if(_t.type===9){ae=ae.concat(_t.expr);continue}ae.push(_t)}}if(ae.length===0&&Te)return X.INSTANCE;ae.sort(l)}if(ae.length!==0){if(ae.length===1)return ae[0];for(let Fe=1;Fe<ae.length;Fe++)ae[Fe-1].equals(ae[Fe])&&(ae.splice(Fe,1),Fe--);if(ae.length===1)return ae[0];if(z){for(let Fe=0;Fe<ae.length;Fe++)for(let Ye=Fe+1;Ye<ae.length;Ye++)O(ae[Fe],ae[Ye])&&(ae.splice(Ye,1),Ye--);if(ae.length===1)return ae[0]}return new Le(ae,v)}}serialize(){return this.expr.map(S=>S.serialize()).join(" || ")}keys(){const S=[];for(let v of this.expr)S.push(...v.keys());return S}negate(){if(!this.negated){let S=[];for(let v of this.expr)S.push(v.negate());for(;S.length>1;){const v=S.shift(),z=S.shift(),ae=[];for(const Fe of oe(v))for(const Ye of oe(z))ae.push(ge.create([Fe,Ye],null));const Te=S.length===0;S.unshift(Le.create(ae,null,Te))}this.negated=S[0]}return this.negated}}class xe extends g{constructor(S,v,z){super(S,null),this._defaultValue=v,typeof z=="object"?xe._info.push(Object.assign(Object.assign({},z),{key:S})):z!==!0&&xe._info.push({key:S,description:z,type:v!=null?typeof v:void 0})}static all(){return xe._info.values()}bindTo(S){return S.createKey(this.key,this._defaultValue)}getValue(S){return S.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(S){return _.create(this.key,S)}}xe._info=[];const $e=(0,Se.yh)("contextKeyService"),J="setContext";function D(ie,S){return ie<S?-1:ie>S?1:0}function N(ie,S,v,z){return ie<v?-1:ie>v?1:S<z?-1:S>z?1:0}function O(ie,S){if(S.type===6&&ie.type!==9&&ie.type!==6){for(const ae of S.expr)if(ie.equals(ae))return!0}const v=ie.negate(),z=oe(v).concat(oe(S));z.sort(l);for(let ae=0;ae<z.length;ae++){const Fe=z[ae].negate();for(let Ye=ae+1;Ye<z.length;Ye++){const _t=z[Ye];if(Fe.equals(_t))return!0}}return!1}function oe(ie){return ie.type===9?ie.expr:[ie]}},16925:function(Xt,st,K){"use strict";K.d(st,{I8:function(){return B},TG:function(){return de},jt:function(){return j},yh:function(){return he}});var B;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function me(ce){return ce[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=me})(B||(B={}));const de=he("instantiationService");function Se(p,me,ce,l){me[B.DI_TARGET]===me?me[B.DI_DEPENDENCIES].push({id:p,index:ce,optional:l}):(me[B.DI_DEPENDENCIES]=[{id:p,index:ce,optional:l}],me[B.DI_TARGET]=me)}function he(p){if(B.serviceIds.has(p))return B.serviceIds.get(p);const me=function(ce,l,X){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Se(me,ce,X,!1)};return me.toString=()=>p,B.serviceIds.set(p,me),me}function j(p){return function(me,ce,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Se(p,me,l,!0)}}},44650:function(Xt,st,K){"use strict";K.d(st,{B:function(){return he}});var B=K(76068),de=K(72999);class Se{constructor(){this.data=new Map}add(p,me){B.ok(de.HD(p)),B.ok(de.Kn(me)),B.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,me)}as(p){return this.data.get(p)||null}}const he=new Se},66213:function(Xt,st,K){"use strict";K.d(st,{e:function(){return B}});var B;(function(de){de.DARK="dark",de.LIGHT="light",de.HIGH_CONTRAST="hc"})(B||(B={}))},49055:function(Xt,st,K){"use strict";K.d(st,{EN:function(){return l},IP:function(){return g},Ic:function(){return A},XE:function(){return me},bB:function(){return M},kS:function(){return X},m6:function(){return P}});var B=K(52615),de=K(4348),Se=K(69323),he=K(16925),j=K(44650),p=K(66213);const me=(0,he.yh)("themeService");var ce;(function(H){function V(L){return L&&typeof L=="object"&&typeof L.id=="string"}H.isThemeColor=V})(ce||(ce={}));function l(H){return{id:H}}var X;(function(H){function V(se){return se&&typeof se=="object"&&typeof se.id=="string"&&(typeof se.color=="undefined"||ce.isThemeColor(se.color))}H.isThemeIcon=V;const L=new RegExp(`^\\$\\((${B.dT.iconNameExpression}(?:${B.dT.iconModifierExpression})?)\\)$`);function I(se){const te=L.exec(se);if(!te)return;let[,ge]=te;return{id:ge}}H.fromString=I;function w(se,te){let ge=se.id;const Le=ge.lastIndexOf("~");return Le!==-1&&(ge=ge.substring(0,Le)),te&&(ge=`${ge}~${te}`),{id:ge}}H.modify=w;function R(se,te){var ge,Le;return se.id===te.id&&((ge=se.color)===null||ge===void 0?void 0:ge.id)===((Le=te.color)===null||Le===void 0?void 0:Le.id)}H.isEqual=R;function q(se,te){return{id:se.id,color:te?l(te):void 0}}H.asThemeIcon=q,H.asClassNameArray=B.dT.asClassNameArray,H.asClassName=B.dT.asClassName,H.asCSSSelector=B.dT.asCSSSelector})(X||(X={}));function P(H){switch(H){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const g={ThemingContribution:"base.contributions.theming"};class _{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new de.Q5}onColorThemeChange(V){return this.themingParticipants.push(V),this.onThemingParticipantAddedEmitter.fire(V),(0,Se.OF)(()=>{const L=this.themingParticipants.indexOf(V);this.themingParticipants.splice(L,1)})}getThemingParticipants(){return this.themingParticipants}}let E=new _;j.B.add(g.ThemingContribution,E);function A(H){return E.onColorThemeChange(H)}class M extends Se.JT{constructor(V){super(),this.themeService=V,this.theme=V.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(L=>this.onThemeChange(L)))}onThemeChange(V){this.theme=V,this.updateStyles()}updateStyles(){}}},96478:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return se}});var B=K(71409),de=K(87075),Se=K(11036),he=K(39224),j=K(65352),p=K(92310),me=K.n(p),ce=K(8654),l=K(59301),X=K(10228),P=K(16089),g=X.Z.ESC,_=X.Z.TAB;function E(te){var ge=te.visible,Le=te.triggerRef,xe=te.onVisibleChange,$e=te.autoFocus,J=te.overlayRef,D=l.useRef(!1),N=function(){if(ge){var S,v;(S=Le.current)===null||S===void 0||(v=S.focus)===null||v===void 0||v.call(S),xe==null||xe(!1)}},O=function(){var S;return(S=J.current)!==null&&S!==void 0&&S.focus?(J.current.focus(),D.current=!0,!0):!1},oe=function(S){switch(S.keyCode){case g:N();break;case _:{var v=!1;D.current||(v=O()),v?S.preventDefault():N();break}}};l.useEffect(function(){return ge?(window.addEventListener("keydown",oe),$e&&(0,P.Z)(O,3),function(){window.removeEventListener("keydown",oe),D.current=!1}):function(){D.current=!1}},[ge])}var A=(0,l.forwardRef)(function(te,ge){var Le=te.overlay,xe=te.arrow,$e=te.prefixCls,J=(0,l.useMemo)(function(){var N;return typeof Le=="function"?N=Le():N=Le,N},[Le]),D=(0,ce.sQ)(ge,(0,ce.C4)(J));return l.createElement(l.Fragment,null,xe&&l.createElement("div",{className:"".concat($e,"-arrow")}),l.cloneElement(J,{ref:(0,ce.Yr)(J)?D:void 0}))}),M=A,H={adjustX:1,adjustY:1},V=[0,0],L={topLeft:{points:["bl","tl"],overflow:H,offset:[0,-4],targetOffset:V},top:{points:["bc","tc"],overflow:H,offset:[0,-4],targetOffset:V},topRight:{points:["br","tr"],overflow:H,offset:[0,-4],targetOffset:V},bottomLeft:{points:["tl","bl"],overflow:H,offset:[0,4],targetOffset:V},bottom:{points:["tc","bc"],overflow:H,offset:[0,4],targetOffset:V},bottomRight:{points:["tr","br"],overflow:H,offset:[0,4],targetOffset:V}},I=L,w=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function R(te,ge){var Le,xe=te.arrow,$e=xe===void 0?!1:xe,J=te.prefixCls,D=J===void 0?"rc-dropdown":J,N=te.transitionName,O=te.animation,oe=te.align,ie=te.placement,S=ie===void 0?"bottomLeft":ie,v=te.placements,z=v===void 0?I:v,ae=te.getPopupContainer,Te=te.showAction,Fe=te.hideAction,Ye=te.overlayClassName,_t=te.overlayStyle,Ut=te.visible,si=te.trigger,Ge=si===void 0?["hover"]:si,ft=te.autoFocus,$t=te.overlay,ut=te.children,li=te.onVisibleChange,We=(0,he.Z)(te,w),Ee=l.useState(),Ie=(0,Se.Z)(Ee,2),ne=Ie[0],we=Ie[1],ke="visible"in te?Ut:ne,ee=l.useRef(null),Y=l.useRef(null),C=l.useRef(null);l.useImperativeHandle(ge,function(){return ee.current});var Q=function(je){we(je),li==null||li(je)};E({visible:ke,triggerRef:C,onVisibleChange:Q,autoFocus:ft,overlayRef:Y});var F=function(je){var Ue=te.onOverlayClick;we(!1),Ue&&Ue(je)},U=function(){return l.createElement(M,{ref:Y,overlay:$t,prefixCls:D,arrow:$e})},W=function(){return typeof $t=="function"?U:U()},re=function(){var je=te.minOverlayWidthMatchTrigger,Ue=te.alignPoint;return"minOverlayWidthMatchTrigger"in te?je:!Ue},le=function(){var je=te.openClassName;return je!==void 0?je:"".concat(D,"-open")},ye=l.cloneElement(ut,{className:me()((Le=ut.props)===null||Le===void 0?void 0:Le.className,ke&&le()),ref:(0,ce.Yr)(ut)?(0,ce.sQ)(C,(0,ce.C4)(ut)):void 0}),De=Fe;return!De&&Ge.indexOf("contextMenu")!==-1&&(De=["click"]),l.createElement(j.Z,(0,B.Z)({builtinPlacements:z},We,{prefixCls:D,ref:ee,popupClassName:me()(Ye,(0,de.Z)({},"".concat(D,"-show-arrow"),$e)),popupStyle:_t,action:Ge,showAction:Te,hideAction:De,popupPlacement:S,popupAlign:oe,popupTransitionName:N,popupAnimation:O,popupVisible:ke,stretch:re()?"minWidth":"",popup:W(),onPopupVisibleChange:Q,onPopupClick:F,getPopupContainer:ae}),ye)}var q=l.forwardRef(R),se=q},28321:function(Xt,st,K){"use strict";K.d(st,{iz:function(){return Zt},ck:function(){return ht},BW:function(){return et},sN:function(){return ht},Wd:function(){return mt},ZP:function(){return zt},Xl:function(){return Le}});var B=K(71409),de=K(87075),Se=K(89490),he=K(62730),j=K(11036),p=K(39224),me=K(92310),ce=K.n(me),l=K(11780),X=K(18929),P=K(13697),g=K(48736),_=K(59301),E=K(4676),A=_.createContext(null);function M(ve,Ce){return ve===void 0?null:"".concat(ve,"-").concat(Ce)}function H(ve){var Ce=_.useContext(A);return M(Ce,ve)}var V=K(80547),L=["children","locked"],I=_.createContext(null);function w(ve,Ce){var Qe=(0,Se.Z)({},ve);return Object.keys(Ce).forEach(function(qe){var rt=Ce[qe];rt!==void 0&&(Qe[qe]=rt)}),Qe}function R(ve){var Ce=ve.children,Qe=ve.locked,qe=(0,p.Z)(ve,L),rt=_.useContext(I),ct=(0,V.Z)(function(){return w(rt,qe)},[rt,qe],function(lt,gt){return!Qe&&(lt[0]!==gt[0]||!(0,P.Z)(lt[1],gt[1],!0))});return _.createElement(I.Provider,{value:ct},Ce)}var q=[],se=_.createContext(null);function te(){return _.useContext(se)}var ge=_.createContext(q);function Le(ve){var Ce=_.useContext(ge);return _.useMemo(function(){return ve!==void 0?[].concat((0,he.Z)(Ce),[ve]):Ce},[Ce,ve])}var xe=_.createContext(null),$e=_.createContext({}),J=$e,D=K(29194);function N(ve){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,D.Z)(ve)){var Qe=ve.nodeName.toLowerCase(),qe=["input","select","textarea","button"].includes(Qe)||ve.isContentEditable||Qe==="a"&&!!ve.getAttribute("href"),rt=ve.getAttribute("tabindex"),ct=Number(rt),lt=null;return rt&&!Number.isNaN(ct)?lt=ct:qe&&lt===null&&(lt=0),qe&&ve.disabled&&(lt=null),lt!==null&&(lt>=0||Ce&&lt<0)}return!1}function O(ve){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Qe=(0,he.Z)(ve.querySelectorAll("*")).filter(function(qe){return N(qe,Ce)});return N(ve,Ce)&&Qe.unshift(ve),Qe}var oe=null;function ie(){oe=document.activeElement}function S(){oe=null}function v(){if(oe)try{oe.focus()}catch(ve){}}function z(ve,Ce){if(Ce.keyCode===9){var Qe=O(ve),qe=Qe[Ce.shiftKey?0:Qe.length-1],rt=qe===document.activeElement||ve===document.activeElement;if(rt){var ct=Qe[Ce.shiftKey?Qe.length-1:0];ct.focus(),Ce.preventDefault()}}}var ae=K(10228),Te=K(16089),Fe=ae.Z.LEFT,Ye=ae.Z.RIGHT,_t=ae.Z.UP,Ut=ae.Z.DOWN,si=ae.Z.ENTER,Ge=ae.Z.ESC,ft=ae.Z.HOME,$t=ae.Z.END,ut=[_t,Ut,Fe,Ye];function li(ve,Ce,Qe,qe){var rt,ct="prev",lt="next",gt="children",Wt="parent";if(ve==="inline"&&qe===si)return{inlineTrigger:!0};var Mt=(0,de.Z)((0,de.Z)({},_t,ct),Ut,lt),Jt=(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},Fe,Qe?lt:ct),Ye,Qe?ct:lt),Ut,gt),si,gt),Yt=(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},_t,ct),Ut,lt),si,gt),Ge,Wt),Fe,Qe?gt:Wt),Ye,Qe?Wt:gt),mi={inline:Mt,horizontal:Jt,vertical:Yt,inlineSub:Mt,horizontalSub:Yt,verticalSub:Yt},Ei=(rt=mi["".concat(ve).concat(Ce?"":"Sub")])===null||rt===void 0?void 0:rt[qe];switch(Ei){case ct:return{offset:-1,sibling:!0};case lt:return{offset:1,sibling:!0};case Wt:return{offset:-1,sibling:!1};case gt:return{offset:1,sibling:!1};default:return null}}function We(ve){for(var Ce=ve;Ce;){if(Ce.getAttribute("data-menu-list"))return Ce;Ce=Ce.parentElement}return null}function Ee(ve,Ce){for(var Qe=ve||document.activeElement;Qe;){if(Ce.has(Qe))return Qe;Qe=Qe.parentElement}return null}function Ie(ve,Ce){var Qe=O(ve,!0);return Qe.filter(function(qe){return Ce.has(qe)})}function ne(ve,Ce,Qe){var qe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!ve)return null;var rt=Ie(ve,Ce),ct=rt.length,lt=rt.findIndex(function(gt){return Qe===gt});return qe<0?lt===-1?lt=ct-1:lt-=1:qe>0&&(lt+=1),lt=(lt+ct)%ct,rt[lt]}var we=function(Ce,Qe){var qe=new Set,rt=new Map,ct=new Map;return Ce.forEach(function(lt){var gt=document.querySelector("[data-menu-id='".concat(M(Qe,lt),"']"));gt&&(qe.add(gt),ct.set(gt,lt),rt.set(lt,gt))}),{elements:qe,key2element:rt,element2key:ct}};function ke(ve,Ce,Qe,qe,rt,ct,lt,gt,Wt,Mt){var Jt=_.useRef(),Yt=_.useRef();Yt.current=Ce;var mi=function(){Te.Z.cancel(Jt.current)};return _.useEffect(function(){return function(){mi()}},[]),function(Ei){var Ti=Ei.which;if([].concat(ut,[si,Ge,ft,$t]).includes(Ti)){var gi=ct(),ci=we(gi,qe),Li=ci,Pi=Li.elements,wi=Li.key2element,bi=Li.element2key,Ni=wi.get(Ce),Ri=Ee(Ni,Pi),Fi=bi.get(Ri),Ci=li(ve,lt(Fi,!0).length===1,Qe,Ti);if(!Ci&&Ti!==ft&&Ti!==$t)return;(ut.includes(Ti)||[ft,$t].includes(Ti))&&Ei.preventDefault();var Ii=function(Ki){if(Ki){var ii=Ki,Dt=Ki.querySelector("a");Dt!=null&&Dt.getAttribute("href")&&(ii=Dt);var _i=bi.get(Ki);gt(_i),mi(),Jt.current=(0,Te.Z)(function(){Yt.current===_i&&ii.focus()})}};if([ft,$t].includes(Ti)||Ci.sibling||!Ri){var on;!Ri||ve==="inline"?on=rt.current:on=We(Ri);var Vi,Ai=Ie(on,Pi);Ti===ft?Vi=Ai[0]:Ti===$t?Vi=Ai[Ai.length-1]:Vi=ne(on,Pi,Ri,Ci.offset),Ii(Vi)}else if(Ci.inlineTrigger)Wt(Fi);else if(Ci.offset>0)Wt(Fi,!0),mi(),Jt.current=(0,Te.Z)(function(){ci=we(gi,qe);var Ji=Ri.getAttribute("aria-controls"),Ki=document.getElementById(Ji),ii=ne(Ki,ci.elements);Ii(ii)},5);else if(Ci.offset<0){var sn=lt(Fi,!0),Yi=sn[sn.length-2],Zi=wi.get(Yi);Wt(Yi,!1),Ii(Zi)}}Mt==null||Mt(Ei)}}function ee(ve){Promise.resolve().then(ve)}var Y="__RC_UTIL_PATH_SPLIT__",C=function(Ce){return Ce.join(Y)},Q=function(Ce){return Ce.split(Y)},F="rc-menu-more";function U(){var ve=_.useState({}),Ce=(0,j.Z)(ve,2),Qe=Ce[1],qe=(0,_.useRef)(new Map),rt=(0,_.useRef)(new Map),ct=_.useState([]),lt=(0,j.Z)(ct,2),gt=lt[0],Wt=lt[1],Mt=(0,_.useRef)(0),Jt=(0,_.useRef)(!1),Yt=function(){Jt.current||Qe({})},mi=(0,_.useCallback)(function(wi,bi){var Ni=C(bi);rt.current.set(Ni,wi),qe.current.set(wi,Ni),Mt.current+=1;var Ri=Mt.current;ee(function(){Ri===Mt.current&&Yt()})},[]),Ei=(0,_.useCallback)(function(wi,bi){var Ni=C(bi);rt.current.delete(Ni),qe.current.delete(wi)},[]),Ti=(0,_.useCallback)(function(wi){Wt(wi)},[]),gi=(0,_.useCallback)(function(wi,bi){var Ni=qe.current.get(wi)||"",Ri=Q(Ni);return bi&&gt.includes(Ri[0])&&Ri.unshift(F),Ri},[gt]),ci=(0,_.useCallback)(function(wi,bi){return wi.filter(function(Ni){return Ni!==void 0}).some(function(Ni){var Ri=gi(Ni,!0);return Ri.includes(bi)})},[gi]),Li=function(){var bi=(0,he.Z)(qe.current.keys());return gt.length&&bi.push(F),bi},Pi=(0,_.useCallback)(function(wi){var bi="".concat(qe.current.get(wi)).concat(Y),Ni=new Set;return(0,he.Z)(rt.current.keys()).forEach(function(Ri){Ri.startsWith(bi)&&Ni.add(rt.current.get(Ri))}),Ni},[]);return _.useEffect(function(){return function(){Jt.current=!0}},[]),{registerPath:mi,unregisterPath:Ei,refreshOverflowKeys:Ti,isSubPathKey:ci,getKeyPath:gi,getKeys:Li,getSubPathKeys:Pi}}function W(ve){var Ce=_.useRef(ve);Ce.current=ve;var Qe=_.useCallback(function(){for(var qe,rt=arguments.length,ct=new Array(rt),lt=0;lt<rt;lt++)ct[lt]=arguments[lt];return(qe=Ce.current)===null||qe===void 0?void 0:qe.call.apply(qe,[Ce].concat(ct))},[]);return ve?Qe:void 0}var re=Math.random().toFixed(5).toString().slice(2),le=0;function ye(ve){var Ce=(0,X.Z)(ve,{value:ve}),Qe=(0,j.Z)(Ce,2),qe=Qe[0],rt=Qe[1];return _.useEffect(function(){le+=1;var ct="".concat(re,"-").concat(le);rt("rc-menu-uuid-".concat(ct))},[]),qe}var De=K(16552),Ae=K(19210),je=K(46654),Ue=K(37205),Ke=K(2738),dt=K(8654);function Re(ve,Ce,Qe,qe){var rt=_.useContext(I),ct=rt.activeKey,lt=rt.onActive,gt=rt.onInactive,Wt={active:ct===ve};return Ce||(Wt.onMouseEnter=function(Mt){Qe==null||Qe({key:ve,domEvent:Mt}),lt(ve)},Wt.onMouseLeave=function(Mt){qe==null||qe({key:ve,domEvent:Mt}),gt(ve)}),Wt}function tt(ve){var Ce=_.useContext(I),Qe=Ce.mode,qe=Ce.rtl,rt=Ce.inlineIndent;if(Qe!=="inline")return null;var ct=ve;return qe?{paddingRight:ct*rt}:{paddingLeft:ct*rt}}function Pt(ve){var Ce=ve.icon,Qe=ve.props,qe=ve.children,rt;return Ce===null||Ce===!1?null:(typeof Ce=="function"?rt=_.createElement(Ce,(0,Se.Z)({},Qe)):typeof Ce!="boolean"&&(rt=Ce),rt||qe||null)}var yt=["item"];function Bt(ve){var Ce=ve.item,Qe=(0,p.Z)(ve,yt);return Object.defineProperty(Qe,"item",{get:function(){return(0,g.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),Ce}}),Qe}var jt=["title","attribute","elementRef"],oi=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],ei=["active"],Ht=function(ve){(0,je.Z)(Qe,ve);var Ce=(0,Ue.Z)(Qe);function Qe(){return(0,De.Z)(this,Qe),Ce.apply(this,arguments)}return(0,Ae.Z)(Qe,[{key:"render",value:function(){var rt=this.props,ct=rt.title,lt=rt.attribute,gt=rt.elementRef,Wt=(0,p.Z)(rt,jt),Mt=(0,Ke.Z)(Wt,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,g.ZP)(!lt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),_.createElement(l.Z.Item,(0,B.Z)({},lt,{title:typeof ct=="string"?ct:void 0},Mt,{ref:gt}))}}]),Qe}(_.Component),Qt=_.forwardRef(function(ve,Ce){var Qe=ve.style,qe=ve.className,rt=ve.eventKey,ct=ve.warnKey,lt=ve.disabled,gt=ve.itemIcon,Wt=ve.children,Mt=ve.role,Jt=ve.onMouseEnter,Yt=ve.onMouseLeave,mi=ve.onClick,Ei=ve.onKeyDown,Ti=ve.onFocus,gi=(0,p.Z)(ve,oi),ci=H(rt),Li=_.useContext(I),Pi=Li.prefixCls,wi=Li.onItemClick,bi=Li.disabled,Ni=Li.overflowDisabled,Ri=Li.itemIcon,Fi=Li.selectedKeys,Ci=Li.onActive,Ii=_.useContext(J),on=Ii._internalRenderMenuItem,Vi="".concat(Pi,"-item"),Ai=_.useRef(),sn=_.useRef(),Yi=bi||lt,Zi=(0,dt.x1)(Ce,sn),Ji=Le(rt),Ki=function(Ui){return{key:rt,keyPath:(0,he.Z)(Ji).reverse(),item:Ai.current,domEvent:Ui}},ii=gt||Ri,Dt=Re(rt,Yi,Jt,Yt),_i=Dt.active,Oi=(0,p.Z)(Dt,ei),Bi=Fi.includes(rt),gn=tt(Ji.length),ln=function(Ui){if(!Yi){var vn=Ki(Ui);mi==null||mi(Bt(vn)),wi(vn)}},Xi=function(Ui){if(Ei==null||Ei(Ui),Ui.which===ae.Z.ENTER){var vn=Ki(Ui);mi==null||mi(Bt(vn)),wi(vn)}},hn=function(Ui){Ci(rt),Ti==null||Ti(Ui)},fn={};ve.role==="option"&&(fn["aria-selected"]=Bi);var _n=_.createElement(Ht,(0,B.Z)({ref:Ai,elementRef:Zi,role:Mt===null?"none":Mt||"menuitem",tabIndex:lt?null:-1,"data-menu-id":Ni&&ci?null:ci},(0,Ke.Z)(gi,["extra"]),Oi,fn,{component:"li","aria-disabled":lt,style:(0,Se.Z)((0,Se.Z)({},gn),Qe),className:ce()(Vi,(0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(Vi,"-active"),_i),"".concat(Vi,"-selected"),Bi),"".concat(Vi,"-disabled"),Yi),qe),onClick:ln,onKeyDown:Xi,onFocus:hn}),Wt,_.createElement(Pt,{props:(0,Se.Z)((0,Se.Z)({},ve),{},{isSelected:Bi}),icon:ii}));return on&&(_n=on(_n,ve,{selected:Bi})),_n});function Et(ve,Ce){var Qe=ve.eventKey,qe=te(),rt=Le(Qe);return _.useEffect(function(){if(qe)return qe.registerPath(Qe,rt),function(){qe.unregisterPath(Qe,rt)}},[rt]),qe?null:_.createElement(Qt,(0,B.Z)({},ve,{ref:Ce}))}var ht=_.forwardRef(Et),pt=["className","children"],ti=function(Ce,Qe){var qe=Ce.className,rt=Ce.children,ct=(0,p.Z)(Ce,pt),lt=_.useContext(I),gt=lt.prefixCls,Wt=lt.mode,Mt=lt.rtl;return _.createElement("ul",(0,B.Z)({className:ce()(gt,Mt&&"".concat(gt,"-rtl"),"".concat(gt,"-sub"),"".concat(gt,"-").concat(Wt==="inline"?"inline":"vertical"),qe),role:"menu"},ct,{"data-menu-list":!0,ref:Qe}),rt)},Ot=_.forwardRef(ti);Ot.displayName="SubMenuList";var Xe=Ot,vt=K(11592);function Kt(ve,Ce){return(0,vt.Z)(ve).map(function(Qe,qe){if(_.isValidElement(Qe)){var rt,ct,lt=Qe.key,gt=(rt=(ct=Qe.props)===null||ct===void 0?void 0:ct.eventKey)!==null&&rt!==void 0?rt:lt,Wt=gt==null;Wt&&(gt="tmp_key-".concat([].concat((0,he.Z)(Ce),[qe]).join("-")));var Mt={key:gt,eventKey:gt};return _.cloneElement(Qe,Mt)}return Qe})}var ai=K(65352),St={adjustX:1,adjustY:1},qt={topLeft:{points:["bl","tl"],overflow:St},topRight:{points:["br","tr"],overflow:St},bottomLeft:{points:["tl","bl"],overflow:St},bottomRight:{points:["tr","br"],overflow:St},leftTop:{points:["tr","tl"],overflow:St},leftBottom:{points:["br","bl"],overflow:St},rightTop:{points:["tl","tr"],overflow:St},rightBottom:{points:["bl","br"],overflow:St}},Ct={topLeft:{points:["bl","tl"],overflow:St},topRight:{points:["br","tr"],overflow:St},bottomLeft:{points:["tl","bl"],overflow:St},bottomRight:{points:["tr","br"],overflow:St},rightTop:{points:["tr","tl"],overflow:St},rightBottom:{points:["br","bl"],overflow:St},leftTop:{points:["tl","tr"],overflow:St},leftBottom:{points:["bl","br"],overflow:St}},He=null;function h(ve,Ce,Qe){if(Ce)return Ce;if(Qe)return Qe[ve]||Qe.other}var m={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function y(ve){var Ce=ve.prefixCls,Qe=ve.visible,qe=ve.children,rt=ve.popup,ct=ve.popupStyle,lt=ve.popupClassName,gt=ve.popupOffset,Wt=ve.disabled,Mt=ve.mode,Jt=ve.onVisibleChange,Yt=_.useContext(I),mi=Yt.getPopupContainer,Ei=Yt.rtl,Ti=Yt.subMenuOpenDelay,gi=Yt.subMenuCloseDelay,ci=Yt.builtinPlacements,Li=Yt.triggerSubMenuAction,Pi=Yt.forceSubMenuRender,wi=Yt.rootClassName,bi=Yt.motion,Ni=Yt.defaultMotions,Ri=_.useState(!1),Fi=(0,j.Z)(Ri,2),Ci=Fi[0],Ii=Fi[1],on=Ei?(0,Se.Z)((0,Se.Z)({},Ct),ci):(0,Se.Z)((0,Se.Z)({},qt),ci),Vi=m[Mt],Ai=h(Mt,bi,Ni),sn=_.useRef(Ai);Mt!=="inline"&&(sn.current=Ai);var Yi=(0,Se.Z)((0,Se.Z)({},sn.current),{},{leavedClassName:"".concat(Ce,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Zi=_.useRef();return _.useEffect(function(){return Zi.current=(0,Te.Z)(function(){Ii(Qe)}),function(){Te.Z.cancel(Zi.current)}},[Qe]),_.createElement(ai.Z,{prefixCls:Ce,popupClassName:ce()("".concat(Ce,"-popup"),(0,de.Z)({},"".concat(Ce,"-rtl"),Ei),lt,wi),stretch:Mt==="horizontal"?"minWidth":null,getPopupContainer:mi,builtinPlacements:on,popupPlacement:Vi,popupVisible:Ci,popup:rt,popupStyle:ct,popupAlign:gt&&{offset:gt},action:Wt?[]:[Li],mouseEnterDelay:Ti,mouseLeaveDelay:gi,onPopupVisibleChange:Jt,forceRender:Pi,popupMotion:Yi,fresh:!0},qe)}var k=K(77900);function Z(ve){var Ce=ve.id,Qe=ve.open,qe=ve.keyPath,rt=ve.children,ct="inline",lt=_.useContext(I),gt=lt.prefixCls,Wt=lt.forceSubMenuRender,Mt=lt.motion,Jt=lt.defaultMotions,Yt=lt.mode,mi=_.useRef(!1);mi.current=Yt===ct;var Ei=_.useState(!mi.current),Ti=(0,j.Z)(Ei,2),gi=Ti[0],ci=Ti[1],Li=mi.current?Qe:!1;_.useEffect(function(){mi.current&&ci(!1)},[Yt]);var Pi=(0,Se.Z)({},h(ct,Mt,Jt));qe.length>1&&(Pi.motionAppear=!1);var wi=Pi.onVisibleChanged;return Pi.onVisibleChanged=function(bi){return!mi.current&&!bi&&ci(!0),wi==null?void 0:wi(bi)},gi?null:_.createElement(R,{mode:ct,locked:!mi.current},_.createElement(k.default,(0,B.Z)({visible:Li},Pi,{forceRender:Wt,removeOnLeave:!1,leavedClassName:"".concat(gt,"-hidden")}),function(bi){var Ni=bi.className,Ri=bi.style;return _.createElement(Xe,{id:Ce,className:Ni,style:Ri},rt)}))}var pe=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],be=["active"],ot=_.forwardRef(function(ve,Ce){var Qe=ve.style,qe=ve.className,rt=ve.title,ct=ve.eventKey,lt=ve.warnKey,gt=ve.disabled,Wt=ve.internalPopupClose,Mt=ve.children,Jt=ve.itemIcon,Yt=ve.expandIcon,mi=ve.popupClassName,Ei=ve.popupOffset,Ti=ve.popupStyle,gi=ve.onClick,ci=ve.onMouseEnter,Li=ve.onMouseLeave,Pi=ve.onTitleClick,wi=ve.onTitleMouseEnter,bi=ve.onTitleMouseLeave,Ni=(0,p.Z)(ve,pe),Ri=H(ct),Fi=_.useContext(I),Ci=Fi.prefixCls,Ii=Fi.mode,on=Fi.openKeys,Vi=Fi.disabled,Ai=Fi.overflowDisabled,sn=Fi.activeKey,Yi=Fi.selectedKeys,Zi=Fi.itemIcon,Ji=Fi.expandIcon,Ki=Fi.onItemClick,ii=Fi.onOpenChange,Dt=Fi.onActive,_i=_.useContext(J),Oi=_i._internalRenderSubMenuItem,Bi=_.useContext(xe),gn=Bi.isSubPathKey,ln=Le(),Xi="".concat(Ci,"-submenu"),hn=Vi||gt,fn=_.useRef(),_n=_.useRef(),xn=Jt!=null?Jt:Zi,Ui=Yt!=null?Yt:Ji,vn=on.includes(ct),yn=!Ai&&vn,pn=gn(Yi,ct),dn=Re(ct,hn,wi,bi),pi=dn.active,Pn=(0,p.Z)(dn,be),Tn=_.useState(!1),Gn=(0,j.Z)(Tn,2),On=Gn[0],qn=Gn[1],Mn=function(tn){hn||qn(tn)},Qn=function(tn){Mn(!0),ci==null||ci({key:ct,domEvent:tn})},Wi=function(tn){Mn(!1),Li==null||Li({key:ct,domEvent:tn})},Vn=_.useMemo(function(){return pi||(Ii!=="inline"?On||gn([sn],ct):!1)},[Ii,pi,sn,On,ct,gn]),An=tt(ln.length),as=function(tn){hn||(Pi==null||Pi({key:ct,domEvent:tn}),Ii==="inline"&&ii(ct,!vn))},Jn=W(function(en){gi==null||gi(Bt(en)),Ki(en)}),jn=function(tn){Ii!=="inline"&&ii(ct,tn)},es=function(){Dt(ct)},wn=Ri&&"".concat(Ri,"-popup"),Rn=_.useMemo(function(){return _.createElement(Pt,{icon:Ii!=="horizontal"?Ui:void 0,props:(0,Se.Z)((0,Se.Z)({},ve),{},{isOpen:yn,isSubMenu:!0})},_.createElement("i",{className:"".concat(Xi,"-arrow")}))},[Ii,Ui,ve,yn,Xi]),un=_.createElement("div",(0,B.Z)({role:"menuitem",style:An,className:"".concat(Xi,"-title"),tabIndex:hn?null:-1,ref:fn,title:typeof rt=="string"?rt:null,"data-menu-id":Ai&&Ri?null:Ri,"aria-expanded":yn,"aria-haspopup":!0,"aria-controls":wn,"aria-disabled":hn,onClick:as,onFocus:es},Pn),rt,Rn),In=_.useRef(Ii);if(Ii!=="inline"&&ln.length>1?In.current="vertical":In.current=Ii,!Ai){var mn=In.current;un=_.createElement(y,{mode:mn,prefixCls:Xi,visible:!Wt&&yn&&Ii!=="inline",popupClassName:mi,popupOffset:Ei,popupStyle:Ti,popup:_.createElement(R,{mode:mn==="horizontal"?"vertical":mn},_.createElement(Xe,{id:wn,ref:_n},Mt)),disabled:hn,onVisibleChange:jn},un)}var Nn=_.createElement(l.Z.Item,(0,B.Z)({ref:Ce,role:"none"},Ni,{component:"li",style:Qe,className:ce()(Xi,"".concat(Xi,"-").concat(Ii),qe,(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(Xi,"-open"),yn),"".concat(Xi,"-active"),Vn),"".concat(Xi,"-selected"),pn),"".concat(Xi,"-disabled"),hn)),onMouseEnter:Qn,onMouseLeave:Wi}),un,!Ai&&_.createElement(Z,{id:wn,open:yn,keyPath:ln},Mt));return Oi&&(Nn=Oi(Nn,ve,{selected:pn,active:Vn,open:yn,disabled:hn})),_.createElement(R,{onItemClick:Jn,mode:Ii==="horizontal"?"vertical":Ii,itemIcon:xn,expandIcon:Ui},Nn)}),at=_.forwardRef(function(ve,Ce){var Qe=ve.eventKey,qe=ve.children,rt=Le(Qe),ct=Kt(qe,rt),lt=te();_.useEffect(function(){if(lt)return lt.registerPath(Qe,rt),function(){lt.unregisterPath(Qe,rt)}},[rt]);var gt;return lt?gt=ct:gt=_.createElement(ot,(0,B.Z)({ref:Ce},ve),ct),_.createElement(ge.Provider,{value:rt},gt)}),mt=at,Nt=K(28788);function Zt(ve){var Ce=ve.className,Qe=ve.style,qe=_.useContext(I),rt=qe.prefixCls,ct=te();return ct?null:_.createElement("li",{role:"separator",className:ce()("".concat(rt,"-item-divider"),Ce),style:Qe})}var bt=["className","title","eventKey","children"],Vt=_.forwardRef(function(ve,Ce){var Qe=ve.className,qe=ve.title,rt=ve.eventKey,ct=ve.children,lt=(0,p.Z)(ve,bt),gt=_.useContext(I),Wt=gt.prefixCls,Mt="".concat(Wt,"-item-group");return _.createElement("li",(0,B.Z)({ref:Ce,role:"presentation"},lt,{onClick:function(Yt){return Yt.stopPropagation()},className:ce()(Mt,Qe)}),_.createElement("div",{role:"presentation",className:"".concat(Mt,"-title"),title:typeof qe=="string"?qe:void 0},qe),_.createElement("ul",{role:"group",className:"".concat(Mt,"-list")},ct))}),Ft=_.forwardRef(function(ve,Ce){var Qe=ve.eventKey,qe=ve.children,rt=Le(Qe),ct=Kt(qe,rt),lt=te();return lt?ct:_.createElement(Vt,(0,B.Z)({ref:Ce},(0,Ke.Z)(ve,["warnKey"])),ct)}),et=Ft,xt=["label","children","key","type","extra"];function Ve(ve,Ce,Qe){var qe=Ce.item,rt=Ce.group,ct=Ce.submenu,lt=Ce.divider;return(ve||[]).map(function(gt,Wt){if(gt&&(0,Nt.Z)(gt)==="object"){var Mt=gt,Jt=Mt.label,Yt=Mt.children,mi=Mt.key,Ei=Mt.type,Ti=Mt.extra,gi=(0,p.Z)(Mt,xt),ci=mi!=null?mi:"tmp-".concat(Wt);return Yt||Ei==="group"?Ei==="group"?_.createElement(rt,(0,B.Z)({key:ci},gi,{title:Jt}),Ve(Yt,Ce,Qe)):_.createElement(ct,(0,B.Z)({key:ci},gi,{title:Jt}),Ve(Yt,Ce,Qe)):Ei==="divider"?_.createElement(lt,(0,B.Z)({key:ci},gi)):_.createElement(qe,(0,B.Z)({key:ci},gi,{extra:Ti}),Jt,(!!Ti||Ti===0)&&_.createElement("span",{className:"".concat(Qe,"-item-extra")},Ti))}return null}).filter(function(gt){return gt})}function Ze(ve,Ce,Qe,qe,rt){var ct=ve,lt=(0,Se.Z)({divider:Zt,item:ht,group:et,submenu:mt},qe);return Ce&&(ct=Ve(Ce,lt,rt)),Kt(ct,Qe)}var Rt=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],Lt=[],ui=_.forwardRef(function(ve,Ce){var Qe,qe=ve,rt=qe.prefixCls,ct=rt===void 0?"rc-menu":rt,lt=qe.rootClassName,gt=qe.style,Wt=qe.className,Mt=qe.tabIndex,Jt=Mt===void 0?0:Mt,Yt=qe.items,mi=qe.children,Ei=qe.direction,Ti=qe.id,gi=qe.mode,ci=gi===void 0?"vertical":gi,Li=qe.inlineCollapsed,Pi=qe.disabled,wi=qe.disabledOverflow,bi=qe.subMenuOpenDelay,Ni=bi===void 0?.1:bi,Ri=qe.subMenuCloseDelay,Fi=Ri===void 0?.1:Ri,Ci=qe.forceSubMenuRender,Ii=qe.defaultOpenKeys,on=qe.openKeys,Vi=qe.activeKey,Ai=qe.defaultActiveFirst,sn=qe.selectable,Yi=sn===void 0?!0:sn,Zi=qe.multiple,Ji=Zi===void 0?!1:Zi,Ki=qe.defaultSelectedKeys,ii=qe.selectedKeys,Dt=qe.onSelect,_i=qe.onDeselect,Oi=qe.inlineIndent,Bi=Oi===void 0?24:Oi,gn=qe.motion,ln=qe.defaultMotions,Xi=qe.triggerSubMenuAction,hn=Xi===void 0?"hover":Xi,fn=qe.builtinPlacements,_n=qe.itemIcon,xn=qe.expandIcon,Ui=qe.overflowedIndicator,vn=Ui===void 0?"...":Ui,yn=qe.overflowedIndicatorPopupClassName,pn=qe.getPopupContainer,dn=qe.onClick,pi=qe.onOpenChange,Pn=qe.onKeyDown,Tn=qe.openAnimation,Gn=qe.openTransitionName,On=qe._internalRenderMenuItem,qn=qe._internalRenderSubMenuItem,Mn=qe._internalComponents,Qn=(0,p.Z)(qe,Rt),Wi=_.useMemo(function(){return[Ze(mi,Yt,Lt,Mn,ct),Ze(mi,Yt,Lt,{},ct)]},[mi,Yt,Mn]),Vn=(0,j.Z)(Wi,2),An=Vn[0],as=Vn[1],Jn=_.useState(!1),jn=(0,j.Z)(Jn,2),es=jn[0],wn=jn[1],Rn=_.useRef(),un=ye(Ti),In=Ei==="rtl",mn=(0,X.Z)(Ii,{value:on,postState:function($i){return $i||Lt}}),Nn=(0,j.Z)(mn,2),en=Nn[0],tn=Nn[1],Di=function($i){var nn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function it(){tn($i),pi==null||pi($i)}nn?(0,E.flushSync)(it):it()},cn=_.useState(en),Wn=(0,j.Z)(cn,2),ts=Wn[0],os=Wn[1],Hn=_.useRef(!1),ni=_.useMemo(function(){return(ci==="inline"||ci==="vertical")&&Li?["vertical",Li]:[ci,!1]},[ci,Li]),vi=(0,j.Z)(ni,2),Hi=vi[0],rn=vi[1],qi=Hi==="inline",ls=_.useState(Hi),Zn=(0,j.Z)(ls,2),bn=Zn[0],ds=Zn[1],or=_.useState(rn),Ks=(0,j.Z)(or,2),Mr=Ks[0],$s=Ks[1];_.useEffect(function(){ds(Hi),$s(rn),Hn.current&&(qi?tn(ts):Di(Lt))},[Hi,rn]);var Nr=_.useState(0),Fn=(0,j.Z)(Nr,2),vs=Fn[0],Fr=Fn[1],Rs=vs>=An.length-1||bn!=="horizontal"||wi;_.useEffect(function(){qi&&os(en)},[en]),_.useEffect(function(){return Hn.current=!0,function(){Hn.current=!1}},[]);var is=U(),Gs=is.registerPath,Vs=is.unregisterPath,Br=is.refreshOverflowKeys,Ls=is.isSubPathKey,lr=is.getKeyPath,js=is.getKeys,zn=is.getSubPathKeys,ur=_.useMemo(function(){return{registerPath:Gs,unregisterPath:Vs}},[Gs,Vs]),Ws=_.useMemo(function(){return{isSubPathKey:Ls}},[Ls]);_.useEffect(function(){Br(Rs?Lt:An.slice(vs+1).map(function(an){return an.key}))},[vs,Rs]);var cr=(0,X.Z)(Vi||Ai&&((Qe=An[0])===null||Qe===void 0?void 0:Qe.key),{value:Vi}),hr=(0,j.Z)(cr,2),ys=hr[0],Hs=hr[1],Ur=W(function(an){Hs(an)}),dr=W(function(){Hs(void 0)});(0,_.useImperativeHandle)(Ce,function(){return{list:Rn.current,focus:function($i){var nn,it=js(),Sn=we(it,un),Ss=Sn.elements,Ds=Sn.key2element,Gr=Sn.element2key,Cs=Ie(Rn.current,Ss),zs=ys!=null?ys:Cs[0]?Gr.get(Cs[0]):(nn=An.find(function(Xs){return!Xs.props.disabled}))===null||nn===void 0?void 0:nn.key,xs=Ds.get(zs);if(zs&&xs){var Ys;xs==null||(Ys=xs.focus)===null||Ys===void 0||Ys.call(xs,$i)}}}});var fr=(0,X.Z)(Ki||[],{value:ii,postState:function($i){return Array.isArray($i)?$i:$i==null?Lt:[$i]}}),Is=(0,j.Z)(fr,2),Es=Is[0],pr=Is[1],mr=function($i){if(Yi){var nn=$i.key,it=Es.includes(nn),Sn;Ji?it?Sn=Es.filter(function(Ds){return Ds!==nn}):Sn=[].concat((0,he.Z)(Es),[nn]):Sn=[nn],pr(Sn);var Ss=(0,Se.Z)((0,Se.Z)({},$i),{},{selectedKeys:Sn});it?_i==null||_i(Ss):Dt==null||Dt(Ss)}!Ji&&en.length&&bn!=="inline"&&Di(Lt)},gr=W(function(an){dn==null||dn(Bt(an)),mr(an)}),Zs=W(function(an,$i){var nn=en.filter(function(Sn){return Sn!==an});if($i)nn.push(an);else if(bn!=="inline"){var it=zn(an);nn=nn.filter(function(Sn){return!it.has(Sn)})}(0,P.Z)(en,nn,!0)||Di(nn,!0)}),bs=function($i,nn){var it=nn!=null?nn:!en.includes($i);Zs($i,it)},Kr=ke(bn,ys,In,un,Rn,js,lr,Hs,bs,Pn);_.useEffect(function(){wn(!0)},[]);var _r=_.useMemo(function(){return{_internalRenderMenuItem:On,_internalRenderSubMenuItem:qn}},[On,qn]),vr=bn!=="horizontal"||wi?An:An.map(function(an,$i){return _.createElement(R,{key:an.key,overflowDisabled:$i>vs},an)}),$r=_.createElement(l.Z,(0,B.Z)({id:Ti,ref:Rn,prefixCls:"".concat(ct,"-overflow"),component:"ul",itemComponent:ht,className:ce()(ct,"".concat(ct,"-root"),"".concat(ct,"-").concat(bn),Wt,(0,de.Z)((0,de.Z)({},"".concat(ct,"-inline-collapsed"),Mr),"".concat(ct,"-rtl"),In),lt),dir:Ei,style:gt,role:"menu",tabIndex:Jt,data:vr,renderRawItem:function($i){return $i},renderRawRest:function($i){var nn=$i.length,it=nn?An.slice(-nn):null;return _.createElement(mt,{eventKey:F,title:vn,disabled:Rs,internalPopupClose:nn===0,popupClassName:yn},it)},maxCount:bn!=="horizontal"||wi?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function($i){Fr($i)},onKeyDown:Kr},Qn));return _.createElement(J.Provider,{value:_r},_.createElement(A.Provider,{value:un},_.createElement(R,{prefixCls:ct,rootClassName:lt,mode:bn,openKeys:en,rtl:In,disabled:Pi,motion:es?gn:null,defaultMotions:es?ln:null,activeKey:ys,onActive:Ur,onInactive:dr,selectedKeys:Es,inlineIndent:Bi,subMenuOpenDelay:Ni,subMenuCloseDelay:Fi,forceSubMenuRender:Ci,builtinPlacements:fn,triggerSubMenuAction:hn,getPopupContainer:pn,itemIcon:_n,expandIcon:xn,onItemClick:gr,onOpenChange:Zs},_.createElement(xe.Provider,{value:Ws},$r),_.createElement("div",{style:{display:"none"},"aria-hidden":!0},_.createElement(se.Provider,{value:ur},as)))))}),Tt=ui,It=Tt;It.Item=ht,It.SubMenu=mt,It.ItemGroup=et,It.Divider=Zt;var zt=It},11780:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return ie}});var B=K(71409),de=K(89490),Se=K(11036),he=K(39224),j=K(59301),p=K(92310),me=K.n(p),ce=K(29301),l=K(34280),X=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],P=void 0;function g(S,v){var z=S.prefixCls,ae=S.invalidate,Te=S.item,Fe=S.renderItem,Ye=S.responsive,_t=S.responsiveDisabled,Ut=S.registerSize,si=S.itemKey,Ge=S.className,ft=S.style,$t=S.children,ut=S.display,li=S.order,We=S.component,Ee=We===void 0?"div":We,Ie=(0,he.Z)(S,X),ne=Ye&&!ut;function we(Q){Ut(si,Q)}j.useEffect(function(){return function(){we(null)}},[]);var ke=Fe&&Te!==P?Fe(Te,{index:li}):$t,ee;ae||(ee={opacity:ne?0:1,height:ne?0:P,overflowY:ne?"hidden":P,order:Ye?li:P,pointerEvents:ne?"none":P,position:ne?"absolute":P});var Y={};ne&&(Y["aria-hidden"]=!0);var C=j.createElement(Ee,(0,B.Z)({className:me()(!ae&&z,Ge),style:(0,de.Z)((0,de.Z)({},ee),ft)},Y,Ie,{ref:v}),ke);return Ye&&(C=j.createElement(ce.Z,{onResize:function(F){var U=F.offsetWidth;we(U)},disabled:_t},C)),C}var _=j.forwardRef(g);_.displayName="Item";var E=_,A=K(6089),M=K(4676),H=K(16089);function V(S){if(typeof MessageChannel=="undefined")(0,H.Z)(S);else{var v=new MessageChannel;v.port1.onmessage=function(){return S()},v.port2.postMessage(void 0)}}function L(){var S=j.useRef(null),v=function(ae){S.current||(S.current=[],V(function(){(0,M.unstable_batchedUpdates)(function(){S.current.forEach(function(Te){Te()}),S.current=null})})),S.current.push(ae)};return v}function I(S,v){var z=j.useState(v),ae=(0,Se.Z)(z,2),Te=ae[0],Fe=ae[1],Ye=(0,A.Z)(function(_t){S(function(){Fe(_t)})});return[Te,Ye]}var w=j.createContext(null),R=["component"],q=["className"],se=["className"],te=function(v,z){var ae=j.useContext(w);if(!ae){var Te=v.component,Fe=Te===void 0?"div":Te,Ye=(0,he.Z)(v,R);return j.createElement(Fe,(0,B.Z)({},Ye,{ref:z}))}var _t=ae.className,Ut=(0,he.Z)(ae,q),si=v.className,Ge=(0,he.Z)(v,se);return j.createElement(w.Provider,{value:null},j.createElement(E,(0,B.Z)({ref:z,className:me()(_t,si)},Ut,Ge)))},ge=j.forwardRef(te);ge.displayName="RawItem";var Le=ge,xe=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],$e="responsive",J="invalidate";function D(S){return"+ ".concat(S.length," ...")}function N(S,v){var z=S.prefixCls,ae=z===void 0?"rc-overflow":z,Te=S.data,Fe=Te===void 0?[]:Te,Ye=S.renderItem,_t=S.renderRawItem,Ut=S.itemKey,si=S.itemWidth,Ge=si===void 0?10:si,ft=S.ssr,$t=S.style,ut=S.className,li=S.maxCount,We=S.renderRest,Ee=S.renderRawRest,Ie=S.suffix,ne=S.component,we=ne===void 0?"div":ne,ke=S.itemComponent,ee=S.onVisibleChange,Y=(0,he.Z)(S,xe),C=ft==="full",Q=L(),F=I(Q,null),U=(0,Se.Z)(F,2),W=U[0],re=U[1],le=W||0,ye=I(Q,new Map),De=(0,Se.Z)(ye,2),Ae=De[0],je=De[1],Ue=I(Q,0),Ke=(0,Se.Z)(Ue,2),dt=Ke[0],Re=Ke[1],tt=I(Q,0),Pt=(0,Se.Z)(tt,2),yt=Pt[0],Bt=Pt[1],jt=I(Q,0),oi=(0,Se.Z)(jt,2),ei=oi[0],Ht=oi[1],Qt=(0,j.useState)(null),Et=(0,Se.Z)(Qt,2),ht=Et[0],pt=Et[1],ti=(0,j.useState)(null),Ot=(0,Se.Z)(ti,2),Xe=Ot[0],vt=Ot[1],Kt=j.useMemo(function(){return Xe===null&&C?Number.MAX_SAFE_INTEGER:Xe||0},[Xe,W]),ai=(0,j.useState)(!1),St=(0,Se.Z)(ai,2),qt=St[0],Ct=St[1],He="".concat(ae,"-item"),h=Math.max(dt,yt),m=li===$e,y=Fe.length&&m,k=li===J,Z=y||typeof li=="number"&&Fe.length>li,pe=(0,j.useMemo)(function(){var It=Fe;return y?W===null&&C?It=Fe:It=Fe.slice(0,Math.min(Fe.length,le/Ge)):typeof li=="number"&&(It=Fe.slice(0,li)),It},[Fe,Ge,W,li,y]),be=(0,j.useMemo)(function(){return y?Fe.slice(Kt+1):Fe.slice(pe.length)},[Fe,pe,y,Kt]),ot=(0,j.useCallback)(function(It,zt){var ve;return typeof Ut=="function"?Ut(It):(ve=Ut&&(It==null?void 0:It[Ut]))!==null&&ve!==void 0?ve:zt},[Ut]),at=(0,j.useCallback)(Ye||function(It){return It},[Ye]);function mt(It,zt,ve){Xe===It&&(zt===void 0||zt===ht)||(vt(It),ve||(Ct(It<Fe.length-1),ee==null||ee(It)),zt!==void 0&&pt(zt))}function Nt(It,zt){re(zt.clientWidth)}function Zt(It,zt){je(function(ve){var Ce=new Map(ve);return zt===null?Ce.delete(It):Ce.set(It,zt),Ce})}function bt(It,zt){Bt(zt),Re(yt)}function Vt(It,zt){Ht(zt)}function Ft(It){return Ae.get(ot(pe[It],It))}(0,l.Z)(function(){if(le&&typeof h=="number"&&pe){var It=ei,zt=pe.length,ve=zt-1;if(!zt){mt(0,null);return}for(var Ce=0;Ce<zt;Ce+=1){var Qe=Ft(Ce);if(C&&(Qe=Qe||0),Qe===void 0){mt(Ce-1,void 0,!0);break}if(It+=Qe,ve===0&&It<=le||Ce===ve-1&&It+Ft(ve)<=le){mt(ve,null);break}else if(It+h>le){mt(Ce-1,It-Qe-ei+yt);break}}Ie&&Ft(0)+ei>le&&pt(null)}},[le,Ae,yt,ei,ot,pe]);var et=qt&&!!be.length,xt={};ht!==null&&y&&(xt={position:"absolute",left:ht,top:0});var Ve={prefixCls:He,responsive:y,component:ke,invalidate:k},Ze=_t?function(It,zt){var ve=ot(It,zt);return j.createElement(w.Provider,{key:ve,value:(0,de.Z)((0,de.Z)({},Ve),{},{order:zt,item:It,itemKey:ve,registerSize:Zt,display:zt<=Kt})},_t(It,zt))}:function(It,zt){var ve=ot(It,zt);return j.createElement(E,(0,B.Z)({},Ve,{order:zt,key:ve,item:It,renderItem:at,itemKey:ve,registerSize:Zt,display:zt<=Kt}))},Rt={order:et?Kt:Number.MAX_SAFE_INTEGER,className:"".concat(He,"-rest"),registerSize:bt,display:et},Lt=We||D,ui=Ee?j.createElement(w.Provider,{value:(0,de.Z)((0,de.Z)({},Ve),Rt)},Ee(be)):j.createElement(E,(0,B.Z)({},Ve,Rt),typeof Lt=="function"?Lt(be):Lt),Tt=j.createElement(we,(0,B.Z)({className:me()(!k&&ae,ut),style:$t,ref:v},Y),pe.map(Ze),Z?ui:null,Ie&&j.createElement(E,(0,B.Z)({},Ve,{responsive:m,responsiveDisabled:!y,order:Kt,className:"".concat(He,"-suffix"),registerSize:Vt,display:!0,style:xt}),Ie));return m?j.createElement(ce.Z,{onResize:Nt,disabled:!y},Tt):Tt}var O=j.forwardRef(N);O.displayName="Overflow",O.Item=Le,O.RESPONSIVE=$e,O.INVALIDATE=J;var oe=O,ie=oe},738:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return I}});var B=K(71409),de=K(87075),Se=K(11036),he=K(39224),j=K(92310),p=K.n(j),me=K(18929),ce=K(10228),l=K(26112),X=K(59301);function P(w,R){var q=w.disabled,se=w.prefixCls,te=w.character,ge=w.characterRender,Le=w.index,xe=w.count,$e=w.value,J=w.allowHalf,D=w.focused,N=w.onHover,O=w.onClick,oe=function(Ye){N(Ye,Le)},ie=function(Ye){O(Ye,Le)},S=function(Ye){Ye.keyCode===ce.Z.ENTER&&O(Ye,Le)},v=Le+1,z=new Set([se]);$e===0&&Le===0&&D?z.add("".concat(se,"-focused")):J&&$e+.5>=v&&$e<v?(z.add("".concat(se,"-half")),z.add("".concat(se,"-active")),D&&z.add("".concat(se,"-focused"))):(v<=$e?z.add("".concat(se,"-full")):z.add("".concat(se,"-zero")),v===$e&&D&&z.add("".concat(se,"-focused")));var ae=typeof te=="function"?te(w):te,Te=X.createElement("li",{className:p()(Array.from(z)),ref:R},X.createElement("div",{onClick:q?null:ie,onKeyDown:q?null:S,onMouseMove:q?null:oe,role:"radio","aria-checked":$e>Le?"true":"false","aria-posinset":Le+1,"aria-setsize":xe,tabIndex:q?-1:0},X.createElement("div",{className:"".concat(se,"-first")},ae),X.createElement("div",{className:"".concat(se,"-second")},ae)));return ge&&(Te=ge(Te,w)),Te}var g=X.forwardRef(P);function _(){var w=X.useRef({});function R(se){return w.current[se]}function q(se){return function(te){w.current[se]=te}}return[R,q]}function E(w){var R=w.pageXOffset,q="scrollLeft";if(typeof R!="number"){var se=w.document;R=se.documentElement[q],typeof R!="number"&&(R=se.body[q])}return R}function A(w){var R,q,se=w.ownerDocument,te=se.body,ge=se&&se.documentElement,Le=w.getBoundingClientRect();return R=Le.left,q=Le.top,R-=ge.clientLeft||te.clientLeft||0,q-=ge.clientTop||te.clientTop||0,{left:R,top:q}}function M(w){var R=A(w),q=w.ownerDocument,se=q.defaultView||q.parentWindow;return R.left+=E(se),R.left}var H=["prefixCls","className","defaultValue","value","count","allowHalf","allowClear","keyboard","character","characterRender","disabled","direction","tabIndex","autoFocus","onHoverChange","onChange","onFocus","onBlur","onKeyDown","onMouseLeave"];function V(w,R){var q=w.prefixCls,se=q===void 0?"rc-rate":q,te=w.className,ge=w.defaultValue,Le=w.value,xe=w.count,$e=xe===void 0?5:xe,J=w.allowHalf,D=J===void 0?!1:J,N=w.allowClear,O=N===void 0?!0:N,oe=w.keyboard,ie=oe===void 0?!0:oe,S=w.character,v=S===void 0?"\u2605":S,z=w.characterRender,ae=w.disabled,Te=w.direction,Fe=Te===void 0?"ltr":Te,Ye=w.tabIndex,_t=Ye===void 0?0:Ye,Ut=w.autoFocus,si=w.onHoverChange,Ge=w.onChange,ft=w.onFocus,$t=w.onBlur,ut=w.onKeyDown,li=w.onMouseLeave,We=(0,he.Z)(w,H),Ee=_(),Ie=(0,Se.Z)(Ee,2),ne=Ie[0],we=Ie[1],ke=X.useRef(null),ee=function(){if(!ae){var pt;(pt=ke.current)===null||pt===void 0||pt.focus()}};X.useImperativeHandle(R,function(){return{focus:ee,blur:function(){if(!ae){var pt;(pt=ke.current)===null||pt===void 0||pt.blur()}}}});var Y=(0,me.Z)(ge||0,{value:Le}),C=(0,Se.Z)(Y,2),Q=C[0],F=C[1],U=(0,me.Z)(null),W=(0,Se.Z)(U,2),re=W[0],le=W[1],ye=function(pt,ti){var Ot=Fe==="rtl",Xe=pt+1;if(D){var vt=ne(pt),Kt=M(vt),ai=vt.clientWidth;(Ot&&ti-Kt>ai/2||!Ot&&ti-Kt<ai/2)&&(Xe-=.5)}return Xe},De=function(pt){F(pt),Ge==null||Ge(pt)},Ae=X.useState(!1),je=(0,Se.Z)(Ae,2),Ue=je[0],Ke=je[1],dt=function(){Ke(!0),ft==null||ft()},Re=function(){Ke(!1),$t==null||$t()},tt=X.useState(null),Pt=(0,Se.Z)(tt,2),yt=Pt[0],Bt=Pt[1],jt=function(pt,ti){var Ot=ye(ti,pt.pageX);Ot!==re&&(Bt(Ot),le(null)),si==null||si(Ot)},oi=function(pt){ae||(Bt(null),le(null),si==null||si(void 0)),pt&&(li==null||li(pt))},ei=function(pt,ti){var Ot=ye(ti,pt.pageX),Xe=!1;O&&(Xe=Ot===Q),oi(),De(Xe?0:Ot),le(Xe?Ot:null)},Ht=function(pt){var ti=pt.keyCode,Ot=Fe==="rtl",Xe=D?.5:1;ie&&(ti===ce.Z.RIGHT&&Q<$e&&!Ot?(De(Q+Xe),pt.preventDefault()):ti===ce.Z.LEFT&&Q>0&&!Ot||ti===ce.Z.RIGHT&&Q>0&&Ot?(De(Q-Xe),pt.preventDefault()):ti===ce.Z.LEFT&&Q<$e&&Ot&&(De(Q+Xe),pt.preventDefault())),ut==null||ut(pt)};X.useEffect(function(){Ut&&!ae&&ee()},[]);var Qt=new Array($e).fill(0).map(function(ht,pt){return X.createElement(g,{ref:we(pt),index:pt,count:$e,disabled:ae,prefixCls:"".concat(se,"-star"),allowHalf:D,value:yt===null?Q:yt,onClick:ei,onHover:jt,key:ht||pt,character:v,characterRender:z,focused:Ue})}),Et=p()(se,te,(0,de.Z)((0,de.Z)({},"".concat(se,"-disabled"),ae),"".concat(se,"-rtl"),Fe==="rtl"));return X.createElement("ul",(0,B.Z)({className:Et,onMouseLeave:oi,tabIndex:ae?-1:_t,onFocus:ae?null:dt,onBlur:ae?null:Re,onKeyDown:ae?null:Ht,ref:ke},(0,l.Z)(We,{aria:!0,data:!0,attr:!0})),Qt)}var L=X.forwardRef(V),I=L},29301:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return J}});var B=K(71409),de=K(59301),Se=K(11592),he=K(48736),j=K(89490),p=K(28788),me=K(76846),ce=K(8654),l=de.createContext(null);function X(D){var N=D.children,O=D.onBatchResize,oe=de.useRef(0),ie=de.useRef([]),S=de.useContext(l),v=de.useCallback(function(z,ae,Te){oe.current+=1;var Fe=oe.current;ie.current.push({size:z,element:ae,data:Te}),Promise.resolve().then(function(){Fe===oe.current&&(O==null||O(ie.current),ie.current=[])}),S==null||S(z,ae,Te)},[O,S]);return de.createElement(l.Provider,{value:v},N)}var P=K(76374),g=new Map;function _(D){D.forEach(function(N){var O,oe=N.target;(O=g.get(oe))===null||O===void 0||O.forEach(function(ie){return ie(oe)})})}var E=new P.Z(_),A=null,M=null;function H(D,N){g.has(D)||(g.set(D,new Set),E.observe(D)),g.get(D).add(N)}function V(D,N){g.has(D)&&(g.get(D).delete(N),g.get(D).size||(E.unobserve(D),g.delete(D)))}var L=K(16552),I=K(19210),w=K(46654),R=K(37205),q=function(D){(0,w.Z)(O,D);var N=(0,R.Z)(O);function O(){return(0,L.Z)(this,O),N.apply(this,arguments)}return(0,I.Z)(O,[{key:"render",value:function(){return this.props.children}}]),O}(de.Component);function se(D,N){var O=D.children,oe=D.disabled,ie=de.useRef(null),S=de.useRef(null),v=de.useContext(l),z=typeof O=="function",ae=z?O(ie):O,Te=de.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Fe=!z&&de.isValidElement(ae)&&(0,ce.Yr)(ae),Ye=Fe?(0,ce.C4)(ae):null,_t=(0,ce.x1)(Ye,ie),Ut=function(){var $t;return(0,me.ZP)(ie.current)||(ie.current&&(0,p.Z)(ie.current)==="object"?(0,me.ZP)(($t=ie.current)===null||$t===void 0?void 0:$t.nativeElement):null)||(0,me.ZP)(S.current)};de.useImperativeHandle(N,function(){return Ut()});var si=de.useRef(D);si.current=D;var Ge=de.useCallback(function(ft){var $t=si.current,ut=$t.onResize,li=$t.data,We=ft.getBoundingClientRect(),Ee=We.width,Ie=We.height,ne=ft.offsetWidth,we=ft.offsetHeight,ke=Math.floor(Ee),ee=Math.floor(Ie);if(Te.current.width!==ke||Te.current.height!==ee||Te.current.offsetWidth!==ne||Te.current.offsetHeight!==we){var Y={width:ke,height:ee,offsetWidth:ne,offsetHeight:we};Te.current=Y;var C=ne===Math.round(Ee)?Ee:ne,Q=we===Math.round(Ie)?Ie:we,F=(0,j.Z)((0,j.Z)({},Y),{},{offsetWidth:C,offsetHeight:Q});v==null||v(F,ft,li),ut&&Promise.resolve().then(function(){ut(F,ft)})}},[]);return de.useEffect(function(){var ft=Ut();return ft&&!oe&&H(ft,Ge),function(){return V(ft,Ge)}},[ie.current,oe]),de.createElement(q,{ref:S},Fe?de.cloneElement(ae,{ref:_t}):ae)}var te=de.forwardRef(se),ge=te,Le="rc-observer-key";function xe(D,N){var O=D.children,oe=typeof O=="function"?[O]:(0,Se.Z)(O);return oe.map(function(ie,S){var v=(ie==null?void 0:ie.key)||"".concat(Le,"-").concat(S);return de.createElement(ge,(0,B.Z)({},D,{key:v,ref:S===0?N:void 0}),ie)})}var $e=de.forwardRef(xe);$e.Collection=X;var J=$e},63158:function(Xt,st,K){"use strict";var B=K(71409),de=K(87075),Se=K(11036),he=K(39224),j=K(59301),p=K(92310),me=K.n(p),ce=K(18929),l=K(10228),X=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],P=j.forwardRef(function(g,_){var E,A=g.prefixCls,M=A===void 0?"rc-switch":A,H=g.className,V=g.checked,L=g.defaultChecked,I=g.disabled,w=g.loadingIcon,R=g.checkedChildren,q=g.unCheckedChildren,se=g.onClick,te=g.onChange,ge=g.onKeyDown,Le=(0,he.Z)(g,X),xe=(0,ce.Z)(!1,{value:V,defaultValue:L}),$e=(0,Se.Z)(xe,2),J=$e[0],D=$e[1];function N(S,v){var z=J;return I||(z=S,D(z),te==null||te(z,v)),z}function O(S){S.which===l.Z.LEFT?N(!1,S):S.which===l.Z.RIGHT&&N(!0,S),ge==null||ge(S)}function oe(S){var v=N(!J,S);se==null||se(v,S)}var ie=me()(M,H,(E={},(0,de.Z)(E,"".concat(M,"-checked"),J),(0,de.Z)(E,"".concat(M,"-disabled"),I),E));return j.createElement("button",(0,B.Z)({},Le,{type:"button",role:"switch","aria-checked":J,disabled:I,className:ie,ref:_,onKeyDown:O,onClick:oe}),w,j.createElement("span",{className:"".concat(M,"-inner")},j.createElement("span",{className:"".concat(M,"-inner-checked")},R),j.createElement("span",{className:"".concat(M,"-inner-unchecked")},q)))});P.displayName="Switch",st.Z=P},29125:function(Xt,st,K){"use strict";K.d(st,{G:function(){return he},Z:function(){return V}});var B=K(92310),de=K.n(B),Se=K(59301);function he(L){var I=L.children,w=L.prefixCls,R=L.id,q=L.overlayInnerStyle,se=L.bodyClassName,te=L.className,ge=L.style;return Se.createElement("div",{className:de()("".concat(w,"-content"),te),style:ge},Se.createElement("div",{className:de()("".concat(w,"-inner"),se),id:R,role:"tooltip",style:q},typeof I=="function"?I():I))}var j=K(71409),p=K(89490),me=K(39224),ce=K(65352),l={shiftX:64,adjustY:1},X={adjustX:1,shiftY:!0},P=[0,0],g={left:{points:["cr","cl"],overflow:X,offset:[-4,0],targetOffset:P},right:{points:["cl","cr"],overflow:X,offset:[4,0],targetOffset:P},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:P},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:P},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:P},leftTop:{points:["tr","tl"],overflow:X,offset:[-4,0],targetOffset:P},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:P},rightTop:{points:["tl","tr"],overflow:X,offset:[4,0],targetOffset:P},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:P},rightBottom:{points:["bl","br"],overflow:X,offset:[4,0],targetOffset:P},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:P},leftBottom:{points:["br","bl"],overflow:X,offset:[-4,0],targetOffset:P}},_=null,E=K(80402),A=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],M=function(I,w){var R=I.overlayClassName,q=I.trigger,se=q===void 0?["hover"]:q,te=I.mouseEnterDelay,ge=te===void 0?0:te,Le=I.mouseLeaveDelay,xe=Le===void 0?.1:Le,$e=I.overlayStyle,J=I.prefixCls,D=J===void 0?"rc-tooltip":J,N=I.children,O=I.onVisibleChange,oe=I.afterVisibleChange,ie=I.transitionName,S=I.animation,v=I.motion,z=I.placement,ae=z===void 0?"right":z,Te=I.align,Fe=Te===void 0?{}:Te,Ye=I.destroyTooltipOnHide,_t=Ye===void 0?!1:Ye,Ut=I.defaultVisible,si=I.getTooltipContainer,Ge=I.overlayInnerStyle,ft=I.arrowContent,$t=I.overlay,ut=I.id,li=I.showArrow,We=li===void 0?!0:li,Ee=I.classNames,Ie=I.styles,ne=(0,me.Z)(I,A),we=(0,E.Z)(ut),ke=(0,Se.useRef)(null);(0,Se.useImperativeHandle)(w,function(){return ke.current});var ee=(0,p.Z)({},ne);"visible"in I&&(ee.popupVisible=I.visible);var Y=function(){return Se.createElement(he,{key:"content",prefixCls:D,id:we,bodyClassName:Ee==null?void 0:Ee.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},Ge),Ie==null?void 0:Ie.body)},$t)},C=function(){var F=Se.Children.only(N),U=(F==null?void 0:F.props)||{},W=(0,p.Z)((0,p.Z)({},U),{},{"aria-describedby":$t?we:null});return Se.cloneElement(N,W)};return Se.createElement(ce.Z,(0,j.Z)({popupClassName:de()(R,Ee==null?void 0:Ee.root),prefixCls:D,popup:Y,action:se,builtinPlacements:g,popupPlacement:ae,ref:ke,popupAlign:Fe,getPopupContainer:si,onPopupVisibleChange:O,afterPopupVisibleChange:oe,popupTransitionName:ie,popupAnimation:S,popupMotion:v,defaultPopupVisible:Ut,autoDestroy:_t,mouseLeaveDelay:xe,popupStyle:(0,p.Z)((0,p.Z)({},$e),Ie==null?void 0:Ie.root),mouseEnterDelay:ge,arrow:We},ee),C())},H=(0,Se.forwardRef)(M),V=H},639:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return I}});var B=K(71409),de=K(87075),Se=K(89490),he=K(11036),j=K(39224),p=K(59301),me=K(92310),ce=K.n(me),l=K(26112),X=K(30699),P=function(R){for(var q=R.prefixCls,se=R.level,te=R.isStart,ge=R.isEnd,Le="".concat(q,"-indent-unit"),xe=[],$e=0;$e<se;$e+=1)xe.push(p.createElement("span",{key:$e,className:ce()(Le,(0,de.Z)((0,de.Z)({},"".concat(Le,"-start"),te[$e]),"".concat(Le,"-end"),ge[$e]))}));return p.createElement("span",{"aria-hidden":"true",className:"".concat(q,"-indent")},xe)},g=p.memo(P),_=K(65065),E=K(34061),A=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],M="open",H="close",V="---",L=function(R){var q,se,te,ge=R.eventKey,Le=R.className,xe=R.style,$e=R.dragOver,J=R.dragOverGapTop,D=R.dragOverGapBottom,N=R.isLeaf,O=R.isStart,oe=R.isEnd,ie=R.expanded,S=R.selected,v=R.checked,z=R.halfChecked,ae=R.loading,Te=R.domRef,Fe=R.active,Ye=R.data,_t=R.onMouseMove,Ut=R.selectable,si=(0,j.Z)(R,A),Ge=p.useContext(X.k),ft=p.useContext(X.y),$t=p.useRef(null),ut=p.useState(!1),li=(0,he.Z)(ut,2),We=li[0],Ee=li[1],Ie=!!(Ge.disabled||R.disabled||(q=ft.nodeDisabled)!==null&&q!==void 0&&q.call(ft,Ye)),ne=p.useMemo(function(){return!Ge.checkable||R.checkable===!1?!1:Ge.checkable},[Ge.checkable,R.checkable]),we=function(vt){Ie||Ge.onNodeSelect(vt,(0,E.F)(R))},ke=function(vt){Ie||!ne||R.disableCheckbox||Ge.onNodeCheck(vt,(0,E.F)(R),!v)},ee=p.useMemo(function(){return typeof Ut=="boolean"?Ut:Ge.selectable},[Ut,Ge.selectable]),Y=function(vt){Ge.onNodeClick(vt,(0,E.F)(R)),ee?we(vt):ke(vt)},C=function(vt){Ge.onNodeDoubleClick(vt,(0,E.F)(R))},Q=function(vt){Ge.onNodeMouseEnter(vt,(0,E.F)(R))},F=function(vt){Ge.onNodeMouseLeave(vt,(0,E.F)(R))},U=function(vt){Ge.onNodeContextMenu(vt,(0,E.F)(R))},W=p.useMemo(function(){return!!(Ge.draggable&&(!Ge.draggable.nodeDraggable||Ge.draggable.nodeDraggable(Ye)))},[Ge.draggable,Ye]),re=function(vt){vt.stopPropagation(),Ee(!0),Ge.onNodeDragStart(vt,R);try{vt.dataTransfer.setData("text/plain","")}catch(Kt){}},le=function(vt){vt.preventDefault(),vt.stopPropagation(),Ge.onNodeDragEnter(vt,R)},ye=function(vt){vt.preventDefault(),vt.stopPropagation(),Ge.onNodeDragOver(vt,R)},De=function(vt){vt.stopPropagation(),Ge.onNodeDragLeave(vt,R)},Ae=function(vt){vt.stopPropagation(),Ee(!1),Ge.onNodeDragEnd(vt,R)},je=function(vt){vt.preventDefault(),vt.stopPropagation(),Ee(!1),Ge.onNodeDrop(vt,R)},Ue=function(vt){ae||Ge.onNodeExpand(vt,(0,E.F)(R))},Ke=p.useMemo(function(){var Xe=(0,_.Z)(Ge.keyEntities,ge)||{},vt=Xe.children;return!!(vt||[]).length},[Ge.keyEntities,ge]),dt=p.useMemo(function(){return N===!1?!1:N||!Ge.loadData&&!Ke||Ge.loadData&&R.loaded&&!Ke},[N,Ge.loadData,Ke,R.loaded]);p.useEffect(function(){ae||typeof Ge.loadData=="function"&&ie&&!dt&&!R.loaded&&Ge.onNodeLoad((0,E.F)(R))},[ae,Ge.loadData,Ge.onNodeLoad,ie,dt,R]);var Re=p.useMemo(function(){var Xe;return(Xe=Ge.draggable)!==null&&Xe!==void 0&&Xe.icon?p.createElement("span",{className:"".concat(Ge.prefixCls,"-draggable-icon")},Ge.draggable.icon):null},[Ge.draggable]),tt=function(vt){var Kt=R.switcherIcon||Ge.switcherIcon;return typeof Kt=="function"?Kt((0,Se.Z)((0,Se.Z)({},R),{},{isLeaf:vt})):Kt},Pt=function(){if(dt){var vt=tt(!0);return vt!==!1?p.createElement("span",{className:ce()("".concat(Ge.prefixCls,"-switcher"),"".concat(Ge.prefixCls,"-switcher-noop"))},vt):null}var Kt=tt(!1);return Kt!==!1?p.createElement("span",{onClick:Ue,className:ce()("".concat(Ge.prefixCls,"-switcher"),"".concat(Ge.prefixCls,"-switcher_").concat(ie?M:H))},Kt):null},yt=p.useMemo(function(){if(!ne)return null;var Xe=typeof ne!="boolean"?ne:null;return p.createElement("span",{className:ce()("".concat(Ge.prefixCls,"-checkbox"),(0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(Ge.prefixCls,"-checkbox-checked"),v),"".concat(Ge.prefixCls,"-checkbox-indeterminate"),!v&&z),"".concat(Ge.prefixCls,"-checkbox-disabled"),Ie||R.disableCheckbox)),onClick:ke,role:"checkbox","aria-checked":z?"mixed":v,"aria-disabled":Ie||R.disableCheckbox,"aria-label":"Select ".concat(typeof R.title=="string"?R.title:"tree node")},Xe)},[ne,v,z,Ie,R.disableCheckbox,R.title]),Bt=p.useMemo(function(){return dt?null:ie?M:H},[dt,ie]),jt=p.useMemo(function(){return p.createElement("span",{className:ce()("".concat(Ge.prefixCls,"-iconEle"),"".concat(Ge.prefixCls,"-icon__").concat(Bt||"docu"),(0,de.Z)({},"".concat(Ge.prefixCls,"-icon_loading"),ae))})},[Ge.prefixCls,Bt,ae]),oi=p.useMemo(function(){var Xe=!!Ge.draggable,vt=!R.disabled&&Xe&&Ge.dragOverNodeKey===ge;return vt?Ge.dropIndicatorRender({dropPosition:Ge.dropPosition,dropLevelOffset:Ge.dropLevelOffset,indent:Ge.indent,prefixCls:Ge.prefixCls,direction:Ge.direction}):null},[Ge.dropPosition,Ge.dropLevelOffset,Ge.indent,Ge.prefixCls,Ge.direction,Ge.draggable,Ge.dragOverNodeKey,Ge.dropIndicatorRender]),ei=p.useMemo(function(){var Xe=R.title,vt=Xe===void 0?V:Xe,Kt="".concat(Ge.prefixCls,"-node-content-wrapper"),ai;if(Ge.showIcon){var St=R.icon||Ge.icon;ai=St?p.createElement("span",{className:ce()("".concat(Ge.prefixCls,"-iconEle"),"".concat(Ge.prefixCls,"-icon__customize"))},typeof St=="function"?St(R):St):jt}else Ge.loadData&&ae&&(ai=jt);var qt;return typeof vt=="function"?qt=vt(Ye):Ge.titleRender?qt=Ge.titleRender(Ye):qt=vt,p.createElement("span",{ref:$t,title:typeof vt=="string"?vt:"",className:ce()(Kt,"".concat(Kt,"-").concat(Bt||"normal"),(0,de.Z)({},"".concat(Ge.prefixCls,"-node-selected"),!Ie&&(S||We))),onMouseEnter:Q,onMouseLeave:F,onContextMenu:U,onClick:Y,onDoubleClick:C},ai,p.createElement("span",{className:"".concat(Ge.prefixCls,"-title")},qt),oi)},[Ge.prefixCls,Ge.showIcon,R,Ge.icon,jt,Ge.titleRender,Ye,Bt,Q,F,U,Y,C]),Ht=(0,l.Z)(si,{aria:!0,data:!0}),Qt=(0,_.Z)(Ge.keyEntities,ge)||{},Et=Qt.level,ht=oe[oe.length-1],pt=!Ie&&W,ti=Ge.draggingNodeKey===ge,Ot=Ut!==void 0?{"aria-selected":!!Ut}:void 0;return p.createElement("div",(0,B.Z)({ref:Te,role:"treeitem","aria-expanded":N?void 0:ie,className:ce()(Le,"".concat(Ge.prefixCls,"-treenode"),(te={},(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)(te,"".concat(Ge.prefixCls,"-treenode-disabled"),Ie),"".concat(Ge.prefixCls,"-treenode-switcher-").concat(ie?"open":"close"),!N),"".concat(Ge.prefixCls,"-treenode-checkbox-checked"),v),"".concat(Ge.prefixCls,"-treenode-checkbox-indeterminate"),z),"".concat(Ge.prefixCls,"-treenode-selected"),S),"".concat(Ge.prefixCls,"-treenode-loading"),ae),"".concat(Ge.prefixCls,"-treenode-active"),Fe),"".concat(Ge.prefixCls,"-treenode-leaf-last"),ht),"".concat(Ge.prefixCls,"-treenode-draggable"),W),"dragging",ti),(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)(te,"drop-target",Ge.dropTargetKey===ge),"drop-container",Ge.dropContainerKey===ge),"drag-over",!Ie&&$e),"drag-over-gap-top",!Ie&&J),"drag-over-gap-bottom",!Ie&&D),"filter-node",(se=Ge.filterTreeNode)===null||se===void 0?void 0:se.call(Ge,(0,E.F)(R))),"".concat(Ge.prefixCls,"-treenode-leaf"),dt))),style:xe,draggable:pt,onDragStart:pt?re:void 0,onDragEnter:W?le:void 0,onDragOver:W?ye:void 0,onDragLeave:W?De:void 0,onDrop:W?je:void 0,onDragEnd:W?Ae:void 0,onMouseMove:_t},Ot,Ht),p.createElement(g,{prefixCls:Ge.prefixCls,level:Et,isStart:O,isEnd:oe}),Re,Pt(),yt,ei)};L.isTreeNode=1;var I=L},30699:function(Xt,st,K){"use strict";K.d(st,{k:function(){return de},y:function(){return Se}});var B=K(59301),de=B.createContext(null),Se=B.createContext({})},62379:function(Xt,st,K){"use strict";K.d(st,{OF:function(){return ge.Z},y6:function(){return H.y},ZP:function(){return Ie}});var B=K(71409),de=K(28788),Se=K(89490),he=K(62730),j=K(16552),p=K(19210),me=K(90264),ce=K(46654),l=K(37205),X=K(87075),P=K(92310),g=K.n(P),_=K(10228),E=K(26112),A=K(48736),M=K(59301),H=K(30699),V=function(we){var ke=we.dropPosition,ee=we.dropLevelOffset,Y=we.indent,C={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(ke){case-1:C.top=0,C.left=-ee*Y;break;case 1:C.bottom=0,C.left=-ee*Y;break;case 0:C.bottom=0,C.left=Y;break}return M.createElement("div",{style:C})},L=V;function I(ne){if(ne==null)throw new TypeError("Cannot destructure "+ne)}var w=K(11036),R=K(39224),q=K(34280),se=K(65283),te=K(77900),ge=K(639);function Le(ne,we){var ke=M.useState(!1),ee=(0,w.Z)(ke,2),Y=ee[0],C=ee[1];(0,q.Z)(function(){if(Y)return ne(),function(){we()}},[Y]),(0,q.Z)(function(){return C(!0),function(){C(!1)}},[])}var xe=Le,$e=K(34061),J=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],D=M.forwardRef(function(ne,we){var ke=ne.className,ee=ne.style,Y=ne.motion,C=ne.motionNodes,Q=ne.motionType,F=ne.onMotionStart,U=ne.onMotionEnd,W=ne.active,re=ne.treeNodeRequiredProps,le=(0,R.Z)(ne,J),ye=M.useState(!0),De=(0,w.Z)(ye,2),Ae=De[0],je=De[1],Ue=M.useContext(H.k),Ke=Ue.prefixCls,dt=C&&Q!=="hide";(0,q.Z)(function(){C&&dt!==Ae&&je(dt)},[C]);var Re=function(){C&&F()},tt=M.useRef(!1),Pt=function(){C&&!tt.current&&(tt.current=!0,U())};xe(Re,Pt);var yt=function(jt){dt===jt&&Pt()};return C?M.createElement(te.default,(0,B.Z)({ref:we,visible:Ae},Y,{motionAppear:Q==="show",onVisibleChanged:yt}),function(Bt,jt){var oi=Bt.className,ei=Bt.style;return M.createElement("div",{ref:jt,className:g()("".concat(Ke,"-treenode-motion"),oi),style:ei},C.map(function(Ht){var Qt=Object.assign({},(I(Ht.data),Ht.data)),Et=Ht.title,ht=Ht.key,pt=Ht.isStart,ti=Ht.isEnd;delete Qt.children;var Ot=(0,$e.H8)(ht,re);return M.createElement(ge.Z,(0,B.Z)({},Qt,Ot,{title:Et,active:W,data:Ht.data,key:ht,isStart:pt,isEnd:ti}))}))}):M.createElement(ge.Z,(0,B.Z)({domRef:we,className:ke,style:ee},le,{active:W}))}),N=D;function O(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ke=ne.length,ee=we.length;if(Math.abs(ke-ee)!==1)return{add:!1,key:null};function Y(C,Q){var F=new Map;C.forEach(function(W){F.set(W,!0)});var U=Q.filter(function(W){return!F.has(W)});return U.length===1?U[0]:null}return ke<ee?{add:!0,key:Y(ne,we)}:{add:!1,key:Y(we,ne)}}function oe(ne,we,ke){var ee=ne.findIndex(function(F){return F.key===ke}),Y=ne[ee+1],C=we.findIndex(function(F){return F.key===ke});if(Y){var Q=we.findIndex(function(F){return F.key===Y.key});return we.slice(C+1,Q)}return we.slice(C+1)}var ie=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","scrollWidth","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],S={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},v=function(){},z="RC_TREE_MOTION_".concat(Math.random()),ae={key:z},Te={key:z,level:0,index:0,pos:"0",node:ae,nodes:[ae]},Fe={parent:null,children:[],pos:Te.pos,data:ae,title:null,key:z,isStart:[],isEnd:[]};function Ye(ne,we,ke,ee){return we===!1||!ke?ne:ne.slice(0,Math.ceil(ke/ee)+1)}function _t(ne){var we=ne.key,ke=ne.pos;return(0,$e.km)(we,ke)}function Ut(ne){for(var we=String(ne.data.key),ke=ne;ke.parent;)ke=ke.parent,we="".concat(ke.data.key," > ").concat(we);return we}var si=M.forwardRef(function(ne,we){var ke=ne.prefixCls,ee=ne.data,Y=ne.selectable,C=ne.checkable,Q=ne.expandedKeys,F=ne.selectedKeys,U=ne.checkedKeys,W=ne.loadedKeys,re=ne.loadingKeys,le=ne.halfCheckedKeys,ye=ne.keyEntities,De=ne.disabled,Ae=ne.dragging,je=ne.dragOverNodeKey,Ue=ne.dropPosition,Ke=ne.motion,dt=ne.height,Re=ne.itemHeight,tt=ne.virtual,Pt=ne.scrollWidth,yt=ne.focusable,Bt=ne.activeItem,jt=ne.focused,oi=ne.tabIndex,ei=ne.onKeyDown,Ht=ne.onFocus,Qt=ne.onBlur,Et=ne.onActiveChange,ht=ne.onListChangeStart,pt=ne.onListChangeEnd,ti=(0,R.Z)(ne,ie),Ot=M.useRef(null),Xe=M.useRef(null);M.useImperativeHandle(we,function(){return{scrollTo:function(Ze){Ot.current.scrollTo(Ze)},getIndentWidth:function(){return Xe.current.offsetWidth}}});var vt=M.useState(Q),Kt=(0,w.Z)(vt,2),ai=Kt[0],St=Kt[1],qt=M.useState(ee),Ct=(0,w.Z)(qt,2),He=Ct[0],h=Ct[1],m=M.useState(ee),y=(0,w.Z)(m,2),k=y[0],Z=y[1],pe=M.useState([]),be=(0,w.Z)(pe,2),ot=be[0],at=be[1],mt=M.useState(null),Nt=(0,w.Z)(mt,2),Zt=Nt[0],bt=Nt[1],Vt=M.useRef(ee);Vt.current=ee;function Ft(){var Ve=Vt.current;h(Ve),Z(Ve),at([]),bt(null),pt()}(0,q.Z)(function(){St(Q);var Ve=O(ai,Q);if(Ve.key!==null)if(Ve.add){var Ze=He.findIndex(function(zt){var ve=zt.key;return ve===Ve.key}),Rt=Ye(oe(He,ee,Ve.key),tt,dt,Re),Lt=He.slice();Lt.splice(Ze+1,0,Fe),Z(Lt),at(Rt),bt("show")}else{var ui=ee.findIndex(function(zt){var ve=zt.key;return ve===Ve.key}),Tt=Ye(oe(ee,He,Ve.key),tt,dt,Re),It=ee.slice();It.splice(ui+1,0,Fe),Z(It),at(Tt),bt("hide")}else He!==ee&&(h(ee),Z(ee))},[Q,ee]),M.useEffect(function(){Ae||Ft()},[Ae]);var et=Ke?k:ee,xt={expandedKeys:Q,selectedKeys:F,loadedKeys:W,loadingKeys:re,checkedKeys:U,halfCheckedKeys:le,dragOverNodeKey:je,dropPosition:Ue,keyEntities:ye};return M.createElement(M.Fragment,null,jt&&Bt&&M.createElement("span",{style:S,"aria-live":"assertive"},Ut(Bt)),M.createElement("div",null,M.createElement("input",{style:S,disabled:yt===!1||De,tabIndex:yt!==!1?oi:null,onKeyDown:ei,onFocus:Ht,onBlur:Qt,value:"",onChange:v,"aria-label":"for screen reader"})),M.createElement("div",{className:"".concat(ke,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},M.createElement("div",{className:"".concat(ke,"-indent")},M.createElement("div",{ref:Xe,className:"".concat(ke,"-indent-unit")}))),M.createElement(se.Z,(0,B.Z)({},ti,{data:et,itemKey:_t,height:dt,fullHeight:!1,virtual:tt,itemHeight:Re,scrollWidth:Pt,prefixCls:"".concat(ke,"-list"),ref:Ot,role:"tree",onVisibleChange:function(Ze){Ze.every(function(Rt){return _t(Rt)!==z})&&Ft()}}),function(Ve){var Ze=Ve.pos,Rt=Object.assign({},(I(Ve.data),Ve.data)),Lt=Ve.title,ui=Ve.key,Tt=Ve.isStart,It=Ve.isEnd,zt=(0,$e.km)(ui,Ze);delete Rt.key,delete Rt.children;var ve=(0,$e.H8)(zt,xt);return M.createElement(N,(0,B.Z)({},Rt,ve,{title:Lt,active:!!Bt&&ui===Bt.key,pos:Ze,data:Ve.data,isStart:Tt,isEnd:It,motion:Ke,motionNodes:ui===z?ot:null,motionType:Zt,onMotionStart:ht,onMotionEnd:Ft,treeNodeRequiredProps:xt,onMouseMove:function(){Et(null)}}))}))}),Ge=si,ft=K(82661),$t=K(34643),ut=K(65065),li=10,We=function(ne){(0,ce.Z)(ke,ne);var we=(0,l.Z)(ke);function ke(){var ee;(0,j.Z)(this,ke);for(var Y=arguments.length,C=new Array(Y),Q=0;Q<Y;Q++)C[Q]=arguments[Q];return ee=we.call.apply(we,[this].concat(C)),(0,X.Z)((0,me.Z)(ee),"destroyed",!1),(0,X.Z)((0,me.Z)(ee),"delayedDragEnterLogic",void 0),(0,X.Z)((0,me.Z)(ee),"loadingRetryTimes",{}),(0,X.Z)((0,me.Z)(ee),"state",{keyEntities:{},indent:null,selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null,fieldNames:(0,$e.w$)()}),(0,X.Z)((0,me.Z)(ee),"dragStartMousePosition",null),(0,X.Z)((0,me.Z)(ee),"dragNodeProps",null),(0,X.Z)((0,me.Z)(ee),"currentMouseOverDroppableNodeKey",null),(0,X.Z)((0,me.Z)(ee),"listRef",M.createRef()),(0,X.Z)((0,me.Z)(ee),"onNodeDragStart",function(F,U){var W=ee.state,re=W.expandedKeys,le=W.keyEntities,ye=ee.props.onDragStart,De=U.eventKey;ee.dragNodeProps=U,ee.dragStartMousePosition={x:F.clientX,y:F.clientY};var Ae=(0,ft._5)(re,De);ee.setState({draggingNodeKey:De,dragChildrenKeys:(0,ft.wA)(De,le),indent:ee.listRef.current.getIndentWidth()}),ee.setExpandedKeys(Ae),window.addEventListener("dragend",ee.onWindowDragEnd),ye==null||ye({event:F,node:(0,$e.F)(U)})}),(0,X.Z)((0,me.Z)(ee),"onNodeDragEnter",function(F,U){var W=ee.state,re=W.expandedKeys,le=W.keyEntities,ye=W.dragChildrenKeys,De=W.flattenNodes,Ae=W.indent,je=ee.props,Ue=je.onDragEnter,Ke=je.onExpand,dt=je.allowDrop,Re=je.direction,tt=U.pos,Pt=U.eventKey;if(ee.currentMouseOverDroppableNodeKey!==Pt&&(ee.currentMouseOverDroppableNodeKey=Pt),!ee.dragNodeProps){ee.resetDragState();return}var yt=(0,ft.OM)(F,ee.dragNodeProps,U,Ae,ee.dragStartMousePosition,dt,De,le,re,Re),Bt=yt.dropPosition,jt=yt.dropLevelOffset,oi=yt.dropTargetKey,ei=yt.dropContainerKey,Ht=yt.dropTargetPos,Qt=yt.dropAllowed,Et=yt.dragOverNodeKey;if(ye.includes(oi)||!Qt){ee.resetDragState();return}if(ee.delayedDragEnterLogic||(ee.delayedDragEnterLogic={}),Object.keys(ee.delayedDragEnterLogic).forEach(function(ht){clearTimeout(ee.delayedDragEnterLogic[ht])}),ee.dragNodeProps.eventKey!==U.eventKey&&(F.persist(),ee.delayedDragEnterLogic[tt]=window.setTimeout(function(){if(ee.state.draggingNodeKey!==null){var ht=(0,he.Z)(re),pt=(0,ut.Z)(le,U.eventKey);pt&&(pt.children||[]).length&&(ht=(0,ft.L0)(re,U.eventKey)),ee.props.hasOwnProperty("expandedKeys")||ee.setExpandedKeys(ht),Ke==null||Ke(ht,{node:(0,$e.F)(U),expanded:!0,nativeEvent:F.nativeEvent})}},800)),ee.dragNodeProps.eventKey===oi&&jt===0){ee.resetDragState();return}ee.setState({dragOverNodeKey:Et,dropPosition:Bt,dropLevelOffset:jt,dropTargetKey:oi,dropContainerKey:ei,dropTargetPos:Ht,dropAllowed:Qt}),Ue==null||Ue({event:F,node:(0,$e.F)(U),expandedKeys:re})}),(0,X.Z)((0,me.Z)(ee),"onNodeDragOver",function(F,U){var W=ee.state,re=W.dragChildrenKeys,le=W.flattenNodes,ye=W.keyEntities,De=W.expandedKeys,Ae=W.indent,je=ee.props,Ue=je.onDragOver,Ke=je.allowDrop,dt=je.direction;if(ee.dragNodeProps){var Re=(0,ft.OM)(F,ee.dragNodeProps,U,Ae,ee.dragStartMousePosition,Ke,le,ye,De,dt),tt=Re.dropPosition,Pt=Re.dropLevelOffset,yt=Re.dropTargetKey,Bt=Re.dropContainerKey,jt=Re.dropTargetPos,oi=Re.dropAllowed,ei=Re.dragOverNodeKey;re.includes(yt)||!oi||(ee.dragNodeProps.eventKey===yt&&Pt===0?ee.state.dropPosition===null&&ee.state.dropLevelOffset===null&&ee.state.dropTargetKey===null&&ee.state.dropContainerKey===null&&ee.state.dropTargetPos===null&&ee.state.dropAllowed===!1&&ee.state.dragOverNodeKey===null||ee.resetDragState():tt===ee.state.dropPosition&&Pt===ee.state.dropLevelOffset&&yt===ee.state.dropTargetKey&&Bt===ee.state.dropContainerKey&&jt===ee.state.dropTargetPos&&oi===ee.state.dropAllowed&&ei===ee.state.dragOverNodeKey||ee.setState({dropPosition:tt,dropLevelOffset:Pt,dropTargetKey:yt,dropContainerKey:Bt,dropTargetPos:jt,dropAllowed:oi,dragOverNodeKey:ei}),Ue==null||Ue({event:F,node:(0,$e.F)(U)}))}}),(0,X.Z)((0,me.Z)(ee),"onNodeDragLeave",function(F,U){ee.currentMouseOverDroppableNodeKey===U.eventKey&&!F.currentTarget.contains(F.relatedTarget)&&(ee.resetDragState(),ee.currentMouseOverDroppableNodeKey=null);var W=ee.props.onDragLeave;W==null||W({event:F,node:(0,$e.F)(U)})}),(0,X.Z)((0,me.Z)(ee),"onWindowDragEnd",function(F){ee.onNodeDragEnd(F,null,!0),window.removeEventListener("dragend",ee.onWindowDragEnd)}),(0,X.Z)((0,me.Z)(ee),"onNodeDragEnd",function(F,U){var W=ee.props.onDragEnd;ee.setState({dragOverNodeKey:null}),ee.cleanDragState(),W==null||W({event:F,node:(0,$e.F)(U)}),ee.dragNodeProps=null,window.removeEventListener("dragend",ee.onWindowDragEnd)}),(0,X.Z)((0,me.Z)(ee),"onNodeDrop",function(F,U){var W,re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,le=ee.state,ye=le.dragChildrenKeys,De=le.dropPosition,Ae=le.dropTargetKey,je=le.dropTargetPos,Ue=le.dropAllowed;if(Ue){var Ke=ee.props.onDrop;if(ee.setState({dragOverNodeKey:null}),ee.cleanDragState(),Ae!==null){var dt=(0,Se.Z)((0,Se.Z)({},(0,$e.H8)(Ae,ee.getTreeNodeRequiredProps())),{},{active:((W=ee.getActiveItem())===null||W===void 0?void 0:W.key)===Ae,data:(0,ut.Z)(ee.state.keyEntities,Ae).node}),Re=ye.includes(Ae);(0,A.ZP)(!Re,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var tt=(0,ft.yx)(je),Pt={event:F,node:(0,$e.F)(dt),dragNode:ee.dragNodeProps?(0,$e.F)(ee.dragNodeProps):null,dragNodesKeys:[ee.dragNodeProps.eventKey].concat(ye),dropToGap:De!==0,dropPosition:De+Number(tt[tt.length-1])};re||Ke==null||Ke(Pt),ee.dragNodeProps=null}}}),(0,X.Z)((0,me.Z)(ee),"cleanDragState",function(){var F=ee.state.draggingNodeKey;F!==null&&ee.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),ee.dragStartMousePosition=null,ee.currentMouseOverDroppableNodeKey=null}),(0,X.Z)((0,me.Z)(ee),"triggerExpandActionExpand",function(F,U){var W=ee.state,re=W.expandedKeys,le=W.flattenNodes,ye=U.expanded,De=U.key,Ae=U.isLeaf;if(!(Ae||F.shiftKey||F.metaKey||F.ctrlKey)){var je=le.filter(function(Ke){return Ke.key===De})[0],Ue=(0,$e.F)((0,Se.Z)((0,Se.Z)({},(0,$e.H8)(De,ee.getTreeNodeRequiredProps())),{},{data:je.data}));ee.setExpandedKeys(ye?(0,ft._5)(re,De):(0,ft.L0)(re,De)),ee.onNodeExpand(F,Ue)}}),(0,X.Z)((0,me.Z)(ee),"onNodeClick",function(F,U){var W=ee.props,re=W.onClick,le=W.expandAction;le==="click"&&ee.triggerExpandActionExpand(F,U),re==null||re(F,U)}),(0,X.Z)((0,me.Z)(ee),"onNodeDoubleClick",function(F,U){var W=ee.props,re=W.onDoubleClick,le=W.expandAction;le==="doubleClick"&&ee.triggerExpandActionExpand(F,U),re==null||re(F,U)}),(0,X.Z)((0,me.Z)(ee),"onNodeSelect",function(F,U){var W=ee.state.selectedKeys,re=ee.state,le=re.keyEntities,ye=re.fieldNames,De=ee.props,Ae=De.onSelect,je=De.multiple,Ue=U.selected,Ke=U[ye.key],dt=!Ue;dt?je?W=(0,ft.L0)(W,Ke):W=[Ke]:W=(0,ft._5)(W,Ke);var Re=W.map(function(tt){var Pt=(0,ut.Z)(le,tt);return Pt?Pt.node:null}).filter(Boolean);ee.setUncontrolledState({selectedKeys:W}),Ae==null||Ae(W,{event:"select",selected:dt,node:U,selectedNodes:Re,nativeEvent:F.nativeEvent})}),(0,X.Z)((0,me.Z)(ee),"onNodeCheck",function(F,U,W){var re=ee.state,le=re.keyEntities,ye=re.checkedKeys,De=re.halfCheckedKeys,Ae=ee.props,je=Ae.checkStrictly,Ue=Ae.onCheck,Ke=U.key,dt,Re={event:"check",node:U,checked:W,nativeEvent:F.nativeEvent};if(je){var tt=W?(0,ft.L0)(ye,Ke):(0,ft._5)(ye,Ke),Pt=(0,ft._5)(De,Ke);dt={checked:tt,halfChecked:Pt},Re.checkedNodes=tt.map(function(Ht){return(0,ut.Z)(le,Ht)}).filter(Boolean).map(function(Ht){return Ht.node}),ee.setUncontrolledState({checkedKeys:tt})}else{var yt=(0,$t.S)([].concat((0,he.Z)(ye),[Ke]),!0,le),Bt=yt.checkedKeys,jt=yt.halfCheckedKeys;if(!W){var oi=new Set(Bt);oi.delete(Ke);var ei=(0,$t.S)(Array.from(oi),{checked:!1,halfCheckedKeys:jt},le);Bt=ei.checkedKeys,jt=ei.halfCheckedKeys}dt=Bt,Re.checkedNodes=[],Re.checkedNodesPositions=[],Re.halfCheckedKeys=jt,Bt.forEach(function(Ht){var Qt=(0,ut.Z)(le,Ht);if(Qt){var Et=Qt.node,ht=Qt.pos;Re.checkedNodes.push(Et),Re.checkedNodesPositions.push({node:Et,pos:ht})}}),ee.setUncontrolledState({checkedKeys:Bt},!1,{halfCheckedKeys:jt})}Ue==null||Ue(dt,Re)}),(0,X.Z)((0,me.Z)(ee),"onNodeLoad",function(F){var U,W=F.key,re=ee.state.keyEntities,le=(0,ut.Z)(re,W);if(!(le!=null&&(U=le.children)!==null&&U!==void 0&&U.length)){var ye=new Promise(function(De,Ae){ee.setState(function(je){var Ue=je.loadedKeys,Ke=Ue===void 0?[]:Ue,dt=je.loadingKeys,Re=dt===void 0?[]:dt,tt=ee.props,Pt=tt.loadData,yt=tt.onLoad;if(!Pt||Ke.includes(W)||Re.includes(W))return null;var Bt=Pt(F);return Bt.then(function(){var jt=ee.state.loadedKeys,oi=(0,ft.L0)(jt,W);yt==null||yt(oi,{event:"load",node:F}),ee.setUncontrolledState({loadedKeys:oi}),ee.setState(function(ei){return{loadingKeys:(0,ft._5)(ei.loadingKeys,W)}}),De()}).catch(function(jt){if(ee.setState(function(ei){return{loadingKeys:(0,ft._5)(ei.loadingKeys,W)}}),ee.loadingRetryTimes[W]=(ee.loadingRetryTimes[W]||0)+1,ee.loadingRetryTimes[W]>=li){var oi=ee.state.loadedKeys;(0,A.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),ee.setUncontrolledState({loadedKeys:(0,ft.L0)(oi,W)}),De()}Ae(jt)}),{loadingKeys:(0,ft.L0)(Re,W)}})});return ye.catch(function(){}),ye}}),(0,X.Z)((0,me.Z)(ee),"onNodeMouseEnter",function(F,U){var W=ee.props.onMouseEnter;W==null||W({event:F,node:U})}),(0,X.Z)((0,me.Z)(ee),"onNodeMouseLeave",function(F,U){var W=ee.props.onMouseLeave;W==null||W({event:F,node:U})}),(0,X.Z)((0,me.Z)(ee),"onNodeContextMenu",function(F,U){var W=ee.props.onRightClick;W&&(F.preventDefault(),W({event:F,node:U}))}),(0,X.Z)((0,me.Z)(ee),"onFocus",function(){var F=ee.props.onFocus;ee.setState({focused:!0});for(var U=arguments.length,W=new Array(U),re=0;re<U;re++)W[re]=arguments[re];F==null||F.apply(void 0,W)}),(0,X.Z)((0,me.Z)(ee),"onBlur",function(){var F=ee.props.onBlur;ee.setState({focused:!1}),ee.onActiveChange(null);for(var U=arguments.length,W=new Array(U),re=0;re<U;re++)W[re]=arguments[re];F==null||F.apply(void 0,W)}),(0,X.Z)((0,me.Z)(ee),"getTreeNodeRequiredProps",function(){var F=ee.state,U=F.expandedKeys,W=F.selectedKeys,re=F.loadedKeys,le=F.loadingKeys,ye=F.checkedKeys,De=F.halfCheckedKeys,Ae=F.dragOverNodeKey,je=F.dropPosition,Ue=F.keyEntities;return{expandedKeys:U||[],selectedKeys:W||[],loadedKeys:re||[],loadingKeys:le||[],checkedKeys:ye||[],halfCheckedKeys:De||[],dragOverNodeKey:Ae,dropPosition:je,keyEntities:Ue}}),(0,X.Z)((0,me.Z)(ee),"setExpandedKeys",function(F){var U=ee.state,W=U.treeData,re=U.fieldNames,le=(0,$e.oH)(W,F,re);ee.setUncontrolledState({expandedKeys:F,flattenNodes:le},!0)}),(0,X.Z)((0,me.Z)(ee),"onNodeExpand",function(F,U){var W=ee.state.expandedKeys,re=ee.state,le=re.listChanging,ye=re.fieldNames,De=ee.props,Ae=De.onExpand,je=De.loadData,Ue=U.expanded,Ke=U[ye.key];if(!le){var dt=W.includes(Ke),Re=!Ue;if((0,A.ZP)(Ue&&dt||!Ue&&!dt,"Expand state not sync with index check"),W=Re?(0,ft.L0)(W,Ke):(0,ft._5)(W,Ke),ee.setExpandedKeys(W),Ae==null||Ae(W,{node:U,expanded:Re,nativeEvent:F.nativeEvent}),Re&&je){var tt=ee.onNodeLoad(U);tt&&tt.then(function(){var Pt=(0,$e.oH)(ee.state.treeData,W,ye);ee.setUncontrolledState({flattenNodes:Pt})}).catch(function(){var Pt=ee.state.expandedKeys,yt=(0,ft._5)(Pt,Ke);ee.setExpandedKeys(yt)})}}}),(0,X.Z)((0,me.Z)(ee),"onListChangeStart",function(){ee.setUncontrolledState({listChanging:!0})}),(0,X.Z)((0,me.Z)(ee),"onListChangeEnd",function(){setTimeout(function(){ee.setUncontrolledState({listChanging:!1})})}),(0,X.Z)((0,me.Z)(ee),"onActiveChange",function(F){var U=ee.state.activeKey,W=ee.props,re=W.onActiveChange,le=W.itemScrollOffset,ye=le===void 0?0:le;U!==F&&(ee.setState({activeKey:F}),F!==null&&ee.scrollTo({key:F,offset:ye}),re==null||re(F))}),(0,X.Z)((0,me.Z)(ee),"getActiveItem",function(){var F=ee.state,U=F.activeKey,W=F.flattenNodes;return U===null?null:W.find(function(re){var le=re.key;return le===U})||null}),(0,X.Z)((0,me.Z)(ee),"offsetActiveKey",function(F){var U=ee.state,W=U.flattenNodes,re=U.activeKey,le=W.findIndex(function(Ae){var je=Ae.key;return je===re});le===-1&&F<0&&(le=W.length),le=(le+F+W.length)%W.length;var ye=W[le];if(ye){var De=ye.key;ee.onActiveChange(De)}else ee.onActiveChange(null)}),(0,X.Z)((0,me.Z)(ee),"onKeyDown",function(F){var U=ee.state,W=U.activeKey,re=U.expandedKeys,le=U.checkedKeys,ye=U.fieldNames,De=ee.props,Ae=De.onKeyDown,je=De.checkable,Ue=De.selectable;switch(F.which){case _.Z.UP:{ee.offsetActiveKey(-1),F.preventDefault();break}case _.Z.DOWN:{ee.offsetActiveKey(1),F.preventDefault();break}}var Ke=ee.getActiveItem();if(Ke&&Ke.data){var dt=ee.getTreeNodeRequiredProps(),Re=Ke.data.isLeaf===!1||!!(Ke.data[ye.children]||[]).length,tt=(0,$e.F)((0,Se.Z)((0,Se.Z)({},(0,$e.H8)(W,dt)),{},{data:Ke.data,active:!0}));switch(F.which){case _.Z.LEFT:{Re&&re.includes(W)?ee.onNodeExpand({},tt):Ke.parent&&ee.onActiveChange(Ke.parent.key),F.preventDefault();break}case _.Z.RIGHT:{Re&&!re.includes(W)?ee.onNodeExpand({},tt):Ke.children&&Ke.children.length&&ee.onActiveChange(Ke.children[0].key),F.preventDefault();break}case _.Z.ENTER:case _.Z.SPACE:{je&&!tt.disabled&&tt.checkable!==!1&&!tt.disableCheckbox?ee.onNodeCheck({},tt,!le.includes(W)):!je&&Ue&&!tt.disabled&&tt.selectable!==!1&&ee.onNodeSelect({},tt);break}}}Ae==null||Ae(F)}),(0,X.Z)((0,me.Z)(ee),"setUncontrolledState",function(F){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!ee.destroyed){var re=!1,le=!0,ye={};Object.keys(F).forEach(function(De){if(ee.props.hasOwnProperty(De)){le=!1;return}re=!0,ye[De]=F[De]}),re&&(!U||le)&&ee.setState((0,Se.Z)((0,Se.Z)({},ye),W))}}),(0,X.Z)((0,me.Z)(ee),"scrollTo",function(F){ee.listRef.current.scrollTo(F)}),ee}return(0,p.Z)(ke,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var Y=this.props,C=Y.activeKey,Q=Y.itemScrollOffset,F=Q===void 0?0:Q;C!==void 0&&C!==this.state.activeKey&&(this.setState({activeKey:C}),C!==null&&this.scrollTo({key:C,offset:F}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var Y=this.state,C=Y.focused,Q=Y.flattenNodes,F=Y.keyEntities,U=Y.draggingNodeKey,W=Y.activeKey,re=Y.dropLevelOffset,le=Y.dropContainerKey,ye=Y.dropTargetKey,De=Y.dropPosition,Ae=Y.dragOverNodeKey,je=Y.indent,Ue=this.props,Ke=Ue.prefixCls,dt=Ue.className,Re=Ue.style,tt=Ue.showLine,Pt=Ue.focusable,yt=Ue.tabIndex,Bt=yt===void 0?0:yt,jt=Ue.selectable,oi=Ue.showIcon,ei=Ue.icon,Ht=Ue.switcherIcon,Qt=Ue.draggable,Et=Ue.checkable,ht=Ue.checkStrictly,pt=Ue.disabled,ti=Ue.motion,Ot=Ue.loadData,Xe=Ue.filterTreeNode,vt=Ue.height,Kt=Ue.itemHeight,ai=Ue.scrollWidth,St=Ue.virtual,qt=Ue.titleRender,Ct=Ue.dropIndicatorRender,He=Ue.onContextMenu,h=Ue.onScroll,m=Ue.direction,y=Ue.rootClassName,k=Ue.rootStyle,Z=(0,E.Z)(this.props,{aria:!0,data:!0}),pe;Qt&&((0,de.Z)(Qt)==="object"?pe=Qt:typeof Qt=="function"?pe={nodeDraggable:Qt}:pe={});var be={prefixCls:Ke,selectable:jt,showIcon:oi,icon:ei,switcherIcon:Ht,draggable:pe,draggingNodeKey:U,checkable:Et,checkStrictly:ht,disabled:pt,keyEntities:F,dropLevelOffset:re,dropContainerKey:le,dropTargetKey:ye,dropPosition:De,dragOverNodeKey:Ae,indent:je,direction:m,dropIndicatorRender:Ct,loadData:Ot,filterTreeNode:Xe,titleRender:qt,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return M.createElement(H.k.Provider,{value:be},M.createElement("div",{className:g()(Ke,dt,y,(0,X.Z)((0,X.Z)((0,X.Z)({},"".concat(Ke,"-show-line"),tt),"".concat(Ke,"-focused"),C),"".concat(Ke,"-active-focused"),W!==null)),style:k},M.createElement(Ge,(0,B.Z)({ref:this.listRef,prefixCls:Ke,style:Re,data:Q,disabled:pt,selectable:jt,checkable:!!Et,motion:ti,dragging:U!==null,height:vt,itemHeight:Kt,virtual:St,focusable:Pt,focused:C,tabIndex:Bt,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:He,onScroll:h,scrollWidth:ai},this.getTreeNodeRequiredProps(),Z))))}}],[{key:"getDerivedStateFromProps",value:function(Y,C){var Q=C.prevProps,F={prevProps:Y};function U(Bt){return!Q&&Y.hasOwnProperty(Bt)||Q&&Q[Bt]!==Y[Bt]}var W,re=C.fieldNames;if(U("fieldNames")&&(re=(0,$e.w$)(Y.fieldNames),F.fieldNames=re),U("treeData")?W=Y.treeData:U("children")&&((0,A.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),W=(0,$e.zn)(Y.children)),W){F.treeData=W;var le=(0,$e.I8)(W,{fieldNames:re});F.keyEntities=(0,Se.Z)((0,X.Z)({},z,Te),le.keyEntities)}var ye=F.keyEntities||C.keyEntities;if(U("expandedKeys")||Q&&U("autoExpandParent"))F.expandedKeys=Y.autoExpandParent||!Q&&Y.defaultExpandParent?(0,ft.r7)(Y.expandedKeys,ye):Y.expandedKeys;else if(!Q&&Y.defaultExpandAll){var De=(0,Se.Z)({},ye);delete De[z];var Ae=[];Object.keys(De).forEach(function(Bt){var jt=De[Bt];jt.children&&jt.children.length&&Ae.push(jt.key)}),F.expandedKeys=Ae}else!Q&&Y.defaultExpandedKeys&&(F.expandedKeys=Y.autoExpandParent||Y.defaultExpandParent?(0,ft.r7)(Y.defaultExpandedKeys,ye):Y.defaultExpandedKeys);if(F.expandedKeys||delete F.expandedKeys,W||F.expandedKeys){var je=(0,$e.oH)(W||C.treeData,F.expandedKeys||C.expandedKeys,re);F.flattenNodes=je}if(Y.selectable&&(U("selectedKeys")?F.selectedKeys=(0,ft.BT)(Y.selectedKeys,Y):!Q&&Y.defaultSelectedKeys&&(F.selectedKeys=(0,ft.BT)(Y.defaultSelectedKeys,Y))),Y.checkable){var Ue;if(U("checkedKeys")?Ue=(0,ft.E6)(Y.checkedKeys)||{}:!Q&&Y.defaultCheckedKeys?Ue=(0,ft.E6)(Y.defaultCheckedKeys)||{}:W&&(Ue=(0,ft.E6)(Y.checkedKeys)||{checkedKeys:C.checkedKeys,halfCheckedKeys:C.halfCheckedKeys}),Ue){var Ke=Ue,dt=Ke.checkedKeys,Re=dt===void 0?[]:dt,tt=Ke.halfCheckedKeys,Pt=tt===void 0?[]:tt;if(!Y.checkStrictly){var yt=(0,$t.S)(Re,!0,ye);Re=yt.checkedKeys,Pt=yt.halfCheckedKeys}F.checkedKeys=Re,F.halfCheckedKeys=Pt}}return U("loadedKeys")&&(F.loadedKeys=Y.loadedKeys),F}}]),ke}(M.Component);(0,X.Z)(We,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:L,allowDrop:function(){return!0},expandAction:!1}),(0,X.Z)(We,"TreeNode",ge.Z);var Ee=We,Ie=Ee},82661:function(Xt,st,K){"use strict";K.d(st,{BT:function(){return M},E6:function(){return L},L0:function(){return X},OM:function(){return A},_5:function(){return l},r7:function(){return I},wA:function(){return g},yx:function(){return P}});var B=K(62730),de=K(28788),Se=K(48736),he=K(59301),j=K(639),p=K(65065),me=K(34061),ce=null;function l(w,R){if(!w)return[];var q=w.slice(),se=q.indexOf(R);return se>=0&&q.splice(se,1),q}function X(w,R){var q=(w||[]).slice();return q.indexOf(R)===-1&&q.push(R),q}function P(w){return w.split("-")}function g(w,R){var q=[],se=(0,p.Z)(R,w);function te(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];ge.forEach(function(Le){var xe=Le.key,$e=Le.children;q.push(xe),te($e)})}return te(se.children),q}function _(w){if(w.parent){var R=P(w.pos);return Number(R[R.length-1])===w.parent.children.length-1}return!1}function E(w){var R=P(w.pos);return Number(R[R.length-1])===0}function A(w,R,q,se,te,ge,Le,xe,$e,J){var D,N=w.clientX,O=w.clientY,oe=w.target.getBoundingClientRect(),ie=oe.top,S=oe.height,v=(J==="rtl"?-1:1)*(((te==null?void 0:te.x)||0)-N),z=(v-12)/se,ae=$e.filter(function(Ie){var ne;return(ne=xe[Ie])===null||ne===void 0||(ne=ne.children)===null||ne===void 0?void 0:ne.length}),Te=(0,p.Z)(xe,q.eventKey);if(O<ie+S/2){var Fe=Le.findIndex(function(Ie){return Ie.key===Te.key}),Ye=Fe<=0?0:Fe-1,_t=Le[Ye].key;Te=(0,p.Z)(xe,_t)}var Ut=Te.key,si=Te,Ge=Te.key,ft=0,$t=0;if(!ae.includes(Ut))for(var ut=0;ut<z&&_(Te);ut+=1)Te=Te.parent,$t+=1;var li=R.data,We=Te.node,Ee=!0;return E(Te)&&Te.level===0&&O<ie+S/2&&ge({dragNode:li,dropNode:We,dropPosition:-1})&&Te.key===q.eventKey?ft=-1:(si.children||[]).length&&ae.includes(Ge)?ge({dragNode:li,dropNode:We,dropPosition:0})?ft=0:Ee=!1:$t===0?z>-1.5?ge({dragNode:li,dropNode:We,dropPosition:1})?ft=1:Ee=!1:ge({dragNode:li,dropNode:We,dropPosition:0})?ft=0:ge({dragNode:li,dropNode:We,dropPosition:1})?ft=1:Ee=!1:ge({dragNode:li,dropNode:We,dropPosition:1})?ft=1:Ee=!1,{dropPosition:ft,dropLevelOffset:$t,dropTargetKey:Te.key,dropTargetPos:Te.pos,dragOverNodeKey:Ge,dropContainerKey:ft===0?null:((D=Te.parent)===null||D===void 0?void 0:D.key)||null,dropAllowed:Ee}}function M(w,R){if(w){var q=R.multiple;return q?w.slice():w.length?[w[0]]:w}}var H=function(R){return R};function V(w,R){if(!w)return[];var q=R||{},se=q.processProps,te=se===void 0?H:se,ge=Array.isArray(w)?w:[w];return ge.map(function(Le){var xe=Le.children,$e=_objectWithoutProperties(Le,ce),J=V(xe,R);return React.createElement(TreeNode,_extends({key:$e.key},te($e)),J)})}function L(w){if(!w)return null;var R;if(Array.isArray(w))R={checkedKeys:w,halfCheckedKeys:void 0};else if((0,de.Z)(w)==="object")R={checkedKeys:w.checked||void 0,halfCheckedKeys:w.halfChecked||void 0};else return(0,Se.ZP)(!1,"`checkedKeys` is not an array or an object"),null;return R}function I(w,R){var q=new Set;function se(te){if(!q.has(te)){var ge=(0,p.Z)(R,te);if(ge){q.add(te);var Le=ge.parent,xe=ge.node;xe.disabled||Le&&se(Le.key)}}}return(w||[]).forEach(function(te){se(te)}),(0,B.Z)(q)}},34643:function(Xt,st,K){"use strict";K.d(st,{S:function(){return me}});var B=K(48736),de=K(65065);function Se(ce,l){var X=new Set;return ce.forEach(function(P){l.has(P)||X.add(P)}),X}function he(ce){var l=ce||{},X=l.disabled,P=l.disableCheckbox,g=l.checkable;return!!(X||P)||g===!1}function j(ce,l,X,P){for(var g=new Set(ce),_=new Set,E=0;E<=X;E+=1){var A=l.get(E)||new Set;A.forEach(function(L){var I=L.key,w=L.node,R=L.children,q=R===void 0?[]:R;g.has(I)&&!P(w)&&q.filter(function(se){return!P(se.node)}).forEach(function(se){g.add(se.key)})})}for(var M=new Set,H=X;H>=0;H-=1){var V=l.get(H)||new Set;V.forEach(function(L){var I=L.parent,w=L.node;if(!(P(w)||!L.parent||M.has(L.parent.key))){if(P(L.parent.node)){M.add(I.key);return}var R=!0,q=!1;(I.children||[]).filter(function(se){return!P(se.node)}).forEach(function(se){var te=se.key,ge=g.has(te);R&&!ge&&(R=!1),!q&&(ge||_.has(te))&&(q=!0)}),R&&g.add(I.key),q&&_.add(I.key),M.add(I.key)}})}return{checkedKeys:Array.from(g),halfCheckedKeys:Array.from(Se(_,g))}}function p(ce,l,X,P,g){for(var _=new Set(ce),E=new Set(l),A=0;A<=P;A+=1){var M=X.get(A)||new Set;M.forEach(function(I){var w=I.key,R=I.node,q=I.children,se=q===void 0?[]:q;!_.has(w)&&!E.has(w)&&!g(R)&&se.filter(function(te){return!g(te.node)}).forEach(function(te){_.delete(te.key)})})}E=new Set;for(var H=new Set,V=P;V>=0;V-=1){var L=X.get(V)||new Set;L.forEach(function(I){var w=I.parent,R=I.node;if(!(g(R)||!I.parent||H.has(I.parent.key))){if(g(I.parent.node)){H.add(w.key);return}var q=!0,se=!1;(w.children||[]).filter(function(te){return!g(te.node)}).forEach(function(te){var ge=te.key,Le=_.has(ge);q&&!Le&&(q=!1),!se&&(Le||E.has(ge))&&(se=!0)}),q||_.delete(w.key),se&&E.add(w.key),H.add(w.key)}})}return{checkedKeys:Array.from(_),halfCheckedKeys:Array.from(Se(E,_))}}function me(ce,l,X,P){var g=[],_;P?_=P:_=he;var E=new Set(ce.filter(function(V){var L=!!(0,de.Z)(X,V);return L||g.push(V),L})),A=new Map,M=0;Object.keys(X).forEach(function(V){var L=X[V],I=L.level,w=A.get(I);w||(w=new Set,A.set(I,w)),w.add(L),M=Math.max(M,I)}),(0,B.ZP)(!g.length,"Tree missing follow keys: ".concat(g.slice(0,100).map(function(V){return"'".concat(V,"'")}).join(", ")));var H;return l===!0?H=j(E,A,M,_):H=p(E,l.halfCheckedKeys,A,M,_),H}},65065:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return B}});function B(de,Se){return de[Se]}},34061:function(Xt,st,K){"use strict";K.d(st,{F:function(){return I},H8:function(){return L},I8:function(){return V},km:function(){return g},oH:function(){return M},w$:function(){return _},zn:function(){return A}});var B=K(28788),de=K(62730),Se=K(89490),he=K(39224),j=K(11592),p=K(2738),me=K(48736),ce=K(65065),l=["children"];function X(w,R){return"".concat(w,"-").concat(R)}function P(w){return w&&w.type&&w.type.isTreeNode}function g(w,R){return w!=null?w:R}function _(w){var R=w||{},q=R.title,se=R._title,te=R.key,ge=R.children,Le=q||"title";return{title:Le,_title:se||[Le],key:te||"key",children:ge||"children"}}function E(w,R){var q=new Map;function se(te){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(te||[]).forEach(function(Le){var xe=Le[R.key],$e=Le[R.children];warning(xe!=null,"Tree node must have a certain key: [".concat(ge).concat(xe,"]"));var J=String(xe);warning(!q.has(J)||xe===null||xe===void 0,"Same 'key' exist in the Tree: ".concat(J)),q.set(J,!0),se($e,"".concat(ge).concat(J," > "))})}se(w)}function A(w){function R(q){var se=(0,j.Z)(q);return se.map(function(te){if(!P(te))return(0,me.ZP)(!te,"Tree/TreeNode can only accept TreeNode as children."),null;var ge=te.key,Le=te.props,xe=Le.children,$e=(0,he.Z)(Le,l),J=(0,Se.Z)({key:ge},$e),D=R(xe);return D.length&&(J.children=D),J}).filter(function(te){return te})}return R(w)}function M(w,R,q){var se=_(q),te=se._title,ge=se.key,Le=se.children,xe=new Set(R===!0?[]:R),$e=[];function J(D){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return D.map(function(O,oe){for(var ie=X(N?N.pos:"0",oe),S=g(O[ge],ie),v,z=0;z<te.length;z+=1){var ae=te[z];if(O[ae]!==void 0){v=O[ae];break}}var Te=Object.assign((0,p.Z)(O,[].concat((0,de.Z)(te),[ge,Le])),{title:v,key:S,parent:N,pos:ie,children:null,data:O,isStart:[].concat((0,de.Z)(N?N.isStart:[]),[oe===0]),isEnd:[].concat((0,de.Z)(N?N.isEnd:[]),[oe===D.length-1])});return $e.push(Te),R===!0||xe.has(S)?Te.children=J(O[Le]||[],Te):Te.children=[],Te})}return J(w),$e}function H(w,R,q){var se={};(0,B.Z)(q)==="object"?se=q:se={externalGetKey:q},se=se||{};var te=se,ge=te.childrenPropName,Le=te.externalGetKey,xe=te.fieldNames,$e=_(xe),J=$e.key,D=$e.children,N=ge||D,O;Le?typeof Le=="string"?O=function(S){return S[Le]}:typeof Le=="function"&&(O=function(S){return Le(S)}):O=function(S,v){return g(S[J],v)};function oe(ie,S,v,z){var ae=ie?ie[N]:w,Te=ie?X(v.pos,S):"0",Fe=ie?[].concat((0,de.Z)(z),[ie]):[];if(ie){var Ye=O(ie,Te),_t={node:ie,index:S,pos:Te,key:Ye,parentPos:v.node?v.pos:null,level:v.level+1,nodes:Fe};R(_t)}ae&&ae.forEach(function(Ut,si){oe(Ut,si,{node:ie,pos:Te,level:v?v.level+1:-1},Fe)})}oe(null)}function V(w){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=R.initWrapper,se=R.processEntity,te=R.onProcessFinished,ge=R.externalGetKey,Le=R.childrenPropName,xe=R.fieldNames,$e=arguments.length>2?arguments[2]:void 0,J=ge||$e,D={},N={},O={posEntities:D,keyEntities:N};return q&&(O=q(O)||O),H(w,function(oe){var ie=oe.node,S=oe.index,v=oe.pos,z=oe.key,ae=oe.parentPos,Te=oe.level,Fe=oe.nodes,Ye={node:ie,nodes:Fe,index:S,key:z,pos:v,level:Te},_t=g(z,v);D[v]=Ye,N[_t]=Ye,Ye.parent=D[ae],Ye.parent&&(Ye.parent.children=Ye.parent.children||[],Ye.parent.children.push(Ye)),se&&se(Ye,O)},{externalGetKey:J,childrenPropName:Le,fieldNames:xe}),te&&te(O),O}function L(w,R){var q=R.expandedKeys,se=R.selectedKeys,te=R.loadedKeys,ge=R.loadingKeys,Le=R.checkedKeys,xe=R.halfCheckedKeys,$e=R.dragOverNodeKey,J=R.dropPosition,D=R.keyEntities,N=(0,ce.Z)(D,w),O={eventKey:w,expanded:q.indexOf(w)!==-1,selected:se.indexOf(w)!==-1,loaded:te.indexOf(w)!==-1,loading:ge.indexOf(w)!==-1,checked:Le.indexOf(w)!==-1,halfChecked:xe.indexOf(w)!==-1,pos:String(N?N.pos:""),dragOver:$e===w&&J===0,dragOverGapTop:$e===w&&J===-1,dragOverGapBottom:$e===w&&J===1};return O}function I(w){var R=w.data,q=w.expanded,se=w.selected,te=w.checked,ge=w.loaded,Le=w.loading,xe=w.halfChecked,$e=w.dragOver,J=w.dragOverGapTop,D=w.dragOverGapBottom,N=w.pos,O=w.active,oe=w.eventKey,ie=(0,Se.Z)((0,Se.Z)({},R),{},{expanded:q,selected:se,checked:te,loaded:ge,loading:Le,halfChecked:xe,dragOver:$e,dragOverGapTop:J,dragOverGapBottom:D,pos:N,active:O,key:oe});return"props"in ie||Object.defineProperty(ie,"props",{get:function(){return(0,me.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),w}}),ie}},49658:function(Xt,st){"use strict";st.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var K=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(K)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(K==null?void 0:K.substr(0,4))}},65283:function(Xt,st,K){"use strict";K.d(st,{Z:function(){return li}});var B=K(71409),de=K(28788),Se=K(89490),he=K(87075),j=K(11036),p=K(39224),me=K(92310),ce=K.n(me),l=K(29301),X=K(70425),P=K(34280),g=K(59301),_=K(4676),E=g.forwardRef(function(We,Ee){var Ie=We.height,ne=We.offsetY,we=We.offsetX,ke=We.children,ee=We.prefixCls,Y=We.onInnerResize,C=We.innerProps,Q=We.rtl,F=We.extra,U={},W={display:"flex",flexDirection:"column"};return ne!==void 0&&(U={height:Ie,position:"relative",overflow:"hidden"},W=(0,Se.Z)((0,Se.Z)({},W),{},(0,he.Z)((0,he.Z)((0,he.Z)((0,he.Z)((0,he.Z)({transform:"translateY(".concat(ne,"px)")},Q?"marginRight":"marginLeft",-we),"position","absolute"),"left",0),"right",0),"top",0))),g.createElement("div",{style:U},g.createElement(l.Z,{onResize:function(le){var ye=le.offsetHeight;ye&&Y&&Y()}},g.createElement("div",(0,B.Z)({style:W,className:ce()((0,he.Z)({},"".concat(ee,"-holder-inner"),ee)),ref:Ee},C),ke,F)))});E.displayName="Filler";var A=E;function M(We){var Ee=We.children,Ie=We.setRef,ne=g.useCallback(function(we){Ie(we)},[]);return g.cloneElement(Ee,{ref:ne})}function H(We,Ee,Ie,ne,we,ke,ee,Y){var C=Y.getKey;return We.slice(Ee,Ie+1).map(function(Q,F){var U=Ee+F,W=ee(Q,U,{style:{width:ne},offsetX:we}),re=C(Q);return g.createElement(M,{key:re,setRef:function(ye){return ke(Q,ye)}},W)})}function V(We,Ee,Ie,ne){var we=Ie-We,ke=Ee-Ie,ee=Math.min(we,ke)*2;if(ne<=ee){var Y=Math.floor(ne/2);return ne%2?Ie+Y+1:Ie-Y}return we>ke?Ie-(ne-ke):Ie+(ne-we)}function L(We,Ee,Ie){var ne=We.length,we=Ee.length,ke,ee;if(ne===0&&we===0)return null;ne<we?(ke=We,ee=Ee):(ke=Ee,ee=We);var Y={__EMPTY_ITEM__:!0};function C(le){return le!==void 0?Ie(le):Y}for(var Q=null,F=Math.abs(ne-we)!==1,U=0;U<ee.length;U+=1){var W=C(ke[U]),re=C(ee[U]);if(W!==re){Q=U,F=F||W!==C(ee[U+1]);break}}return Q===null?null:{index:Q,multiple:F}}function I(We,Ee,Ie){var ne=g.useState(We),we=(0,j.Z)(ne,2),ke=we[0],ee=we[1],Y=g.useState(null),C=(0,j.Z)(Y,2),Q=C[0],F=C[1];return g.useEffect(function(){var U=L(ke||[],We||[],Ee);(U==null?void 0:U.index)!==void 0&&(Ie==null||Ie(U.index),F(We[U.index])),ee(We)},[We]),[Q]}var w=K(16089),R=(typeof navigator=="undefined"?"undefined":(0,de.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),q=R,se=function(We,Ee,Ie,ne){var we=(0,g.useRef)(!1),ke=(0,g.useRef)(null);function ee(){clearTimeout(ke.current),we.current=!0,ke.current=setTimeout(function(){we.current=!1},50)}var Y=(0,g.useRef)({top:We,bottom:Ee,left:Ie,right:ne});return Y.current.top=We,Y.current.bottom=Ee,Y.current.left=Ie,Y.current.right=ne,function(C,Q){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,U=C?Q<0&&Y.current.left||Q>0&&Y.current.right:Q<0&&Y.current.top||Q>0&&Y.current.bottom;return F&&U?(clearTimeout(ke.current),we.current=!1):(!U||we.current)&&ee(),!we.current&&U}};function te(We,Ee,Ie,ne,we,ke,ee){var Y=(0,g.useRef)(0),C=(0,g.useRef)(null),Q=(0,g.useRef)(null),F=(0,g.useRef)(!1),U=se(Ee,Ie,ne,we);function W(je,Ue){if(w.Z.cancel(C.current),!U(!1,Ue)){var Ke=je;if(!Ke._virtualHandled)Ke._virtualHandled=!0;else return;Y.current+=Ue,Q.current=Ue,q||Ke.preventDefault(),C.current=(0,w.Z)(function(){var dt=F.current?10:1;ee(Y.current*dt,!1),Y.current=0})}}function re(je,Ue){ee(Ue,!0),q||je.preventDefault()}var le=(0,g.useRef)(null),ye=(0,g.useRef)(null);function De(je){if(We){w.Z.cancel(ye.current),ye.current=(0,w.Z)(function(){le.current=null},2);var Ue=je.deltaX,Ke=je.deltaY,dt=je.shiftKey,Re=Ue,tt=Ke;(le.current==="sx"||!le.current&&dt&&Ke&&!Ue)&&(Re=Ke,tt=0,le.current="sx");var Pt=Math.abs(Re),yt=Math.abs(tt);le.current===null&&(le.current=ke&&Pt>yt?"x":"y"),le.current==="y"?W(je,tt):re(je,Re)}}function Ae(je){We&&(F.current=je.detail===Q.current)}return[De,Ae]}function ge(We,Ee,Ie,ne){var we=g.useMemo(function(){return[new Map,[]]},[We,Ie.id,ne]),ke=(0,j.Z)(we,2),ee=ke[0],Y=ke[1],C=function(F){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:F,W=ee.get(F),re=ee.get(U);if(W===void 0||re===void 0)for(var le=We.length,ye=Y.length;ye<le;ye+=1){var De,Ae=We[ye],je=Ee(Ae);ee.set(je,ye);var Ue=(De=Ie.get(je))!==null&&De!==void 0?De:ne;if(Y[ye]=(Y[ye-1]||0)+Ue,je===F&&(W=ye),je===U&&(re=ye),W!==void 0&&re!==void 0)break}return{top:Y[W-1]||0,bottom:Y[re]}};return C}var Le=K(16552),xe=K(19210),$e=function(){function We(){(0,Le.Z)(this,We),(0,he.Z)(this,"maps",void 0),(0,he.Z)(this,"id",0),(0,he.Z)(this,"diffRecords",new Map),this.maps=Object.create(null)}return(0,xe.Z)(We,[{key:"set",value:function(Ie,ne){this.diffRecords.set(Ie,this.maps[Ie]),this.maps[Ie]=ne,this.id+=1}},{key:"get",value:function(Ie){return this.maps[Ie]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),We}(),J=$e;function D(We){var Ee=parseFloat(We);return isNaN(Ee)?0:Ee}function N(We,Ee,Ie){var ne=g.useState(0),we=(0,j.Z)(ne,2),ke=we[0],ee=we[1],Y=(0,g.useRef)(new Map),C=(0,g.useRef)(new J),Q=(0,g.useRef)(0);function F(){Q.current+=1}function U(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;F();var le=function(){var Ae=!1;Y.current.forEach(function(je,Ue){if(je&&je.offsetParent){var Ke=je.offsetHeight,dt=getComputedStyle(je),Re=dt.marginTop,tt=dt.marginBottom,Pt=D(Re),yt=D(tt),Bt=Ke+Pt+yt;C.current.get(Ue)!==Bt&&(C.current.set(Ue,Bt),Ae=!0)}}),Ae&&ee(function(je){return je+1})};if(re)le();else{Q.current+=1;var ye=Q.current;Promise.resolve().then(function(){ye===Q.current&&le()})}}function W(re,le){var ye=We(re),De=Y.current.get(ye);le?(Y.current.set(ye,le),U()):Y.current.delete(ye),!De!=!le&&(le?Ee==null||Ee(re):Ie==null||Ie(re))}return(0,g.useEffect)(function(){return F},[]),[W,U,C.current,ke]}var O=14/15;function oe(We,Ee,Ie){var ne=(0,g.useRef)(!1),we=(0,g.useRef)(0),ke=(0,g.useRef)(0),ee=(0,g.useRef)(null),Y=(0,g.useRef)(null),C,Q=function(re){if(ne.current){var le=Math.ceil(re.touches[0].pageX),ye=Math.ceil(re.touches[0].pageY),De=we.current-le,Ae=ke.current-ye,je=Math.abs(De)>Math.abs(Ae);je?we.current=le:ke.current=ye;var Ue=Ie(je,je?De:Ae,!1,re);Ue&&re.preventDefault(),clearInterval(Y.current),Ue&&(Y.current=setInterval(function(){je?De*=O:Ae*=O;var Ke=Math.floor(je?De:Ae);(!Ie(je,Ke,!0)||Math.abs(Ke)<=.1)&&clearInterval(Y.current)},16))}},F=function(){ne.current=!1,C()},U=function(re){C(),re.touches.length===1&&!ne.current&&(ne.current=!0,we.current=Math.ceil(re.touches[0].pageX),ke.current=Math.ceil(re.touches[0].pageY),ee.current=re.target,ee.current.addEventListener("touchmove",Q,{passive:!1}),ee.current.addEventListener("touchend",F,{passive:!0}))};C=function(){ee.current&&(ee.current.removeEventListener("touchmove",Q),ee.current.removeEventListener("touchend",F))},(0,P.Z)(function(){return We&&Ee.current.addEventListener("touchstart",U,{passive:!0}),function(){var W;(W=Ee.current)===null||W===void 0||W.removeEventListener("touchstart",U),C(),clearInterval(Y.current)}},[We])}function ie(We){return Math.floor(Math.pow(We,.5))}function S(We,Ee){var Ie="touches"in We?We.touches[0]:We;return Ie[Ee?"pageX":"pageY"]-window[Ee?"scrollX":"scrollY"]}function v(We,Ee,Ie){g.useEffect(function(){var ne=Ee.current;if(We&&ne){var we=!1,ke,ee,Y=function(){w.Z.cancel(ke)},C=function W(){Y(),ke=(0,w.Z)(function(){Ie(ee),W()})},Q=function(re){if(!(re.target.draggable||re.button!==0)){var le=re;le._virtualHandled||(le._virtualHandled=!0,we=!0)}},F=function(){we=!1,Y()},U=function(re){if(we){var le=S(re,!1),ye=ne.getBoundingClientRect(),De=ye.top,Ae=ye.bottom;if(le<=De){var je=De-le;ee=-ie(je),C()}else if(le>=Ae){var Ue=le-Ae;ee=ie(Ue),C()}else Y()}};return ne.addEventListener("mousedown",Q),ne.ownerDocument.addEventListener("mouseup",F),ne.ownerDocument.addEventListener("mousemove",U),function(){ne.removeEventListener("mousedown",Q),ne.ownerDocument.removeEventListener("mouseup",F),ne.ownerDocument.removeEventListener("mousemove",U),Y()}}},[We])}var z=10;function ae(We,Ee,Ie,ne,we,ke,ee,Y){var C=g.useRef(),Q=g.useState(null),F=(0,j.Z)(Q,2),U=F[0],W=F[1];return(0,P.Z)(function(){if(U&&U.times<z){if(!We.current){W(function(ti){return(0,Se.Z)({},ti)});return}ke();var re=U.targetAlign,le=U.originAlign,ye=U.index,De=U.offset,Ae=We.current.clientHeight,je=!1,Ue=re,Ke=null;if(Ae){for(var dt=re||le,Re=0,tt=0,Pt=0,yt=Math.min(Ee.length-1,ye),Bt=0;Bt<=yt;Bt+=1){var jt=we(Ee[Bt]);tt=Re;var oi=Ie.get(jt);Pt=tt+(oi===void 0?ne:oi),Re=Pt}for(var ei=dt==="top"?De:Ae-De,Ht=yt;Ht>=0;Ht-=1){var Qt=we(Ee[Ht]),Et=Ie.get(Qt);if(Et===void 0){je=!0;break}if(ei-=Et,ei<=0)break}switch(dt){case"top":Ke=tt-De;break;case"bottom":Ke=Pt-Ae+De;break;default:{var ht=We.current.scrollTop,pt=ht+Ae;tt<ht?Ue="top":Pt>pt&&(Ue="bottom")}}Ke!==null&&ee(Ke),Ke!==U.lastTop&&(je=!0)}je&&W((0,Se.Z)((0,Se.Z)({},U),{},{times:U.times+1,targetAlign:Ue,lastTop:Ke}))}},[U,We.current]),function(re){if(re==null){Y();return}if(w.Z.cancel(C.current),typeof re=="number")ee(re);else if(re&&(0,de.Z)(re)==="object"){var le,ye=re.align;"index"in re?le=re.index:le=Ee.findIndex(function(je){return we(je)===re.key});var De=re.offset,Ae=De===void 0?0:De;W({times:0,index:le,offset:Ae,originAlign:ye})}}}var Te=g.forwardRef(function(We,Ee){var Ie=We.prefixCls,ne=We.rtl,we=We.scrollOffset,ke=We.scrollRange,ee=We.onStartMove,Y=We.onStopMove,C=We.onScroll,Q=We.horizontal,F=We.spinSize,U=We.containerSize,W=We.style,re=We.thumbStyle,le=We.showScrollBar,ye=g.useState(!1),De=(0,j.Z)(ye,2),Ae=De[0],je=De[1],Ue=g.useState(null),Ke=(0,j.Z)(Ue,2),dt=Ke[0],Re=Ke[1],tt=g.useState(null),Pt=(0,j.Z)(tt,2),yt=Pt[0],Bt=Pt[1],jt=!ne,oi=g.useRef(),ei=g.useRef(),Ht=g.useState(le),Qt=(0,j.Z)(Ht,2),Et=Qt[0],ht=Qt[1],pt=g.useRef(),ti=function(){le===!0||le===!1||(clearTimeout(pt.current),ht(!0),pt.current=setTimeout(function(){ht(!1)},3e3))},Ot=ke-U||0,Xe=U-F||0,vt=g.useMemo(function(){if(we===0||Ot===0)return 0;var y=we/Ot;return y*Xe},[we,Ot,Xe]),Kt=function(k){k.stopPropagation(),k.preventDefault()},ai=g.useRef({top:vt,dragging:Ae,pageY:dt,startTop:yt});ai.current={top:vt,dragging:Ae,pageY:dt,startTop:yt};var St=function(k){je(!0),Re(S(k,Q)),Bt(ai.current.top),ee(),k.stopPropagation(),k.preventDefault()};g.useEffect(function(){var y=function(be){be.preventDefault()},k=oi.current,Z=ei.current;return k.addEventListener("touchstart",y,{passive:!1}),Z.addEventListener("touchstart",St,{passive:!1}),function(){k.removeEventListener("touchstart",y),Z.removeEventListener("touchstart",St)}},[]);var qt=g.useRef();qt.current=Ot;var Ct=g.useRef();Ct.current=Xe,g.useEffect(function(){if(Ae){var y,k=function(be){var ot=ai.current,at=ot.dragging,mt=ot.pageY,Nt=ot.startTop;w.Z.cancel(y);var Zt=oi.current.getBoundingClientRect(),bt=U/(Q?Zt.width:Zt.height);if(at){var Vt=(S(be,Q)-mt)*bt,Ft=Nt;!jt&&Q?Ft-=Vt:Ft+=Vt;var et=qt.current,xt=Ct.current,Ve=xt?Ft/xt:0,Ze=Math.ceil(Ve*et);Ze=Math.max(Ze,0),Ze=Math.min(Ze,et),y=(0,w.Z)(function(){C(Ze,Q)})}},Z=function(){je(!1),Y()};return window.addEventListener("mousemove",k,{passive:!0}),window.addEventListener("touchmove",k,{passive:!0}),window.addEventListener("mouseup",Z,{passive:!0}),window.addEventListener("touchend",Z,{passive:!0}),function(){window.removeEventListener("mousemove",k),window.removeEventListener("touchmove",k),window.removeEventListener("mouseup",Z),window.removeEventListener("touchend",Z),w.Z.cancel(y)}}},[Ae]),g.useEffect(function(){return ti(),function(){clearTimeout(pt.current)}},[we]),g.useImperativeHandle(Ee,function(){return{delayHidden:ti}});var He="".concat(Ie,"-scrollbar"),h={position:"absolute",visibility:Et?null:"hidden"},m={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return Q?(h.height=8,h.left=0,h.right=0,h.bottom=0,m.height="100%",m.width=F,jt?m.left=vt:m.right=vt):(h.width=8,h.top=0,h.bottom=0,jt?h.right=0:h.left=0,m.width="100%",m.height=F,m.top=vt),g.createElement("div",{ref:oi,className:ce()(He,(0,he.Z)((0,he.Z)((0,he.Z)({},"".concat(He,"-horizontal"),Q),"".concat(He,"-vertical"),!Q),"".concat(He,"-visible"),Et)),style:(0,Se.Z)((0,Se.Z)({},h),W),onMouseDown:Kt,onMouseMove:ti},g.createElement("div",{ref:ei,className:ce()("".concat(He,"-thumb"),(0,he.Z)({},"".concat(He,"-thumb-moving"),Ae)),style:(0,Se.Z)((0,Se.Z)({},m),re),onMouseDown:St}))}),Fe=Te,Ye=20;function _t(){var We=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Ie=We/Ee*We;return isNaN(Ie)&&(Ie=0),Ie=Math.max(Ie,Ye),Math.floor(Ie)}var Ut=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],si=[],Ge={overflowY:"auto",overflowAnchor:"none"};function ft(We,Ee){var Ie=We.prefixCls,ne=Ie===void 0?"rc-virtual-list":Ie,we=We.className,ke=We.height,ee=We.itemHeight,Y=We.fullHeight,C=Y===void 0?!0:Y,Q=We.style,F=We.data,U=We.children,W=We.itemKey,re=We.virtual,le=We.direction,ye=We.scrollWidth,De=We.component,Ae=De===void 0?"div":De,je=We.onScroll,Ue=We.onVirtualScroll,Ke=We.onVisibleChange,dt=We.innerProps,Re=We.extraRender,tt=We.styles,Pt=We.showScrollBar,yt=Pt===void 0?"optional":Pt,Bt=(0,p.Z)(We,Ut),jt=g.useCallback(function(ii){return typeof W=="function"?W(ii):ii==null?void 0:ii[W]},[W]),oi=N(jt,null,null),ei=(0,j.Z)(oi,4),Ht=ei[0],Qt=ei[1],Et=ei[2],ht=ei[3],pt=!!(re!==!1&&ke&&ee),ti=g.useMemo(function(){return Object.values(Et.maps).reduce(function(ii,Dt){return ii+Dt},0)},[Et.id,Et.maps]),Ot=pt&&F&&(Math.max(ee*F.length,ti)>ke||!!ye),Xe=le==="rtl",vt=ce()(ne,(0,he.Z)({},"".concat(ne,"-rtl"),Xe),we),Kt=F||si,ai=(0,g.useRef)(),St=(0,g.useRef)(),qt=(0,g.useRef)(),Ct=(0,g.useState)(0),He=(0,j.Z)(Ct,2),h=He[0],m=He[1],y=(0,g.useState)(0),k=(0,j.Z)(y,2),Z=k[0],pe=k[1],be=(0,g.useState)(!1),ot=(0,j.Z)(be,2),at=ot[0],mt=ot[1],Nt=function(){mt(!0)},Zt=function(){mt(!1)},bt={getKey:jt};function Vt(ii){m(function(Dt){var _i;typeof ii=="function"?_i=ii(Dt):_i=ii;var Oi=Jt(_i);return ai.current.scrollTop=Oi,Oi})}var Ft=(0,g.useRef)({start:0,end:Kt.length}),et=(0,g.useRef)(),xt=I(Kt,jt),Ve=(0,j.Z)(xt,1),Ze=Ve[0];et.current=Ze;var Rt=g.useMemo(function(){if(!pt)return{scrollHeight:void 0,start:0,end:Kt.length-1,offset:void 0};if(!Ot){var ii;return{scrollHeight:((ii=St.current)===null||ii===void 0?void 0:ii.offsetHeight)||0,start:0,end:Kt.length-1,offset:void 0}}for(var Dt=0,_i,Oi,Bi,gn=Kt.length,ln=0;ln<gn;ln+=1){var Xi=Kt[ln],hn=jt(Xi),fn=Et.get(hn),_n=Dt+(fn===void 0?ee:fn);_n>=h&&_i===void 0&&(_i=ln,Oi=Dt),_n>h+ke&&Bi===void 0&&(Bi=ln),Dt=_n}return _i===void 0&&(_i=0,Oi=0,Bi=Math.ceil(ke/ee)),Bi===void 0&&(Bi=Kt.length-1),Bi=Math.min(Bi+1,Kt.length-1),{scrollHeight:Dt,start:_i,end:Bi,offset:Oi}},[Ot,pt,h,Kt,ht,ke]),Lt=Rt.scrollHeight,ui=Rt.start,Tt=Rt.end,It=Rt.offset;Ft.current.start=ui,Ft.current.end=Tt,g.useLayoutEffect(function(){var ii=Et.getRecord();if(ii.size===1){var Dt=Array.from(ii.keys())[0],_i=ii.get(Dt),Oi=Kt[ui];if(Oi&&_i===void 0){var Bi=jt(Oi);if(Bi===Dt){var gn=Et.get(Dt),ln=gn-ee;Vt(function(Xi){return Xi+ln})}}}Et.resetRecord()},[Lt]);var zt=g.useState({width:0,height:ke}),ve=(0,j.Z)(zt,2),Ce=ve[0],Qe=ve[1],qe=function(Dt){Qe({width:Dt.offsetWidth,height:Dt.offsetHeight})},rt=(0,g.useRef)(),ct=(0,g.useRef)(),lt=g.useMemo(function(){return _t(Ce.width,ye)},[Ce.width,ye]),gt=g.useMemo(function(){return _t(Ce.height,Lt)},[Ce.height,Lt]),Wt=Lt-ke,Mt=(0,g.useRef)(Wt);Mt.current=Wt;function Jt(ii){var Dt=ii;return Number.isNaN(Mt.current)||(Dt=Math.min(Dt,Mt.current)),Dt=Math.max(Dt,0),Dt}var Yt=h<=0,mi=h>=Wt,Ei=Z<=0,Ti=Z>=ye,gi=se(Yt,mi,Ei,Ti),ci=function(){return{x:Xe?-Z:Z,y:h}},Li=(0,g.useRef)(ci()),Pi=(0,X.zX)(function(ii){if(Ue){var Dt=(0,Se.Z)((0,Se.Z)({},ci()),ii);(Li.current.x!==Dt.x||Li.current.y!==Dt.y)&&(Ue(Dt),Li.current=Dt)}});function wi(ii,Dt){var _i=ii;Dt?((0,_.flushSync)(function(){pe(_i)}),Pi()):Vt(_i)}function bi(ii){var Dt=ii.currentTarget.scrollTop;Dt!==h&&Vt(Dt),je==null||je(ii),Pi()}var Ni=function(Dt){var _i=Dt,Oi=ye?ye-Ce.width:0;return _i=Math.max(_i,0),_i=Math.min(_i,Oi),_i},Ri=(0,X.zX)(function(ii,Dt){Dt?((0,_.flushSync)(function(){pe(function(_i){var Oi=_i+(Xe?-ii:ii);return Ni(Oi)})}),Pi()):Vt(function(_i){var Oi=_i+ii;return Oi})}),Fi=te(pt,Yt,mi,Ei,Ti,!!ye,Ri),Ci=(0,j.Z)(Fi,2),Ii=Ci[0],on=Ci[1];oe(pt,ai,function(ii,Dt,_i,Oi){var Bi=Oi;return gi(ii,Dt,_i)?!1:!Bi||!Bi._virtualHandled?(Bi&&(Bi._virtualHandled=!0),Ii({preventDefault:function(){},deltaX:ii?Dt:0,deltaY:ii?0:Dt}),!0):!1}),v(Ot,ai,function(ii){Vt(function(Dt){return Dt+ii})}),(0,P.Z)(function(){function ii(_i){var Oi=Yt&&_i.detail<0,Bi=mi&&_i.detail>0;pt&&!Oi&&!Bi&&_i.preventDefault()}var Dt=ai.current;return Dt.addEventListener("wheel",Ii,{passive:!1}),Dt.addEventListener("DOMMouseScroll",on,{passive:!0}),Dt.addEventListener("MozMousePixelScroll",ii,{passive:!1}),function(){Dt.removeEventListener("wheel",Ii),Dt.removeEventListener("DOMMouseScroll",on),Dt.removeEventListener("MozMousePixelScroll",ii)}},[pt,Yt,mi]),(0,P.Z)(function(){if(ye){var ii=Ni(Z);pe(ii),Pi({x:ii})}},[Ce.width,ye]);var Vi=function(){var Dt,_i;(Dt=rt.current)===null||Dt===void 0||Dt.delayHidden(),(_i=ct.current)===null||_i===void 0||_i.delayHidden()},Ai=ae(ai,Kt,Et,ee,jt,function(){return Qt(!0)},Vt,Vi);g.useImperativeHandle(Ee,function(){return{nativeElement:qt.current,getScrollInfo:ci,scrollTo:function(Dt){function _i(Oi){return Oi&&(0,de.Z)(Oi)==="object"&&("left"in Oi||"top"in Oi)}_i(Dt)?(Dt.left!==void 0&&pe(Ni(Dt.left)),Ai(Dt.top)):Ai(Dt)}}}),(0,P.Z)(function(){if(Ke){var ii=Kt.slice(ui,Tt+1);Ke(ii,Kt)}},[ui,Tt,Kt]);var sn=ge(Kt,jt,Et,ee),Yi=Re==null?void 0:Re({start:ui,end:Tt,virtual:Ot,offsetX:Z,offsetY:It,rtl:Xe,getSize:sn}),Zi=H(Kt,ui,Tt,ye,Z,Ht,U,bt),Ji=null;ke&&(Ji=(0,Se.Z)((0,he.Z)({},C?"height":"maxHeight",ke),Ge),pt&&(Ji.overflowY="hidden",ye&&(Ji.overflowX="hidden"),at&&(Ji.pointerEvents="none")));var Ki={};return Xe&&(Ki.dir="rtl"),g.createElement("div",(0,B.Z)({ref:qt,style:(0,Se.Z)((0,Se.Z)({},Q),{},{position:"relative"}),className:vt},Ki,Bt),g.createElement(l.Z,{onResize:qe},g.createElement(Ae,{className:"".concat(ne,"-holder"),style:Ji,ref:ai,onScroll:bi,onMouseEnter:Vi},g.createElement(A,{prefixCls:ne,height:Lt,offsetX:Z,offsetY:It,scrollWidth:ye,onInnerResize:Qt,ref:St,innerProps:dt,rtl:Xe,extra:Yi},Zi))),Ot&&Lt>ke&&g.createElement(Fe,{ref:rt,prefixCls:ne,scrollOffset:h,scrollRange:Lt,rtl:Xe,onScroll:wi,onStartMove:Nt,onStopMove:Zt,spinSize:gt,containerSize:Ce.height,style:tt==null?void 0:tt.verticalScrollBar,thumbStyle:tt==null?void 0:tt.verticalScrollBarThumb,showScrollBar:yt}),Ot&&ye>Ce.width&&g.createElement(Fe,{ref:ct,prefixCls:ne,scrollOffset:Z,scrollRange:ye,rtl:Xe,onScroll:wi,onStartMove:Nt,onStopMove:Zt,spinSize:lt,containerSize:Ce.width,horizontal:!0,style:tt==null?void 0:tt.horizontalScrollBar,thumbStyle:tt==null?void 0:tt.horizontalScrollBarThumb,showScrollBar:yt}))}var $t=g.forwardRef(ft);$t.displayName="List";var ut=$t,li=ut},83145:function(Xt,st,K){"use strict";Object.defineProperty(st,"__esModule",{value:!0}),st.CopyToClipboard=void 0;var B=Se(K(59301)),de=Se(K(25769));function Se(L){return L&&L.__esModule?L:{default:L}}function he(L){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?he=function(w){return typeof w}:he=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},he(L)}function j(L,I){var w=Object.keys(L);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(L);I&&(R=R.filter(function(q){return Object.getOwnPropertyDescriptor(L,q).enumerable})),w.push.apply(w,R)}return w}function p(L){for(var I=1;I<arguments.length;I++){var w=arguments[I]!=null?arguments[I]:{};I%2?j(w,!0).forEach(function(R){H(L,R,w[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(L,Object.getOwnPropertyDescriptors(w)):j(w).forEach(function(R){Object.defineProperty(L,R,Object.getOwnPropertyDescriptor(w,R))})}return L}function me(L,I){if(L==null)return{};var w=ce(L,I),R,q;if(Object.getOwnPropertySymbols){var se=Object.getOwnPropertySymbols(L);for(q=0;q<se.length;q++)R=se[q],!(I.indexOf(R)>=0)&&Object.prototype.propertyIsEnumerable.call(L,R)&&(w[R]=L[R])}return w}function ce(L,I){if(L==null)return{};var w={},R=Object.keys(L),q,se;for(se=0;se<R.length;se++)q=R[se],!(I.indexOf(q)>=0)&&(w[q]=L[q]);return w}function l(L,I){if(!(L instanceof I))throw new TypeError("Cannot call a class as a function")}function X(L,I){for(var w=0;w<I.length;w++){var R=I[w];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(L,R.key,R)}}function P(L,I,w){return I&&X(L.prototype,I),w&&X(L,w),L}function g(L,I){return I&&(he(I)==="object"||typeof I=="function")?I:E(L)}function _(L){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},_(L)}function E(L){if(L===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return L}function A(L,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function");L.prototype=Object.create(I&&I.prototype,{constructor:{value:L,writable:!0,configurable:!0}}),I&&M(L,I)}function M(L,I){return M=Object.setPrototypeOf||function(R,q){return R.__proto__=q,R},M(L,I)}function H(L,I,w){return I in L?Object.defineProperty(L,I,{value:w,enumerable:!0,configurable:!0,writable:!0}):L[I]=w,L}var V=function(L){A(I,L);function I(){var w,R;l(this,I);for(var q=arguments.length,se=new Array(q),te=0;te<q;te++)se[te]=arguments[te];return R=g(this,(w=_(I)).call.apply(w,[this].concat(se))),H(E(R),"onClick",function(ge){var Le=R.props,xe=Le.text,$e=Le.onCopy,J=Le.children,D=Le.options,N=B.default.Children.only(J),O=(0,de.default)(xe,D);$e&&$e(xe,O),N&&N.props&&typeof N.props.onClick=="function"&&N.props.onClick(ge)}),R}return P(I,[{key:"render",value:function(){var R=this.props,q=R.text,se=R.onCopy,te=R.options,ge=R.children,Le=me(R,["text","onCopy","options","children"]),xe=B.default.Children.only(ge);return B.default.cloneElement(xe,p({},Le,{onClick:this.onClick}))}}]),I}(B.default.PureComponent);st.CopyToClipboard=V,H(V,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Xt,st,K){"use strict";var B=K(83145),de=B.CopyToClipboard;de.CopyToClipboard=de,Xt.exports=de},76374:function(Xt,st,K){"use strict";var B=function(){if(typeof Map!="undefined")return Map;function J(D,N){var O=-1;return D.some(function(oe,ie){return oe[0]===N?(O=ie,!0):!1}),O}return function(){function D(){this.__entries__=[]}return Object.defineProperty(D.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),D.prototype.get=function(N){var O=J(this.__entries__,N),oe=this.__entries__[O];return oe&&oe[1]},D.prototype.set=function(N,O){var oe=J(this.__entries__,N);~oe?this.__entries__[oe][1]=O:this.__entries__.push([N,O])},D.prototype.delete=function(N){var O=this.__entries__,oe=J(O,N);~oe&&O.splice(oe,1)},D.prototype.has=function(N){return!!~J(this.__entries__,N)},D.prototype.clear=function(){this.__entries__.splice(0)},D.prototype.forEach=function(N,O){O===void 0&&(O=null);for(var oe=0,ie=this.__entries__;oe<ie.length;oe++){var S=ie[oe];N.call(O,S[1],S[0])}},D}()}(),de=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Se=function(){return typeof K.g!="undefined"&&K.g.Math===Math?K.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),he=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Se):function(J){return setTimeout(function(){return J(Date.now())},1e3/60)}}(),j=2;function p(J,D){var N=!1,O=!1,oe=0;function ie(){N&&(N=!1,J()),O&&v()}function S(){he(ie)}function v(){var z=Date.now();if(N){if(z-oe<j)return;O=!0}else N=!0,O=!1,setTimeout(S,D);oe=z}return v}var me=20,ce=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",X=function(){function J(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),me)}return J.prototype.addObserver=function(D){~this.observers_.indexOf(D)||this.observers_.push(D),this.connected_||this.connect_()},J.prototype.removeObserver=function(D){var N=this.observers_,O=N.indexOf(D);~O&&N.splice(O,1),!N.length&&this.connected_&&this.disconnect_()},J.prototype.refresh=function(){var D=this.updateObservers_();D&&this.refresh()},J.prototype.updateObservers_=function(){var D=this.observers_.filter(function(N){return N.gatherActive(),N.hasActive()});return D.forEach(function(N){return N.broadcastActive()}),D.length>0},J.prototype.connect_=function(){!de||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},J.prototype.disconnect_=function(){!de||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},J.prototype.onTransitionEnd_=function(D){var N=D.propertyName,O=N===void 0?"":N,oe=ce.some(function(ie){return!!~O.indexOf(ie)});oe&&this.refresh()},J.getInstance=function(){return this.instance_||(this.instance_=new J),this.instance_},J.instance_=null,J}(),P=function(J,D){for(var N=0,O=Object.keys(D);N<O.length;N++){var oe=O[N];Object.defineProperty(J,oe,{value:D[oe],enumerable:!1,writable:!1,configurable:!0})}return J},g=function(J){var D=J&&J.ownerDocument&&J.ownerDocument.defaultView;return D||Se},_=q(0,0,0,0);function E(J){return parseFloat(J)||0}function A(J){for(var D=[],N=1;N<arguments.length;N++)D[N-1]=arguments[N];return D.reduce(function(O,oe){var ie=J["border-"+oe+"-width"];return O+E(ie)},0)}function M(J){for(var D=["top","right","bottom","left"],N={},O=0,oe=D;O<oe.length;O++){var ie=oe[O],S=J["padding-"+ie];N[ie]=E(S)}return N}function H(J){var D=J.getBBox();return q(0,0,D.width,D.height)}function V(J){var D=J.clientWidth,N=J.clientHeight;if(!D&&!N)return _;var O=g(J).getComputedStyle(J),oe=M(O),ie=oe.left+oe.right,S=oe.top+oe.bottom,v=E(O.width),z=E(O.height);if(O.boxSizing==="border-box"&&(Math.round(v+ie)!==D&&(v-=A(O,"left","right")+ie),Math.round(z+S)!==N&&(z-=A(O,"top","bottom")+S)),!I(J)){var ae=Math.round(v+ie)-D,Te=Math.round(z+S)-N;Math.abs(ae)!==1&&(v-=ae),Math.abs(Te)!==1&&(z-=Te)}return q(oe.left,oe.top,v,z)}var L=function(){return typeof SVGGraphicsElement!="undefined"?function(J){return J instanceof g(J).SVGGraphicsElement}:function(J){return J instanceof g(J).SVGElement&&typeof J.getBBox=="function"}}();function I(J){return J===g(J).document.documentElement}function w(J){return de?L(J)?H(J):V(J):_}function R(J){var D=J.x,N=J.y,O=J.width,oe=J.height,ie=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,S=Object.create(ie.prototype);return P(S,{x:D,y:N,width:O,height:oe,top:N,right:D+O,bottom:oe+N,left:D}),S}function q(J,D,N,O){return{x:J,y:D,width:N,height:O}}var se=function(){function J(D){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=q(0,0,0,0),this.target=D}return J.prototype.isActive=function(){var D=w(this.target);return this.contentRect_=D,D.width!==this.broadcastWidth||D.height!==this.broadcastHeight},J.prototype.broadcastRect=function(){var D=this.contentRect_;return this.broadcastWidth=D.width,this.broadcastHeight=D.height,D},J}(),te=function(){function J(D,N){var O=R(N);P(this,{target:D,contentRect:O})}return J}(),ge=function(){function J(D,N,O){if(this.activeObservations_=[],this.observations_=new B,typeof D!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=D,this.controller_=N,this.callbackCtx_=O}return J.prototype.observe=function(D){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(D instanceof g(D).Element))throw new TypeError('parameter 1 is not of type "Element".');var N=this.observations_;N.has(D)||(N.set(D,new se(D)),this.controller_.addObserver(this),this.controller_.refresh())}},J.prototype.unobserve=function(D){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(D instanceof g(D).Element))throw new TypeError('parameter 1 is not of type "Element".');var N=this.observations_;N.has(D)&&(N.delete(D),N.size||this.controller_.removeObserver(this))}},J.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},J.prototype.gatherActive=function(){var D=this;this.clearActive(),this.observations_.forEach(function(N){N.isActive()&&D.activeObservations_.push(N)})},J.prototype.broadcastActive=function(){if(this.hasActive()){var D=this.callbackCtx_,N=this.activeObservations_.map(function(O){return new te(O.target,O.broadcastRect())});this.callback_.call(D,N,D),this.clearActive()}},J.prototype.clearActive=function(){this.activeObservations_.splice(0)},J.prototype.hasActive=function(){return this.activeObservations_.length>0},J}(),Le=typeof WeakMap!="undefined"?new WeakMap:new B,xe=function(){function J(D){if(!(this instanceof J))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var N=X.getInstance(),O=new ge(D,N,this);Le.set(this,O)}return J}();["observe","unobserve","disconnect"].forEach(function(J){xe.prototype[J]=function(){var D;return(D=Le.get(this))[J].apply(D,arguments)}});var $e=function(){return typeof Se.ResizeObserver!="undefined"?Se.ResizeObserver:xe}();st.Z=$e},98040:function(Xt){Xt.exports=function(){var st=document.getSelection();if(!st.rangeCount)return function(){};for(var K=document.activeElement,B=[],de=0;de<st.rangeCount;de++)B.push(st.getRangeAt(de));switch(K.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":K.blur();break;default:K=null;break}return st.removeAllRanges(),function(){st.type==="Caret"&&st.removeAllRanges(),st.rangeCount||B.forEach(function(Se){st.addRange(Se)}),K&&K.focus()}}},82059:function(Xt){var st=arguments[3],K=arguments[4],B=arguments[5],de=JSON.stringify;Xt.exports=function(Se,he){for(var j,p=Object.keys(B),me=0,ce=p.length;me<ce;me++){var l=p[me],X=B[l].exports;if(X===Se||X&&X.default===Se){j=l;break}}if(!j){j=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var P={},me=0,ce=p.length;me<ce;me++){var l=p[me];P[l]=l}K[j]=["function(require,module,exports){"+Se+"(self); }",P]}var g=Math.floor(Math.pow(16,8)*Math.random()).toString(16),_={};_[j]=j,K[g]=["function(require,module,exports){var f = require("+de(j)+");(f.default ? f.default : f)(self);}",_];var E={};A(g);function A(w){E[w]=!0;for(var R in K[w][1]){var q=K[w][1][R];E[q]||A(q)}}var M="("+st+")({"+Object.keys(E).map(function(w){return de(w)+":["+K[w][0]+","+de(K[w][1])+"]"}).join(",")+"},{},["+de(g)+"])",H=window.URL||window.webkitURL||window.mozURL||window.msURL,V=new Blob([M],{type:"text/javascript"});if(he&&he.bare)return V;var L=H.createObjectURL(V),I=new Worker(L);return I.objectURL=L,I}},93314:function(Xt){"use strict";Xt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},79710:function(Xt,st,K){"use strict";K.d(st,{ZP:function(){return gs}});const B=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},de=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Se},Se=Number.MAX_SAFE_INTEGER||9007199254740991;let he=function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a}({}),j=function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a}({}),p=function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a}({});var me={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ce={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class X{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l(e),this.fast_=new l(t),this.defaultTTFB_=n,this.ttfb_=new l(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new l(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new l(t,n.getEstimate(),n.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new l(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,s=i/n;this.fast_.sample(n,s),this.slow_.sample(n,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function P(a,e,t){return(e=M(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function g(){return g=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(a[i]=t[i])}return a},g.apply(null,arguments)}function _(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,i)}return t}function E(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_(Object(t),!0).forEach(function(i){P(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):_(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function A(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var i=t.call(a,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function M(a){var e=A(a,"string");return typeof e=="symbol"?e:e+""}class H{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=V,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const V=function(){},L={trace:V,debug:V,log:V,warn:V,info:V,error:V};function I(){return g({},L)}function w(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):V}function R(a,e,t){return e[a]?e[a].bind(e):w(a,t)}const q=I();function se(a,e,t){const i=I();if(typeof console=="object"&&a===!0||typeof a=="object"){const n=["debug","log","info","warn","error"];n.forEach(s=>{i[s]=R(s,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.2`)}catch(s){return I()}n.forEach(s=>{q[s]=R(s,a)})}else g(q,i);return i}const te=q;function ge(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Le(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function xe(a,e){const t=Object.keys(a),i=Object.keys(e),n=t.length,s=i.length;return!n||!s||n===s&&!t.some(r=>i.indexOf(r)===-1)}function $e(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const d=u.indexOf("\0");return d!==-1?u.substring(0,d):u}return u.replace(/\0/g,"")}const t=a.length;let i,n,s,r="",o=0;for(;o<t;){if(i=a[o++],i===0&&e)return r;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(i);break;case 12:case 13:n=a[o++],r+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=a[o++],s=a[o++],r+=String.fromCharCode((i&15)<<12|(n&63)<<6|(s&63)<<0);break}}return r}const J={hexDump:function(a){let e="";for(let t=0;t<a.length;t++){let i=a[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}};function D(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var N={exports:{}},O;function oe(){return O||(O=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,u,d){if(d=d||{},c=c.trim(),u=u.trim(),!u){if(!d.alwaysNormalize)return c;var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");return f.path=o.normalizePath(f.path),o.buildURLFromParts(f)}var b=o.parseURL(u);if(!b)throw new Error("Error trying to parse relative URL.");if(b.scheme)return d.alwaysNormalize?(b.path=o.normalizePath(b.path),o.buildURLFromParts(b)):u;var x=o.parseURL(c);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var T=n.exec(x.path);x.netLoc=T[1],x.path=T[2]}x.netLoc&&!x.path&&(x.path="/");var G={scheme:x.scheme,netLoc:b.netLoc,path:null,params:b.params,query:b.query,fragment:b.fragment};if(!b.netLoc&&(G.netLoc=x.netLoc,b.path[0]!=="/"))if(!b.path)G.path=x.path,b.params||(G.params=x.params,b.query||(G.query=x.query));else{var $=x.path,ue=$.substring(0,$.lastIndexOf("/")+1)+b.path;G.path=o.normalizePath(ue)}return G.path===null&&(G.path=d.alwaysNormalize?o.normalizePath(b.path):b.path),o.buildURLFromParts(G)},parseURL:function(c){var u=i.exec(c);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(s,"");c.length!==(c=c.replace(r,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};a.exports=o})()}(N)),N.exports}var ie=oe();class S{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var v={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class z{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,_t(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let n;i.length===1?n=(t==null?void 0:t.byteRangeEndOffset)||0:n=parseInt(i[1]),this._byteRange=[n,parseInt(i[0])+n]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[v.AUDIO]:null,[v.VIDEO]:null,[v.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new S),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ie.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[v.AUDIO]=null,e[v.VIDEO]=null,e[v.AUDIOVIDEO]=null}}function ae(a){return a.sn!=="initSegment"}class Te extends z{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange){const e=this.byteRange[0],t=this.byteRange[1];if(B(e)&&B(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=B(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!B(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return ae(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,s,r=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:s,partial:r};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,s)}}class Fe extends z{constructor(e,t,i,n,s){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const r=e.enumeratedString("BYTERANGE");r&&this.setByteRange(r,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Ye(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Ye(t,e)}}function _t(a,e){const t=Ye(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const Ut=Math.pow(2,32)-1,si=[].push,Ge={video:1,audio:2,id3:3,text:4};function ft(a){return String.fromCharCode.apply(null,a)}function $t(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function ut(a,e){const t=We(a,e);return t<0?4294967296+t:t}function li(a,e){let t=ut(a,e);return t*=Math.pow(2,32),t+=ut(a,e+4),t}function We(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function Ee(a,e,t){a[e]=t>>24,a[e+1]=t>>16&255,a[e+2]=t>>8&255,a[e+3]=t&255}function Ie(a){const e=a.byteLength;for(let t=0;t<e;){const i=ut(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ne(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=ut(a,n),r=ft(a.subarray(n+4,n+8)),o=s>1?n+s:i;if(r===e[0])if(e.length===1)t.push(a.subarray(n+8,o));else{const c=ne(a.subarray(n+8,o),e.slice(1));c.length&&si.apply(t,c)}n=o}return t}function we(a){const e=[],t=a[0];let i=8;const n=ut(a,i);i+=4;let s=0,r=0;t===0?(s=ut(a,i),r=ut(a,i+4),i+=8):(s=li(a,i),r=li(a,i+8),i+=16),i+=2;let o=a.length+r;const c=$t(a,i);i+=2;for(let u=0;u<c;u++){let d=i;const f=ut(a,d);d+=4;const b=f&2147483647;if((f&2147483648)>>>31===1)return te.warn("SIDX has hierarchical references (not supported)"),null;const T=ut(a,d);d+=4,e.push({referenceSize:b,subsegmentDuration:T,info:{duration:T/n,start:o,end:o+b-1}}),o+=b,d+=4,i=d}return{earliestPresentationTime:s,timescale:n,version:t,referencesCount:c,references:e}}function ke(a){const e=[],t=ne(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=ne(s,["tkhd"])[0];if(r){let o=r[0];const c=ut(r,o===0?12:20),u=ne(s,["mdia","mdhd"])[0];if(u){o=u[0];const d=ut(u,o===0?12:20),f=ne(s,["mdia","hdlr"])[0];if(f){const b=ft(f.subarray(8,12)),x={soun:v.AUDIO,vide:v.VIDEO}[b],T=ne(s,["mdia","minf","stbl","stsd"])[0],G=ee(T);x?(e[c]={timescale:d,type:x,stsd:G},e[x]=E({timescale:d,id:c},G)):e[c]={timescale:d,type:b,stsd:G}}}}}return ne(a,["moov","mvex","trex"]).forEach(n=>{const s=ut(n,4),r=e[s];r&&(r.default={duration:ut(n,12),flags:ut(n,20)})}),e}function ee(a){const e=a.subarray(8),t=e.subarray(86),i=ft(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const u=ne(e,[i])[0].subarray(i==="enca"?28:78);ne(u,["sinf"]).forEach(f=>{const b=ne(f,["schm"])[0];if(b){const x=ft(b.subarray(4,8));if(x==="cbcs"||x==="cenc"){const T=ne(f,["frma"])[0];T&&(n=ft(T))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=ne(t,["avcC"])[0];c&&c.length>3&&(n+="."+Q(c[1])+Q(c[2])+Q(c[3]),s=Y(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=ne(e,[i])[0],u=ne(c.subarray(28),["esds"])[0];if(u&&u.length>7){let d=4;if(u[d++]!==3)break;d=C(u,d),d+=2;const f=u[d++];if(f&128&&(d+=2),f&64&&(d+=u[d++]),u[d++]!==4)break;d=C(u,d);const b=u[d++];if(b===64)n+="."+Q(b);else break;if(d+=12,u[d++]!==5)break;d=C(u,d);const x=u[d++];let T=(x&248)>>3;T===31&&(T+=1+((x&7)<<3)+((u[d]&224)>>5)),n+="."+T}break}case"hvc1":case"hev1":{const c=ne(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],d=["","A","B","C"][u>>6],f=u&31,b=ut(c,2),x=(u&32)>>5?"H":"L",T=c[12],G=c.subarray(6,12);n+="."+d+f,n+="."+b.toString(16).toUpperCase(),n+="."+x+T;let $="";for(let ue=G.length;ue--;){const _e=G[ue];(_e||$)&&($="."+_e.toString(16).toUpperCase()+$)}n+=$}s=Y(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=Y(n,t)||n;break}case"vp09":{const c=ne(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],d=c[5],f=c[6]>>4&15;n+="."+F(u)+"."+F(d)+"."+F(f)}break}case"av01":{const c=ne(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,d=c[1]&31,f=c[2]>>>7?"H":"M",b=(c[2]&64)>>6,x=(c[2]&32)>>5,T=u===2&&b?x?12:10:b?10:8,G=(c[2]&16)>>4,$=(c[2]&8)>>3,ue=(c[2]&4)>>2,_e=c[2]&3;n+="."+u+"."+F(d)+f+"."+F(T)+"."+G+"."+$+ue+_e+"."+F(1)+"."+F(1)+"."+F(1)+"."+0,s=Y("dav1",t)}break}}return{codec:n,encrypted:r,supplemental:s}}function Y(a,e){const t=ne(e,["dvvC"]),i=t.length?t[0]:ne(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+F(n)+"."+F(s)}}function C(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function Q(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function F(a){return(a<10?"0":"")+a}function U(a,e){if(!a||!e)return a;const t=e.keyId;return t&&e.isCommonEncryption&&ne(a,["moov","trak"]).forEach(n=>{const r=ne(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=ne(r,["enca"]);const c=o.length>0;c||(o=ne(r,["encv"])),o.forEach(u=>{const d=c?u.subarray(28):u.subarray(78);ne(d,["sinf"]).forEach(b=>{const x=W(b);if(x){const T=x.subarray(8,24);T.some(G=>G!==0)||(te.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${J.hexDump(T)} -> ${J.hexDump(t)}`),x.set(t,8))}})})}),a}function W(a){const e=ne(a,["schm"])[0];if(e){const t=ft(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ne(a,["schi","tenc"])[0]}return null}function re(a,e){return ne(e,["moof","traf"]).reduce((t,i)=>{const n=ne(i,["tfdt"])[0],s=n[0],r=ne(i,["tfhd"]).reduce((o,c)=>{const u=ut(c,4),d=a[u];if(d){let f=ut(n,4);if(s===1){if(f===Ut)return te.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;f*=Ut+1,f+=ut(n,8)}const b=d.timescale||9e4,x=f/b;if(B(x)&&(o===null||x<o))return x}return o},null);return r!==null&&B(r)&&(t===null||r<t)?r:t},null)}function le(a,e){let t=0,i=0,n=0;const s=ne(a,["moof","traf"]);for(let r=0;r<s.length;r++){const o=s[r],c=ne(o,["tfhd"])[0],u=ut(c,4),d=e[u];if(!d)continue;const f=d.default,b=ut(c,0)|(f==null?void 0:f.flags);let x=f==null?void 0:f.duration;b&8&&(b&2?x=ut(c,12):x=ut(c,8));const T=d.timescale||9e4,G=ne(o,["trun"]);for(let $=0;$<G.length;$++){if(t=ye(G[$]),!t&&x){const ue=ut(G[$],4);t=x*ue}d.type===v.VIDEO?i+=t/T:d.type===v.AUDIO&&(n+=t/T)}}if(i===0&&n===0){let r=1/0,o=0,c=0;const u=ne(a,["sidx"]);for(let d=0;d<u.length;d++){const f=we(u[d]);if(f!=null&&f.references){r=Math.min(r,f.earliestPresentationTime/f.timescale);const b=f.references.reduce((x,T)=>x+T.info.duration||0,0);o=Math.max(o,b+f.earliestPresentationTime/f.timescale),c=o-r}}if(c&&B(c))return c}return i||n}function ye(a){const e=ut(a,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const n=ut(a,4);for(let s=0;s<n;s++){if(e&256){const r=ut(a,t);i+=r,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function De(a,e,t){ne(e,["moof","traf"]).forEach(i=>{ne(i,["tfhd"]).forEach(n=>{const s=ut(n,4),r=a[s];if(!r)return;const o=r.timescale||9e4;ne(i,["tfdt"]).forEach(c=>{const u=c[0],d=t*o;if(d){let f=ut(c,4);if(u===0)f-=d,f=Math.max(f,0),Ee(c,4,f);else{f*=Math.pow(2,32),f+=ut(c,8),f-=d,f=Math.max(f,0);const b=Math.floor(f/(Ut+1)),x=Math.floor(f%(Ut+1));Ee(c,4,b),Ee(c,8,x)}}})})})}function Ae(a){const e={valid:null,remainder:null},t=ne(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=a.slice(0,i.byteOffset-8),e.remainder=a.slice(i.byteOffset-8),e}function je(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Ue(a,e){const t=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return ne(i,["moof"]).map(c=>{const u=c.byteOffset-8;ne(c,["traf"]).map(f=>{const b=ne(f,["tfdt"]).map(x=>{const T=x[0];let G=ut(x,4);return T===1&&(G*=Math.pow(2,32),G+=ut(x,8)),G/n})[0];return b!==void 0&&(a=b),ne(f,["tfhd"]).map(x=>{const T=ut(x,4),G=ut(x,0)&16777215,$=(G&1)!==0,ue=(G&2)!==0,_e=(G&8)!==0;let fe=0;const Pe=(G&16)!==0;let Oe=0;const Je=(G&32)!==0;let Me=8;T===s&&($&&(Me+=8),ue&&(Me+=4),_e&&(fe=ut(x,Me),Me+=4),Pe&&(Oe=ut(x,Me),Me+=4),Je&&(Me+=4),e.type==="video"&&(r=Ke(e.codec)),ne(f,["trun"]).map(ze=>{const nt=ze[0],Ne=ut(ze,0)&16777215,At=(Ne&1)!==0;let Gt=0;const Mi=(Ne&4)!==0,yi=(Ne&256)!==0;let di=0;const ri=(Ne&512)!==0;let fi=0;const hi=(Ne&1024)!==0,wt=(Ne&2048)!==0;let kt=0;const xi=ut(ze,4);let Si=8;At&&(Gt=ut(ze,Si),Si+=4),Mi&&(Si+=4);let ki=Gt+u;for(let Gi=0;Gi<xi;Gi++){if(yi?(di=ut(ze,Si),Si+=4):di=fe,ri?(fi=ut(ze,Si),Si+=4):fi=Oe,hi&&(Si+=4),wt&&(nt===0?kt=ut(ze,Si):kt=We(ze,Si),Si+=4),e.type===v.VIDEO){let zi=0;for(;zi<fi;){const Qi=ut(i,ki);if(ki+=4,dt(r,i[ki])){const Dn=i.subarray(ki,ki+Qi);Re(Dn,r?2:1,a+kt/n,t)}ki+=Qi,zi+=Qi+4}}a+=di/n}}))})})}),t}function Ke(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function dt(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Re(a,e,t,i){const n=tt(a);let s=0;s+=e;let r=0,o=0,c=0;for(;s<n.length;){r=0;do{if(s>=n.length)break;c=n[s++],r+=c}while(c===255);o=0;do{if(s>=n.length)break;c=n[s++],o+=c}while(c===255);const u=n.length-s;let d=s;if(o<u)s+=o;else if(o>u){te.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[d++]===181){const b=$t(n,d);if(d+=2,b===49){const x=ut(n,d);if(d+=4,x===1195456820){const T=n[d++];if(T===3){const G=n[d++],$=31&G,ue=64&G,_e=ue?2+$*3:0,fe=new Uint8Array(_e);if(ue){fe[0]=G;for(let Pe=1;Pe<_e;Pe++)fe[Pe]=n[d++]}i.push({type:T,payloadType:r,pts:t,bytes:fe})}}}}}else if(r===5&&o>16){const f=[];for(let T=0;T<16;T++){const G=n[d++].toString(16);f.push(G.length==1?"0"+G:G),(T===3||T===5||T===7||T===9)&&f.push("-")}const b=o-16,x=new Uint8Array(b);for(let T=0;T<b;T++)x[T]=n[d++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:$e(x),userDataBytes:x})}}}function tt(a){const e=a.byteLength,t=[];let i=1;for(;i<e-2;)a[i]===0&&a[i+1]===0&&a[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return a;const n=e-t.length,s=new Uint8Array(n);let r=0;for(i=0;i<n;r++,i++)r===t[0]&&(r++,t.shift()),s[i]=a[r];return s}function Pt(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;ft(a.subarray(u,u+1))!=="\0";)t+=ft(a.subarray(u,u+1)),u+=1;for(t+=ft(a.subarray(u,u+1)),u+=1;ft(a.subarray(u,u+1))!=="\0";)i+=ft(a.subarray(u,u+1)),u+=1;i+=ft(a.subarray(u,u+1)),u+=1,n=ut(a,12),s=ut(a,16),o=ut(a,20),c=ut(a,24),u=28}else if(e===1){u+=4,n=ut(a,u),u+=4;const f=ut(a,u);u+=4;const b=ut(a,u);for(u+=4,r=Xo(2,32)*f+b,de(r)||(r=Number.MAX_SAFE_INTEGER,te.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ut(a,u),u+=4,c=ut(a,u),u+=4;ft(a.subarray(u,u+1))!=="\0";)t+=ft(a.subarray(u,u+1)),u+=1;for(t+=ft(a.subarray(u,u+1)),u+=1;ft(a.subarray(u,u+1))!=="\0";)i+=ft(a.subarray(u,u+1)),u+=1;i+=ft(a.subarray(u,u+1)),u+=1}const d=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:d}}function yt(a,...e){const t=e.length;let i=8,n=t;for(;n--;)i+=e[n].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=i&255,s.set(a,4),n=0,i=8;n<t;n++)s.set(e[n],i),i+=e[n].byteLength;return s}function Bt(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let i,n;i=0,n=new Uint8Array;let s;i>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const r=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),yt([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t||new Uint8Array)}function jt(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let i=0;for(;i+32<t;){const n=new DataView(a,i),s=oi(n);e.push(s),i+=s.size}}return e}function oi(a){const e=a.getUint32(0),t=a.byteOffset,i=a.byteLength;if(i<e)return{offset:t,size:i};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const s=a.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const r=a.buffer,o=J.hexDump(new Uint8Array(r,t+12,16)),c=a.getUint32(28);let u=null,d=null;if(s===0){if(e-32<c||c<22)return{offset:t,size:e};d=new Uint8Array(r,t+32,c)}else if(s===1){if(!c||i<t+32+c*16+16)return{offset:t,size:e};u=[];for(let f=0;f<c;f++)u.push(new Uint8Array(r,t+32+f*16,16))}return{version:s,systemId:o,kids:u,data:d,offset:t,size:e}}const ei=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ht={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 Qt(a,e){const t=Ht[e];return!!t&&!!t[a.slice(0,4)]}function Et(a,e,t=!0){return!a.split(",").some(i=>!ht(i,e,t))}function ht(a,e,t=!0){var i;const n=ge(t);return(i=n==null?void 0:n.isTypeSupported(pt(a,e)))!=null?i:!1}function pt(a,e){return`${e}/mp4;codecs=${a}`}function ti(a){if(a){const e=a.substring(0,4);return Ht.video[e]}return 2}function Ot(a){const e=ei();return a.split(",").reduce((t,i)=>{const s=e&&Ke(i)?9:Ht.video[i];return s?(s*2+t)/(t?3:2):(Ht.audio[i]+t)/(t?2:1)},0)}const Xe={};function vt(a,e=!0){if(Xe[a])return Xe[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let n=0;n<t.length;n++){var i;if(ht(t[n],"audio",e))return Xe[a]=t[n],t[n];if(t[n]==="mp3"&&(i=ge(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const Kt=/flac|opus|mp4a\.40\.34/i;function ai(a,e=!0){return a.replace(Kt,t=>vt(t.toLowerCase(),e))}function St(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)Qt(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function qt(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let i=t.length;i--;)if(t[i].substring(0,4)===a.substring(0,4))return t[i]}return t[0]}}return e||a}function Ct(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");if(i.length>2){let n=i.shift()+".";n+=parseInt(i.shift()).toString(16),n+=("000"+parseInt(i.shift()).toString(16)).slice(-4),e[t]=n}}return e.join(",")}function He(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return a}function h(a){const e=ge(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function m(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const y={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function k(a,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const Z={};function pe(a,e,t,i,n,s){const r=a.audioCodec?a.audioGroups:null,o=s==null?void 0:s.audioCodec,c=s==null?void 0:s.channels,u=c?parseInt(c):o?1/0:2;let d=null;if(r!=null&&r.length)try{r.length===1&&r[0]?d=e.groups[r[0]].channels:d=r.reduce((f,b)=>{if(b){const x=e.groups[b];if(!x)throw new Error(`Audio track group ${b} not found`);Object.keys(x.channels).forEach(T=>{f[T]=(f[T]||0)+x.channels[T]})}return f},{2:0})}catch(f){return!0}return a.videoCodec!==void 0&&(a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(i,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(n,8e6))||!!d&&B(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function be(a,e,t){const i=a.videoCodec,n=a.audioCodec;if(!i&&!n||!t)return Promise.resolve(y);const s=[];if(i){const r={width:a.width,height:a.height,bitrate:Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)),framerate:a.frameRate||30},o=a.videoRange;o!=="SDR"&&(r.transferFunction=o.toLowerCase());const c=i.split(","),u=navigator.userAgent;if(c.some(d=>Ke(d))&&ei())return Promise.resolve(k(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${u})`),s));s.push.apply(s,c.map(d=>({type:"media-source",video:E(E({},r),{},{contentType:pt(He(d),"video")})})))}return n&&a.audioGroups&&a.audioGroups.forEach(r=>{var o;r&&((o=e.groups[r])==null||o.tracks.forEach(c=>{if(c.groupId===r){const u=c.channels||"",d=parseFloat(u);B(d)&&d>2&&s.push.apply(s,n.split(",").map(f=>({type:"media-source",audio:{contentType:pt(f,"audio"),channels:""+d}})))}}))}),Promise.all(s.map(r=>{const o=ot(r);return Z[o]||(Z[o]=t.decodingInfo(r))})).then(r=>({supported:!r.some(o=>!o.supported),configurations:s,decodingInfoResults:r})).catch(r=>({supported:!1,configurations:s,decodingInfoResults:[],error:r}))}function ot(a){const{audio:e,video:t}=a,i=t||e;if(i){const n=m(i.contentType);if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${n}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${n}`}return""}const at=["NONE","TYPE-0","TYPE-1",null];function mt(a){return at.indexOf(a)>-1}const Nt=["SDR","PQ","HLG"];function Zt(a){return!!a&&Nt.indexOf(a)>-1}var bt={No:"",Yes:"YES",v2:"v2"};function Vt(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?bt.v2:bt.Yes:bt.No}class Ft{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class et{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return xt(this._audioGroups,e)}hasSubtitleGroup(e){return xt(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function xt(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Ve(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function Ze(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||Nt.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&Ve(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Rt=a=>{const e=new WeakSet;return(t,i)=>{if(a&&(i=a(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},Lt=(a,e)=>JSON.stringify(a,Rt(e));function ui(a,e,t,i,n){const s=Object.keys(a),r=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,c=n==null?void 0:n.videoCodec,u=r&&parseInt(r)===2;let d=!1,f=!1,b=1/0,x=1/0,T=1/0,G=1/0,$=0,ue=[];const{preferHDR:_e,allowedVideoRanges:fe}=Ze(e,n);for(let ze=s.length;ze--;){const nt=a[s[ze]];d||(d=nt.channels[2]>0),b=Math.min(b,nt.minHeight),x=Math.min(x,nt.minFramerate),T=Math.min(T,nt.minBitrate),fe.filter(At=>nt.videoRanges[At]>0).length>0&&(f=!0)}b=B(b)?b:0,x=B(x)?x:0;const Pe=Math.max(1080,b),Oe=Math.max(30,x);T=B(T)?T:t,t=Math.max(T,t),f||(e=void 0);const Je=s.length>1;return{codecSet:s.reduce((ze,nt)=>{const Ne=a[nt];if(nt===ze)return ze;if(ue=f?fe.filter(At=>Ne.videoRanges[At]>0):[],Je){if(Ne.minBitrate>t)return Tt(nt,`min bitrate of ${Ne.minBitrate} > current estimate of ${t}`),ze;if(!Ne.hasDefaultAudio)return Tt(nt,"no renditions with default or auto-select sound found"),ze;if(o&&nt.indexOf(o.substring(0,4))%5!==0)return Tt(nt,`audio codec preference "${o}" not found`),ze;if(r&&!u){if(!Ne.channels[r])return Tt(nt,`no renditions with ${r} channel sound found (channels options: ${Object.keys(Ne.channels)})`),ze}else if((!o||u)&&d&&Ne.channels[2]===0)return Tt(nt,"no renditions with stereo sound found"),ze;if(Ne.minHeight>Pe)return Tt(nt,`min resolution of ${Ne.minHeight} > maximum of ${Pe}`),ze;if(Ne.minFramerate>Oe)return Tt(nt,`min framerate of ${Ne.minFramerate} > maximum of ${Oe}`),ze;if(!ue.some(At=>Ne.videoRanges[At]>0))return Tt(nt,`no variants with VIDEO-RANGE of ${Lt(ue)} found`),ze;if(c&&nt.indexOf(c.substring(0,4))%5!==0)return Tt(nt,`video codec preference "${c}" not found`),ze;if(Ne.maxScore<$)return Tt(nt,`max score of ${Ne.maxScore} < selected max of ${$}`),ze}return ze&&(Ot(nt)>=Ot(ze)||Ne.fragmentError>a[ze].fragmentError)?ze:(G=Ne.minIndex,$=Ne.maxScore,nt)},void 0),videoRanges:ue,preferHDR:_e,minFramerate:x,minBitrate:T,minIndex:G}}function Tt(a,e){te.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function It(a){return a.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function zt(a,e,t,i){return a.slice(t,i+1).reduce((n,s,r)=>{if(!s.codecSet)return n;const o=s.audioGroups;let c=n[s.codecSet];c||(n[s.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,s.bitrate);const u=Math.min(s.height,s.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,s.frameRate),c.minIndex=Math.min(c.minIndex,r),c.maxScore=Math.max(c.maxScore,s.score),c.fragmentError+=s.fragmentError,c.videoRanges[s.videoRange]=(c.videoRanges[s.videoRange]||0)+1,o&&o.forEach(d=>{if(!d)return;const f=e.groups[d];f&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(b=>{c.channels[b]=(c.channels[b]||0)+f.channels[b]}))}),n},{})}function ve(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}=a;return{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}}function Ce(a,e,t){if("attrs"in a){const i=e.indexOf(a);if(i!==-1)return i}for(let i=0;i<e.length;i++){const n=e[i];if(Qe(a,n,t))return i}return-1}function Qe(a,e,t){const{groupId:i,name:n,lang:s,assocLang:r,default:o}=a,c=a.forced;return(i===void 0||e.groupId===i)&&(n===void 0||e.name===n)&&(s===void 0||qe(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||rt(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function qe(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function rt(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function ct(a,e){const{audioCodec:t,channels:i}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function lt(a,e,t,i,n){const s=e[i],o=e.reduce((b,x,T)=>{const G=x.uri;return(b[G]||(b[G]=[])).push(T),b},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,d=s.codecSet.substring(0,4),f=gt(e,i,b=>{if(b.videoRange!==c||b.frameRate!==u||b.codecSet.substring(0,4)!==d)return!1;const x=b.audioGroups,T=t.filter(G=>!x||x.indexOf(G.groupId)!==-1);return Ce(a,T,n)>-1});return f>-1?f:gt(e,i,b=>{const x=b.audioGroups,T=t.filter(G=>!x||x.indexOf(G.groupId)!==-1);return Ce(a,T,n)>-1})}function gt(a,e,t){for(let i=e;i>-1;i--)if(t(a[i]))return i;for(let i=e+1;i<a.length;i++)if(t(a[i]))return i;return-1}function Wt(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Mt extends H{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:n,partCurrent:s,hls:r}=this,{autoLevelEnabled:o,media:c}=r;if(!n||!c)return;const u=performance.now(),d=s?s.stats:n.stats,f=s?s.duration:n.duration,b=u-d.loading.start,x=r.minAutoLevel,T=n.level,G=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||T<=x){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const $=G>-1&&G!==T,ue=!!t||$;if(!ue&&(c.paused||!c.playbackRate||!c.readyState))return;const _e=r.mainForwardBufferInfo;if(!ue&&_e===null)return;const fe=this.bwEstimator.getEstimateTTFB(),Pe=Math.abs(c.playbackRate);if(b<=Math.max(fe,1e3*(f/(Pe*2))))return;const Oe=_e?_e.len/Pe:0,Je=d.loading.first?d.loading.first-d.loading.start:-1,Me=d.loaded&&Je>-1,ze=this.getBwEstimate(),nt=r.levels,Ne=nt[T],At=Math.max(d.loaded,Math.round(f*(n.bitrate||Ne.averageBitrate)/8));let Gt=Me?b-Je:b;Gt<1&&Me&&(Gt=Math.min(b,d.loaded*8/ze));const Mi=Me?d.loaded*1e3/Gt:0,yi=fe/1e3,di=Mi?(At-d.loaded)/Mi:At*8/ze+yi;if(di<=Oe)return;const ri=Mi?Mi*8:ze,fi=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,hi=this.hls.config.abrBandWidthUpFactor;let wt=Number.POSITIVE_INFINITY,kt;for(kt=T-1;kt>x;kt--){const Gi=nt[kt].maxBitrate,zi=!nt[kt].details||fi;if(wt=this.getTimeToLoadFrag(yi,ri,f*Gi,zi),wt<Math.min(Oe,f+yi))break}if(wt>=di||wt>f*10)return;Me?this.bwEstimator.sample(b-Math.min(fe,Je),d.loaded):this.bwEstimator.sampleTTFB(b);const xi=nt[kt].maxBitrate;this.getBwEstimate()*hi>xi&&this.resetEstimator(xi);const Si=this.findBestLevel(xi,x,kt,0,Oe,1,1);Si>-1&&(kt=Si),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${T} is loading too slowly;
Fragment duration: ${n.duration.toFixed(3)}
Time to underbuffer: ${Oe.toFixed(3)} s
Estimated load time for current fragment: ${di.toFixed(3)} s
Estimated load time for down switch fragment: ${wt.toFixed(3)} s
TTFB estimate: ${Je|0} ms
Current BW estimate: ${B(ze)?ze|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${kt} @ ${xi|0} bps`),r.nextLoadLevel=r.nextAutoLevel=kt,this.clearTimer();const ki=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===kt&&kt>0){const Gi=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${kt>0?"and switching down":""}
Fragment duration: ${n.duration.toFixed(3)} s
Time to underbuffer: ${Gi.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,kt>x){let zi=this.findBestLevel(this.hls.levels[x].bitrate,x,kt,0,Gi,1,1);zi===-1&&(zi=x),this.hls.nextLoadLevel=this.hls.nextAutoLevel=zi,this.resetEstimator(this.hls.levels[zi].bitrate)}}};$||di>wt*2?ki():this.timer=self.setInterval(ki,wt*1e3),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:s,stats:d})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new X(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(p.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case j.BUFFER_ADD_CODEC_ERROR:case j.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case j.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:s}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const r=performance.now(),o=s?s.stats:i.stats,c=r-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,i,n){const s=e+i/t,r=n?e+this.lastLevelLoadSec:0;return s+r}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,s=n.end-n.first;B(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===ce.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+n.loaded,c=(r.loaded?r.loaded.duration:0)+s;r.loaded={bytes:o,duration:c},r.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const s={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,s=n!=null&&n.stats.loaded?n.stats:i.stats;if(s.aborted||this.ignoreFragment(i))return;const r=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,s.loaded),s.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ce.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,s=this.findBestLevel(i,t,e,0,n,1,1);if(s>-1)return s;const r=this.hls.firstLevel,o=Math.min(Math.max(r,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${r} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=i&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,s)&&r[e].loadError<=r[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:s,minAutoLevel:r}=i,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let d=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const $=this.findBestLevel(c,r,n,u,0,d,f);if($>=0)return this.rebufferNotice=-1,$}let b=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const $=this.bitrateTestDelay;$&&(b=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-$,this.info(`bitrate test took ${Math.round(1e3*$)}ms, set first fragment max fetchDuration to ${Math.round(1e3*b)} ms`),d=f=1)}const x=this.findBestLevel(c,r,n,u,b,d,f);if(this.rebufferNotice!==x&&(this.rebufferNotice=x,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${x}`)),x>-1)return x;const T=i.levels[r],G=i.loadLevelObj;return G&&(T==null?void 0:T.bitrate)<G.bitrate?r:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,n,s,r,o){var c;const u=n+s,d=this.lastLoadedFragLevel,f=d===-1?this.hls.firstLevel:d,{fragCurrent:b,partCurrent:x}=this,{levels:T,allAudioTracks:G,loadLevel:$,config:ue}=this.hls;if(T.length===1)return 0;const _e=T[f],fe=!!((c=this.hls.latestLevelDetails)!=null&&c.live),Pe=$===-1||d===-1;let Oe,Je="SDR",Me=(_e==null?void 0:_e.frameRate)||0;const{audioPreference:ze,videoPreference:nt}=ue,Ne=this.audioTracksByGroup||(this.audioTracksByGroup=It(G));let At=-1;if(Pe){if(this.firstSelection!==-1)return this.firstSelection;const ri=this.codecTiers||(this.codecTiers=zt(T,Ne,t,i)),fi=ui(ri,Je,e,ze,nt),{codecSet:hi,videoRanges:wt,minFramerate:kt,minBitrate:xi,minIndex:Si,preferHDR:ki}=fi;At=Si,Oe=hi,Je=ki?wt[wt.length-1]:wt[0],Me=kt,e=Math.max(e,xi),this.log(`picked start tier ${Lt(fi)}`)}else Oe=_e==null?void 0:_e.codecSet,Je=_e==null?void 0:_e.videoRange;const Gt=x?x.duration:b?b.duration:0,Mi=this.bwEstimator.getEstimateTTFB()/1e3,yi=[];for(let ri=i;ri>=t;ri--){var di;const fi=T[ri],hi=ri>f;if(!fi)continue;if(ue.useMediaCapabilities&&!fi.supportedResult&&!fi.supportedPromise){const zi=navigator.mediaCapabilities;typeof(zi==null?void 0:zi.decodingInfo)=="function"&&(pe(fi,Ne,Je,Me,e,ze)||Ke(fi.videoCodec))?(fi.supportedPromise=be(fi,Ne,zi),fi.supportedPromise.then(Qi=>{if(!this.hls)return;fi.supportedResult=Qi;const Dn=this.hls.levels,kn=Dn.indexOf(fi);Qi.error?this.warn(`MediaCapabilities decodingInfo error: "${Qi.error}" for level ${kn} ${Lt(Qi)}`):Qi.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${kn} ${Lt(Qi)}`),kn>-1&&Dn.length>1&&(this.log(`Removing unsupported level ${kn}`),this.hls.removeLevel(kn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):fi.supportedResult=y}if((Oe&&fi.codecSet!==Oe||Je&&fi.videoRange!==Je||hi&&Me>fi.frameRate||!hi&&Me>0&&Me<fi.frameRate||fi.supportedResult&&!((di=fi.supportedResult.decodingInfoResults)!=null&&di[0].smooth))&&(!Pe||ri!==At)){yi.push(ri);continue}const wt=fi.details,kt=(x?wt==null?void 0:wt.partTarget:wt==null?void 0:wt.averagetargetduration)||Gt;let xi;hi?xi=o*e:xi=r*e;const Si=Gt&&n>=Gt*2&&s===0?fi.averageBitrate:fi.maxBitrate,ki=this.getTimeToLoadFrag(Mi,xi,Si*kt,wt===void 0);if(xi>=Si&&(ri===d||fi.loadError===0&&fi.fragmentError===0)&&(ki<=Mi||!B(ki)||fe&&!this.bitrateTestDelay||ki<u)){const zi=this.forcedAutoLevel;return ri!==$&&(zi===-1||zi!==$)&&(yi.length&&this.trace(`Skipped level(s) ${yi.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${T[yi[0]].codecs}" ${T[yi[0]].videoRange}; not compatible with "${Oe}" ${Je}`),this.info(`switch candidate:${f}->${ri} adjustedbw(${Math.round(xi)})-bitrate=${Math.round(xi-Si)} ttfb:${Mi.toFixed(1)} avgDuration:${kt.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${ki.toFixed(1)} firstSelection:${Pe} codecSet:${fi.codecSet} videoRange:${fi.videoRange} hls.loadLevel:${$}`)),Pe&&(this.firstSelection=ri),ri}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const Jt={search:function(a,e){let t=0,i=a.length-1,n=null,s=null;for(;t<=i;){n=(t+i)/2|0,s=a[n];const r=e(s);if(r>0)t=n+1;else if(r<0)i=n-1;else return s}return null}};function Yt(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!B(e))return null;const i=a[0].programDateTime;if(e<(i||0))return null;const n=a[a.length-1].endProgramDateTime;if(e>=(n||0))return null;t=t||0;for(let s=0;s<a.length;++s){const r=a[s];if(gi(e,t,r))return r}return null}function mi(a,e,t=0,i=0,n=.005){let s=null;if(a){s=e[1+a.sn-e[0].sn]||null;const o=a.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),s&&a.level!==s.level&&s.end<=a.end&&(s=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!a||a.level===s.level)&&Ti(t,i,s)===0||Ei(s,a,Math.min(n,i))))return s;const r=Jt.search(e,Ti.bind(null,t,i));return r&&(r!==a||!s)?r:s}function Ei(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((n,s)=>(s[0]==="INF"&&(n+=parseFloat(s[1])),n),t);return a.start<=i}return!1}function Ti(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=a?1:t.start-i>a&&t.start?-1:0}function gi(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function ci(a,e){return Jt.search(a,t=>t.cc<e?1:t.cc>e?-1:0)}function Li(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){const i=t.start,n=t.end;let s=a.fragments;if(!t.relurl){const{fragmentHint:r}=a;r&&(s=s.concat(r))}return Jt.search(s,r=>r.cc<e||r.end<=i?1:r.cc>e||r.start>=n?-1:0)}return null}function Pi(a){switch(a.details){case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_TIMEOUT:case j.LEVEL_LOAD_TIMEOUT:case j.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function wi(a,e){const t=Pi(e);return a.default[`${t?"timeout":"error"}Retry`]}function bi(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Ni(a){return E(E({},a),{errorRetry:null,timeoutRetry:null})}function Ri(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(Fi(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function Fi(a){return a===0&&navigator.onLine===!1||!!a&&(a<400||a>499)}var Ci={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ii={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class on extends H{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ce.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,s=t.context;switch(t.details){case j.FRAG_LOAD_ERROR:case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_ERROR:case j.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case j.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Vi();return}case j.FRAG_GAP:case j.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ci.SendAlternateToPenaltyBox;return}case j.LEVEL_EMPTY_ERROR:case j.LEVEL_PARSING_ERROR:{var r,o;const u=t.parent===ce.MAIN?t.level:n.loadLevel;t.details===j.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(o=r.levelDetails)!=null&&o.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u))}return;case j.LEVEL_LOAD_ERROR:case j.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case j.AUDIO_TRACK_LOAD_ERROR:case j.AUDIO_TRACK_LOAD_TIMEOUT:case j.SUBTITLE_LOAD_ERROR:case j.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const u=n.loadLevelObj;if(u&&(s.type===me.AUDIO_TRACK&&u.hasAudioGroup(s.groupId)||s.type===me.SUBTITLE_TRACK&&u.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=Ci.SendAlternateToPenaltyBox,t.errorAction.flags=Ii.MoveAllAlternatesMatchingHost;return}}return;case j.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.loadLevelObj,d=u==null?void 0:u.attrs["HDCP-LEVEL"];d?t.errorAction={action:Ci.SendAlternateToPenaltyBox,flags:Ii.MoveAllAlternatesMatchingHDCP,hdcpLevel:d}:this.keySystemError(t)}return;case j.BUFFER_ADD_CODEC_ERROR:case j.REMUX_ALLOC_ERROR:case j.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case j.INTERNAL_EXCEPTION:case j.BUFFER_APPENDING_ERROR:case j.BUFFER_FULL_ERROR:case j.LEVEL_SWITCH_ERROR:case j.BUFFER_STALLED_ERROR:case j.BUFFER_SEEK_OVER_HOLE:case j.BUFFER_NUDGE_ON_STALL:t.errorAction=Vi();return}t.type===he.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=wi(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Ri(n,s,Pi(e),e.response))return{action:Ci.RetryRequest,flags:Ii.None,retryConfig:n,retryCount:s};const o=this.getLevelSwitchAction(e,t);return n&&(o.retryConfig=n,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,o=wi(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((d,f)=>d+f.fragmentError,0);if(n&&(e.details!==j.FRAG_GAP&&n.fragmentError++,Ri(o,c,Pi(e),e.response)))return{action:Ci.RetryRequest,flags:Ii.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,i);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var s,r;const u=e.details;n.loadError++,u===j.BUFFER_APPEND_ERROR&&n.fragmentError++;let d=-1;const{levels:f,loadLevel:b,minAutoLevel:x,maxAutoLevel:T}=i;i.autoLevelEnabled||(i.loadLevel=-1);const G=(s=e.frag)==null?void 0:s.type,ue=(G===ce.AUDIO&&u===j.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===j.BUFFER_ADD_CODEC_ERROR||u===j.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:Je})=>n.audioCodec!==Je),fe=e.sourceBufferName==="video"&&(u===j.BUFFER_ADD_CODEC_ERROR||u===j.BUFFER_APPEND_ERROR)&&f.some(({codecSet:Je,audioCodec:Me})=>n.codecSet!==Je&&n.audioCodec===Me),{type:Pe,groupId:Oe}=(r=e.context)!=null?r:{};for(let Je=f.length;Je--;){const Me=(Je+b)%f.length;if(Me!==b&&Me>=x&&Me<=T&&f[Me].loadError===0){var o,c;const ze=f[Me];if(u===j.FRAG_GAP&&G===ce.MAIN&&e.frag){const nt=f[Me].details;if(nt){const Ne=mi(e.frag,nt.fragments,e.frag.start);if(Ne!=null&&Ne.gap)continue}}else{if(Pe===me.AUDIO_TRACK&&ze.hasAudioGroup(Oe)||Pe===me.SUBTITLE_TRACK&&ze.hasSubtitleGroup(Oe))continue;if(G===ce.AUDIO&&(o=n.audioGroups)!=null&&o.some(nt=>ze.hasAudioGroup(nt))||G===ce.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(nt=>ze.hasSubtitleGroup(nt))||ue&&n.audioCodec===ze.audioCodec||!ue&&n.audioCodec!==ze.audioCodec||fe&&n.codecSet===ze.codecSet)continue}d=Me;break}}if(d>-1&&i.loadLevel!==d)return e.levelRetry=!0,this.playlistError=0,{action:Ci.SendAlternateToPenaltyBox,flags:Ii.None,nextAutoLevel:d}}return{action:Ci.SendAlternateToPenaltyBox,flags:Ii.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case Ci.DoNothing:break;case Ci.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==j.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case Ci.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n,hdcpLevel:s,nextAutoLevel:r}=i;switch(n){case Ii.None:this.switchLevel(e,r);break;case Ii.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=at[at.indexOf(s)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,r)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===j.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=m(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function Vi(a){const e={action:Ci.DoNothing,flags:Ii.None};return a&&(e.resolved=!0),e}var Ai={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class sn{constructor(e){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=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let n=i.length;n--;){const s=i[n];if(!s)break;const r=s.end;if(s.start<=e&&r!==null&&e<=r)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:n}=this,s=Object.keys(n);for(let r=s.length;r--;){const o=n[s[r]];if((o==null?void 0:o.body.type)===t&&(!i||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,i,n,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(n==null?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const c=this.fragments[o];if(!c||r>=c.body.sn)return;if(!c.buffered&&(!c.loaded||s)){c.body.type===i&&this.removeFragment(c.body);return}const u=c.range[e];if(u){if(u.time.length===0){this.removeFragment(c.body);return}u.time.some(d=>{const f=!this.isTimeBuffered(d.startPTS,d.endPTS,t);return f&&this.removeFragment(c.body),f})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,n=Zi(i),s=this.fragments[n];if(!s||s.buffered&&i.gap)return;const r=!i.relurl;Object.keys(t).forEach(o=>{const c=i.elementaryStreams[o];if(!c)return;const u=t[o],d=r||c.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,d,u)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=i.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),Yi(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=Ji(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=Zi(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,i,n){const s={time:[],partial:i},r=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||r;for(let d=0;d<n.length;d++){const f=n.start(d)-this.bufferPadding,b=n.end(d)+this.bufferPadding;if(u>=f&&c<=b){s.time.push({startPTS:Math.max(r,n.start(d)),endPTS:Math.min(o,n.end(d))});break}else if(r<b&&o>f){const x=Math.max(r,n.start(d)),T=Math.min(o,n.end(d));T>x&&(s.partial=!0,s.time.push({startPTS:x,endPTS:T}))}else if(o<=f)break}return s}getPartialFragment(e){let t=null,i,n,s,r=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const d=c[u];d&&Yi(d)&&(n=d.body.start-o,s=d.body.end+o,e>=n&&e<=s&&(i=Math.min(e-n,s-e),r<=i&&(t=d.body,r=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Yi(t))}getState(e){const t=Zi(e),i=this.fragments[t];return i?i.buffered?Yi(i)?Ai.PARTIAL:Ai.OK:Ai.APPENDING:Ai.NOT_LOADED}isTimeBuffered(e,t,i){let n,s;for(let r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,s=i.end(r)+this.bufferPadding,e>=n&&t<=s)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,s=Zi(i);this.fragments[s]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:s,type:r}=t;if(i.sn==="initSegment")return;const o=i.type;if(n){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(n)}this.timeRanges=s;const c=s[r];this.detectEvictedFragments(r,c,o,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Zi(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const s=t[i[n]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,s){n&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const o=this.fragments[r];if(!o)return;const c=o.body;c.type!==i||n&&!c.gap||c.start<t&&c.end>e&&(o.buffered||s)&&this.removeFragment(c)})}removeFragment(e){const t=Zi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=Ji(i,s=>s.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const i=(e=this.hls)==null||(t=e.latestLevelDetails)==null?void 0:t.partList;i&&i.forEach(n=>n.clearElementaryStreamInfo())}}function Yi(a){var e,t,i;return a.buffered&&(a.body.gap||((e=a.range.video)==null?void 0:e.partial)||((t=a.range.audio)==null?void 0:t.partial)||((i=a.range.audiovideo)==null?void 0:i.partial))}function Zi(a){return`${a.type}_${a.level}_${a.sn}`}function Ji(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Ki={cbc:0,ctr:1};class ii{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Ki.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Ki.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Dt(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class _i{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(n*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],s=i[1],r=i[2],o=i[3],c=this.invSubMix,u=c[0],d=c[1],f=c[2],b=c[3],x=new Uint32Array(256);let T=0,G=0,$=0;for($=0;$<256;$++)$<128?x[$]=$<<1:x[$]=$<<1^283;for($=0;$<256;$++){let ue=G^G<<1^G<<2^G<<3^G<<4;ue=ue>>>8^ue&255^99,e[T]=ue,t[ue]=T;const _e=x[T],fe=x[_e],Pe=x[fe];let Oe=x[ue]*257^ue*16843008;n[T]=Oe<<24|Oe>>>8,s[T]=Oe<<16|Oe>>>16,r[T]=Oe<<8|Oe>>>24,o[T]=Oe,Oe=Pe*16843009^fe*65537^_e*257^T*16843008,u[ue]=Oe<<24|Oe>>>8,d[ue]=Oe<<16|Oe>>>16,f[ue]=Oe<<8|Oe>>>24,b[ue]=Oe,T?(T=_e^x[x[x[Pe^_e]]],G^=x[x[G]]):T=G=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n<t.length&&i;)i=t[n]===this.key[n],n++;if(i)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const r=this.ksRows=(s+6+1)*4;let o,c;const u=this.keySchedule=new Uint32Array(r),d=this.invKeySchedule=new Uint32Array(r),f=this.sBox,b=this.rcon,x=this.invSubMix,T=x[0],G=x[1],$=x[2],ue=x[3];let _e,fe;for(o=0;o<r;o++){if(o<s){_e=u[o]=t[o];continue}fe=_e,o%s===0?(fe=fe<<8|fe>>>24,fe=f[fe>>>24]<<24|f[fe>>>16&255]<<16|f[fe>>>8&255]<<8|f[fe&255],fe^=b[o/s|0]<<24):s>6&&o%s===4&&(fe=f[fe>>>24]<<24|f[fe>>>16&255]<<16|f[fe>>>8&255]<<8|f[fe&255]),u[o]=_e=(u[o-s]^fe)>>>0}for(c=0;c<r;c++)o=r-c,c&3?fe=u[o]:fe=u[o-4],c<4||o<=4?d[c]=fe:d[c]=T[f[fe>>>24]]^G[f[fe>>>16&255]]^$[f[fe>>>8&255]]^ue[f[fe&255]],d[c]=d[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const n=this.keySize+6,s=this.invKeySchedule,r=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],d=o[2],f=o[3],b=this.uint8ArrayToUint32Array_(i);let x=b[0],T=b[1],G=b[2],$=b[3];const ue=new Int32Array(e),_e=new Int32Array(ue.length);let fe,Pe,Oe,Je,Me,ze,nt,Ne,At,Gt,Mi,yi,di,ri;const fi=this.networkToHostOrderSwap;for(;t<ue.length;){for(At=fi(ue[t]),Gt=fi(ue[t+1]),Mi=fi(ue[t+2]),yi=fi(ue[t+3]),Me=At^s[0],ze=yi^s[1],nt=Mi^s[2],Ne=Gt^s[3],di=4,ri=1;ri<n;ri++)fe=c[Me>>>24]^u[ze>>16&255]^d[nt>>8&255]^f[Ne&255]^s[di],Pe=c[ze>>>24]^u[nt>>16&255]^d[Ne>>8&255]^f[Me&255]^s[di+1],Oe=c[nt>>>24]^u[Ne>>16&255]^d[Me>>8&255]^f[ze&255]^s[di+2],Je=c[Ne>>>24]^u[Me>>16&255]^d[ze>>8&255]^f[nt&255]^s[di+3],Me=fe,ze=Pe,nt=Oe,Ne=Je,di=di+4;fe=r[Me>>>24]<<24^r[ze>>16&255]<<16^r[nt>>8&255]<<8^r[Ne&255]^s[di],Pe=r[ze>>>24]<<24^r[nt>>16&255]<<16^r[Ne>>8&255]<<8^r[Me&255]^s[di+1],Oe=r[nt>>>24]<<24^r[Ne>>16&255]<<16^r[Me>>8&255]<<8^r[ze&255]^s[di+2],Je=r[Ne>>>24]<<24^r[Me>>16&255]<<16^r[ze>>8&255]<<8^r[nt&255]^s[di+3],_e[t]=fi(fe^x),_e[t+1]=fi(Je^T),_e[t+2]=fi(Oe^G),_e[t+3]=fi(Pe^$),x=At,T=Gt,G=Mi,$=yi,t=t+4}return _e.buffer}}class Oi{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=Bi(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Bi(a){switch(a){case Ki.cbc:return"AES-CBC";case Ki.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const gn=16;class ln{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(i){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Dt(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,n){return this.useSoftware?new Promise((s,r)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,n);const c=this.flush();c?s(c.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:s,currentResult:r,remainderData:o}=this;if(n!==Ki.cbc||t.byteLength!==16)return te.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=je(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(i=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new _i),u.expandKey(t);const d=r;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,d||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new Oi(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new ii(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(te.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%gn;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(te.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Xi=Math.pow(2,17);class hn{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(T=>T[0]==="GAP")){c(_n(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),d=fn(e);e.loader=u;const f=Ni(n.fragLoadPolicy.default),b={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Xi};e.stats=u.stats;const x={onSuccess:(T,G,$,ue)=>{this.resetLoader(e,u);let _e=T.data;$.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(_e.slice(0,16)),_e=_e.slice(16)),o({frag:e,part:null,payload:_e,networkDetails:ue})},onError:(T,G,$,ue)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:i,data:void 0},T),error:new Error(`HTTP Error ${T.code} ${T.text}`),networkDetails:$,stats:ue}))},onAbort:(T,G,$)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:$,stats:T}))},onTimeout:(T,G,$)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${b.timeout}ms`),networkDetails:$,stats:T}))}};t&&(x.onProgress=(T,G,$,ue)=>t({frag:e,part:null,payload:$,networkDetails:ue})),u.load(d,b,x)})}loadPart(e,t,i){this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(_n(e,t));return}const u=this.loader=s?new s(n):new r(n),d=fn(e,t);e.loader=u;const f=Ni(n.fragLoadPolicy.default),b={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Xi};t.stats=u.stats,u.load(d,b,{onSuccess:(x,T,G,$)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const ue={frag:e,part:t,payload:x.data,networkDetails:$};i(ue),o(ue)},onError:(x,T,G,$)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:d.url,data:void 0},x),error:new Error(`HTTP Error ${x.code} ${x.text}`),networkDetails:G,stats:$}))},onAbort:(x,T,G)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:G,stats:x}))},onTimeout:(x,T,G)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${b.timeout}ms`),networkDetails:G,stats:x}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,s=n.total;if(i.loaded+=n.loaded,s){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(i.loaded/s),c),f=(c-u)*Math.round(i.loaded/u);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);const r=i.loading,o=n.loading;r.start?r.first+=o.first-o.start:(r.start=o.start,r.first=o.first),r.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function fn(a,e=null){const t=e||a,i={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(B(n)&&B(s)){var r;let o=n,c=s;if(a.sn==="initSegment"&&xn((r=a.decryptdata)==null?void 0:r.method)){const u=s-n;u%16&&(c=s+(16-u%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=c}return i}function _n(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:he.MEDIA_ERROR,details:j.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new Ui(i)}function xn(a){return a==="AES-128"||a==="AES-256"}class Ui extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class vn extends H{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class yn{constructor(e,t,i,n=0,s=-1,r=!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=pn(),this.buffering={audio:pn(),video:pn(),audiovideo:pn()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function pn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const dn={length:0,start:()=>0,end:()=>0};class pi{static isBuffered(e,t){if(e){const i=pi.getBuffered(e);for(let n=i.length;n--;)if(t>=i.start(n)&&t<=i.end(n))return!0}return!1}static bufferedRanges(e){if(e){const t=pi.getBuffered(e);return pi.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const n=pi.bufferedRanges(e);if(n.length)return pi.bufferedInfo(n,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((d,f)=>d.start-f.start||f.end-d.end);let n=-1,s=[];if(i)for(let d=0;d<e.length;d++){t>=e[d].start&&t<=e[d].end&&(n=d);const f=s.length;if(f){const b=s[f-1].end;e[d].start-b<i?e[d].end>b&&(s[f-1].end=e[d].end):s.push(e[d])}else s.push(e[d])}else s=e;let r=0,o,c=t,u=t;for(let d=0;d<s.length;d++){const f=s[d].start,b=s[d].end;if(n===-1&&t>=f&&t<=b&&(n=d),t+i>=f&&t<b)c=f,u=b,r=u-t;else if(t+i<f){o=f;break}}return{len:r,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||dn}catch(t){return te.log("failed to get media.buffered",t),dn}}}const Pn=/\{\$([a-zA-Z0-9-_]+)\}/g;function Tn(a){return Pn.test(a)}function Gn(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Pn,i=>{const n=i.substring(2,i.length-1),s=t==null?void 0:t[n];return s===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):s})}return e}function On(a,e,t){let i=a.variableList;i||(a.variableList=i={});let n,s;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(n))s=r.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(r){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else n=e.NAME,s=e.VALUE;n in i?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=s||""}function qn(a,e,t){const i=e.IMPORT;if(t&&i in t){let n=a.variableList;n||(a.variableList=n={}),n[i]=t[i]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const Mn=/^(\d+)x(\d+)$/,Qn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Wi{constructor(e,t){typeof e=="string"&&(e=Wi.parseAttrList(e,t)),g(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let n=0;n<t.length/2;n++)i[n]=parseInt(t.slice(n*2,n*2+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((n,s)=>(n[s.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Mn.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={},s='"';for(Qn.lastIndex=0;(i=Qn.exec(e))!==null;){const r=i[1].trim();let o=i[2];const c=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let u=!1;if(c)o=o.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))o=Gn(t,o);else if(!u&&!c)switch(r){case"CLOSED-CAPTIONS":if(o==="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":te.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const Vn="com.apple.hls.interstitial";function An(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function as(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class Jn{constructor(e,t,i=0){var n;if(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=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(n=t==null?void 0:t.tagOrder)!=null?n:i,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){te.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=g(new Wi({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);B(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(te.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(B(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Vn}get isValid(){return!!this.id&&!this._badValueForSameId&&B(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)}}const jn=10;class es{constructor(e){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=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?B(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||jn}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function wn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Rn(a){switch(a){case"AES-128":case"AES-256":return Ki.cbc;case"AES-256-CTR":return Ki.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function un(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function In(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function mn(a){const e=In(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Nn(a){const e=function(i,n,s){const r=i[n];i[n]=i[s],i[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function en(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const s=n[0]==="base64",r=n[1];s?(i.splice(-1,1),t=un(r)):t=mn(r)}}return t}const tn=typeof self!="undefined"?self:void 0;var Di={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},cn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Wn(a){switch(a){case cn.FAIRPLAY:return Di.FAIRPLAY;case cn.PLAYREADY:return Di.PLAYREADY;case cn.WIDEVINE:return Di.WIDEVINE;case cn.CLEARKEY:return Di.CLEARKEY}}var ts={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function os(a){if(a===ts.WIDEVINE)return Di.WIDEVINE;if(a===ts.PLAYREADY)return Di.PLAYREADY;if(a===ts.CENC||a===ts.CLEARKEY)return Di.CLEARKEY}function Hn(a){switch(a){case Di.FAIRPLAY:return cn.FAIRPLAY;case Di.PLAYREADY:return cn.PLAYREADY;case Di.WIDEVINE:return cn.WIDEVINE;case Di.CLEARKEY:return cn.CLEARKEY}}function ni(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[Di.FAIRPLAY,Di.WIDEVINE,Di.PLAYREADY,Di.CLEARKEY].filter(n=>!!e[n]):[];return!i[Di.WIDEVINE]&&t&&i.push(Di.WIDEVINE),i}const vi=function(a){return tn!=null&&(a=tn.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Hi(a,e,t,i){let n;switch(a){case Di.FAIRPLAY:n=["cenc","sinf"];break;case Di.WIDEVINE:case Di.PLAYREADY:n=["cenc"];break;case Di.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return rn(n,e,t,i)}function rn(a,e,t,i){return[{initDataTypes:a,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function qi(a){var e;return a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function ls(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=un(o).subarray(0,16);return Nn(c),c}}return null}let Zn={};class bn{static clearKeyUriToKeyIdMap(){Zn={}}constructor(e,t,i,n=[1],s=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=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!wn(e)}isSupported(){if(this.method){if(wn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case cn.FAIRPLAY:case cn.WIDEVINE:case cn.PLAYREADY:case cn.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(wn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(te.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=ds(e);return new bn(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=en(this.uri);if(t)switch(this.keyFormat){case cn.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case cn.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Bt(i,null,t),this.keyId=ls(t);break}default:{let i=t.subarray(0,16);if(i.length!==16){const n=new Uint8Array(16);n.set(i,16-i.length),i=n}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=Zn[this.uri];if(!i){const n=Object.keys(Zn).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),Zn[this.uri]=i}this.keyId=i}return this}}function ds(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const or=/#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,Ks=/#EXT-X-MEDIA:(.*)/g,Mr=/^#EXT(?:INF|-X-TARGETDURATION):/m,$s=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Nr=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("|"));class Fn{static findGroup(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}}static resolve(e,t){return ie.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Mr.test(e)}static parseMasterPlaylist(e,t){const i=Tn(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];or.lastIndex=0;let r;for(;(r=or.exec(e))!=null;)if(r[1]){var o;const u=new Wi(r[1],n),d=Gn(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Fn.resolve(d,t)},b=u.decimalResolution("RESOLUTION");b&&(f.width=b.width,f.height=b.height),Gs(u.CODECS,f);const x=u["SUPPLEMENTAL-CODECS"];x&&(f.supplemental={},Gs(x,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),n.levels.push(f)}else if(r[3]){const u=r[3],d=r[4];switch(u){case"SESSION-DATA":{const f=new Wi(d,n),b=f["DATA-ID"];b&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[b]=f);break}case"SESSION-KEY":{const f=Rs(d,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):te.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const f=new Wi(d,n);On(n,f,t)}break}case"CONTENT-STEERING":{const f=new Wi(d,n);n.contentSteering={uri:Fn.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=is(d);break}}}const c=s.length>0&&s.length<n.levels.length;return n.levels=c?s:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,i){let n;const s={},r=i.levels,o={AUDIO:r.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:r.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(Ks.lastIndex=0;(n=Ks.exec(e))!==null;){const u=new Wi(n[1],i),d=u.TYPE;if(d){const f=o[d],b=s[d]||[];s[d]=b;const x=u.LANGUAGE,T=u["ASSOC-LANGUAGE"],G=u.CHANNELS,$=u.CHARACTERISTICS,ue=u["INSTREAM-ID"],_e={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||x||"",type:d,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:x,url:u.URI?Fn.resolve(u.URI,t):""};if(T&&(_e.assocLang=T),G&&(_e.channels=G),$&&(_e.characteristics=$),ue&&(_e.instreamId=ue),f!=null&&f.length){const fe=Fn.findGroup(f,_e.groupId)||f[0];Vs(_e,fe,"audioCodec"),Vs(_e,fe,"textCodec")}b.push(_e)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new es(t),d=u.fragments,f=[];let b=null,x=0,T=0,G=0,$=0,ue=0,_e=null,fe=new Te(n,c),Pe,Oe,Je,Me=-1,ze=!1,nt=null,Ne;if($s.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Tn(e),((o=$s.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(Pe=$s.exec(e))!==null;){ze&&(ze=!1,fe=new Te(n,c),fe.playlistOffset=G,fe.start=G,fe.sn=x,fe.cc=$,ue&&(fe.bitrate=ue),fe.level=i,b&&(fe.initSegment=b,b.rawProgramDateTime&&(fe.rawProgramDateTime=b.rawProgramDateTime,b.rawProgramDateTime=null),nt&&(fe.setByteRange(nt),nt=null)));const yi=Pe[1];if(yi){fe.duration=parseFloat(yi);const di=(" "+Pe[2]).slice(1);fe.title=di||null,fe.tagList.push(di?["INF",yi,di]:["INF",yi])}else if(Pe[3]){if(B(fe.duration)){fe.playlistOffset=G,fe.start=G,Je&&js(fe,Je,u),fe.sn=x,fe.level=i,fe.cc=$,d.push(fe);const di=(" "+Pe[3]).slice(1);fe.relurl=Gn(u,di),Ls(fe,_e,f),_e=fe,G+=fe.duration,x++,T=0,ze=!0}}else{if(Pe=Pe[0].match(Nr),!Pe){te.warn("No matches on slow regex match for level playlist!");continue}for(Oe=1;Oe<Pe.length&&Pe[Oe]===void 0;Oe++);const di=(" "+Pe[Oe]).slice(1),ri=(" "+Pe[Oe+1]).slice(1),fi=Pe[Oe+2]?(" "+Pe[Oe+2]).slice(1):null;switch(di){case"BYTERANGE":_e?fe.setByteRange(ri,_e):fe.setByteRange(ri);break;case"PROGRAM-DATE-TIME":fe.rawProgramDateTime=ri,fe.tagList.push(["PROGRAM-DATE-TIME",ri]),Me===-1&&(Me=d.length);break;case"PLAYLIST-TYPE":u.type&&zn(u,di,Pe),u.type=ri.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?zn(u,di,Pe):d.length>0&&ur(u,di,Pe),x=u.startSN=parseInt(ri);break;case"SKIP":{u.skippedSegments&&zn(u,di,Pe);const hi=new Wi(ri,u),wt=hi.decimalInteger("SKIPPED-SEGMENTS");if(B(wt)){u.skippedSegments+=wt;for(let xi=wt;xi--;)d.push(null);x+=wt}const kt=hi.enumeratedString("RECENTLY-REMOVED-DATERANGES");kt&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(kt.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&zn(u,di,Pe),u.targetduration=Math.max(parseInt(ri),1);break;case"VERSION":u.version!==null&&zn(u,di,Pe),u.version=parseInt(ri);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||zn(u,di,Pe),u.live=!1;break;case"#":(ri||fi)&&fe.tagList.push(fi?[ri,fi]:[ri]);break;case"DISCONTINUITY":$++,fe.tagList.push(["DIS"]);break;case"GAP":fe.gap=!0,fe.tagList.push([di]);break;case"BITRATE":fe.tagList.push([di,ri]),ue=parseInt(ri)*1e3,B(ue)?fe.bitrate=ue:ue=0;break;case"DATERANGE":{const hi=new Wi(ri,u),wt=new Jn(hi,u.dateRanges[hi.ID],u.dateRangeTagCount);u.dateRangeTagCount++,wt.isValid||u.skippedSegments?u.dateRanges[wt.id]=wt:te.warn(`Ignoring invalid DATERANGE tag: "${ri}"`),fe.tagList.push(["EXT-X-DATERANGE",ri]);break}case"DEFINE":{{const hi=new Wi(ri,u);"IMPORT"in hi?qn(u,hi,r):On(u,hi,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?zn(u,di,Pe):d.length>0&&ur(u,di,Pe),u.startCC=$=parseInt(ri);break;case"KEY":{const hi=Rs(ri,t,u);if(hi.isSupported()){if(hi.method==="NONE"){Je=void 0;break}Je||(Je={}),Je[hi.keyFormat]&&(Je=g({},Je)),Je[hi.keyFormat]=hi}else te.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${ri}"`);break}case"START":u.startTimeOffset=is(ri);break;case"MAP":{const hi=new Wi(ri,u);if(fe.duration){const wt=new Te(n,c);lr(wt,hi,i,Je),b=wt,fe.initSegment=b,b.rawProgramDateTime&&!fe.rawProgramDateTime&&(fe.rawProgramDateTime=b.rawProgramDateTime)}else{const wt=fe.byteRangeEndOffset;if(wt){const kt=fe.byteRangeStartOffset;nt=`${wt-kt}@${kt}`}else nt=null;lr(fe,hi,i,Je),b=fe,ze=!0}b.cc=$;break}case"SERVER-CONTROL":{Ne&&zn(u,di,Pe),Ne=new Wi(ri),u.canBlockReload=Ne.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Ne.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Ne.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Ne.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Ne.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&zn(u,di,Pe);const hi=new Wi(ri);u.partTarget=hi.decimalFloatingPoint("PART-TARGET");break}case"PART":{let hi=u.partList;hi||(hi=u.partList=[]);const wt=T>0?hi[hi.length-1]:void 0,kt=T++,xi=new Wi(ri,u),Si=new Fe(xi,fe,c,kt,wt);hi.push(Si),fe.duration+=Si.duration;break}case"PRELOAD-HINT":{const hi=new Wi(ri,u);u.preloadHint=hi;break}case"RENDITION-REPORT":{const hi=new Wi(ri,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(hi);break}default:te.warn(`line parsed but not handled: ${Pe}`);break}}}_e&&!_e.relurl?(d.pop(),G-=_e.duration,u.partList&&(u.fragmentHint=_e)):u.partList&&(Ls(fe,_e,f),fe.cc=$,u.fragmentHint=fe,Je&&js(fe,Je,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const At=d.length,Gt=d[0],Mi=d[At-1];if(G+=u.skippedSegments*u.targetduration,G>0&&At&&Mi){u.averagetargetduration=G/At;const yi=Mi.sn;u.endSN=yi!=="initSegment"?yi:0,u.live||(Mi.endList=!0),Gt&&u.startCC===void 0&&(u.startCC=Gt.cc),Me>0&&(Br(d,Me),Gt&&f.unshift(Gt))}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(G+=u.fragmentHint.duration),u.totalduration=G,f.length&&u.dateRangeTagCount&&Gt&&vs(f,u),u.endCC=$,u}}function vs(a,e){const t=a.length,i=a[t-1],n=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let r=s.length;r--;){const o=e.dateRanges[s[r]],c=o.startDate.getTime();o.tagAnchor=i.ref;for(let u=t;u--;){const d=Fr(e,c,a,u,n);if(d!==-1){o.tagAnchor=e.fragments[d].ref;break}}}}function Fr(a,e,t,i,n){const s=t[i];if(s){const o=s.programDateTime;if(e>=o||i===0){var r;const c=(((r=t[i+1])==null?void 0:r.start)||n)-s.start;if(e<=o+c*1e3){const u=t[i].sn-a.startSN,d=a.fragments;if(d.length>t.length){const b=(t[i+1]||d[d.length-1]).sn-a.startSN;for(let x=b;x>u;x--){const T=d[x].programDateTime;if(e>=T&&e<T+d[x].duration*1e3)return x}}return u}}}return-1}function Rs(a,e,t){var i,n;const s=new Wi(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,d=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!c&&te.error(`Invalid IV: ${s.IV}`);const f=o?Fn.resolve(o,e):"",b=(u||"1").split("/").map(Number).filter(Number.isFinite);return new bn(r,f,d,b,c)}function is(a){const t=new Wi(a).decimalFloatingPoint("TIME-OFFSET");return B(t)?t:null}function Gs(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>Qt(s,i));n.length&&(e[`${i}Codec`]=n.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>n.indexOf(s)===-1))}),e.unknownCodecs=t}function Vs(a,e,t){const i=e[t];i&&(a[t]=i)}function Br(a,e){let t=a[e];for(let i=e;i--;){const n=a[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function Ls(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function lr(a,e,t,i){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",i&&(a.levelkeys=i),a.initSegment=null}function js(a,e,t){a.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(a)}function zn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function ur(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Ws(a,e){const t=e.startPTS;if(B(t)){let i=0,n;e.sn>a.sn?(i=t-a.start,n=a):(i=a.start-t,n=e),n.duration!==i&&n.setDuration(i)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function cr(a,e,t,i,n,s){i-t<=0&&(te.warn("Fragment should have a positive duration",e),i=t+e.duration,s=n+e.duration);let o=t,c=i;const u=e.startPTS,d=e.endPTS;if(B(u)){const $=Math.abs(u-t);B(e.deltaPTS)?e.deltaPTS=Math.max($,e.deltaPTS):e.deltaPTS=$,o=Math.max(t,u),t=Math.min(t,u),n=Math.min(n,e.startDTS),c=Math.min(i,d),i=Math.max(i,d),s=Math.max(s,e.endDTS)}const f=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=o,e.startDTS=n,e.endPTS=i,e.minEndPTS=c,e.endDTS=s;const b=e.sn;if(!a||b<a.startSN||b>a.endSN)return 0;let x;const T=b-a.startSN,G=a.fragments;for(G[T]=e,x=T;x>0;x--)Ws(G[x],G[x-1]);for(x=T;x<G.length-1;x++)Ws(G[x],G[x+1]);return a.fragmentHint&&Ws(G[G.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,f}function hr(a,e){if(a===e)return;let t=null;const i=a.fragments;for(let c=i.length-1;c>=0;c--){const u=i[c].initSegment;if(u){t=u;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let n;Ur(a,e,(c,u,d,f)=>{if(!e.startCC&&u.cc!==c.cc){var b,x;const T=c.cc-u.cc;for(let G=d;G<f.length;G++)f[G].cc+=T;e.startCC=(b=(x=pr(a,e.startSN-1))==null?void 0:x.cc)!=null?b:f[0].cc,e.endCC=f[f.length-1].cc}B(c.startPTS)&&B(c.endPTS)&&(u.setStart(u.startPTS=c.startPTS),u.startDTS=c.startDTS,u.maxStartPTS=c.maxStartPTS,u.endPTS=c.endPTS,u.endDTS=c.endDTS,u.minEndPTS=c.minEndPTS,u.setDuration(c.endPTS-c.startPTS),u.duration&&(n=u),e.PTSKnown=e.alignedSliding=!0),c.hasStreams&&(u.elementaryStreams=c.elementaryStreams),u.loader=c.loader,c.hasStats&&(u.stats=c.stats),c.initSegment&&(u.initSegment=c.initSegment,t=c.initSegment)});const s=e.fragments,r=e.fragmentHint?s.concat(e.fragmentHint):s;if(t&&r.forEach(c=>{var u;c&&(!c.initSegment||c.initSegment.relurl===((u=t)==null?void 0:u.relurl))&&(c.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=s.some(c=>!c),e.deltaUpdateFailed){te.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let c=e.skippedSegments;c--;)s.shift();e.startSN=s[0].sn}else{e.endCC=s[s.length-1].cc,e.canSkipDateRanges&&(e.dateRanges=ys(a.dateRanges,e));const c=a.fragments.filter(u=>u.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<r.length;u++)r[u].programDateTime===null&&Ls(r[u],r[u-1],c);vs(c,e)}Hs(a.partList,e.partList,(c,u)=>{u.elementaryStreams=c.elementaryStreams,u.stats=c.stats}),n?cr(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):fr(a,e),s.length&&(e.totalduration=e.edge-s[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const c=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=c),e.driftEndTime=o,e.driftEnd=c}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function ys(a,e){const{dateRanges:t,recentlyRemovedDateranges:i}=e,n=g({},a);i&&i.forEach(o=>{delete n[o]});const r=Object.keys(n).length;return r&&Object.keys(t).forEach(o=>{const c=n[o],u=new Jn(t[o].attr,c);u.isValid?(n[o]=u,c||(u.tagOrder+=r)):te.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Lt(t[o].attr)}"`)}),n}function Hs(a,e,t){if(a&&e){let i=0;for(let n=0,s=a.length;n<=s;n++){const r=a[n],o=e[n+i];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):i--}}}function Ur(a,e,t){const i=e.skippedSegments,n=Math.max(a.startSN,e.startSN)-e.startSN,s=(a.fragmentHint?1:0)+(i?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,r=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=n;u<=s;u++){const d=c[r+u];let f=o[u];if(i&&!f&&d&&(f=e.fragments[u]=d),d&&f){if(t(d,f,u,o),d.url&&d.url!==f.url){e.playlistParsingError=dr(`media sequence mismatch ${f.sn}:`,a,e,d,f);return}else if(d.cc!==f.cc){e.playlistParsingError=dr(`discontinuity sequence mismatch (${d.cc}!=${f.cc})`,a,e,d,f);return}}}}function dr(a,e,t,i,n){return new Error(`${a} ${n.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function fr(a,e,t=!0){const i=e.startSN+e.skippedSegments-a.startSN,n=a.fragments,s=i>=0;let r=0;if(s&&i<n.length)r=n[i].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)r=a.fragmentStart;else return;Is(e,r)}function Is(a,e){if(e){const t=a.fragments;for(let i=a.skippedSegments;i<t.length;i++)t[i].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function Es(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const i=a.fragments;if(i.length&&t*4>e){const s=i[i.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function pr(a,e,t){if(!a)return null;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function mr(a,e,t){return a?gr(a.partList,e,t):null}function gr(a,e,t){if(a)for(let i=a.length;i--;){const n=a[i];if(n.index===t&&n.fragment.sn===e)return n}return null}function Zs(a){a.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function bs(a,e){for(let i=0,n=a.length;i<n;i++){var t;if(((t=a[i])==null?void 0:t.cc)===e)return a[i]}return null}function Kr(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function _r(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function vr(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)_r(t[i],a);e.fragmentHint&&_r(e.fragmentHint,a),e.alignedSliding=!0}function $r(a,e){a&&(an(e,a),!e.alignedSliding&&a&&$i(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&fr(a,e,!1))}function an(a,e){if(!Kr(e,a))return;const t=Math.min(e.endCC,a.endCC),i=bs(e.fragments,t),n=bs(a.fragments,t);if(!i||!n)return;te.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;vr(s,a)}function $i(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,i=e.fragments;if(!t.length||!i.length)return;let n,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(n=bs(i,r),s=bs(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=bs(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,c=s.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(s.start-n.start);vr(u,a)}const nn={toString:function(a){let e="";const t=a.length;for(let i=0;i<t;i++)e+=`[${a.start(i).toFixed(3)}-${a.end(i).toFixed(3)}]`;return e}},it={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Sn extends vn{constructor(e,t,i,n,s){super(n,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=it.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:r,fragCurrent:o,media:c,mediaBuffer:u,state:d}=this,f=c?c.currentTime:0,b=pi.bufferInfo(u||c,f,r.maxBufferHole);if(this.log(`media seeking to ${B(f)?f.toFixed(3):f}, state: ${d}`),this.state===it.ENDED)this.resetLoadingState();else if(o){const x=r.maxFragLookUpTolerance,T=o.start-x,G=o.start+o.duration+x;if(!b.len||G<b.start||T>b.end){const $=f>G;(f<T||$)&&($&&o.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const x=this.lastCurrentTime;if(f>x&&(this.lastCurrentTime=f),!this.loadingParts){const T=Math.max(b.end,f),G=this.shouldLoadParts(this.getLevelDetails(),T);G&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${T.toFixed(2)}`),this.loadingParts=G)}}!this.hls.hasEnoughToStart&&!b.len&&(this.log(`setting startPosition to ${f} because of seek before start`),this.nextLoadPosition=this.startPosition=f),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new hn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new ln(e.config)}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===it.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=it.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const s=e.nextStart;if(s&&s>n&&s<t.edge||this.media.currentTime<e.start)return!1;const o=t.partList;if(o!=null&&o.length){const u=o[o.length-1];return pi.isBuffered(this.media,u.start+u.duration/2)}const c=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;i.removeEventListener("seeking",this.onMediaSeeking),i.removeEventListener("ended",this.onMediaEnded),i.addEventListener("seeking",this.onMediaSeeking),i.addEventListener("ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===it.STOPPED&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(n!==null){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n.removeEventListener("seeking",this.onMediaSeeking),n.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=it.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const n=s=>{const r=s.frag;if(this.fragContextChanged(r)){this.warn(`${r.type} sn: ${r.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(r,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(r);return}r.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,i,n).then(s=>{if(!s)return;const r=this.state,o=s.frag;if(this.fragContextChanged(o)){(r===it.FRAG_LOADING||!this.fragCurrent&&r===it.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=it.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(p.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===it.STOPPED||this.state===it.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Ai.APPENDING){const s=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,r?r.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Ai.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(p.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const n=i==null?void 0:i.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{frag:s,payload:r}=i,o=s.decryptdata;if(r&&r.byteLength>0&&o!=null&&o.key&&o.iv&&wn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,Rn(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const d=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:d}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===it.STOPPED||this.state===it.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==it.STOPPED&&(this.state=it.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?nn.toString(pi.getBuffered(i)):"(detached)"})`),ae(e)){var n;if(e.type!==ce.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=it.IDLE;return}}const s=(n=this.levels)==null?void 0:n[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=it.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:s}=e,r=!s||s.length===0||s.some(c=>!c),o=new yn(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!r);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var s;this.fragCurrent=e;const r=t==null?void 0:t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let o=null;e.encrypted&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=it.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(p.KEY_LOADED,f),this.state===it.KEY_LOADING&&(this.state=it.IDLE),f}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&r.encryptedFragments.length&&this.keyLoader.loadClear(e,r.encryptedFragments);const c=this.fragPrevious;if(ae(e)&&(!c||e.sn!==c.sn)){const f=this.shouldLoadParts(t.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=f)}if(i=Math.max(e.start,i||0),this.loadingParts&&ae(e)){const f=r.partList;if(f&&n){i>e.end&&r.fragmentHint&&(e=r.fragmentHint);const b=this.getNextPart(f,e,i);if(b>-1){const x=f[b];e=this.fragCurrent=x.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${x.index} (${b}/${f.length-1}) of ${this.fragInfo(e,!1,x)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=x.start+x.duration,this.state=it.FRAG_LOADING;let T;return o?T=o.then(G=>!G||this.fragContextChanged(G.frag)?null:this.doFragPartsLoad(e,x,t,n)).catch(G=>this.handleFragLoadError(G)):T=this.doFragPartsLoad(e,x,t,n).catch(G=>this.handleFragLoadError(G)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:x,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):T}else if(!e.url||this.loadedEndOfParts(f,i))return Promise.resolve(null)}}if(ae(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${r?"["+r.startSN+"-"+r.endSN+"]":""}, target: ${parseFloat(i.toFixed(3))}`),B(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=it.FRAG_LOADING;const u=this.config.progressive;let d;return u&&o?d=o.then(f=>!f||this.fragContextChanged(f==null?void 0:f.frag)?null:this.fragmentLoader.load(e,n)).catch(f=>this.handleFragLoadError(f)):d=Promise.all([this.fragmentLoader.load(e,u?n:void 0),o]).then(([f])=>(!u&&f&&n&&n(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,i,n){return new Promise((s,r)=>{var o;const c=[],u=(o=i.details)==null?void 0:o.partList,d=f=>{this.fragmentLoader.loadPart(e,f,n).then(b=>{c[f.index]=b;const x=b.part;this.hls.trigger(p.FRAG_LOADED,b);const T=mr(i.details,e.sn,f.index+1)||gr(u,e.sn,f.index+1);if(T)d(T);else return s({frag:e,part:x,partsLoaded:c})}).catch(r)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===j.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==it.PARSING){!this.fragCurrent&&this.state!==it.STOPPED&&this.state!==it.ERROR&&(this.state=it.IDLE);return}const{frag:i,part:n,level:s}=t,r=self.performance.now();i.stats.parsing.end=r,n&&(n.stats.parsing.end=r);const o=this.getLevelDetails(),u=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(i,n,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var i;const s=e.partList[0],r=s.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=r){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:s,part:r}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const o=t[n],c=o.details,u=r>-1?mr(c,s,r):null,d=u?u.fragment:pr(c,s,i);return d?(i&&i!==d&&(d.stats=i.stats),{frag:d,part:u,level:o}):null}bufferFragmentData(e,t,i,n,s){var r;if(!e||this.state!==it.PARSING)return;const{data1:o,data2:c}=e;let u=o;if(o&&c&&(u=je(o,c)),!((r=u)!=null&&r.length))return;const d={type:e.type,frag:t,part:i,chunkMeta:n,parent:t.type,data:u};if(this.hls.trigger(p.BUFFER_APPENDING,d),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!pi.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=pi.bufferInfo(t,i,0),s=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-r,n.end-r),i+r);e.start-o>r&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var i;const n=this.getLoadPosition();if(!B(n))return null;const r=this.lastCurrentTime>n||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,r)}getFwdBufferInfoAtPos(e,t,i,n){const s=pi.bufferInfo(e,t,n);if(s.len===0&&s.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,i);if(r&&(s.nextStart<=r.end||r.gap)){const o=Math.max(Math.min(s.nextStart,r.end)-t,n);return pi.bufferInfo(e,t,o)}}return s}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),s=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return s>=n?(i.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=ce.MAIN){var i;const n=(i=this.fragmentTracker)==null?void 0:i.getAppendedFrag(e,t);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:s}=this,r=i[0].start,o=s.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const f=s.initialLiveManifestSize;if(n<f)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t,i);const b=this.hls.startPosition,x=this.hls.liveSyncPosition,T=c?(b!==-1&&b>=r?b:x)||c.start:e;this.log(`Setting startPosition to ${T} to match start frag at live edge. mainStart: ${b} liveSyncPosition: ${x} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=T}}else e<=r&&(c=i[0]);if(!c){const f=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,f,t)}let d=this.filterReplacedPrimary(c,t);if(!d&&c){const f=c.sn-t.startSN;d=this.filterReplacedPrimary(i[f+1]||null,t)}return this.mapToInitFragWhenRequired(d)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Ai.OK||i===Ai.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&i.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(o!==null&&i.len+o.len>=s){const c=r.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(Ss(this.hls.config)){var e,t;if((e=this.hls.interstitialsManager)==null||(t=e.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Ss(this.hls.config)&&e.type!==ce.SUBTITLE){const i=this.hls.interstitialsManager,n=i==null?void 0:i.bufferingItem;if(n){const r=n.event;if(r){if(r.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&(t==null?void 0:t.live)===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const s=i==null?void 0:i.playerQueue;if(s)for(let r=s.length;r--;){const o=s[r].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let n=-1,s=!1,r=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(r=r&&!u.independent,n>-1&&i<u.start)break;const d=u.loaded;d?n=-1:(s||u.independent||r)&&u.fragment===t&&(n=o),s=d}return n}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=Yt(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const s=i.sn+1;if(s>=e.startSN&&s<=e.endSN){const r=t[s-e.startSN];i.cc===r.cc&&(n=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=ci(t,i.cc),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:u}=n,d=i.partList,f=!!(this.loadingParts&&d!=null&&d.length&&c);f&&c&&!this.bitrateTest&&d[d.length-1].fragment.sn===c.sn&&(r=r.concat(c),o=c.sn);let b;if(e<t){var x;const G=e<this.lastCurrentTime||e>t-u||(x=this.media)!=null&&x.paused||!this.startFragRequested?0:u;b=mi(s,r,e,G)}else b=r[r.length-1];if(b){const T=b.sn-i.startSN,G=this.fragmentTracker.getState(b);if((G===Ai.OK||G===Ai.PARTIAL&&b.gap)&&(s=b),s&&b.sn===s.sn&&(!f||d[0].fragment.sn>b.sn||!i.live&&!f)&&s&&b.level===s.level){const ue=r[T+1];b.sn<o&&this.fragmentTracker.getState(ue)!==Ai.OK?b=ue:b=null}}return b}alignPlaylists(e,t,i){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,o=e.alignedSliding&&B(s);if(r||!o&&!s){$r(i,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),c}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const n=this.timelineOffset;if(i===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&B(r)?(i=t+r,r<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+n}this.nextLoadPosition=i+n}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&ae(e)&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==it.FRAG_LOADING_WAITING_RETRY)&&(this.state=it.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const T=this.getCurrentContext(t.chunkMeta);T&&(t.frag=T.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var n;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const s=t.details===j.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const r=t.errorAction,{action:o,flags:c,retryCount:u=0,retryConfig:d}=r||{},f=!!r&&!!d,b=f&&o===Ci.RetryRequest,x=f&&!r.resolved&&c===Ii.MoveAllAlternatesMatchingHost;if(!b&&x&&ae(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),r.resolved=!0;else if((b||x)&&u<d.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const T=bi(d,u);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${d.maxNumRetry} in ${T}ms`),r.resolved=!0,this.retryDate=self.performance.now()+T,this.state=it.FRAG_LOADING_WAITING_RETRY}else if(d&&r)if(this.resetFragmentErrors(e),u<d.maxNumRetry)!s&&o!==Ci.RemoveAlternatePermanently&&(r.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else o===Ci.SendAlternateToPenaltyBox?this.state=it.WAITING_LEVEL:this.state=it.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===it.PARSING||this.state===it.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),s=n&&n.len>.5;s&&this.reduceMaxBufferLength(n.len,(t==null?void 0:t.duration)||10);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===ce.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==it.STOPPED&&(this.state=it.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=pi.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===it.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==it.STOPPED&&(this.state=it.IDLE)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of ${this.playlistLabel()} ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const s=i.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,u)=>{const d=e.elementaryStreams[u];if(d){const f=d.endPTS-d.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),c||!1;const b=n?0:cr(s,e,d.startPTS,d.endPTS,d.startDTS,d.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:i,drift:b,type:u,frag:e,start:d.startPTS,end:d.endPTS}),!0}return c},!1)){var o;if(i.fragmentError===0&&this.treatAsGap(e,i),((o=this.transmuxer)==null?void 0:o.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=it.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===ce.MAIN?"level":"track"}fragInfo(e,t=!0,i){var n,s;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((n=t&&!i?e.startPTS:(i||e).start)!=null?n:NaN).toFixed(3)}-${((s=t&&!i?e.endPTS:(i||e).end)!=null?s:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Ss(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Ds{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=Gr(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Gr(a,e){const t=new Uint8Array(e);let i=0;for(let n=0;n<a.length;n++){const s=a[n];t.set(s,i),i+=s.length}return t}var Cs={exports:{}},zs;function xs(){return zs||(zs=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,b){if(typeof d!="function")throw new TypeError("The listener must be a function");var x=new n(d,f||c,b),T=t?t+u:u;return c._events[T]?c._events[T].fn?c._events[T]=[c._events[T],x]:c._events[T].push(x):(c._events[T]=x,c._eventsCount++),c}function r(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},o.prototype.listeners=function(u){var d=t?t+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var b=0,x=f.length,T=new Array(x);b<x;b++)T[b]=f[b].fn;return T},o.prototype.listenerCount=function(u){var d=t?t+u:u,f=this._events[d];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,d,f,b,x,T){var G=t?t+u:u;if(!this._events[G])return!1;var $=this._events[G],ue=arguments.length,_e,fe;if($.fn){switch($.once&&this.removeListener(u,$.fn,void 0,!0),ue){case 1:return $.fn.call($.context),!0;case 2:return $.fn.call($.context,d),!0;case 3:return $.fn.call($.context,d,f),!0;case 4:return $.fn.call($.context,d,f,b),!0;case 5:return $.fn.call($.context,d,f,b,x),!0;case 6:return $.fn.call($.context,d,f,b,x,T),!0}for(fe=1,_e=new Array(ue-1);fe<ue;fe++)_e[fe-1]=arguments[fe];$.fn.apply($.context,_e)}else{var Pe=$.length,Oe;for(fe=0;fe<Pe;fe++)switch($[fe].once&&this.removeListener(u,$[fe].fn,void 0,!0),ue){case 1:$[fe].fn.call($[fe].context);break;case 2:$[fe].fn.call($[fe].context,d);break;case 3:$[fe].fn.call($[fe].context,d,f);break;case 4:$[fe].fn.call($[fe].context,d,f,b);break;default:if(!_e)for(Oe=1,_e=new Array(ue-1);Oe<ue;Oe++)_e[Oe-1]=arguments[Oe];$[fe].fn.apply($[fe].context,_e)}}return!0},o.prototype.on=function(u,d,f){return s(this,u,d,f,!1)},o.prototype.once=function(u,d,f){return s(this,u,d,f,!0)},o.prototype.removeListener=function(u,d,f,b){var x=t?t+u:u;if(!this._events[x])return this;if(!d)return r(this,x),this;var T=this._events[x];if(T.fn)T.fn===d&&(!b||T.once)&&(!f||T.context===f)&&r(this,x);else{for(var G=0,$=[],ue=T.length;G<ue;G++)(T[G].fn!==d||b&&!T[G].once||f&&T[G].context!==f)&&$.push(T[G]);$.length?this._events[x]=$.length===1?$[0]:$:r(this,x)}return this},o.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&r(this,d)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,a.exports=o}(Cs)),Cs.exports}var Ys=xs(),Xs=D(Ys);const qs="1.6.2",ks={};function Jo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function el(){const a=ks[qs];if(a)return a.clientCount++,a;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),n={worker:new self.Worker(t),objectURL:t,clientCount:1};return ks[qs]=n,n}function tl(a){const e=ks[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,n={worker:new self.Worker(t),scriptURL:t,clientCount:1};return ks[a]=n,n}function il(a){const e=ks[a||qs];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete ks[a||qs],n&&self.URL.revokeObjectURL(n),i.terminate()}}function Aa(a,e){return e+10<=a.length&&a[e]===51&&a[e+1]===68&&a[e+2]===73&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function Vr(a,e){return e+10<=a.length&&a[e]===73&&a[e+1]===68&&a[e+2]===51&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function yr(a,e){let t=0;return t=(a[e]&127)<<21,t|=(a[e+1]&127)<<14,t|=(a[e+2]&127)<<7,t|=a[e+3]&127,t}function Qs(a,e){const t=e;let i=0;for(;Vr(a,e);){i+=10;const n=yr(a,e+6);i+=n,Aa(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function nl(a,e,t,i){const n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],r=s>>2&15;if(r>12){const x=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!0,error:x,reason:x.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,d=n[r];let f=r;(o===5||o===29)&&(f-=3);const b=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return te.log(`manifest codec:${i}, parsed codec:${u}, channels:${c}, rate:${d} (ADTS object type:${o} sampling index:${r})`),{config:b,samplerate:d,channelCount:c,codec:u,parsedCodec:u,manifestCodec:i}}function wa(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ra(a,e){return a[e+1]&1?7:9}function jr(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function sl(a,e){return e+5<a.length}function Er(a,e){return e+1<a.length&&wa(a,e)}function rl(a,e){return sl(a,e)&&wa(a,e)&&jr(a,e)<=a.length-e}function al(a,e){if(Er(a,e)){const t=Ra(a,e);if(e+t>=a.length)return!1;const i=jr(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||Er(a,n)}return!1}function La(a,e,t,i,n){if(!a.samplerate){const s=nl(e,t,i,n);if(!s)return;g(a,s)}}function Ia(a){return 1024*9e4/a}function ol(a,e){const t=Ra(a,e);if(e+t<=a.length){const i=jr(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Da(a,e,t,i,n){const s=Ia(a.samplerate),r=i+n*s,o=ol(e,t);let c;if(o){const{frameLength:f,headerLength:b}=o,x=b+f,T=Math.max(0,t+x-e.length);T?(c=new Uint8Array(x-b),c.set(e.subarray(t+b,e.length),0)):c=e.subarray(t+b,t+x);const G={unit:c,pts:r};return T||a.samples.push(G),{sample:G,length:x,missing:T}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:r},length:u,missing:-1}}function ll(a,e){return Vr(a,e)&&yr(a,e+6)+10<=a.length-e}function ul(a){if(a.size<2)return;const e=$e(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function cl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=$e(a.data.subarray(t),!0);t+=i.length+1;const n=$e(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=$e(a.data.subarray(1));return{key:a.type,info:"",data:e}}function hl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=$e(a.data.subarray(t),!0);t+=i.length+1;const n=$e(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=$e(a.data);return{key:a.type,info:"",data:e}}function dl(a){return btoa(String.fromCharCode(...a))}function Ca(a,e){if(a<0)return-Ca(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const n=Math.floor(a*t);return(n%2===0?n:n+1)/t}else return Math.round(a*t)/t}function fl(a,e){const t=new URL(a),i=new URL(e);if(t.origin!==i.origin)return a;const n=t.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")}function pl(){try{return crypto.randomUUID()}catch(a){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?s:s&3|8).toString(16)})}}}function ml(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function Wr(a,e=0,t=1/0){return gl(a,e,t,Uint8Array)}function gl(a,e,t,i){const n=_l(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=vl(a)?a.byteOffset:0,o=(r+a.byteLength)/s,c=(r+e)/s,u=Math.floor(Math.max(0,Math.min(c,o))),d=Math.floor(Math.min(u+Math.max(t,0),o));return new i(n,u,d-u)}function _l(a){return a instanceof ArrayBuffer?a:a.buffer}function vl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function yl(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=a.data.subarray(1).indexOf(0);if(i===-1)return;const n=$e(Wr(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=$e(Wr(a.data,3+i,r));let c;return n==="-->"?c=$e(Wr(a.data,4+i+r)):c=ml(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function El(a){return a.type==="PRIV"?ul(a):a.type[0]==="W"?hl(a):a.type==="APIC"?yl(a):cl(a)}function bl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=yr(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const br=10,Sl=10;function ka(a){let e=0;const t=[];for(;Vr(a,e);){const i=yr(a,e+6);a[e+5]>>6&1&&(e+=br),e+=br;const n=e+i;for(;e+Sl<n;){const s=bl(a.subarray(e)),r=El(s);r&&t.push(r),e+=s.size+br}Aa(a,e)&&(e+=br)}return t}function Pa(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function xl(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function Hr(a){const e=ka(a);for(let t=0;t<e.length;t++){const i=e[t];if(Pa(i))return xl(i)}}let Bn=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function ns(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Zr{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=je(this.cachedData,e),this.cachedData=null);let i=Qs(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,c=i?Hr(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&B(c))&&(this.basePTS=Tl(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Bn.audioId3,duration:Number.POSITIVE_INFINITY});n<u;){if(this.canParse(e,n)){const d=this.appendFrame(r,e,n);d?(this.frameIndex++,this.lastPTS=d.sample.pts,n+=d.length,s=n):n=u}else ll(e,n)?(i=Qs(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Bn.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,s=n):n++;if(n===u&&s!==u){const d=e.slice(s);this.cachedData?this.cachedData=je(this.cachedData,d):this.cachedData=d}}return{audioTrack:r,videoTrack:ns(),id3Track:o,textTrack:ns()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:ns(),id3Track:this._id3Track,textTrack:ns()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Tl=(a,e,t)=>{if(B(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Sr=null;const Al=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],wl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Rl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ll=[0,1,1,4];function Oa(a,e,t,i,n){if(t+24>e.length)return;const s=Ma(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=i+n*r,c={unit:e.subarray(t,t+s.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=s.channelCount,a.samplerate=s.sampleRate,a.samples.push(c),{sample:c,length:s.frameLength,missing:0}}}function Ma(a,e){const t=a[e+1]>>3&3,i=a[e+1]>>1&3,n=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-i:i===3?3:4,u=Al[c*14+n-1]*1e3,f=wl[(t===3?0:t===2?1:2)*3+s],b=o===3?1:2,x=Rl[t][i],T=Ll[i],G=x*8*T,$=Math.floor(x*u/f+r)*T;if(Sr===null){const fe=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Sr=fe?parseInt(fe[1]):0}return!!Sr&&Sr<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:b,frameLength:$,samplesPerFrame:G}}}function zr(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Na(a,e){return e+1<a.length&&zr(a,e)}function Il(a,e){return zr(a,e)&&4<=a.length-e}function Fa(a,e){if(e+1<a.length&&zr(a,e)){const i=Ma(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||Na(a,s)}return!1}class Dl extends Zr{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Qs(e,0);let n=(i==null?void 0:i.length)||0;if(Fa(e,n))return!1;for(let s=e.length;n<s;n++)if(al(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return rl(e,t)}appendFrame(e,t,i){La(e,this.observer,t,i,e.manifestCodec);const n=Da(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const Ba=(a,e)=>{let t=0,i=5;e+=i;const n=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;i>0;){r[0]=a[e];const o=Math.min(i,8),c=8-o;s[0]=4278190080>>>24+c<<c,n[0]=(r[0]&s[0])>>c,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class Cl extends Zr{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=Ua(e,t,i,this.basePTS,this.frameIndex);if(n!==-1)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}static probe(e){if(!e)return!1;const t=Qs(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Ba(e,i)<16}}function Ua(a,e,t,i,n){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],c=e[t+4]&63,d=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+s]*2;if(t+d>e.length)return-1;const f=e[t+6]>>5;let b=0;f===2?b+=2:(f&1&&f!==1&&(b+=2),f&4&&(b+=2));const x=(e[t+6]<<8|e[t+7])>>12-b&1,G=[2,1,2,3,3,4,4,5][f]+x,$=e[t+5]>>3,ue=e[t+5]&7,_e=new Uint8Array([s<<6|$<<1|ue>>2,(ue&3)<<6|f<<3|x<<2|c>>4,c<<4&224]),fe=1536/o*9e4,Pe=i+n*fe,Oe=e.subarray(t,t+d);return a.config=_e,a.channelCount=G,a.samplerate=o,a.samples.push({unit:Oe,pts:Pe}),d}class kl extends Zr{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Qs(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Ba(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(Fa(e,i))return te.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Il(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Oa(e,t,i,this.basePTS,this.frameIndex)}}const Pl=/\/emsg[-/]ID3/i;class Ol{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const s=this.videoTrack=ns("video",1),r=this.audioTrack=ns("audio",1),o=this.txtTrack=ns("text",1);if(this.id3Track=ns("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=ke(e);if(c.video){const{id:u,timescale:d,codec:f,supplemental:b}=c.video;s.id=u,s.timescale=o.timescale=d,s.codec=f,s.supplemental=b}if(c.audio){const{id:u,timescale:d,codec:f}=c.audio;r.id=u,r.timescale=d,r.codec=f}o.id=Ge.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return Ie(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=je(this.remainderData,e));const o=Ae(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=Ue(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return i.samples=Ue(e,t),{videoTrack:t,audioTrack:ns(),id3Track:n,textTrack:ns()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=ne(e.samples,["emsg"]);n&&n.forEach(s=>{const r=Pt(s);if(Pl.test(r.schemeIdUri)){const o=Ka(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=r.payload;i.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Bn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Ka(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Bn.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function Ka(a,e){return B(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ml{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new ln(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Ki.cbc)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const s=n.subarray(16,n.length-n.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(o=>{const c=new Uint8Array(o);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)i.set(e.subarray(s,s+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)e.set(i.subarray(n,n+16),s);return e}decryptAvcSample(e,t,i,n,s){const r=tt(s.data),o=this.getAvcEncryptedData(r);this.decryptBuffer(o.buffer).then(c=>{s.data=this.getAvcDecryptedUnit(r,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)})}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const s=e[t].units;for(;!(i>=s.length);i++){const r=s[i];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,i,n,r),!this.decrypter.isSync()))return}}}}class $a{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const s=i.units;n=s[s.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const s=i[n-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,u,d,f,b=-1,x=0;for(s===-1&&(b=0,x=this.getNALuType(t,0),s=0,c=1);c<n;){if(u=t[c++],!s){s=u?0:1;continue}if(s===1){s=u?0:2;continue}if(!u)s=3;else if(u===1){if(d=c-s-1,b>=0){const T={data:t.subarray(b,d),type:x};o.push(T)}else{const T=this.getLastNalUnit(e.samples);T&&(r&&c<=4-r&&T.state&&(T.data=T.data.subarray(0,T.data.byteLength-r)),d>0&&(T.data=je(T.data,t.subarray(0,d)),T.state=0))}c<n?(f=this.getNALuType(t,c),b=c,x=f,s=0):s=-1}else s=0}if(b>=0&&s>=0){const T={data:t.subarray(b,n),type:x,state:s};o.push(T)}if(o.length===0){const T=this.getLastNalUnit(e.samples);T&&(T.data=je(T.data,t))}return e.naluState=s,o}}class Js{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");n.set(e.subarray(i,i+s)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&te.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Ga extends $a{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var d,f;switch(u.type){case 1:{let G=!1;o=!0;const $=u.data;if(c&&$.length>4){const ue=this.readSliceType($);(ue===2||ue===4||ue===7||ue===9)&&(G=!0)}if(G){var b;(b=r)!=null&&b.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.frame=!0,r.key=G;break}case 5:o=!0,(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 6:{o=!0,Re(u.data,1,i.pts,t.samples);break}case 7:{var x,T;o=!0,c=!0;const G=u.data,$=this.readSPS(G);if(!e.sps||e.width!==$.width||e.height!==$.height||((x=e.pixelRatio)==null?void 0:x[0])!==$.pixelRatio[0]||((T=e.pixelRatio)==null?void 0:T[1])!==$.pixelRatio[1]){e.width=$.width,e.height=$.height,e.pixelRatio=$.pixelRatio,e.sps=[G];const ue=G.subarray(1,4);let _e="avc1.";for(let fe=0;fe<3;fe++){let Pe=ue[fe].toString(16);Pe.length<2&&(Pe="0"+Pe),_e+=Pe}e.codec=_e}break}case 8:o=!0,e.pps=[u.data];break;case 9:o=!0,e.audFound=!0,(f=r)!=null&&f.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:o=!0;break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Js(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,s;for(let r=0;r<e;r++)n!==0&&(s=t.readEG(),n=(i+s+256)%256),i=n===0?i:n}readSPS(e){const t=new Js(e);let i=0,n=0,s=0,r=0,o,c,u;const d=t.readUByte.bind(t),f=t.readBits.bind(t),b=t.readUEG.bind(t),x=t.readBoolean.bind(t),T=t.skipBits.bind(t),G=t.skipEG.bind(t),$=t.skipUEG.bind(t),ue=this.skipScalingList.bind(this);d();const _e=d();if(f(5),T(3),d(),$(),_e===100||_e===110||_e===122||_e===244||_e===44||_e===83||_e===86||_e===118||_e===128){const ze=b();if(ze===3&&T(1),$(),$(),T(1),x())for(c=ze!==3?8:12,u=0;u<c;u++)x()&&(u<6?ue(16,t):ue(64,t))}$();const fe=b();if(fe===0)b();else if(fe===1)for(T(1),G(),G(),o=b(),u=0;u<o;u++)G();$(),T(1);const Pe=b(),Oe=b(),Je=f(1);Je===0&&T(1),T(1),x()&&(i=b(),n=b(),s=b(),r=b());let Me=[1,1];if(x()&&x())switch(d()){case 1:Me=[1,1];break;case 2:Me=[12,11];break;case 3:Me=[10,11];break;case 4:Me=[16,11];break;case 5:Me=[40,33];break;case 6:Me=[24,11];break;case 7:Me=[20,11];break;case 8:Me=[32,11];break;case 9:Me=[80,33];break;case 10:Me=[18,11];break;case 11:Me=[15,11];break;case 12:Me=[64,33];break;case 13:Me=[160,99];break;case 14:Me=[4,3];break;case 15:Me=[3,2];break;case 16:Me=[2,1];break;case 255:{Me=[d()<<8|d(),d()<<8|d()];break}}return{width:Math.ceil((Pe+1)*16-i*2-n*2),height:(2-Je)*(Oe+1)*16-(Je?2:4)*(s+r),pixelRatio:Me}}}class Va extends $a{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var d,f;switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var b;(b=r)!=null&&b.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 19:case 20:o=!0,(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 39:o=!0,Re(u.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=g(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const x=this.readSPS(u.data);e.width=x.width,e.height=x.height,e.pixelRatio=x.pixelRatio,e.codec=x.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const T in x.params)e.params[T]=x.params[T]}this.pushParameterSet(e.sps,u.data,e.vps),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const x=this.readPPS(u.data);for(const T in x)e.params[T]=x[T]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(f=r)!=null&&f.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Js(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new Js(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),s=t.readBoolean(),r=t.readBits(5),o=t.readUByte(),c=t.readUByte(),u=t.readUByte(),d=t.readUByte(),f=t.readUByte(),b=t.readUByte(),x=t.readUByte(),T=t.readUByte(),G=t.readUByte(),$=t.readUByte(),ue=t.readUByte(),_e=[],fe=[];for(let ji=0;ji<i;ji++)_e.push(t.readBoolean()),fe.push(t.readBoolean());if(i>0)for(let ji=i;ji<8;ji++)t.readBits(2);for(let ji=0;ji<i;ji++)_e[ji]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),fe[ji]&&t.readUByte();t.readUEG();const Pe=t.readUEG();Pe==3&&t.skipBits(1);const Oe=t.readUEG(),Je=t.readUEG(),Me=t.readBoolean();let ze=0,nt=0,Ne=0,At=0;Me&&(ze+=t.readUEG(),nt+=t.readUEG(),Ne+=t.readUEG(),At+=t.readUEG());const Gt=t.readUEG(),Mi=t.readUEG(),yi=t.readUEG(),di=t.readBoolean();for(let ji=di?0:i;ji<=i;ji++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let Ln=0;Ln<4;Ln++)for(let $n=0;$n<(Ln===3?2:6);$n++)if(!t.readBoolean())t.readUEG();else{const Xn=Math.min(64,1<<4+(Ln<<1));Ln>1&&t.readEG();for(let Us=0;Us<Xn;Us++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const hi=t.readUEG();let wt=0;for(let ji=0;ji<hi;ji++){let Ln=!1;if(ji!==0&&(Ln=t.readBoolean()),Ln){ji===hi&&t.readUEG(),t.readBoolean(),t.readUEG();let $n=0;for(let As=0;As<=wt;As++){const Xn=t.readBoolean();let Us=!1;Xn||(Us=t.readBoolean()),(Xn||Us)&&$n++}wt=$n}else{const $n=t.readUEG(),As=t.readUEG();wt=$n+As;for(let Xn=0;Xn<$n;Xn++)t.readUEG(),t.readBoolean();for(let Xn=0;Xn<As;Xn++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const ji=t.readUEG();for(let Ln=0;Ln<ji;Ln++){for(let $n=0;$n<yi+4;$n++)t.readBits(1);t.readBits(1)}}let xi=0,Si=1,ki=1,Gi=!0,zi=1,Qi=0;t.readBoolean(),t.readBoolean();let Dn=!1;if(t.readBoolean()){if(t.readBoolean()){const ws=t.readUByte(),Wo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Or=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];ws>0&&ws<16?(Si=Wo[ws-1],ki=Or[ws-1]):ws===255&&(Si=t.readBits(16),ki=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),Dn=t.readBoolean(),Dn&&(ze+=t.readUEG(),nt+=t.readUEG(),Ne+=t.readUEG(),At+=t.readUEG()),t.readBoolean()&&(zi=t.readBits(32),Qi=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Or=t.readBoolean(),Ho=t.readBoolean();let rr=!1;(Or||Ho)&&(rr=t.readBoolean(),rr&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),rr&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Zo=0;Zo<=i;Zo++){Gi=t.readBoolean();const ih=Gi||t.readBoolean();let zo=!1;ih?t.readEG():zo=t.readBoolean();const Yo=zo?1:t.readUEG()+1;if(Or)for(let ar=0;ar<Yo;ar++)t.readUEG(),t.readUEG(),rr&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Ho)for(let ar=0;ar<Yo;ar++)t.readUEG(),t.readUEG(),rr&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),xi=t.readUEG())}let _s=Oe,jo=Je;if(Me||Dn){let ji=1,Ln=1;Pe===1?ji=Ln=2:Pe==2&&(ji=2),_s=Oe-ji*nt-ji*ze,jo=Je-Ln*At-Ln*Ne}const eh=n?["A","B","C"][n]:"",th=o<<24|c<<16|u<<8|d;let xa=0;for(let ji=0;ji<32;ji++)xa=(xa|(th>>ji&1)<<31-ji)>>>0;let Ta=xa.toString(16);return r===1&&Ta==="2"&&(Ta="6"),{codecString:`hvc1.${eh}${r}.${Ta}.${s?"H":"L"}${ue}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,c,u,d],general_constraint_indicator_flags:[f,b,x,T,G,$],general_level_idc:ue,bit_depth:Gt+8,bit_depth_luma_minus8:Gt,bit_depth_chroma_minus8:Mi,min_spatial_segmentation_idc:xi,chroma_format_idc:Pe,frame_rate:{fixed:Gi,fps:Qi/zi}},width:_s,height:jo,pixelRatio:[Si,ki]}}readPPS(e){const t=new Js(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),s=t.readBoolean();let r=1;return s&&n?r=0:s?r=3:n&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const En=188;class fs{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=fs.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(En*5,t-En)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=En)if(e[c]===71&&(t-c===En||e[c+En]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+En*99,e.length-En)+1)),s||(s=Yr(e,c)===0),s&&o>1&&(r===0&&o>2||c+En>i))return r}else{if(o)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Ge[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=fs.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=fs.createTrack("audio",n),this._id3Track=fs.createTrack("id3"),this._txtTrack=fs.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){i||(this.sampleAes=null);let s;const r=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let d=r.pid,f=r.pesData,b=o.pid,x=c.pid,T=o.pesData,G=c.pesData,$=null,ue=this.pmtParsed,_e=this._pmtId,fe=e.length;if(this.remainderData&&(e=je(this.remainderData,e),fe=e.length,this.remainderData=null),fe<En&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const Pe=Math.max(0,fs.syncOffset(e));fe-=(fe-Pe)%En,fe<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,fe,e.buffer.byteLength-fe));let Oe=0;for(let Me=Pe;Me<fe;Me+=En)if(e[Me]===71){const ze=!!(e[Me+1]&64),nt=Yr(e,Me),Ne=(e[Me+3]&48)>>4;let At;if(Ne>1){if(At=Me+5+e[Me+4],At===Me+En)continue}else At=Me+4;switch(nt){case d:if(ze){if(f&&(s=Ps(f,this.logger))){if(this.videoParser===null)switch(r.segmentCodec){case"avc":this.videoParser=new Ga;break;case"hevc":this.videoParser=new Va;break}this.videoParser!==null&&this.videoParser.parsePES(r,u,s,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray(At,Me+En)),f.size+=Me+En-At);break;case b:if(ze){if(T&&(s=Ps(T,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s);break}T={data:[],size:0}}T&&(T.data.push(e.subarray(At,Me+En)),T.size+=Me+En-At);break;case x:ze&&(G&&(s=Ps(G,this.logger))&&this.parseID3PES(c,s),G={data:[],size:0}),G&&(G.data.push(e.subarray(At,Me+En)),G.size+=Me+En-At);break;case 0:ze&&(At+=e[At]+1),_e=this._pmtId=Nl(e,At);break;case _e:{ze&&(At+=e[At]+1);const Gt=Fl(e,At,this.typeSupported,i,this.observer,this.logger);d=Gt.videoPid,d>0&&(r.pid=d,r.segmentCodec=Gt.segmentVideoCodec),b=Gt.audioPid,b>0&&(o.pid=b,o.segmentCodec=Gt.segmentAudioCodec),x=Gt.id3Pid,x>0&&(c.pid=x),$!==null&&!ue&&(this.logger.warn(`MPEG-TS PMT found at ${Me} after unknown PID '${$}'. Backtracking to sync byte @${Pe} to parse all TS packets.`),$=null,Me=Pe-188),ue=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=nt;break}}else Oe++;Oe>0&&Xr(this.observer,new Error(`Found ${Oe} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=T,c.pesData=G;const Je={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(Je),Je}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:s}=e,r=i.pesData,o=t.pesData,c=n.pesData;let u;if(r&&(u=Ps(r,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new Ga;break;case"hevc":this.videoParser=new Va;break}this.videoParser!==null&&(this.videoParser.parsePES(i,s,u,!0),i.pesData=null)}else i.pesData=r;if(o&&(u=Ps(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;c&&(u=Ps(c,this.logger))?(this.parseID3PES(n,u),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Ml(this.observer,this.config,t);return this.decrypt(n,s)}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:s}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{i(e)}):i(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{i(e)})})}destroy(){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}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let s=t.data;if(n){this.aacOverFlow=null;const f=n.missing,b=n.sample.unit.byteLength;if(f===-1)s=je(n.sample.unit,s);else{const x=b-f;n.sample.unit.set(s.subarray(0,f),x),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!Er(s,r);r++);if(r!==i){let f;const b=r<o-1;if(b?f=`AAC PES did not start with ADTS header,offset:${r}`:f="No ADTS header found in AAC PES",Xr(this.observer,new Error(f),b,this.logger),!b)return}La(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const f=Ia(e.samplerate);c=n.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,d;for(;r<o;)if(d=Da(e,s,r,c,u),r+=d.length,d.missing){this.aacOverFlow=d;break}else for(u++;r<o-1&&!Er(s,r);r++);}parseMPEGPES(e,t){const i=t.data,n=i.length;let s=0,r=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<n;)if(Na(i,r)){const c=Oa(e,i,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(n===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=i.length;let r=0,o=0,c;for(;o<s&&(c=Ua(e,i,o,n,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=g({},t,{type:this._videoTrack?Bn.emsg:Bn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Yr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function Nl(a,e){return(a[e+10]&31)<<8|a[e+11]}function Fl(a,e,t,i,n,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(a[e+1]&15)<<8|a[e+2],c=e+3+o-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<c;){const d=Yr(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){qr("ADTS AAC",s);break}case 15:r.audioPid===-1&&(r.audioPid=d);break;case 21:r.id3Pid===-1&&(r.id3Pid=d);break;case 219:if(!i){qr("H.264",s);break}case 27:r.videoPid===-1&&(r.videoPid=d);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=d,r.segmentAudioCodec="mp3");break;case 193:if(!i){qr("AC-3",s);break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=d,r.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&f>0){let b=e+5,x=f;for(;x>2;){switch(a[b]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=d,r.segmentAudioCodec="ac3");break}const G=a[b+1]+2;b+=G,x-=G}}break;case 194:case 135:return Xr(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),r;case 36:r.videoPid===-1&&(r.videoPid=d,r.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=f+5}return r}function Xr(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function qr(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Ps(a,e){let t=0,i,n,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=je(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(n=(i[4]<<8)+i[5],n&&n>a.size-6)return null;const d=i[7];d&192&&(r=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,d&64?(o=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,r-o>60*9e4&&(e.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=i[8];let f=s+9;if(a.size<=f)return null;a.size-=f;const b=new Uint8Array(a.size);for(let x=0,T=c.length;x<T;x++){i=c[x];let G=i.byteLength;if(f)if(f>G){f-=G;continue}else i=i.subarray(f),G-=f,f=0;b.set(i,t),t+=G}return n&&(n-=s+3),{data:b,pts:r,dts:o,len:n}}return null}class Bl{static getSilentFrame(e,t){switch(e){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}}}const ps=Math.pow(2,32)-1;class Be{static init(){Be.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:[]};let e;for(e in Be.types)Be.types.hasOwnProperty(e)&&(Be.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=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]),i=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]);Be.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);Be.STTS=Be.STSC=Be.STCO=s,Be.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Be.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Be.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Be.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const r=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);Be.FTYP=Be.box(Be.types.ftyp,r,c,r,o),Be.DINF=Be.box(Be.types.dinf,Be.box(Be.types.dref,n))}static box(e,...t){let i=8,n=t.length;const s=n;for(;n--;)i+=t[n].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(e,4),n=0,i=8;n<s;n++)r.set(t[n],i),i+=t[n].byteLength;return r}static hdlr(e){return Be.box(Be.types.hdlr,Be.HDLR_TYPES[e])}static mdat(e){return Be.box(Be.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(ps+1)),n=Math.floor(t%(ps+1));return Be.box(Be.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return Be.box(Be.types.mdia,Be.mdhd(e.timescale||0,e.duration||0),Be.hdlr(e.type),Be.minf(e))}static mfhd(e){return Be.box(Be.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?Be.box(Be.types.minf,Be.box(Be.types.smhd,Be.SMHD),Be.DINF,Be.stbl(e)):Be.box(Be.types.minf,Be.box(Be.types.vmhd,Be.VMHD),Be.DINF,Be.stbl(e))}static moof(e,t,i){return Be.box(Be.types.moof,Be.mfhd(e),Be.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Be.trak(e[t]);return Be.box.apply(null,[Be.types.moov,Be.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Be.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Be.trex(e[t]);return Be.box.apply(null,[Be.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(ps+1)),n=Math.floor(t%(ps+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&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 Be.box(Be.types.mvhd,s)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,s;for(n=0;n<t.length;n++)s=t[n].flags,i[n+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return Be.box(Be.types.sdtp,i)}static stbl(e){return Be.box(Be.types.stbl,Be.stsd(e),Be.box(Be.types.stts,Be.STTS),Be.box(Be.types.stsc,Be.STSC),Be.box(Be.types.stsz,Be.STSZ),Be.box(Be.types.stco,Be.STCO))}static avc1(e){let t=[],i=[],n,s,r;for(n=0;n<e.sps.length;n++)s=e.sps[n],r=s.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(s));for(n=0;n<e.pps.length;n++)s=e.pps[n],r=s.byteLength,i.push(r>>>8&255),i.push(r&255),i=i.concat(Array.prototype.slice.call(s));const o=Be.box(Be.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),c=e.width,u=e.height,d=e.pixelRatio[0],f=e.pixelRatio[1];return Be.box(Be.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,u>>8&255,u&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]),o,Be.box(Be.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Be.box(Be.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){const t=e.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,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return Be.box(Be.types.mp4a,Be.audioStsd(e),Be.box(Be.types.esds,Be.esds(e)))}static mp3(e){return Be.box(Be.types[".mp3"],Be.audioStsd(e))}static ac3(e){return Be.box(Be.types["ac-3"],Be.audioStsd(e),Be.box(Be.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Be.box(Be.types.stsd,Be.STSD,Be.mp4a(e));if(t==="ac3"&&e.config)return Be.box(Be.types.stsd,Be.STSD,Be.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Be.box(Be.types.stsd,Be.STSD,Be.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Be.box(Be.types.stsd,Be.STSD,Be.avc1(e));if(t==="hevc"&&e.vps)return Be.box(Be.types.stsd,Be.STSD,Be.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),n=e.width||0,s=e.height||0,r=Math.floor(i/(ps+1)),o=Math.floor(i%(ps+1));return Be.box(Be.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,o>>24,o>>16&255,o>>8&255,o&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,n>>8&255,n&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const i=Be.sdtp(e),n=e.id,s=Math.floor(t/(ps+1)),r=Math.floor(t%(ps+1));return Be.box(Be.types.traf,Be.box(Be.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),Be.box(Be.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255])),Be.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Be.box(Be.types.trak,Be.tkhd(e),Be.mdia(e))}static trex(e){const t=e.id;return Be.box(Be.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],n=i.length,s=12+16*n,r=new Uint8Array(s);let o,c,u,d,f,b;for(t+=8+s,r.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<n;o++)c=i[o],u=c.duration,d=c.size,f=c.flags,b=c.cts,r.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,b>>>24&255,b>>>16&255,b>>>8&255,b&255],12+16*o);return Be.box(Be.types.trun,r)}static initSegment(e){Be.types||Be.init();const t=Be.moov(e);return je(Be.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=4,s=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),n-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let r=s.length;for(let T=0;T<i.length;T+=1){r+=3;for(let G=0;G<i[T].length;G+=1)r+=2+i[T][G].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let T=0;T<i.length;T+=1){o.set(new Uint8Array([32+T|(T===c?128:0),0,i[T].length]),r),r+=3;for(let G=0;G<i[T].length;G+=1)o.set(new Uint8Array([i[T][G].length>>8,i[T][G].length&255]),r),r+=2,o.set(i[T][G],r),r+=i[T][G].length}const u=Be.box(Be.types.hvcC,o),d=e.width,f=e.height,b=e.pixelRatio[0],x=e.pixelRatio[1];return Be.box(Be.types.hvc1,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,d>>8&255,d&255,f>>8&255,f&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]),u,Be.box(Be.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Be.box(Be.types.pasp,new Uint8Array([b>>24,b>>16&255,b>>8&255,b&255,x>>24,x>>16&255,x>>8&255,x&255])))}}Be.types=void 0,Be.HDLR_TYPES=void 0,Be.STTS=void 0,Be.STSC=void 0,Be.STCO=void 0,Be.STSZ=void 0,Be.VMHD=void 0,Be.SMHD=void 0,Be.STSD=void 0,Be.FTYP=void 0,Be.DINF=void 0;const ja=9e4;function Qr(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function Ul(a,e,t=1,i=!1){return Qr(a,e,1/t,i)}function er(a,e=!1){return Qr(a,1e3,1/ja,e)}function Kl(a,e=1){return Qr(a,ja,1/e)}const $l=10*1e3,Gl=1024,Vl=1152,jl=1536;let Os=null,Jr=null;function Wa(a,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class xr{constructor(e,t,i,n){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=e,this.config=t,this.typeSupported=i,this.logger=n,this.ISGenerated=!1,Os===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Os=r?parseInt(r[1]):0}if(Jr===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Jr=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=Un(o,i),c=o-s),c>0?s:o},i);return t&&this.logger.debug("PTS rollover detected"),n}remux(e,t,i,n,s,r,o,c){let u,d,f,b,x,T,G=s,$=s;const ue=e.pid>-1,_e=t.pid>-1,fe=t.samples.length,Pe=e.samples.length>0,Oe=o&&fe>0||fe>1;if((!ue||Pe)&&(!_e||Oe)||this.ISGenerated||o){if(this.ISGenerated){var Me,ze,nt,Ne;const yi=this.videoTrackConfig;(yi&&(t.width!==yi.width||t.height!==yi.height||((Me=t.pixelRatio)==null?void 0:Me[0])!==((ze=yi.pixelRatio)==null?void 0:ze[0])||((nt=t.pixelRatio)==null?void 0:nt[1])!==((Ne=yi.pixelRatio)==null?void 0:Ne[1]))||!yi&&Oe||this.nextAudioPts===null&&Pe)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const At=this.isVideoContiguous;let Gt=-1,Mi;if(Oe&&(Gt=Wl(t.samples),!At&&this.config.forceKeyFrameOnDiscontinuity))if(T=!0,Gt>0){this.logger.warn(`[mp4-remuxer]: Dropped ${Gt} out of ${fe} video samples due to a missing keyframe`);const yi=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Gt),t.dropped+=Gt,$+=(t.samples[0].pts-yi)/t.inputTimeScale,Mi=$}else Gt===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${fe} video samples`),T=!1);if(this.ISGenerated){if(Pe&&Oe){const yi=this.getVideoStartPts(t.samples),ri=(Un(e.samples[0].pts,yi)-yi)/t.inputTimeScale;G+=Math.max(0,ri),$+=Math.max(0,-ri)}if(Pe){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),d=this.remuxAudio(e,G,this.isAudioContiguous,r,_e||Oe||c===ce.AUDIO?$:void 0),Oe){const yi=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),f=this.generateIS(e,t,s,r)),u=this.remuxVideo(t,$,At,yi)}}else Oe&&(u=this.remuxVideo(t,$,At,0));u&&(u.firstKeyFrame=Gt,u.independent=Gt!==-1,u.firstKeyFramePTS=Mi)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(x=Ha(i,s,this._initPTS,this._initDTS)),n.samples.length&&(b=Za(n,s,this._initPTS))),{audio:d,video:u,initSegment:f,independent:T,text:b,id3:x}}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let d=!u||n,f="audio/mp4",b,x,T;if(d&&(b=x=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):Be.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(T=e.inputTimeScale,!u||T!==u.timescale?b=x=s[0].pts-Math.round(T*i):d=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Be.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(T=t.inputTimeScale,!u||T!==u.timescale){const G=this.getVideoStartPts(r),$=Math.round(T*i);x=Math.min(x,Un(r[0].dts,G)-$),b=Math.min(b,G-$)}else d=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:b,timescale:T},this._initDTS={baseTime:x,timescale:T}):b=T=void 0,{tracks:c,initPTS:b,timescale:T}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,u=this._initPTS;let d=this.nextAvcDts,f=8,b=this.videoSampleDuration,x,T,G=Number.POSITIVE_INFINITY,$=Number.NEGATIVE_INFINITY,ue=!1;if(!i||d===null){const wt=t*s,kt=r[0].pts-Un(r[0].dts,r[0].pts);Os&&d!==null&&Math.abs(wt-kt-d)<15e3?i=!0:d=wt-kt}const _e=u.baseTime*s/u.timescale;for(let wt=0;wt<c;wt++){const kt=r[wt];kt.pts=Un(kt.pts-_e,d),kt.dts=Un(kt.dts-_e,d),kt.dts<r[wt>0?wt-1:wt].dts&&(ue=!0)}ue&&r.sort(function(wt,kt){const xi=wt.dts-kt.dts,Si=wt.pts-kt.pts;return xi||Si}),x=r[0].dts,T=r[r.length-1].dts;const fe=T-x,Pe=fe?Math.round(fe/(c-1)):b||e.inputTimeScale/30;if(i){const wt=x-d,kt=wt>Pe,xi=wt<-1;if((kt||xi)&&(kt?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${er(wt,!0)} ms (${wt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${er(-wt,!0)} ms (${wt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!xi||d>=r[0].pts||Os)){x=d;const Si=r[0].pts-wt;if(kt)r[0].dts=x,r[0].pts=Si;else{let ki=!0;for(let Gi=0;Gi<r.length&&!(r[Gi].dts>Si&&ki);Gi++){const zi=r[Gi].pts;if(r[Gi].dts-=wt,r[Gi].pts-=wt,Gi<r.length-1){const Qi=r[Gi+1].pts,Dn=r[Gi].pts,kn=Qi<=Dn,_s=Qi<=zi;ki=kn==_s}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${er(Si,!0)}/${er(x,!0)}, delta: ${er(wt,!0)} ms`)}}x=Math.max(0,x);let Oe=0,Je=0,Me=x;for(let wt=0;wt<c;wt++){const kt=r[wt],xi=kt.units,Si=xi.length;let ki=0;for(let Gi=0;Gi<Si;Gi++)ki+=xi[Gi].data.length;Je+=ki,Oe+=Si,kt.length=ki,kt.dts<Me?(kt.dts=Me,Me+=Pe/4|0||1):Me=kt.dts,G=Math.min(kt.pts,G),$=Math.max(kt.pts,$)}T=r[c-1].dts;const ze=Je+4*Oe+8;let nt;try{nt=new Uint8Array(ze)}catch(wt){this.observer.emit(p.ERROR,p.ERROR,{type:he.MUX_ERROR,details:j.REMUX_ALLOC_ERROR,fatal:!1,error:wt,bytes:ze,reason:`fail allocating video mdat ${ze}`});return}const Ne=new DataView(nt.buffer);Ne.setUint32(0,ze),nt.set(Be.types.mdat,4);let At=!1,Gt=Number.POSITIVE_INFINITY,Mi=Number.POSITIVE_INFINITY,yi=Number.NEGATIVE_INFINITY,di=Number.NEGATIVE_INFINITY;for(let wt=0;wt<c;wt++){const kt=r[wt],xi=kt.units;let Si=0;for(let zi=0,Qi=xi.length;zi<Qi;zi++){const Dn=xi[zi],kn=Dn.data,_s=Dn.data.byteLength;Ne.setUint32(f,_s),f+=4,nt.set(kn,f),f+=_s,Si+=4+_s}let ki;if(wt<c-1)b=r[wt+1].dts-kt.dts,ki=r[wt+1].pts-kt.pts;else{const zi=this.config,Qi=wt>0?kt.dts-r[wt-1].dts:Pe;if(ki=wt>0?kt.pts-r[wt-1].pts:Pe,zi.stretchShortVideoTrack&&this.nextAudioPts!==null){const Dn=Math.floor(zi.maxBufferHole*s),kn=(n?G+n*s:this.nextAudioPts)-kt.pts;kn>Dn?(b=kn-Qi,b<0?b=Qi:At=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${kn/90} ms to the next segment; using duration ${b/90} ms for the last video frame.`)):b=Qi}else b=Qi}const Gi=Math.round(kt.pts-kt.dts);Gt=Math.min(Gt,b),yi=Math.max(yi,b),Mi=Math.min(Mi,ki),di=Math.max(di,ki),o.push(Wa(kt.key,b,Si,Gi))}if(o.length){if(Os){if(Os<70){const wt=o[0].flags;wt.dependsOn=2,wt.isNonSync=0}}else if(Jr&&di-Mi<yi-Gt&&Pe/yi<.025&&o[0].cts===0){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let wt=x;for(let kt=0,xi=o.length;kt<xi;kt++){const Si=wt+o[kt].duration,ki=wt+o[kt].cts;if(kt<xi-1){const Gi=Si+o[kt+1].cts;o[kt].duration=Gi-ki}else o[kt].duration=kt?o[kt-1].duration:Pe;o[kt].cts=0,wt=Si}}}b=At||!b?Pe:b,this.nextAvcDts=d=T+b,this.videoSampleDuration=b,this.isVideoContiguous=!0;const hi={data1:Be.moof(e.sequenceNumber++,x,g(e,{samples:o})),data2:nt,startPTS:G/s,endPTS:($+b)/s,startDTS:x/s,endDTS:d/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,hi}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Vl;case"ac3":return jl;default:return Gl}}remuxAudio(e,t,i,n,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,c=r/o,u=this.getSamplesPerFrame(e),d=u*c,f=this._initPTS,b=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,x=[],T=s!==void 0;let G=e.samples,$=b?0:8,ue=this.nextAudioPts||-1;const _e=t*r,fe=f.baseTime*r/f.timescale;if(this.isAudioContiguous=i=i||G.length&&ue>0&&(n&&Math.abs(_e-ue)<9e3||Math.abs(Un(G[0].pts-fe,_e)-ue)<20*d),G.forEach(function(ri){ri.pts=Un(ri.pts-fe,_e)}),!i||ue<0){if(G=G.filter(ri=>ri.pts>=0),!G.length)return;s===0?ue=0:n&&!T?ue=Math.max(0,_e):ue=G[0].pts}if(e.segmentCodec==="aac"){const ri=this.config.maxAudioFramesDrift;for(let fi=0,hi=ue;fi<G.length;fi++){const wt=G[fi],kt=wt.pts,xi=kt-hi,Si=Math.abs(1e3*xi/r);if(xi<=-ri*d&&T)fi===0&&(this.logger.warn(`Audio frame @ ${(kt/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*xi/r)} ms.`),this.nextAudioPts=ue=hi=kt);else if(xi>=ri*d&&Si<$l&&T){let ki=Math.round(xi/d);hi=kt-ki*d,hi<0&&(ki--,hi+=d),fi===0&&(this.nextAudioPts=ue=hi),this.logger.warn(`[mp4-remuxer]: Injecting ${ki} audio frame @ ${(hi/r).toFixed(3)}s due to ${Math.round(1e3*xi/r)} ms gap.`);for(let Gi=0;Gi<ki;Gi++){const zi=Math.max(hi,0);let Qi=Bl.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Qi||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Qi=wt.unit.subarray()),G.splice(fi,0,{unit:Qi,pts:zi}),hi+=d,fi++}}wt.pts=hi,hi+=d}}let Pe=null,Oe=null,Je,Me=0,ze=G.length;for(;ze--;)Me+=G[ze].unit.byteLength;for(let ri=0,fi=G.length;ri<fi;ri++){const hi=G[ri],wt=hi.unit;let kt=hi.pts;if(Oe!==null){const Si=x[ri-1];Si.duration=Math.round((kt-Oe)/c)}else if(i&&e.segmentCodec==="aac"&&(kt=ue),Pe=kt,Me>0){Me+=$;try{Je=new Uint8Array(Me)}catch(Si){this.observer.emit(p.ERROR,p.ERROR,{type:he.MUX_ERROR,details:j.REMUX_ALLOC_ERROR,fatal:!1,error:Si,bytes:Me,reason:`fail allocating audio mdat ${Me}`});return}b||(new DataView(Je.buffer).setUint32(0,Me),Je.set(Be.types.mdat,4))}else return;Je.set(wt,$);const xi=wt.byteLength;$+=xi,x.push(Wa(!0,u,xi,0)),Oe=kt}const nt=x.length;if(!nt)return;const Ne=x[x.length-1];this.nextAudioPts=ue=Oe+c*Ne.duration;const At=b?new Uint8Array(0):Be.moof(e.sequenceNumber++,Pe/c,g({},e,{samples:x}));e.samples=[];const Gt=Pe/r,Mi=ue/r,di={data1:At,data2:Je,startPTS:Gt,endPTS:Mi,startDTS:Gt,endDTS:Mi,type:"audio",hasAudio:!0,hasVideo:!1,nb:nt};return this.isAudioContiguous=!0,di}}function Un(a,e){let t;if(e===null)return a;for(e<a?t=-8589934592:t=8589934592;Math.abs(a-e)>4294967296;)a+=t;return a}function Wl(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function Ha(a,e,t,i){const n=a.samples.length;if(!n)return;const s=a.inputTimeScale;for(let o=0;o<n;o++){const c=a.samples[o];c.pts=Un(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=Un(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function Za(a,e,t){const i=a.samples.length;if(!i)return;const n=a.inputTimeScale;for(let r=0;r<i;r++){const o=a.samples[r];o.pts=Un(o.pts-t.baseTime*n/t.timescale,e*n)/n}a.samples.sort((r,o)=>r.pts-o.pts);const s=a.samples;return a.samples=[],{samples:s}}class Hl{constructor(e,t,i,n){this.logger=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.logger=n}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(U(e,n)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const n=this.initData=ke(e);n.audio&&(t=za(n.audio,v.AUDIO)),n.video&&(i=za(n.video,v.VIDEO));const s={};n.audio&&n.video?s.audiovideo={container:"video/mp4",codec:t+","+i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:n.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?s.video={container:"video/mp4",codec:i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,i,n,s,r){var o,c;let{initPTS:u,lastEndTime:d}=this;const f={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};B(d)||(d=this.lastEndTime=s||0);const b=t.samples;if(!(b!=null&&b.length))return f;const x={initPTS:void 0,timescale:1};let T=this.initData;if((o=T)!=null&&o.length||(this.generateInitSegment(b),T=this.initData),!((c=T)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1);const G=le(b,T),$=re(T,b),ue=$===null?s:$;(r||!u)&&(Zl(u,ue,s,G)||x.timescale!==u.timescale)&&(x.initPTS=ue-s,u&&u.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${u.baseTime/u.timescale} to ${x.initPTS}`),this.initPTS=u={baseTime:x.initPTS,timescale:1});const _e=e?ue-u.baseTime/u.timescale:d,fe=_e+G;De(T,b,u.baseTime/u.timescale),G>0?this.lastEndTime=fe:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Pe=!!T.audio,Oe=!!T.video;let Je="";Pe&&(Je+="audio"),Oe&&(Je+="video");const Me={data1:b,startPTS:_e,startDTS:_e,endPTS:fe,endDTS:fe,type:Je,hasAudio:Pe,hasVideo:Oe,nb:1,dropped:0};return f.audio=Me.type==="audio"?Me:void 0,f.video=Me.type!=="audio"?Me:void 0,f.initSegment=x,f.id3=Ha(i,s,u,u),n.samples.length&&(f.text=Za(n,s,u)),f}}function Zl(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>n}function za(a,e){const t=a==null?void 0:a.codec;return t&&t.length>4?t:e===v.AUDIO?t==="ec-3"||t==="ac-3"||t==="alac"?t:t==="fLaC"||t==="Opus"?ai(t,!1):(te.warn(`Unhandled audio codec "${t}" in mp4 MAP`),t||"mp4a"):(te.warn(`Unhandled video codec "${t}" in mp4 MAP`),t||"avc1")}let us;try{us=self.performance.now.bind(self.performance)}catch(a){us=Date.now}const Tr=[{demux:Ol,remux:Hl},{demux:fs,remux:xr},{demux:Dl,remux:xr},{demux:kl,remux:xr}];Tr.splice(2,0,{demux:Cl,remux:xr});class Ya{constructor(e,t,i,n,s,r){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=e,this.typeSupported=t,this.config=i,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const s=i.transmuxing;s.executeStart=us();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:u,discontinuity:d,trackSwitch:f,accurateTimeOffset:b,timeOffset:x,initSegmentChange:T}=n||o,{audioCodec:G,videoCodec:$,defaultInitPts:ue,duration:_e,initSegmentData:fe}=c,Pe=zl(r,t);if(Pe&&wn(Pe.method)){const ze=this.getDecrypter(),nt=Rn(Pe.method);if(ze.isSync()){let Ne=ze.softwareDecrypt(r,Pe.key.buffer,Pe.iv.buffer,nt);if(i.part>-1){const Gt=ze.flush();Ne=Gt&&Gt.buffer}if(!Ne)return s.executeEnd=us(),ea(i);r=new Uint8Array(Ne)}else return this.asyncResult=!0,this.decryptionPromise=ze.webCryptoDecrypt(r,Pe.key.buffer,Pe.iv.buffer,nt).then(Ne=>{const At=this.push(Ne,null,i);return this.decryptionPromise=null,At}),this.decryptionPromise}const Oe=this.needsProbing(d,f);if(Oe){const ze=this.configureTransmuxer(r);if(ze)return this.logger.warn(`[transmuxer] ${ze.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!1,error:ze,reason:ze.message}),s.executeEnd=us(),ea(i)}(d||f||T||Oe)&&this.resetInitSegment(fe,G,$,_e,t),(d||T||Oe)&&this.resetInitialTimestamp(ue),u||this.resetContiguity();const Je=this.transmux(r,Pe,x,b,i);this.asyncResult=tr(Je);const Me=this.currentTransmuxState;return Me.contiguous=!0,Me.discontinuity=!1,Me.trackSwitch=!1,s.executeEnd=us(),Je}flush(e){const t=e.transmuxing;t.executeStart=us();const{decrypter:i,currentTransmuxState:n,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:o}=n;if(i){const f=i.flush();f&&r.push(this.push(f.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=us();const f=[ea(e)];return this.asyncResult?Promise.resolve(f):f}const d=c.flush(o);return tr(d)?(this.asyncResult=!0,d.then(f=>(this.flushRemux(r,f,e),r))):(this.flushRemux(r,d,e),this.asyncResult?Promise.resolve(r):r)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===ce.MAIN?"level":"track"} ${i.level}`);const d=this.remuxer.remux(n,s,r,o,u,c,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=us()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,s){const{demuxer:r,remuxer:o}=this;!r||!o||(r.resetInitSegment(e,t,i,n),o.resetInitSegment(e,t,i,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,s){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,i,n,s):r=this.transmuxUnencrypted(e,i,n,s),r}transmuxUnencrypted(e,t,i,n){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,r,o,c,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,s){return this.demuxer.demuxSampleAes(e,t,i).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,i,n,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let s;for(let f=0,b=Tr.length;f<b;f++){var r;if((r=Tr[f].demux)!=null&&r.probe(e,this.logger)){s=Tr[f];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,u=s.remux,d=s.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(i,t,n,this.logger)),(!o||!(o instanceof d))&&(this.demuxer=new d(i,t,n,this.logger),this.probe=d.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new ln(this.config)),e}}function zl(a,e){let t=null;return a.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ea=a=>({remuxResult:{},chunkMeta:a});function tr(a){return"then"in a&&a.then instanceof Function}class Yl{constructor(e,t,i,n,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=s||null}}class Xl{constructor(e,t,i,n,s,r){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=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=s,this.initSegmentChange=r}}let Xa=0;class qa{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Xa++,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=c=>{const u=c.data,d=this.hls;if(!(!d||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var f;const b=(f=this.workerContext)==null?void 0:f.objectURL;b&&self.URL.revokeObjectURL(b);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{d.logger[u.data.logType]&&d.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,d.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const r=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===p.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new Xs,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=h(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||Jo()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=tl(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=el());const{worker:d}=this.workerContext;d.addEventListener("message",this.onWorkerMessage),d.addEventListener("error",this.onWorkerError),d.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:Lt(s)})}catch(d){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,d),this.terminateWorker(),this.error=null,this.transmuxer=new Ya(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new Ya(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Xa++;const t=this.hls.config,i=h(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Lt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),il(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,s,r,o,c,u,d){var f,b;u.transmuxing.start=self.performance.now();const{instanceNo:x,transmuxer:T}=this,G=r?r.start:s.start,$=s.decryptdata,ue=this.frag,_e=!(ue&&s.cc===ue.cc),fe=!(ue&&u.level===ue.level),Pe=ue?u.sn-ue.sn:-1,Oe=this.part?u.part-this.part.index:-1,Je=Pe===0&&u.id>1&&u.id===(ue==null?void 0:ue.stats.chunkCount),Me=!fe&&(Pe===1||Pe===0&&(Oe===1||Je&&Oe<=0)),ze=self.performance.now();(fe||Pe||s.stats.parsing.start===0)&&(s.stats.parsing.start=ze),r&&(Oe||!Me)&&(r.stats.parsing.start=ze);const nt=!(ue&&((f=s.initSegment)==null?void 0:f.url)===((b=ue.initSegment)==null?void 0:b.url)),Ne=new Xl(_e,Me,c,fe,G,nt);if(!Me||_e||nt){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===ce.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${_e}
trackSwitch: ${fe}
contiguous: ${Me}
accurateTimeOffset: ${c}
timeOffset: ${G}
initSegmentChange: ${nt}`);const At=new Yl(i,n,t,o,d);this.configureTransmuxer(At)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:x,cmd:"demux",data:e,decryptdata:$,chunkMeta:u,state:Ne},e instanceof ArrayBuffer?[e]:[]);else if(T){const At=T.push(e,$,u,Ne);tr(At)?At.then(Gt=>{this.handleTransmuxComplete(Gt)}).catch(Gt=>{this.transmuxerError(Gt,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(At)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const n=i.flush(e);tr(n)?n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Qa=100;class ql extends Sn{constructor(e,t,i){super(e,t,i,"audio-stream-controller",ce.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s}){if(i===ce.MAIN){const r=t.cc,o=this.fragCurrent;if(this.initPTS[r]={baseTime:n,timescale:s},this.log(`InitPTS for cc: ${r} found from main: ${n}/${s}`),this.mainAnchor=t,this.state===it.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==r)&&(this.nextLoadPosition=this.findSyncFrag(t).start),this.tick()}else!this.hls.hasEnoughToStart&&o&&o.cc!==r?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(t).start,o.abortRequests(),this.resetLoadingState()):this.state===it.IDLE&&this.tick()}}findSyncFrag(e){const t=this.getLevelDetails(),i=e.cc;return Li(t,i,e)||t&&ci(t.fragments,i)||e}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=it.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Qa),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=it.IDLE):this.state=it.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case it.IDLE:this.doTickIdle();break;case it.WAITING_TRACK:{const{levels:t,trackId:i}=this,n=t==null?void 0:t[i],s=n==null?void 0:n.details;if(s&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(s))break;this.state=it.WAITING_INIT_PTS}break}case it.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:n,trackId:s}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[s])||null),this.state=it.IDLE}break}case it.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:i,part:n,cache:s,complete:r}=t,o=this.mainAnchor;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.state=it.FRAG_LOADING;const c=s.flush().buffer,u={frag:i,part:n,payload:c,networkDetails:null};this._handleFragmentLoadProgress(u),r&&super._handleFragmentLoadComplete(u)}else o&&o.cc!==t.frag.cc&&(this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${o.cc}`),this.nextLoadPosition=this.findSyncFrag(o).start,this.clearWaitingFragment())}else this.state=it.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.state!==it.STOPPED&&(this.state=it.IDLE))}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:s}=this,r=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(i!=null&&i[s]))return;const o=i[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=it.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,v.AUDIO,ce.AUDIO));const d=this.getFwdBufferInfo(u,ce.AUDIO);if(d===null)return;if(!this.switchingTrack&&this._streamEnded(d,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=it.ENDED;return}const f=d.len,b=t.maxBufferLength,x=c.fragments,T=x[0].start,G=this.getLoadPosition(),$=this.flushing?G:d.end;if(this.switchingTrack&&n){const fe=G;c.PTSKnown&&fe<T&&(d.end>T||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=T+.05)}if(f>=b&&!this.switchingTrack&&$<x[x.length-1].start)return;let ue=this.getNextFragment($,c);if(ue&&this.isLoopLoading(ue,$)&&(ue=this.getNextFragmentLoopLoading(ue,c,d,ce.MAIN,b)),!ue){this.bufferFlushed=!0;return}let _e=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&_e&&ae(ue)&&!ue.endList&&(!c.live||!this.loadingParts&&$<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(_e)===Ai.OK&&(this.mainFragLoading=_e=null),_e&&ae(_e))){if(ue.start>_e.end){const Pe=this.fragmentTracker.getFragAtPos($,ce.MAIN);Pe&&Pe.end>_e.end&&(_e=Pe,this.mainFragLoading={frag:Pe,targetBufferTime:null})}if(ue.start>_e.end)return}this.loadFragment(ue,o,$)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new et(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==it.STOPPED&&(this.setInterval(Qa),this.state=it.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(p.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:s,id:r,groupId:o,track:c}=t;if(!n){this.warn(`Audio tracks reset while loading track ${r} "${c.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||s.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==it.STOPPED&&(this.state=it.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${r} "${c.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const d=n[r];let f=0;if(s.live||(i=d.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(d.details){var b;f=this.alignPlaylists(s,d.details,(b=this.levelLastLoaded)==null?void 0:b.details)}s.alignedSliding||(an(s,u),s.alignedSliding||$i(s,u),f=s.fragmentStart)}d.details=s,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===it.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=it.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{config:r,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const u=c[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const d=u.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const f=r.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let b=this.transmuxer;b||(b=this.transmuxer=new qa(this.hls,ce.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const x=this.initPTS[i.cc],T=(t=i.initSegment)==null?void 0:t.data;if(x!==void 0){const $=n?n.index:-1,ue=$!==-1,_e=new yn(i.level,i.sn,i.stats.chunkCount,s.byteLength,$,ue);b.push(s,T,f,"",i,n,d.totalduration,!1,_e,x)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:G}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Ds,complete:!1};G.push(new Uint8Array(s)),this.state!==it.STOPPED&&(this.state=it.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===ce.MAIN&&ae(t.frag)&&(this.mainFragLoading=t,this.state===it.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==ce.AUDIO){!this.audioOnly&&i.type===ce.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(ae(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,E({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=it.ERROR;return}switch(t.details){case j.FRAG_GAP:case j.FRAG_PARSING_ERROR:case j.FRAG_DECRYPT_ERROR:case j.FRAG_LOAD_ERROR:case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_ERROR:case j.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.AUDIO,t);break;case j.AUDIO_TRACK_LOAD_ERROR:case j.AUDIO_TRACK_LOAD_TIMEOUT:case j.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===it.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===me.AUDIO_TRACK&&(this.state=it.IDLE);break;case j.BUFFER_ADD_CODEC_ERROR:case j.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case j.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case j.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==v.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==v.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===it.ENDED&&(this.state=it.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,ce.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:d}=o,{details:f}=d,{audio:b,text:x,id3:T,initSegment:G}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=it.PARSING,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),G!=null&&G.tracks){const $=c.initSegment||c;this._bufferInitSegment(d,G.tracks,$,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:$,id:i,tracks:G.tracks})}if(b){const{startPTS:$,endPTS:ue,startDTS:_e,endDTS:fe}=b;u&&(u.elementaryStreams[v.AUDIO]={startPTS:$,endPTS:ue,startDTS:_e,endDTS:fe}),c.setElementaryStreamInfo(v.AUDIO,$,ue,_e,fe),this.bufferFragmentData(b,c,u,r)}if(T!=null&&(t=T.samples)!=null&&t.length){const $=g({id:i,frag:c,details:f},T);n.trigger(p.FRAG_PARSING_METADATA,$)}if(x){const $=g({id:i,frag:c,details:f},x);n.trigger(p.FRAG_PARSING_USERDATA,$)}}_bufferInitSegment(e,t,i,n){if(this.state!==it.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=ce.AUDIO;const r=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${r}/${s.codec}]`),r&&r.split(",").length===1&&(s.levelCodec=r),this.hls.trigger(p.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===Ai.NOT_LOADED||n===Ai.PARTIAL){var s;if(!ae(e))this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=it.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&$i(t.details,r)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;Qe({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,ct)||(Wt(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(p.AUDIO_TRACK_SWITCHED,E({},e))}}class ta extends H{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=t==null?void 0:t.renditionReports;if(n){let s=-1;for(let r=0;r<n.length;r++){const o=n[r];let c;try{c=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),c=o.URI||""}if(c===e){s=r;break}else c===e.substring(0,c.length)&&(s=r)}if(s!==-1){const r=n[s],o=parseInt(r["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let c=parseInt(r["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const d=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&d>t.partTarget&&(c+=1)}const u=i&&Vt(i);return new Ft(o,c>=0?c:void 0,u)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:s}=t,r=self.performance.now(),o=s.loading.first?Math.max(0,r-s.loading.first):0;n.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const d=Math.max(c||0,0);n.appliedTimelineOffset=d,n.fragments.forEach(f=>{f.start=f.playlistOffset+d})}if(n.live||i!=null&&i.live){const d="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){hr(i,n);const _e=n.playlistParsingError;if(_e){this.warn(_e);const fe=this.hls;if(!fe.config.ignorePlaylistParsingErrors){var u;const{networkDetails:Pe}=t;fe.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:_e,reason:_e.message,level:t.level||void 0,parent:(u=n.fragments[0])==null?void 0:u.type,networkDetails:Pe,stats:s});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,b=f?f.end-f.len:0,x=(n.edge-b)*1e3,T=Es(n,x);if(n.requestScheduled+T<r?n.requestScheduled=r:n.requestScheduled+=T,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let G,$,ue;if(n.canBlockReload&&n.endSN&&n.advanced){const _e=this.hls.config.lowLatencyMode,fe=n.lastPartSn,Pe=n.endSN,Oe=n.lastPartIndex,Je=Oe!==-1,Me=fe===Pe;Je?Me?($=Pe+1,ue=_e?0:Oe):($=fe,ue=_e?Oe+1:n.maxPartIndex):$=Pe+1;const ze=n.age,nt=ze+n.ageHeader;let Ne=Math.min(nt-n.partTarget,n.targetduration*1.5);if(Ne>0){if(nt>n.targetduration*3)this.log(`Playlist last advanced ${ze.toFixed(2)}s ago. Omitting segment and part directives.`),$=void 0,ue=void 0;else if(i!=null&&i.tuneInGoal&&nt-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Ne} with playlist age: ${n.age}`),Ne=0;else{const At=Math.floor(Ne/n.targetduration);if($+=At,ue!==void 0){const Gt=Math.round(Ne%n.targetduration/n.partTarget);ue+=Gt}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${ze.toFixed(2)}s goal: ${Ne} skip sn ${At} to part ${ue}`)}n.tuneInGoal=Ne}if(G=this.getDeliveryDirectives(n,t.deliveryDirectives,$,ue),_e||!Me){n.requestScheduled=r,this.loadingPlaylist(d,G);return}}else(n.canBlockReload||n.canSkipUntil)&&(G=this.getDeliveryDirectives(n,t.deliveryDirectives,$,ue));G&&$!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(T-o*2,T/2)),this.scheduleLoading(d,G,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n){this.loadingPlaylist(e,t);return}const s=self.performance.now(),r=n.requestScheduled;if(s>=r){this.loadingPlaylist(e,t);return}const o=r-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,i,n){let s=Vt(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=bt.No),new Ft(i,n,s)}checkRetry(e){const t=e.details,i=Pi(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===Ci.RetryRequest||!n.resolved&&s===Ci.SendAlternateToPenaltyBox);if(c){var u;if(r>=o.maxNumRetry)return!1;if(i&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const d=bi(o,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),d),this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" in ${d}ms`)}e.levelRetry=!0,n.resolved=!0}return c}}function Ja(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!ir(a[t].attrs,e[t].attrs))return!1;return!0}function ir(a,e,t){const i=a["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(n=>a[n]!==e[n])}function ia(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class Ql extends ta{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Audio track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(n==null?void 0:n.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(b=>!i||i.indexOf(b.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(b=>b.default)&&(this.selectDefaultTrack=!1),o.forEach((b,x)=>{b.id=x});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const b=Ce(c,o,ct);if(b>-1)s=o[b];else{const x=Ce(c,this.tracks);s=this.tracks[x]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const d={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(p.AUDIO_TRACKS_UPDATED,d);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var r;const b=new Error(`No audio track selected for current audio group-ID(s): ${(r=this.groupIds)==null?void 0:r.join(",")} track count: ${o.length}`);this.warn(b.message),this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:b})}}}onError(e,t){t.fatal||!t.context||t.context.type===me.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&Qe(e,n,ct))return n;const s=Ce(e,this.tracksInGroup,ct);if(s>-1){const r=this.tracksInGroup[s];return this.setAudioTrack(s),r}else if(n){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const o=lt(e,t.levels,i,r,ct);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=Ce(e,i);if(r>-1)return i[r]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],s=n.details&&!n.details.live;if(e===this.trackId&&n===i&&s||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,E({},n)),s))return;const r=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(!(this.selectDefaultTrack&&!n.default)&&(!e||Qe(e,n,ct)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const d=t[u];if(Qe({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},d,ct))return u}for(let u=0;u<t.length;u++){const d=t[u];if(ir(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const d=t[u];if(ir(e.attrs,d.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Wt(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}}class Jl{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];n.push(e),n.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(s){var i;if(n.onError(s),this.queues===null||this.tracks===null)return;const r=(i=this.tracks[e])==null?void 0:i.buffer;r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],n=i==null?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const eo=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,to="HlsJsTrackRemovedError";class eu extends Error{constructor(e){super(e),this.name=to}}class tu extends H{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:n,mediaSource:s}=this;i&&this.log("Media source opened"),!(!n||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:n,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:n}=this;i!==n&&this.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=Le(ge(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){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}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this),e.off(p.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const r=this.isQueued();(s||r)&&this.warn(`Transfering MediaSource with${r?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?g(i,n.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(i[r]=g({},this.tracks[r]),this.removeBuffer(r)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media,n=ge(this.appendSource);if(this.transferData=this.overrides=void 0,i&&n){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),s)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&r instanceof c,io(i),iu(i,o),i.load()}catch(c){i.src=o}else i.src=o}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,s=n?Object.keys(n):null,r=s?s.length:0,o=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(n&&s&&r){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: ${Lt(i,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${Lt(n,(c,u)=>c==="initSegment"?void 0:u)}}`),!xe(n,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,u=this.details,d=Math.max(c,(u==null?void 0:u.fragments[0].start)||0);if(d-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${d}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${d} currentTime: ${c}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=d;return}this.transferData=void 0,s.forEach(c=>{const u=c,d=n[u];if(d){const f=d.buffer;if(f){const b=this.fragmentTracker,x=d.id;if(b.hasFragments(x)||b.hasParts(x)){const $=pi.getBuffered(f);b.detectEvictedFragments(u,$,x,null,!0)}const T=na(u),G=[u,f];this.sourceBuffers[T]=G,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,d)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=s.readyState==="open";try{const c=s.sourceBuffers;for(let u=c.length;u--;)o&&c[u].abort(),s.removeSourceBuffer(c[u]);o&&s.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(n.removeAttribute("src"),this.appendSource&&io(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(p.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[na(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Jl(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),r=!s&&this.sourceBufferCount&&this.media&&n.some(o=>!i[o]);if(s||r){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${n}" SourceBuffers`);return}n.forEach(o=>{var c,u,d;const f=t[o],{id:b,codec:x,levelCodec:T,container:G,metadata:$,supplemental:ue}=f;let _e=i[o];const fe=(c=this.transferData)==null||(u=c.tracks)==null?void 0:u[o],Pe=fe!=null&&fe.buffer?fe:_e,Oe=(Pe==null?void 0:Pe.pendingCodec)||(Pe==null?void 0:Pe.codec),Je=Pe==null?void 0:Pe.levelCodec;_e||(_e=i[o]={buffer:void 0,listeners:[],codec:x,supplemental:ue,container:G,levelCodec:T,metadata:$,id:b});const Me=qt(Oe,Je),ze=Me==null?void 0:Me.replace(eo,"$1");let nt=qt(x,T);const Ne=(d=nt)==null?void 0:d.replace(eo,"$1");nt&&Me&&ze!==Ne&&(o.slice(0,5)==="audio"&&(nt=ai(nt,this.appendSource)),this.log(`switching codec ${Oe} to ${nt}`),nt!==(_e.pendingCodec||_e.codec)&&(_e.pendingCodec=nt),_e.container=G,this.appendChangeType(o,G,nt))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,s={label:`change-type=${n}`,execute:()=>{const r=this.tracks[e];if(r){const o=r.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),o.changeType(n),r.codec=i,r.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{this.warn(`Failed to change ${e} SourceBuffer type`,r)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,ce.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&pi.isBuffered(c.buffer,n)||((o=this.fragmentTracker.getAppendedFrag(n,ce.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:n,type:s,parent:r,frag:o,part:c,chunkMeta:u}=t,d=u.buffering[s],f=o.sn,b=self.performance.now();d.start=b;const x=o.stats.buffering,T=c?c.stats.buffering:null;x.start===0&&(x.start=b),T&&T.start===0&&(T.start=b);const G=i.audio;let $=!1;s==="audio"&&(G==null?void 0:G.container)==="audio/mpeg"&&($=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const ue=this.tracks.video,_e=ue==null?void 0:ue.buffer;if(_e&&f!=="initSegment"){const Oe=c||o,Je=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend){const ze=Oe.start+Oe.duration*.05,nt=_e.buffered,Ne=this.currentOp("video");!nt.length&&!Ne?this.blockAudio(Oe):!Ne&&!pi.isBuffered(_e,ze)&&this.lastVideoAppendEnd<ze&&this.blockAudio(Oe)}else if(s==="video"){const Me=Oe.end;if(Je){const ze=Je.frag.start;(Me>ze||Me<this.lastVideoAppendEnd||pi.isBuffered(_e,ze))&&this.unblockAudio()}this.lastVideoAppendEnd=Me}}const fe=(c||o).start,Pe={label:`append-${s}`,execute:()=>{if(d.executeStart=self.performance.now(),$){const Oe=this.tracks[s];if(Oe){const Je=Oe.buffer;if(Je){const Me=fe-Je.timestampOffset;Math.abs(Me)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${fe} (delta: ${Me}) sn: ${f})`),Je.timestampOffset=fe)}}}this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const Oe=self.performance.now();d.executeEnd=d.end=Oe,x.first===0&&(x.first=Oe),T&&T.first===0&&(T.first=Oe);const Je={};this.sourceBuffers.forEach(([Me,ze])=>{Me&&(Je[Me]=pi.getBuffered(ze))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:s,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:Je})},onError:Oe=>{var Je;const Me={type:he.MEDIA_ERROR,parent:o.type,details:j.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:Oe,err:Oe,fatal:!1},ze=(Je=this.media)==null?void 0:Je.error;if(Oe.code===DOMException.QUOTA_EXCEEDED_ERR)Me.details=j.BUFFER_FULL_ERROR;else if(Oe.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!ze)Me.errorAction=Vi(!0);else if(Oe.name===to&&this.sourceBufferCount===0)Me.errorAction=Vi(!0);else{const nt=++this.appendErrors[s];this.warn(`Failed ${nt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${ze||"no media error"})`),(nt>=this.hls.config.appendErrorMaxRetry||ze)&&(Me.fatal=!0)}this.hls.trigger(p.ERROR,Me)}};this.append(Pe,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:s}=t;i?this.append(this.getFlushOp(i,n,s),i):this.sourceBuffers.forEach(([r])=>{r&&this.append(this.getFlushOp(r,n,s),r)})}onFragParsed(e,t){const{frag:i,part:n}=t,s=[],r=n?n.elementaryStreams:i.elementaryStreams;r[v.AUDIOVIDEO]?s.push("audiovideo"):(r[v.AUDIO]&&s.push("audio"),r[v.VIDEO]&&s.push("video"));const o=()=>{const c=self.performance.now();i.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const u=n?n.stats:i.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:i,part:n,stats:u,id:i.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,s).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t,i;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((i=this.tracks[e])==null?void 0:i.ending))})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([r])=>{if(r){const o=this.tracks[r];(!t.type||t.type===r)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${r} buffer reached EOS`)))}});const n=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([r])=>{var o;return r&&!((o=this.tracks[r])!=null&&o.ended)})&&(n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream(),this.hls.trigger(p.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(p.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){const e=this.getDurationAndRange();e&&this.blockUntilOpen(()=>this.updateMediaSource(e))}onError(e,t){if(t.details===j.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;B(n)&&n!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const n=e.config,s=i.currentTime,r=t.levelTargetDuration,o=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(B(o)&&o>=0){const c=Math.max(o,r),u=Math.floor(s/r)*r-c;this.flushBackBuffer(s,r,u)}if(B(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),u=Math.max(c,r),d=Math.floor(s/r)*r+u;this.flushFrontBuffer(s,r,d)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const o=pi.getBuffered(s);if(o.length>0&&i>o.start(0)){var r;this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:i});const c=this.tracks[n];if((r=this.details)!=null&&r.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(c!=null&&c.ended){this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:n})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const r=pi.getBuffered(s),o=r.length;if(o<2)return;const c=r.start(o-1),u=r.end(o-1);if(i>c||e>=c&&e<=u)return;this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||(i==null?void 0:i.readyState)!=="open")return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&i.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),d=Math.max(u,n);return{duration:1/0,start:u,end:d}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return B(s)?{duration:s}:null;const r=this.media.duration,o=B(i.duration)?i.duration:0;return n>o&&n>r||!B(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(B(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${i}.`),n.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Lt(i)}`),this.tracksReady){var n;const s=(n=this.transferData)==null?void 0:n.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger(p.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const r=s,o=e[r];if(this.isPending(o)){const c=this.getTrackCodec(o,r),u=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(r)?" Queued":""} ${Lt(o)}`);try{const d=i.addSourceBuffer(u),f=na(r),b=[r,d];t[f]=b,o.buffer=d}catch(d){var n;this.error(`error while trying to add sourceBuffer: ${d.message}`),this.shiftAndExecuteNext(r),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[r],this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,sourceBufferName:r,mimeType:u,parent:o.id});return}this.trackSourceBuffer(r,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&(t==="video"||t==="audiovideo")&&Et(i,"video")&&(n=St(n,i));const s=qt(n,e.levelCodec);return s?t.slice(0,5)==="audio"?ai(s,this.appendSource):s:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,r)=>{const o=r.removedRanges;o!=null&&o.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const s=this.currentOp(e);s&&s.onError(n)}removeExecutor(e,t,i){const{media:n,mediaSource:s}=this,r=this.tracks[e],o=r==null?void 0:r.buffer;if(!n||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=B(n.duration)?n.duration:1/0,u=B(s.duration)?s.duration:1/0,d=Math.max(0,t),f=Math.min(i,c,u);f>d&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${d},${f}] from the ${e} SourceBuffer`),o.remove(d,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i==null?void 0:i.buffer;if(!n)throw new eu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(r=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const s=n.buffer;if(!s)return;const r=i.bind(this,e);n.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function io(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function iu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function na(a){return a==="audio"?1:0}class sa{constructor(e){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=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&B(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((n,s)=>this.isLevelAllowed(n)&&s<=e);return this.clientRect=null,sa.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const n=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let s=e.length-1;const r=Math.max(t,i);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=r||c.height>=r)&&n(c,e[o+1])){s=o;break}}return s}}const Cn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},nu={HLS:"h"},nr={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},su={[nr.OBJECT]:["br","d","ot","tb"],[nr.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[nr.SESSION]:["cid","pr","sf","sid","st","v"],[nr.STATUS]:["bs","rtp"]};class Ms{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Ms?i:new Ms(i))),this.value=e,this.params=t}}const ru="Dict";function au(a){return Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":typeof a=="object"?JSON.stringify(a):String(a)}function ou(a,e,t,i){return new Error(`failed to ${a} "${au(e)}" as ${t}`,{cause:i})}function ss(a,e,t){return ou("serialize",a,e,t)}class no{constructor(e){this.description=e}}const so="Bare Item",lu="Boolean";function uu(a){if(typeof a!="boolean")throw ss(a,lu);return a?"?1":"?0"}const cu="Byte Sequence";function hu(a){if(ArrayBuffer.isView(a)===!1)throw ss(a,cu);return`:${dl(a)}:`}const du="Integer";function fu(a){return a<-999999999999999||999999999999999<a}function ro(a){if(fu(a))throw ss(a,du);return a.toString()}function pu(a){return`@${ro(a.getTime()/1e3)}`}const mu="Decimal";function gu(a){const e=Ca(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ss(a,mu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const _u="String",vu=/[\x00-\x1f\x7f]+/;function yu(a){if(vu.test(a))throw ss(a,_u);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Eu(a){return a.description||a.toString().slice(7,-1)}const bu="Token";function ao(a){const e=Eu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ss(e,bu);return e}function ra(a){switch(typeof a){case"number":if(!B(a))throw ss(a,so);return Number.isInteger(a)?ro(a):gu(a);case"string":return yu(a);case"symbol":return ao(a);case"boolean":return uu(a);case"object":if(a instanceof Date)return pu(a);if(a instanceof Uint8Array)return hu(a);if(a instanceof no)return ao(a);default:throw ss(a,so)}}const Su="Key";function aa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw ss(a,Su);return a}function oa(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${aa(e)}`:`;${aa(e)}=${ra(t)}`).join("")}function oo(a){return a instanceof Ms?`${ra(a.value)}${oa(a.params)}`:ra(a)}function xu(a){return`(${a.value.map(oo).join(" ")})${oa(a.params)}`}function Tu(a,e={whitespace:!0}){if(typeof a!="object")throw ss(a,ru);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof Ms||(s=new Ms(s));let r=aa(n);return s.value===!0?r+=oa(s.params):(r+="=",Array.isArray(s.value)?r+=xu(s):r+=oo(s)),r}).join(`,${i}`)}function Au(a,e){return Tu(a,e)}function wu(a){return a==="ot"||a==="sf"||a==="st"}function Ru(a){return typeof a=="number"?B(a):a!=null&&a!==""&&a!==!1}const Ar=a=>Math.round(a),Lu=(a,e)=>(e!=null&&e.baseUrl&&(a=fl(a,e.baseUrl)),encodeURIComponent(a)),wr=a=>Ar(a/100)*100,Iu={br:Ar,d:Ar,bl:wr,dl:wr,mtp:wr,nor:Lu,rtp:wr,tb:Ar};function Du(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=g({},Iu,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return i.forEach(r=>{if(s!=null&&s(r))return;let o=a[r];const c=n[r];c&&(o=c(o,e)),!(r==="v"&&o===1)&&(r=="pr"&&o===1||Ru(o)&&(wu(r)&&typeof o=="string"&&(o=new no(o)),t[r]=o))}),t}function lo(a,e={}){return a?Au(Du(a,e),g({whitespace:!1},e)):""}function Cu(a,e={}){const t={};if(!a)return t;const i=Object.entries(a),n=Object.entries(su).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((r,o)=>{var c,u;const[d,f]=o,b=((c=n.find(x=>x[1].includes(d)))===null||c===void 0?void 0:c[0])||nr.REQUEST;return(u=r[b])!==null&&u!==void 0||(r[b]={}),r[b][d]=f,r},{});return Object.entries(s).reduce((r,[o,c])=>(r[o]=lo(c,e),r),t)}function ku(a,e,t){return g(a,Cu(e,t))}const Pu="CMCD";function Ou(a,e={}){if(!a)return"";const t=lo(a,e);return`${Pu}=${encodeURIComponent(t)}`}const uo=/CMCD=[^&#]+/;function Mu(a,e,t){const i=Ou(e,t);if(!i)return a;if(uo.test(a))return a.replace(uo,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Nu{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:Cn.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=n=>{try{const{frag:s,part:r}=n,o=this.hls.levels[s.level],c=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:c};(c===Cn.VIDEO||c===Cn.AUDIO||c==Cn.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const d=r?this.getNextPart(r):this.getNextFrag(s);d!=null&&d.url&&d.url!==s.url&&(u.nor=d.url),this.apply(n,u)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:nu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){g(t,this.createData());const i=t.ot===Cn.INIT||t.ot===Cn.VIDEO||t.ot===Cn.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((r,o)=>(n.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),ku(e.headers,t,s)):e.url=Mu(e.url,t,s)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t,i;const{index:n,fragment:s}=e,r=(t=this.hls.levels[s.level])==null||(i=t.details)==null?void 0:i.partList;if(r){const{sn:o}=s;for(let c=r.length-1;c>=0;c--){const u=r[c];if(u.index===n&&u.fragment.sn===o)return r[c+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Cn.TIMED_TEXT;if(e.sn==="initSegment")return Cn.INIT;if(t==="audio")return Cn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Cn.VIDEO:Cn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Cn.AUDIO)i=n.audioTracks;else{const s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;i=n.levels.slice(0,r)}for(const s of i)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Cn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:pi.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}}const Fu=3e5;class Bu extends H{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===Ci.SendAlternateToPenaltyBox&&i.flags===Ii.MoveAllAlternatesMatchingHost){const n=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&n?r=this.getPathwayForGroupId(o,u,r):c&&(r=c)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&n&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${n&&n.length} priorities: ${Lt(s)} penalized: ${Lt(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(s=>{n-i[s]>Fu&&delete i[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in i)continue;if(r===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,Zs(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];c&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let s=0;s<n.length;s++)if(t===me.AUDIO_TRACK&&n[s].hasAudioGroup(e)||t===me.SUBTITLE_TRACK&&n[s].hasSubtitleGroup(e))return n[s].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};e.forEach(s=>{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":c}=s;if(t.some(d=>d.pathwayId===r))return;const u=this.getLevelsForPathway(o).map(d=>{const f=new Wi(d.attrs);f["PATHWAY-ID"]=r;const b=f.AUDIO&&`${f.AUDIO}_clone_${r}`,x=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;b&&(i[f.AUDIO]=b,f.AUDIO=b),x&&(n[f.SUBTITLES]=x,f.SUBTITLES=x);const T=ho(d.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),G=new et({attrs:f,audioCodec:d.audioCodec,bitrate:d.bitrate,height:d.height,name:d.name,url:T,videoCodec:d.videoCodec,width:d.width});if(d.audioGroups)for(let $=1;$<d.audioGroups.length;$++)G.addGroupId("audio",`${d.audioGroups[$]}_clone_${r}`);if(d.subtitleGroups)for(let $=1;$<d.subtitleGroups.length;$++)G.addGroupId("text",`${d.subtitleGroups[$]}_clone_${r}`);return G});t.push(...u),co(this.audioTracks,i,c,r),co(this.subtitleTracks,n,c,r)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let n;try{n=new self.URL(e)}catch(d){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const d=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+d)}const s={responseType:"json",url:n.href},r=t.steeringManifestLoadPolicy.default,o=r.errorRetry||r.timeoutRetry||{},c={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(d,f,b,x)=>{this.log(`Loaded steering manifest: "${n}"`);const T=d.data;if((T==null?void 0:T.VERSION)!==1){this.log(`Steering VERSION ${T.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=T.TTL;const{"RELOAD-URI":G,"PATHWAY-CLONES":$,"PATHWAY-PRIORITY":ue}=T;if(G)try{this.uri=new self.URL(G,n).href}catch(fe){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${G}`);return}this.scheduleRefresh(this.uri||b.url),$&&this.clonePathways($);const _e={steeringManifest:T,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,_e),ue&&this.updatePathwayPriority(ue)},onError:(d,f,b,x)=>{if(this.log(`Error loading steering manifest: ${d.code} ${d.text} (${f.url})`),this.stopLoad(),d.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let T=this.timeToLoad*1e3;if(d.code===429){const G=this.loader;if(typeof(G==null?void 0:G.getResponseHeader)=="function"){const $=G.getResponseHeader("Retry-After");$&&(T=parseFloat($)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,T)},onTimeout:(d,f,b)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(s,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const n=(i=this.hls)==null?void 0:i.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function co(a,e,t,i){a&&Object.keys(e).forEach(n=>{const s=a.filter(r=>r.groupId===n).map(r=>{const o=g({},r);return o.details=void 0,o.attrs=new Wi(o.attrs),o.url=o.attrs.URI=ho(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[n],o.attrs["PATHWAY-ID"]=i,o});a.push(...s)})}function ho(a,e,t,i){const{HOST:n,PARAMS:s,[t]:r}=i;let o;e&&(o=r==null?void 0:r[e],o&&(a=o));const c=new self.URL(a);return n&&!o&&(c.host=n),s&&Object.keys(s).sort().forEach(u=>{u&&c.searchParams.set(u,s[u])}),c.href}class Ns extends H{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Ns.CDMCleanupPromise?[Ns.CDMCleanupPromise]:[],this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,s=`"${t.type}" event: init data type: "${i}"`;if(this.debug(s),n!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=ni(this.config));const o=r.map(Hn).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=Wn(r);let c,u;if(i==="sinf"){if(o!==Di.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const T=ft(new Uint8Array(n));try{const G=un(JSON.parse(T).sinf),$=W(G);if(!$)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array($.subarray(8,24)),u=Di.FAIRPLAY}catch(G){this.warn(`${s} Failed to parse sinf: ${G}`);return}}else{if(o!==Di.WIDEVINE&&o!==Di.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const T=jt(n),G=T.filter(ue=>!!ue.systemId&&os(ue.systemId)===o);G.length>1&&this.warn(`${s} Using first of ${G.length} pssh found for selected key-system ${o}`);const $=G[0];if(!$){T.length===0||T.some(ue=>!ue.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${T.map(ue=>os(ue.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(u=os($.systemId),$.version===0&&$.data)if(u===Di.WIDEVINE){const ue=$.data.length-22;c=new Uint8Array($.data.subarray(ue,ue+16))}else u===Di.PLAYREADY&&(c=ls($.data))}if(!u||!c)return;const d=J.hexDump(c),{keyIdToKeySessionPromise:f,mediaKeySessions:b}=this;let x=f[d];for(let T=0;T<b.length;T++){const G=b[T],$=G.decryptdata;if(!$.keyId)continue;const ue=J.hexDump($.keyId);if(d===ue||$.uri.replace(/-/g,"").indexOf(d)!==-1){if(x=f[ue],$.pssh)break;delete f[ue],$.pssh=new Uint8Array(n),$.keyId=c,x=f[d]=x.then(()=>this.generateRequestWithPreferredKeySession(G,i,n,"encrypted-event-key-match")),x.catch(_e=>this.handleError(_e));break}}if(!x){if(u!==o){this.log(`Ignoring "${t.type}" event with ${u} init data for selected key-system ${o}`);return}x=f[d]=this.getKeySystemSelectionPromise([u]).then(({keySystem:T,mediaKeys:G})=>{var $;this.throwIfDestroyed();const ue=new bn("ISO-23001-7",d,($=Hn(T))!=null?$:"");return ue.pssh=new Uint8Array(n),ue.keyId=c,this.attemptSetMediaKeys(T,G).then(()=>{this.throwIfDestroyed();const _e=this.createMediaKeySessionContext({decryptdata:ue,keySystem:T,mediaKeys:G});return this.generateRequestWithPreferredKeySession(_e,i,n,"encrypted-event-no-match")})}),x.catch(T=>this.handleError(T))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){const e=this.media;this.unregisterListeners(),this.onMediaDetached(),this._clear(e);const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===Di.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(r,o,c)=>!!r&&c.indexOf(r)===o,n=t.map(r=>r.audioCodec).filter(i),s=t.map(r=>r.videoCodec).filter(i);return n.length+s.length===0&&s.push("avc1.42e01e"),new Promise((r,o)=>{const c=u=>{const d=u.shift();this.getMediaKeysPromise(d,n,s).then(f=>r({keySystem:d,mediaKeys:f})).catch(f=>{u.length?c(u):f instanceof Kn?o(f):o(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return vi===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){const n=Hi(e,t,i,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let r=s==null?void 0:s.keySystemAccess;if(!r){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Lt(n)}`),r=this.requestMediaKeySystemAccess(e,n);const o=this.keySystemAccessPromises[e]={keySystemAccess:r};return r.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),r.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const u=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=c.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),u.then(f=>f?this.setMediaKeysServerCertificate(d,e,f):d))),o.mediaKeys.catch(d=>{this.error(`Failed to create media-keys for "${e}"}: ${d}`)}),o.mediaKeys})}return r.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${J.hexDump(e.keyId||[])}`);const n=i.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,s,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return J.hexDump(e.keyId)}updateKeySession(e,t){var i;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${J.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
} (data length: ${t&&t.byteLength})`),n.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const n=ni(this.config),s=e.map(Wn).filter(r=>!!r&&n.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:r})=>{const o=Hn(r);o?t(o):i(new Error(`Unable to find format for key-system "${r}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);let s=this.keyIdToKeySessionPromise[i];return s||(s=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(o,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:o,mediaKeys:c,decryptdata:t}))))),(this.keyIdToKeySessionPromise[i]=s.then(o=>{const c="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(o,c,u,"playlist-key")})).catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Kn?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=Wn(e.keyFormat),s=n?[n]:ni(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=ni(this.config)),e.length===0)throw new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Lt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>i.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var s,r;const o=(s=this.config.drmSystems)==null||(r=s[e.keySystem])==null?void 0:r.generateRequest;if(o)try{const T=o.call(this.hls,t,i,e);if(!T)throw new Error("Invalid response from configured generateRequest filter");t=T.initDataType,i=T.initData?T.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(T){var c;if(this.warn(T.message),(c=this.hls)!=null&&c.config.debug)throw T}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${u} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new Xs,f=e._onmessage=T=>{const G=e.mediaKeysSession;if(!G){d.emit("error",new Error("invalid state"));return}const{messageType:$,message:ue}=T;this.log(`"${$}" message event for session "${G.sessionId}" message size: ${ue.byteLength}`),$==="license-request"||$==="license-renewal"?this.renewLicense(e,ue).catch(_e=>{d.eventNames().length?d.emit("error",_e):this.handleError(_e)}):$==="license-release"?e.keySystem===Di.FAIRPLAY&&(this.updateKeySession(e,In("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${$}"`)},b=e._onkeystatuseschange=T=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const $=e.keyStatus;d.emit("keyStatus",$),$==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",f),e.mediaKeysSession.addEventListener("keystatuseschange",b);const x=new Promise((T,G)=>{d.on("error",G),d.on("keyStatus",$=>{$.startsWith("usable")?T():$==="output-restricted"?G(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):$==="internal-error"?G(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${$}"`)):$==="expired"?G(new Error("key expired while generating request")):this.warn(`unhandled key status change "${$}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var T;this.log(`Request generated for key-session "${(T=e.mediaKeysSession)==null?void 0:T.sessionId}" keyId: ${u}`)}).catch(T=>{throw new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_SESSION,error:T,fatal:!1},`Error generating key-session request: ${T}`)}).then(()=>x).catch(T=>{throw d.removeAllListeners(),this.removeSession(e),T}).then(()=>(d.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{if(typeof i=="string"&&typeof t=="object"){const n=i;i=t,t=n}this.log(`key status change "${t}" for keyStatuses keyId: ${J.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${J.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,o)=>{const c={responseType:"arraybuffer",url:s},u=t.certLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(b,x,T,G)=>{r(b.data)},onError:(b,x,T,G)=>{o(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:T,response:E({url:c.url,data:void 0},b)},`"${e}" certificate request failed (${s}). Status: ${b.code} (${b.text})`))},onTimeout:(b,x,T)=>{o(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:T,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(b,x,T)=>{o(new Error("aborted"))}};n.load(c,d,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,s)=>{e.setServerCertificate(i).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),n(e)}).catch(r=>{s(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:n,fatal:!0},n.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(i,"application/xml"),s=n.querySelectorAll("HttpHeader");if(s.length>0){let d;for(let f=0,b=s.length;f<b;f++){var r,o;d=s[f];const x=(r=d.querySelector("name"))==null?void 0:r.textContent,T=(o=d.querySelector("value"))==null?void 0:o.textContent;x&&T&&e.setRequestHeader(x,T)}}const c=n.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return In(atob(u))}setupLicenseXHR(e,t,i,n){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,i,n)}).catch(r=>{if(!i.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,i,n)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,s)=>{const r=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${r}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let c=o.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const u=this.config.licenseResponseCallback;if(u)try{c=u.call(this.hls,o,r,e)}catch(d){this.error(d)}n(c)}else{const c=i.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:r,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${r}). Status: ${o.status} (${o.statusText})`));else{const d=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${d} attempts left`),this.requestLicense(e,t).then(n,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,r,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==Di.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null)}_clear(e){var t;const i=this.mediaKeySessions;this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},bn.clearKeyUriToKeyIdMap();const n=i.length;Ns.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(e==null||(t=e.setMediaKeys(null))==null?void 0:t.catch(s=>{var r;this.log(`Could not clear media keys: ${s}`),(r=this.hls)==null||r.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).then(()=>{n&&(this.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(s=>{var r;this.log(`Could not close sessions and clear media keys: ${s}`),(r=this.hls)==null||r.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,s)=>(n.indexOf(s.keyFormat)===-1&&n.push(s.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{drmSystemOptions:s}=this.config;return(qi(s)?new Promise((o,c)=>{self.setTimeout(()=>c(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(o)}):Promise.resolve()).catch(o=>{var c;this.log(`Could not remove session: ${o}`),(c=this.hls)==null||c.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${o}`)})}).then(()=>t.close()).catch(o=>{var c;this.log(`Could not close session: ${o}`),(c=this.hls)==null||c.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}}}Ns.CDMCleanupPromise=void 0;class Kn extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class Uu{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const s=n-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),c>0&&r>u.config.fpsDroppedMonitoringThreshold*o){let d=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=d)&&(d=d-1,u.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:u.currentLevel}),u.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function fo(a,e){let t;try{t=new Event("addtrack")}catch(i){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function po(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){te.debug(`[texttrack-utils]: ${i}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,a.addCue(n)}catch(n){te.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function Fs(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let i=a.cues.length;i--;)e&&a.cues[i].removeEventListener("enter",e),a.removeCue(a.cues[i]);t==="disabled"&&(a.mode=t)}function la(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=$u(a.cues,e,t);for(let r=0;r<s.length;r++)(!i||i(s[r]))&&a.removeCue(s[r])}n==="disabled"&&(a.mode=n)}function Ku(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let i=0,n=t,s;for(;i<=n;)if(s=Math.floor((n+i)/2),e<a[s].startTime)n=s-1;else if(e>a[s].startTime&&i<t)i=s+1;else return s;return a[i].startTime-e<e-a[n].startTime?i:n}function $u(a,e,t){const i=[],n=Ku(a,e);if(n>-1)for(let s=n,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Rr(a){const e=[];for(let t=0;t<a.length;t++){const i=a[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(a[t])}return e}class Gu extends ta{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Rr(this.media.textTracks);for(let s=0;s<i.length;s++)if(i[s].mode==="hidden")t=i[s];else if(i[s].mode==="showing"){t=i[s];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;Rr(i.textTracks).forEach(r=>{Fs(r)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(r=>(n==null?void 0:n.indexOf(r))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(d=>!i||i.indexOf(d.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(d=>d.default)&&(this.selectDefaultTrack=!1),r.forEach((d,f)=>{d.id=f});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=r;const o=this.hls.config.subtitlePreference;if(!s&&o){this.selectDefaultTrack=!1;const d=Ce(o,r);if(d>-1)s=r[d];else{const f=Ce(o,this.tracks);s=this.tracks[f]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const u={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const s=t[n];if(!(i&&!s.default||!i&&!e)&&(!e||Qe(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(ir(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(ir(e.attrs,s.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(ia(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===me.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&Qe(e,i))return i;const n=Ce(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=Ce(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Rr(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>ia(i,s))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==n&&(s.mode="disabled")}),n){const s=this.subtitleDisplay?"showing":"hidden";n.mode!==s&&(n.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!B(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&s)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:r,groupId:o="",name:c,type:u,url:d}=n;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:d});const f=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(f)}}function sr(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Bs=.025;let Lr=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Vu(a,e,t){return`${a.identifier}-${t+1}-${sr(e)}`}class ju{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){if(e>=this.assetList.length)return!0;const t=this.playoutLimit;return e<=0||isNaN(t)?!1:this.assetList[e].startOffset>t}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return ua(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=ua(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=B(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return ua(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Bs))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Lr.Range:Lr.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return Wu(this)}}function ua(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<Bs)?e.start:e.start+e.duration}function mo(a,e,t){const i=new self.URL(a,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Wu(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function ca(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Hu{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{const u=this.interstitial.playoutLimit,d=this.currentTime;this.startOffset+d>=u&&this.hls.trigger(p.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=n;let r=n.uri;try{r=mo(r,s.sessionId).href}catch(c){}s.loadSource(r);const o=()=>{this.hasDetails=!0};s.once(p.LEVEL_LOADED,o),s.once(p.AUDIO_TRACK_LOADED,o),s.once(p.SUBTITLE_TRACK_LOADED,o),s.on(p.MEDIA_ATTACHING,(c,{media:u})=>{this.removeMediaListeners(),this.mediaAttached=u,this.interstitial.playoutLimit&&u.addEventListener("timeupdate",this.checkPlayout)})}bufferedInPlaceToEnd(e){var t;if(!this.interstitial.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,n=pi.bufferInfo(e,i,0);return this.getAssetTime(n.end)>=this._bufferedEosTime-.02}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=pi.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}on(e,t,i){this.hls.on(e,t)}once(e,t,i){this.hls.once(e,t)}off(e,t,i){this.hls.off(e,t)}toString(){var e,t;return`HlsAssetPlayer: ${ca(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${(t=this.interstitial)!=null&&t.appendInPlace?"append-in-place":""}`}}const go=.033;class Zu extends H{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(s=n[i])!=null&&s.event;){var s;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;n<i.length;n++){let s=i[n];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return n}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let n=e;n<=t&&i[n];n++){const s=i[n].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var i;if(((i=t[n].event)==null?void 0:i.identifier)===e)return n}return-1}findAssetIndex(e,t){const i=e.assetList,n=i.length;if(n>1)for(let s=0;s<n;s++){const r=i[s];if(!r.error){const o=r.timelineStart;if(t===o||t>o&&t<o+(r.duration||0))return s}}return 0}get assetIdAtEnd(){var e,t;const i=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(i){const n=i.assetList,s=n[n.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:n}=i,s=this.events,r=this.parseDateRanges(n,{url:i.url},t),o=Object.keys(n),c=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,d)=>{const f=u.cue.pre,b=u.cue.post,x=d.cue.pre,T=d.cue.post;if(f&&!x)return-1;if(x&&!f||b&&!T)return 1;if(T&&!b)return-1;if(!f&&!x&&!b&&!T){const G=u.startTime,$=d.startTime;if(G!==$)return G-$}return u.dateRange.tagOrder-d.dateRange.tagOrder}),this.events=r,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[]){const i=this.events||[];if(i.length||t.length||this.length<2){const n=this.items,s=this.parseSchedule(i,e);(t.length||(n==null?void 0:n.length)!==s.length||s.some((o,c)=>Math.abs(o.playout.start-n[c].playout.start)>.005||Math.abs(o.playout.end-n[c].playout.end)>.005))&&(this.items=s,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,i){const n=[],s=Object.keys(e);for(let r=0;r<s.length;r++){const o=s[r],c=e[o];if(c.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(c):(u=new ju(c,t),this.eventMap[o]=u,i===!1&&(u.appendInPlace=i)),n.push(u)}}return n}parseSchedule(e,t){const i=[],n=t.main.details,s=n.live?1/0:n.edge;let r=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,u=0;if(e.forEach((d,f)=>{const b=d.cue.pre,x=d.cue.post,T=e[f-1]||null,G=d.appendInPlace,$=x?s:d.startOffset,ue=d.duration,_e=d.timelineOccupancy===Lr.Range?ue:0,fe=d.resumptionOffset,Pe=(T==null?void 0:T.startTime)===$,Oe=$+d.cumulativeDuration;let Je=G?Oe+ue:$+fe;if(b||!x&&$<=0){const ze=u;u+=_e,d.timelineStart=Oe;const nt=r;r+=ue,i.push({event:d,start:Oe,end:Je,playout:{start:nt,end:r},integrated:{start:ze,end:u}})}else if($<=s){if(!Pe){const Ne=$-c;if(Ne>go){const At=c,Gt=u;u+=Ne;const Mi=r;r+=Ne;const yi={previousEvent:e[f-1]||null,nextEvent:d,start:At,end:At+Ne,playout:{start:Mi,end:r},integrated:{start:Gt,end:u}};i.push(yi)}else Ne>0&&T&&(T.cumulativeDuration+=Ne,i[i.length-1].end=$)}x&&(Je=Oe),d.timelineStart=Oe;const ze=u;u+=_e;const nt=r;r+=ue,i.push({event:d,start:Oe,end:Je,playout:{start:nt,end:r},integrated:{start:ze,end:u}})}else return;const Me=d.resumeTime;x||Me>s?c=s:c=Me}),c<s){var o;const d=c,f=u,b=s-c;u+=b;const x=r;r+=b,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:d+b,playout:{start:x,end:r},integrated:{start:f,end:u}})}this.setDurations(s,r,u)}else i.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,n=i.live?1/0:i.edge;let s=0,r=-1;e.forEach((o,c)=>{const u=o.cue.pre,d=o.cue.post,f=u?0:d?n:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!d&&o.snapOptions.in&&(o.resumeAnchor=mi(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<go&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const x=B(o.resumeOffset)?o.resumeOffset:o.duration;s+=x})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>Bs?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):t?!Object.keys(t).some(r=>{const o=t[r].details,c=o.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${r} playlist end ${c}`),!1;const u=mi(null,o.fragments,i);if(!u)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${r} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const d=r==="audio"?.175:0;return Math.abs(u.start-i)<Bs+d||Math.abs(u.end-i)<Bs+d?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${r} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${i} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,n=!1,s=!1;e.assetList.forEach((r,o)=>{const c=t+i;r.startOffset=i,r.timelineStart=c,n||(n=r.duration===null),s||(s=!!r.error);const u=r.error?0:r.duration||0;i+=u}),n&&!s?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function ms(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class zu{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=mo(i,this.hls.sessionId,e.baseUrl)}catch(b){const x=this.assignAssetListError(e,j.ASSET_LIST_LOAD_ERROR,b,i);this.hls.trigger(p.ERROR,x);return}t&&n.protocol!=="data:"&&n.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),c={responseType:"json",url:n.href},u=s.interstitialAssetListLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(b,x,T,G)=>{const $=b.data,ue=$==null?void 0:$.ASSETS;if(!Array.isArray(ue)){const _e=this.assignAssetListError(e,j.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),T.url,x,G);this.hls.trigger(p.ERROR,_e);return}e.assetListResponse=$,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:$,networkDetails:G})},onError:(b,x,T,G)=>{const $=this.assignAssetListError(e,j.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${b.code} ${b.text} (${x.url})`),x.url,G,T);this.hls.trigger(p.ERROR,$)},onTimeout:(b,x,T)=>{const G=this.assignAssetListError(e,j.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${x.url})`),x.url,b,T);this.hls.trigger(p.ERROR,G)}};return o.load(c,d,f),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:he.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function cs(a,e,t){rs(a,e,t),a.addEventListener(e,t)}function rs(a,e,t){a.removeEventListener(e,t)}function _o(a){a==null||a.play().catch(()=>{})}class Yu extends H{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;const n=i-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const r=n<=-.01;this.timelinePos=i,this.bufferedPos=i;const o=this.playingItem;if(!o){this.checkBuffer();return}if(r&&this.schedule.resetErrorsInRange(i,i-n)&&this.updateSchedule(),this.checkBuffer(),r&&i<o.start||i>=o.end){var c;const b=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r){const x=this.findItemIndex(o);if(b>x){const T=this.schedule.findJumpRestrictedIndex(x+1,b);if(T>x){this.setSchedulePosition(T);return}}}this.setSchedulePosition(b);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const b=o.event.assetList[0];b&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,b))}return}const d=u.timelineStart,f=u.duration||0;(r&&i<d||i>=d+f)&&this.setScheduleToAssetAtTime(i,u)},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(i>=n.end){this.timelinePos=n.end;const o=this.findItemIndex(n);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const r=s.timelineStart+(s.duration||0);i>=r&&this.setScheduleToAssetAtTime(i,s)},this.onScheduleUpdate=(i,n)=>{const s=this.schedule,r=this.playingItem,o=s.events||[],c=s.items||[],u=s.durations,d=i.map(x=>x.identifier),f=!!(o.length||d.length);if(f&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(x=>ms(x))}`),d.length&&this.log(`Removed events ${d}`),this.playerQueue.forEach(x=>{if(x.interstitial.appendInPlace){const T=x.assetItem.timelineStart,G=x.timelineOffset-T;if(G)try{x.timelineOffset=T}catch($){Math.abs(G)>Bs&&this.warn(`${$} ("${x.assetId}" ${x.timelineOffset}->${T})`)}}}),r){const x=this.updateItem(r,this.timelinePos);this.itemsMatch(r,x)&&(this.playingItem=x,this.waitingItem=this.endedItem=null)}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const b=this.bufferingItem;if(b){const x=this.updateItem(b,this.bufferedPos);this.itemsMatch(b,x)?this.bufferingItem=x:b.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(b.event,null))}if(i.forEach(x=>{x.assetList.forEach(T=>{this.clearAssetPlayer(T.identifier,null)})}),f||n){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:d}),this.isInterstitial(r)&&d.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new zu(e),this.schedule=new Zu(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(p.MEDIA_ENDED,this.onMediaEnded,this),e.on(p.ERROR,this.onError,this),e.on(p.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(p.MEDIA_ENDED,this.onMediaEnded,this),e.off(p.ERROR,this.onError,this),e.off(p.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){rs(e,"play",this.onPlay),rs(e,"pause",this.onPause),rs(e,"seeking",this.onSeeking),rs(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;cs(i,"seeking",this.onSeeking),cs(i,"timeupdate",this.onTimeupdate),cs(i,"play",this.onPlay),cs(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const s=this.findItemIndex(i);this.setSchedulePosition(s)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=f=>f&&e.getAssetPlayer(f.identifier),n=(f,b,x,T,G)=>{if(f){let $=f[b].start;const ue=f.event;if(ue){if(b==="playout"||ue.timelineOccupancy!==Lr.Point){const _e=i(x);(_e==null?void 0:_e.interstitial)===ue&&($+=_e.assetItem.startOffset+_e[G])}}else{const _e=T==="bufferedPos"?r():e[T];$+=_e-f.start}return $}return 0},s=(f,b)=>{if(f!==0&&b!=="primary"&&e.schedule.length){var x;const T=e.schedule.findItemIndexAtTime(f),G=(x=e.schedule.items)==null?void 0:x[T];if(G){const $=G[b].start-G.start;return f+$}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var b;return(b=e.primaryDetails)!=null&&b.live?e.primaryDetails.edge:e.schedule.durations[f]},c=(f,b)=>{var x,T;const G=e.effectivePlayingItem;if(G!=null&&(x=G.event)!=null&&x.restrictions.skip)return;e.log(`seek to ${f} "${b}"`);const $=e.effectivePlayingItem,ue=e.schedule.findItemIndexAtTime(f,b),_e=(T=e.schedule.items)==null?void 0:T[ue],fe=e.getBufferingPlayer(),Pe=fe==null?void 0:fe.interstitial,Oe=Pe==null?void 0:Pe.appendInPlace,Je=$&&e.itemsMatch($,_e);if($&&(Oe||Je)){const ze=i(e.playingAsset),nt=(ze==null?void 0:ze.media)||e.primaryMedia;if(nt){const Ne=b==="primary"?nt.currentTime:n($,b,e.playingAsset,"timelinePos","currentTime"),At=f-Ne,Gt=(Oe?Ne:nt.currentTime)+At;if(Gt>=0&&(!ze||Oe||Gt<=ze.duration)){nt.currentTime=Gt;return}}}if(_e){let ze=f;if(b!=="primary"){const Ne=_e[b].start,At=f-Ne;ze=_e.start+At}const nt=!e.isInterstitial(_e);if((!e.isInterstitial($)||$.event.appendInPlace)&&(nt||_e.event.appendInPlace)){const Ne=e.media||(Oe?fe==null?void 0:fe.media:null);Ne&&(Ne.currentTime=ze)}else if($){const Ne=e.findItemIndex($);if(ue>Ne){const Gt=e.schedule.findJumpRestrictedIndex(Ne+1,ue);if(Gt>Ne){e.setSchedulePosition(Gt);return}}let At=0;if(nt)e.timelinePos=ze,e.checkBuffer();else{var Me;const Gt=_e==null||(Me=_e.event)==null?void 0:Me.assetList;if(Gt){const Mi=f-(_e[b]||_e).start;for(let yi=Gt.length;yi--;){const di=Gt[yi];if(di.duration&&Mi>=di.startOffset&&Mi<di.startOffset+di.duration){At=yi;break}}}}e.setSchedulePosition(ue,At)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const b=t();return e.isInterstitial(b)?b:null},d={get currentTime(){const f=u(),b=e.effectivePlayingItem;return b&&b===f?n(b,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-b.playout.start:0},set currentTime(f){const b=u(),x=e.effectivePlayingItem;x&&x===b&&c(f+x.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const b=(f=u())==null?void 0:f.event.assetList;return b?b.map(x=>e.getAssetPlayer(x.identifier)):[]},get playingIndex(){var f;const b=(f=u())==null?void 0:f.event;return b&&e.effectivePlayingAsset?b.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};this.manager={get events(){var f,b;return((f=e.schedule)==null||(b=f.events)==null?void 0:b.slice(0))||[]},get schedule(){var f,b;return((f=e.schedule)==null||(b=f.items)==null?void 0:b.slice(0))||[]},get interstitialPlayer(){return u()?d:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const f=t();return e.findItemIndex(f)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const f=e.effectivePlayingItem;return e.findItemIndex(f)},primary:{get bufferedEnd(){return r()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){c(f,"primary")},get duration(){return o("primary")},get seekableStart(){var f;return((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){c(f,"integrated")},get duration(){return o("integrated")},get seekableStart(){var f;return s(((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,b=f==null?void 0:f.event;if(b&&!b.restrictions.skip){const x=e.findItemIndex(f);if(b.appendInPlace){const T=f.playout.start+f.event.duration;c(T+.001,"playout")}else e.advanceAfterAssetEnded(b,x,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t,i;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(s=this.primaryMedia);const r=(i=s)==null?void 0:i.currentTime;if(!(r===void 0||!B(r)))return r}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n){this.detachedData={media:n};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Lt(s)}`),this.detachedData=s}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let s=null;const r=this.hls,o=e!==r,c=o&&e.interstitial.appendInPlace,u=(i=this.detachedData)==null?void 0:i.mediaSource;let d;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),d="Primary";else if(u){const x=this.getBufferingPlayer();x?(s=x.transferMedia(),d=`${x}`):d="detached MediaSource"}else d="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${Lt(s)}`);else if(!this.detachedData||r.media===t){const x=this.playerQueue;x.length>1&&x.forEach(T=>{if(o&&T.interstitial.appendInPlace!==c){const G=T.interstitial;this.clearInterstitial(T.interstitial,null),G.appendInPlace=!1,G.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${G}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((n=s.mediaSource)==null?void 0:n.readyState)!=="closed",b=f&&s?s:t;if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${d}`),b===s){const x=o&&e.assetId===this.schedule.assetIdAtEnd;b.overrides={duration:this.schedule.duration,endOfStream:!o||x,cueRemoval:!o}}e.attachMedia(b)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,n=this.effectivePlayingItem;if(i===-1){const s=this.hls.startPosition;if(this.timelinePos=s,t.length&&t[0].cue.pre){const r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(s>=0||!this.primaryLive){const r=this.timelinePos=s>0?s:0,o=e.findItemIndexAtTime(r);this.setSchedulePosition(o)}}else if(n&&!this.playingItem){const s=e.findItemIndex(n);this.setSchedulePosition(s)}}advanceAfterAssetEnded(e,t,i){const n=i+1;if(!e.isAssetPastPlayoutLimit(n)&&!e.assetList[n].error)this.setSchedulePosition(t,n);else{const s=this.schedule.items;if(s){const r=t+1,o=s.length;if(r>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.timelinePos=c,this.checkBuffer()),this.setSchedulePosition(r)}}}setScheduleToAssetAtTime(e,t){const i=this.schedule,n=t.parentIdentifier,s=i.getEvent(n);if(s){const r=i.findEventIndex(n),o=i.findAssetIndex(s,e);this.setSchedulePosition(r,o)}}setSchedulePosition(e,t){const i=this.schedule.items;if(!i||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const n=e>=0?i[e]:null,s=this.playingItem,r=this.playingLastItem;if(this.isInterstitial(s)){var o;const u=s.event,d=this.playingAsset,f=d==null?void 0:d.identifier,b=f?this.getAssetPlayer(f):null;if(b&&f&&(!this.eventItemsMatch(s,n)||t!==void 0&&f!==((o=u.assetList)==null?void 0:o[t].identifier))){var c;const x=u.findAssetIndex(d);this.log(`INTERSTITIAL_ASSET_ENDED ${x+1}/${u.assetList.length} ${ca(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:x,event:u,schedule:i.slice(0),scheduleIndex:e,player:b}),this.retreiveMediaSource(f,n),b.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&b.detachMedia()}if(!this.eventItemsMatch(s,n)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${ms(s)}`),u.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){this.updateSchedule();const x=this.schedule.items;if(n&&x){const T=this.schedule.findItemIndex(n);this.advanceSchedule(T,x,t,s,r)}return}}this.advanceSchedule(e,i,t,s,r)}advanceSchedule(e,t,i,n,s){const r=e>=0?t[e]:null,o=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(u=>{const d=u.interstitial,f=this.schedule.findEventIndex(d.identifier);(f<e||f>e+1)&&this.clearInterstitial(d,r)}),this.isInterstitial(r)){this.timelinePos=Math.min(Math.max(this.timelinePos,r.start),r.end);const u=r.event;i===void 0&&(i=this.schedule.findAssetIndex(u,this.timelinePos));const d=this.waitingItem;this.assetsBuffered(r,o)||this.setBufferingItem(r);let f=this.preloadAssets(u,i);if(this.eventItemsMatch(r,d||n)||(this.waitingItem=r,this.log(`INTERSTITIAL_STARTED ${ms(r)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(p.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!o){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=r;const b=u.assetList[i];if(!b){const x=t[e+1],T=this.media;x&&T&&!this.isInterstitial(x)&&T.currentTime<x.start&&(T.currentTime=this.timelinePos=x.start),this.advanceAfterAssetEnded(u,e,i||0);return}if(f||(f=this.getAssetPlayer(b.identifier)),f===null||f.destroyed){const x=u.assetList.length;this.warn(`asset ${i+1}/${x} player destroyed ${u}`),f=this.createAssetPlayer(u,b,i)}if(!this.eventItemsMatch(r,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(b))return;this.startAssetPlayer(f,i,t,e,o),this.shouldPlay&&_o(f.media)}else r!==null?(this.resumePrimary(r,e,n),this.shouldPlay&&_o(this.hls.media)):s&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,t;return(e=this.mediaSelection)==null||(t=e.main)==null?void 0:t.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ms(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let r=this.timelinePos;(r<e.start||r>=e.end)&&(r=this.getPrimaryResumption(e,t),this.timelinePos=r),this.attachPrimary(r,e)}if(!i)return;const s=this.schedule.items;s&&(this.log(`resumed ${ms(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(i<n.fragmentStart||i>n.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:pi.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((i=n.mainForwardBufferInfo)==null?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(p.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(p.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const i=this.hls.levels[t.level],n=E(E({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=E(E({},this.altSelection),{},{audio:i});return}const s=E(E({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=E(E({},this.altSelection),{},{subtitles:i});return}const s=E(E({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=ve(t);this.playerQueue.forEach(n=>n.hls.setAudioOption(t)||n.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=ve(t);this.playerQueue.forEach(n=>n.hls.setSubtitleOption(t)||t.id!==-1&&n.hls.setSubtitleOption(i))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let n=0;n<t.length;n++){const s=t[n];if(s.cue.post){var i;const r=this.schedule.findEventIndex(s.identifier),o=(i=this.schedule.items)==null?void 0:i[r];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){const i=this.schedule.items;if(e&&i){const n=this.findItemIndex(e,t);return i[n]||null}return null}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e?this.schedule.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const i=pi.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,t,e)}updateBufferedPos(e,t,i){const n=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const r=this.playingItem,o=this.findItemIndex(r);let c=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var u,d;const f=this.findItemIndex(s),b=Math.min(f+1,t.length-1),x=t[b];if((c===-1&&s&&e>=s.end||(u=x.event)!=null&&u.appendInPlace&&e+.01>=x.start)&&(c=b),b-o>1&&(s==null||(d=s.event)==null?void 0:d.appendInPlace)===!1)return;if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(x);else{const T=this.primaryDetails;this.primaryLive&&T&&e>T.edge-T.targetduration&&x.start<T.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(x)&&this.preloadAssets(x.event,0)}}else i&&r&&!this.itemsMatch(r,s)&&(c===o?this.bufferedToItem(r):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(n=>{const s=this.getAssetPlayer(n.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:n,events:s}=i;if(!n||!s)return t;const r=this.isInterstitial(e),o=this.getBufferingPlayer();if(this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos)),!this.playbackDisabled){const c=o?o.remaining:t?t.end-this.timelinePos:0;this.log(`buffered to boundary ${ms(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),r?e.event.assetList.forEach(u=>{const d=this.getAssetPlayer(u.identifier);d&&d.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering()))}this.hls.trigger(p.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=i.assetList.length===0&&!i.assetListLoader,s=i.cue.once;if(n||!s){const r=this.preloadAssets(i,t);if(r!=null&&r.interstitial.appendInPlace){const o=i.assetList[t],c=this.primaryMedia;o&&c&&this.bufferAssetPlayer(r,c)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,s=n===0&&!e.assetListLoader,r=e.cue.once;if(s){const c=e.timelineStart;if(e.appendInPlace){var o;const b=this.playingItem;!this.isInterstitial(b)&&(b==null||(o=b.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,d=0;if(!this.playingItem&&this.primaryLive&&(d=this.hls.startPosition,d===-1&&(d=this.hls.liveSyncPosition||0)),d&&!(e.cue.pre||e.cue.post)){const b=d-c;b>0&&(u=Math.round(b*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${u?` live-start: ${d} start-offset: ${u}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const f=this.assetListLoader.loadAssetList(e,u);f&&(e.assetListLoader=f)}else if(!r&&n){for(let c=t;c<n;c++){const u=e.assetList[c],d=this.getAssetPlayerQueueIndex(u.identifier);(d===-1||this.playerQueue[d].destroyed)&&!u.error&&this.createAssetPlayer(e,u,c)}return this.getAssetPlayer(e.assetList[t].identifier)}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(n=>{this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,n,s,r){const o={parentIdentifier:e.identifier,identifier:Vu(e,r,t),duration:s,startOffset:i,timelineStart:n,uri:r};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){this.log(`create HLSAssetPlayer for ${ca(t)}`);const n=this.hls,s=n.userConfig;let r=s.videoPreference;const o=n.loadLevelObj||n.levels[n.currentLevel];(r||o)&&(r=g({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=n.audioTracks[n.audioTrack],u=n.subtitleTracks[n.subtitleTrack];let d=0;if(this.primaryLive||e.appendInPlace){const fe=this.timelinePos-t.timelineStart;if(fe>1){const Pe=t.duration;Pe&&fe<Pe&&(d=fe)}}const f=t.identifier,b=E(E({},s),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:c||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(b.timelineOffset=t.timelineStart));const x=b.cmcd;x!=null&&x.sessionId&&x.contentId&&(b.cmcd=g({},x,{contentId:sr(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const T=new Hu(this.HlsPlayerClass,b,e,t);this.playerQueue.push(T),e.assetList[i]=t;const G=fe=>{if(fe.live){const Je=new Error(`Interstitials MUST be VOD assets ${e}`),Me={fatal:!0,type:he.OTHER_ERROR,details:j.INTERSTITIAL_ASSET_ITEM_ERROR,error:Je};this.handleAssetItemError(Me,e,this.schedule.findEventIndex(e.identifier),i,Je.message);return}const Pe=fe.edge-fe.fragmentStart,Oe=t.duration;(Oe===null||Pe>Oe)&&(this.log(`Interstitial asset "${f}" duration change ${Oe} > ${Pe}`),t.duration=Pe,this.updateSchedule())};T.on(p.LEVEL_UPDATED,(fe,{details:Pe})=>G(Pe)),T.on(p.LEVEL_PTS_UPDATED,(fe,{details:Pe})=>G(Pe));const $=(fe,Pe)=>{const Oe=this.getAssetPlayer(f);if(Oe&&Pe.tracks){Oe.off(p.BUFFER_CODECS,$),Oe.tracks=Pe.tracks;const Je=this.primaryMedia;this.bufferingAsset===Oe.assetItem&&Je&&!Oe.media&&this.bufferAssetPlayer(Oe,Je)}};T.on(p.BUFFER_CODECS,$);const ue=()=>{var fe;const Pe=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${Pe}`),!Pe)return;const Oe=this.schedule.findEventIndex(e.identifier),Je=e.findAssetIndex(t),Me=Je+1,ze=(fe=this.schedule.items)==null?void 0:fe[Oe];if(this.isInterstitial(ze))if(Je!==-1&&!e.isAssetPastPlayoutLimit(Me)&&!e.assetList[Me].error)this.bufferedToItem(ze,Me);else{var nt;const Ne=(nt=this.schedule.items)==null?void 0:nt[Oe+1];Ne&&this.bufferedToItem(Ne)}};T.on(p.BUFFERED_TO_END,ue);const _e=fe=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const Oe=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Oe,fe)};return T.once(p.MEDIA_ENDED,_e(i)),T.once(p.PLAYOUT_LIMIT_REACHED,_e(1/0)),T.on(p.ERROR,(fe,Pe)=>{const Oe=this.getAssetPlayer(f);if(Pe.details===j.BUFFER_STALLED_ERROR){if(Oe!=null&&Oe.media){const Je=Oe.currentTime,Me=Oe.duration-Je;Je&&e.appendInPlace&&Me/Oe.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${Oe.media.currentTime}`),ue()):(this.warn(`Stalled at ${Je} of ${Je+Me} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(Pe,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${Pe.error} ${e}`)}),T.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const Pe=new Error(`Asset player destroyed unexpectedly ${f}`),Oe={fatal:!0,type:he.OTHER_ERROR,details:j.INTERSTITIAL_ASSET_ITEM_ERROR,error:Pe};this.handleAssetItemError(Oe,e,this.schedule.findEventIndex(e.identifier),i,Pe.message)}),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:T}),T}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){this.log(`clearAssetPlayer "${e}" toSegment: ${t&&ms(t)}`);const n=this.playerQueue[i];this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,s){const{interstitial:r,assetItem:o,assetId:c}=e,u=r.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!d||d.identifier!==c)&&(d&&(this.clearAssetPlayer(d.identifier,i[n]),delete d.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${e}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,n;const{interstitial:s,assetItem:r,assetId:o}=e,c=this.schedule.findEventIndex(s.identifier),u=(i=this.schedule.items)==null?void 0:i[c];if(!u)return;this.setBufferingItem(u),this.bufferingAsset=r;const d=this.getBufferingPlayer();if(d===e)return;const f=s.appendInPlace;if(f&&(d==null?void 0:d.interstitial.appendInPlace)===!1)return;const b=(d==null?void 0:d.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(f&&r!==this.playingAsset){if(!e.tracks)return;if(b&&!xe(b,e.tracks)){const x=new Error(`Asset "${o}" SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(b)}')`),T={fatal:!0,type:he.OTHER_ERROR,details:j.INTERSTITIAL_ASSET_ITEM_ERROR,error:x},G=s.findAssetIndex(r);this.handleAssetItemError(T,s,c,G,x.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,n,s){if(e.details===j.BUFFER_STALLED_ERROR)return;const r=t.assetList[n]||null;let o=null;if(r){const f=this.getAssetPlayerQueueIndex(r.identifier);o=this.playerQueue[f]||null}const c=this.schedule.items,u=g({},e,{fatal:!1,errorAction:Vi(!0),asset:r,assetListIndex:n,event:t,schedule:c,scheduleIndex:i,player:o});if(this.warn(`Asset item error: ${e.error}`),this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,u),!e.fatal)return;const d=new Error(s);r&&(this.playingAsset!==r&&this.clearAssetPlayer(r.identifier,null),r.error=d),t.assetList.some(f=>!f.error)?t.appendInPlace&&(t.error=d):t.error=d,this.primaryFallback(t)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(this.updateSchedule(),i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${i?ms(i):"<none>"} error: ${e.error}`),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const s=this.updateItem(i,n);if(this.itemsMatch(i,s))this.clearInterstitial(e,null);else{const r=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(r)}}else this.checkStart()}onAssetListLoaded(e,t){var i;const n=t.event,s=n.identifier,r=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(s))return;const o=n.timelineStart,c=n.duration;let u=0;r.forEach((T,G)=>{const $=parseFloat(T.DURATION);this.createAsset(n,G,u,o+u,$,T.URI),u+=$}),n.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${c}) ${n}`);const d=this.waitingItem,f=(d==null?void 0:d.event.identifier)===s;this.updateSchedule();const b=(i=this.bufferingItem)==null?void 0:i.event;if(f){var x;const T=this.schedule.findEventIndex(s),G=(x=this.schedule.items)==null?void 0:x[T];if(G){if(!this.playingItem&&this.timelinePos>G.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==T){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(G)}this.setSchedulePosition(T)}else if((b==null?void 0:b.identifier)===s&&b.appendInPlace){const T=n.assetList[0],G=this.getAssetPlayer(T.identifier),$=this.primaryMedia;T&&G&&$&&this.bufferAssetPlayer(G,$)}}onError(e,t){switch(t.details){case j.ASSET_LIST_PARSING_ERROR:case j.ASSET_LIST_LOAD_ERROR:case j.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case j.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const vo=500;class Xu extends Sn{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",ce.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=it.IDLE,this.setInterval(vo),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(ae(i)&&(this.fragPrevious=i),this.state=it.IDLE,!n)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=i.start;for(let u=0;u<s.length;u++)if(o>=s[u].start&&o<=s[u].end){r=s[u];break}const c=i.start+i.duration;r?r.end=c:(r={start:o,end:c},s.push(r)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const s=n-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(r=>{for(let o=0;o<r.length;){if(r[o].end<=s){r.shift();continue}else if(r[o].start<s)r[o].start=s;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(i,s,ce.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===ce.SUBTITLE&&(t.details===j.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==it.STOPPED&&(this.state=it.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Ja(this.levels,t)){this.levels=t.map(i=>new et(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new et(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ce.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==it.STOPPED&&this.setInterval(vo)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:s}=this,{details:r,id:o}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=s[o];if(o>=s.length||!c)return;this.log(`Subtitle track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(r.live||(i=c.details)!=null&&i.live){const f=this.mainDetails;if(r.deltaUpdateFailed||!f)return;const b=f.fragments[0];if(!c.details)r.hasProgramDateTime&&f.hasProgramDateTime?($i(r,f),u=r.fragmentStart):b&&(u=b.start,Is(r,u));else{var d;u=this.alignPlaylists(r,c.details,(d=this.levelLastLoaded)==null?void 0:d.details),u===0&&b&&(u=b.start,Is(r,u))}}c.details=r,this.levelLastLoaded=c,o===n&&(this.hls.trigger(p.SUBTITLE_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===it.IDLE&&(mi(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&wn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,Rn(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();s.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=it.IDLE})}}doTick(){if(!this.media){this.state=it.IDLE;return}if(this.state===it.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:n}=this,s=this.getLoadPosition(),r=pi.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:c}=r,u=i.details,d=this.hls.maxBufferLength+u.levelTargetDuration;if(c>d)return;const f=u.fragments,b=f.length,x=u.edge;let T=null;const G=this.fragPrevious;if(o<x){const _e=n.maxFragLookUpTolerance,fe=o>x-_e?0:_e;T=mi(G,f,Math.max(f[0].start,o),fe),!T&&G&&G.start<f[0].start&&(T=f[0])}else T=f[b-1];if(T=this.filterReplacedPrimary(T,i.details),!T)return;const $=T.sn-u.startSN,ue=f[$-1];if(ue&&ue.cc===T.cc&&this.fragmentTracker.getState(ue)===Ai.NOT_LOADED&&(T=ue),this.fragmentTracker.getState(T)===Ai.NOT_LOADED){const _e=this.mapToInitFragWhenRequired(T);_e&&this.loadFragment(_e,i,o)}}}loadFragment(e,t,i){ae(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new qu(this.tracksBuffered[this.currentTrackId]||[])}}class qu{constructor(e){this.buffered=void 0;const t=(i,n,s)=>{if(n=n>>>0,n>s-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${s})`);return e[n][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const Qu={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},yo=a=>String.fromCharCode(Qu[a]||a),Yn=15,hs=100,Ju={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ec={17:2,18:4,21:6,22:8,23:10,19:13,20:15},tc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ic={25:2,26:4,29:6,30:8,31:10,27:13,28:15},nc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class sc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;te.log(`${this.time} [${e}] ${i}`)}}}const Ts=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Eo{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class rc{constructor(){this.uchar=" ",this.penState=new Eo}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class ac{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Eo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<hs;t++)this.chars.push(new rc);this.logger=e}equals(e){for(let t=0;t<hs;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<hs;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<hs;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>hs&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=hs)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=yo(e);if(this.pos>=hs){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<hs;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<hs;i++){const n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class ha{constructor(e){this.rows=[],this.currRow=Yn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Yn;t++)this.rows.push(new ac(e));this.logger=e}reset(){for(let e=0;e<Yn;e++)this.rows[e].clear();this.currRow=Yn-1}equals(e){let t=!0;for(let i=0;i<Yn;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Yn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Yn;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+Lt(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Yn;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const o=r.rows[s].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(r.rows[s+u])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,r=Math.max(s-1,0);i.setCursor(e.indent),e.color=i.chars[r].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Lt(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let s=0;s<Yn;s++){const r=this.rows[s].getTextString();r&&(n=s+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
`)),i}getTextAndFormat(){return this.rows}}class bo{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new ha(i),this.nonDisplayedMemory=new ha(i),this.lastOutputScreen=new ha(i),this.currRollUpRow=this.displayedMemory.rows[Yn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Yn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+Lt(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class So{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=lc(),this.logger=void 0;const n=this.logger=new sc;this.channels=[null,new bo(e,t,n),new bo(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const n=t[i]&127,s=t[i+1]&127;let r=!1,o=null;if(n===0&&s===0)continue;this.logger.log(3,()=>"["+Ts([t[i],t[i+1]])+"] -> ("+Ts([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(oc(n,s,c)){Ir(null,null,c),this.logger.log(3,()=>"Repeated command ("+Ts([n,s])+") is dropped");continue}Ir(n,s,this.cmdHistory),r=this.parseCmd(n,s),r||(r=this.parseMidrow(n,s)),r||(r=this.parsePAC(n,s)),r||(r=this.parseBackgroundAttributes(n,s))}else Ir(null,null,c);if(!r&&(o=this.parseChars(n,s),o)){const d=this.currentChannel;d&&d>0?this.channels[d].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Ts([n,s])+" orig: "+Ts([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))return!1;const s=e===20||e===21||e===23?1:2,r=this.channels[s];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=s,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Ts([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(n||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?i=r===1?Ju[e]:tc[e]:i=r===1?ec[e]:ic[e];const o=this.channels[r];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,n.underline=(i&1)===1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((i-16)/2)*4,n}parseChars(e,t){let i,n=null,s=null;if(e>=25?(i=2,s=e-8):(i=1,s=e),s>=17&&s<=19){let r;s===17?r=t+80:s===18?r=t+112:r=t+144,this.logger.log(2,()=>"Special char '"+yo(r)+"' in channel "+i),n=[r]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+Ts(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=nc[s],t%2===1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Ir(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function Ir(a,e,t){t.a=a,t.b=e}function oc(a,e,t){return t.a===a&&t.b===e}function lc(){return{a:null,b:null}}var da=function(){if(tn!=null&&tn.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,c){if(typeof c!="string"||!Array.isArray(o))return!1;const u=c.toLowerCase();return~o.indexOf(u)?u:!1}function i(o){return t(a,o)}function n(o){return t(e,o)}function s(o,...c){let u=1;for(;u<arguments.length;u++){const d=arguments[u];for(const f in d)o[f]=d[f]}return o}function r(o,c,u){const d=this,f={enumerable:!0};d.hasBeenReset=!1;let b="",x=!1,T=o,G=c,$=u,ue=null,_e="",fe=!0,Pe="auto",Oe="start",Je=50,Me="middle",ze=50,nt="middle";Object.defineProperty(d,"id",s({},f,{get:function(){return b},set:function(Ne){b=""+Ne}})),Object.defineProperty(d,"pauseOnExit",s({},f,{get:function(){return x},set:function(Ne){x=!!Ne}})),Object.defineProperty(d,"startTime",s({},f,{get:function(){return T},set:function(Ne){if(typeof Ne!="number")throw new TypeError("Start time must be set to a number.");T=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",s({},f,{get:function(){return G},set:function(Ne){if(typeof Ne!="number")throw new TypeError("End time must be set to a number.");G=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",s({},f,{get:function(){return $},set:function(Ne){$=""+Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",s({},f,{get:function(){return ue},set:function(Ne){ue=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",s({},f,{get:function(){return _e},set:function(Ne){const At=i(Ne);if(At===!1)throw new SyntaxError("An invalid or illegal string was specified.");_e=At,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",s({},f,{get:function(){return fe},set:function(Ne){fe=!!Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",s({},f,{get:function(){return Pe},set:function(Ne){if(typeof Ne!="number"&&Ne!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Pe=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",s({},f,{get:function(){return Oe},set:function(Ne){const At=n(Ne);if(!At)throw new SyntaxError("An invalid or illegal string was specified.");Oe=At,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",s({},f,{get:function(){return Je},set:function(Ne){if(Ne<0||Ne>100)throw new Error("Position must be between 0 and 100.");Je=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",s({},f,{get:function(){return Me},set:function(Ne){const At=n(Ne);if(!At)throw new SyntaxError("An invalid or illegal string was specified.");Me=At,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",s({},f,{get:function(){return ze},set:function(Ne){if(Ne<0||Ne>100)throw new Error("Size must be between 0 and 100.");ze=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",s({},f,{get:function(){return nt},set:function(Ne){const At=n(Ne);if(!At)throw new SyntaxError("An invalid or illegal string was specified.");nt=At,this.hasBeenReset=!0}})),d.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class uc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function xo(a){function e(i,n,s,r){return(i|0)*3600+(n|0)*60+(s|0)+parseFloat(r||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class cc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function To(a,e,t,i){const n=i?a.split(i):[a];for(const s in n){if(typeof n[s]!="string")continue;const r=n[s].split(t);if(r.length!==2)continue;const o=r[0],c=r[1];e(o,c)}}const fa=new da(0,0,""),Dr=fa.align==="middle"?"middle":"center";function hc(a,e,t){const i=a;function n(){const o=xo(a);if(o===null)throw new Error("Malformed timestamp: "+i);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,c){const u=new cc;To(o,function(b,x){let T;switch(b){case"region":for(let G=t.length-1;G>=0;G--)if(t[G].id===x){u.set(b,t[G].region);break}break;case"vertical":u.alt(b,x,["rl","lr"]);break;case"line":T=x.split(","),u.integer(b,T[0]),u.percent(b,T[0])&&u.set("snapToLines",!1),u.alt(b,T[0],["auto"]),T.length===2&&u.alt("lineAlign",T[1],["start",Dr,"end"]);break;case"position":T=x.split(","),u.percent(b,T[0]),T.length===2&&u.alt("positionAlign",T[1],["start",Dr,"end","line-left","line-right","auto"]);break;case"size":u.percent(b,x);break;case"align":u.alt(b,x,["start",Dr,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let d=u.get("line","auto");d==="auto"&&fa.line===-1&&(d=-1),c.line=d,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",Dr);let f=u.get("position","auto");f==="auto"&&fa.position===50&&(f=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=f}function r(){a=a.replace(/^\s+/,"")}if(r(),e.startTime=n(),r(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);a=a.slice(3),r(),e.endTime=n(),r(),s(a,e)}function Ao(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class dc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new uc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let s=t.buffer,r=0;for(s=Ao(s);r<s.length&&s[r]!=="\r"&&s[r]!==`
`;)++r;const o=s.slice(0,r);return s[r]==="\r"&&++r,s[r]===`
`&&++r,t.buffer=s.slice(r),o}function n(s){To(s,function(r,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=i();const o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let r=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:s=i(),t.state){case"HEADER":/:/.test(s)?n(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new da(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{hc(s,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=s.indexOf("-->")!==-1;if(!s||o&&(r=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
`),t.cue.text+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch(s){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const fc=/\r\n|\n\r|\n|\r/g,pa=function(e,t,i=0){return e.slice(i,i+t.length)===t},pc=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!B(t)||!B(i)||!B(n)||!B(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function ma(a,e,t){return sr(a.toString())+sr(e.toString())+sr(t)}const mc=function(e,t,i){let n=e[t],s=e[n.prevCC];if(!s||!s.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(r=s)!=null&&r.new;){var r;e.ccOffset+=n.start-s.start,n.new=!1,n=s,s=e[n.prevCC]}e.presentationOffset=i};function gc(a,e,t,i,n,s,r){const o=new dc,c=$e(new Uint8Array(a)).trim().replace(fc,`
`).split(`
`),u=[],d=e?Kl(e.baseTime,e.timescale):0;let f="00:00.000",b=0,x=0,T,G=!0;o.oncue=function($){const ue=t[i];let _e=t.ccOffset;const fe=(b-d)/9e4;if(ue!=null&&ue.new&&(x!==void 0?_e=t.ccOffset=ue.start:mc(t,i,fe)),fe){if(!e){T=new Error("Missing initPTS for VTT MPEGTS");return}_e=fe-t.presentationOffset}const Pe=$.endTime-$.startTime,Oe=Un(($.startTime+_e-x)*9e4,n*9e4)/9e4;$.startTime=Math.max(Oe,0),$.endTime=Math.max(Oe+Pe,0);const Je=$.text.trim();$.text=decodeURIComponent(encodeURIComponent(Je)),$.id||($.id=ma($.startTime,$.endTime,Je)),$.endTime>0&&u.push($)},o.onparsingerror=function($){T=$},o.onflush=function(){if(T){r(T);return}s(u)},c.forEach($=>{if(G)if(pa($,"X-TIMESTAMP-MAP=")){G=!1,$.slice(16).split(",").forEach(ue=>{pa(ue,"LOCAL:")?f=ue.slice(6):pa(ue,"MPEGTS:")&&(b=parseInt(ue.slice(7)))});try{x=pc(f)/1e3}catch(ue){T=ue}return}else $===""&&(G=!1);o.parse($+`
`)}),o.flush()}const ga="stpp.ttml.im1t",wo=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ro=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_c={left:"start",center:"center",right:"end",start:"start",end:"end"};function Lo(a,e,t,i){const n=ne(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>$e(o)),r=Ul(e.baseTime,1,e.timescale);try{s.forEach(o=>t(vc(o,r)))}catch(o){i(o)}}function vc(a,e){const n=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((f,b)=>(f[b]=n.getAttribute(`ttp:${b}`)||s[b],f),{}),o=n.getAttribute("xml:space")!=="preserve",c=Io(_a(n,"styling","style")),u=Io(_a(n,"layout","region")),d=_a(n,"body","[begin]");return[].map.call(d,f=>{const b=Do(f,o);if(!b||!f.hasAttribute("begin"))return null;const x=ya(f.getAttribute("begin"),r),T=ya(f.getAttribute("dur"),r);let G=ya(f.getAttribute("end"),r);if(x===null)throw Co(f);if(G===null){if(T===null)throw Co(f);G=x+T}const $=new da(x-e,G-e,b);$.id=ma($.startTime,$.endTime,$.text);const ue=u[f.getAttribute("region")],_e=c[f.getAttribute("style")],fe=yc(ue,_e,c),{textAlign:Pe}=fe;if(Pe){const Oe=_c[Pe];Oe&&($.lineAlign=Oe),$.align=Pe}return g($,fe),$}).filter(f=>f!==null)}function _a(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Io(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Do(a,e){return[].slice.call(a.childNodes).reduce((t,i,n)=>{var s;return i.nodeName==="br"&&n?t+`
`:(s=i.childNodes)!=null&&s.length?Do(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function yc(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(n=t[r]),s.reduce((o,c)=>{const u=va(e,i,c)||va(a,i,c)||va(n,i,c);return u&&(o[c]=u),o},{})}function va(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Co(a){return new Error(`Could not parse ttml timestamp ${a}`)}function ya(a,e){if(!a)return null;let t=xo(a);return t===null&&(wo.test(a)?t=Ec(a,e):Ro.test(a)&&(t=bc(a,e))),t}function Ec(a,e){const t=wo.exec(a),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function bc(a,e){const t=Ro.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class Cr{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Sc{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Oo(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Cr(this,"textTrack1"),t=new Cr(this,"textTrack2"),i=new Cr(this,"textTrack3"),n=new Cr(this,"textTrack4");this.cea608Parser1=new So(1,e,t),this.cea608Parser2=new So(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=xc(c[0],c[1],t,i);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),r=!0,u/(i-t)>.5))return}if(r||s.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,n)}else{const o=this.Cues.newCue(null,t,i,n);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s}){const{unparsedVttFrags:r}=this;i===ce.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:s}),r.length&&(this.unparsedVttFrags=[],r.forEach(o=>{this.onFragLoaded(p.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const s=i.textTracks[n];if(Po(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:n}=this,{label:s,languageCode:r}=t[e],o=this.getExistingTrack(s,r);if(o)i[e]=o,Fs(i[e]),fo(i[e],n);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,i[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,n={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach(s=>{Fs(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Oo(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Fs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===ga);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(Ja(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Rr(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let d;if(o){let f=null;for(let b=0;b<o.length;b++)if(o[b]&&Po(o[b],c)){f=o[b],o[b]=null;break}f&&(d=f)}if(d)Fs(d);else{const f=ko(c);d=this.createTextTrack(f,c.name,c.lang),d&&(d.mode="disabled")}d&&this.textTracks.push(d)}),o!=null&&o.length){const c=o.filter(u=>u!==null).map(u=>u.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const r=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const n=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!n)return;const s=`textTrack${n[1]}`,r=this.captionsProperties[s];r&&(r.label=i.name,i.lang&&(r.languageCode=i.lang),r.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===ce.MAIN){var i,n;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,d=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;s&&r&&(u!==o+1||u===o&&d!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=d}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===ce.SUBTITLE)if(n.byteLength){const s=i.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===ga?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Lo(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{i.logger.log(`Failed to parse IMSC1: ${n}`),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:s,unparsedVttFrags:r}=this,o=s.length-1;if(!s[i.cc]&&o===-1){r.push(e);return}const c=this.hls,u=(t=i.initSegment)!=null&&t.data?je(i.initSegment.data,new Uint8Array(n)).buffer:n;gc(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,d=>{this._appendCues(d,i.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},d=>{const f=d.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${d}`),!(f&&o>i.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:d})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Lo(t,this.initPTS[e.cc],()=>{i.textCodec=ga,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(s=>po(n,s))}else{const n=this.tracks[t];if(!n)return;const s=n.default?"default":"subtitles"+t;i.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===ce.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(!(i.type===ce.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let s=0;s<n.length;s++){const r=n[s].bytes;if(r){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(r);this.cea608Parser1.addData(n[s].pts,o[0]),this.cea608Parser2.addData(n[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:s}){const{media:r}=this;if(!(!r||r.currentTime<i)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>la(o[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>la(o[c],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let s=0;s<i;s++){const r=e[n++],o=127&e[n++],c=127&e[n++];if(o===0&&c===0)continue;if((4&r)!==0){const d=3&r;(d===0||d===1)&&(t[d].push(o),t[d].push(c))}}return t}}function ko(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Po(a,e){return!!a&&a.kind===ko(e)&&ia(e,a)}function xc(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function Oo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Tc=/\s/,Ac={newCue(a,e,t,i){const n=[];let s,r,o,c,u;const d=self.VTTCue||self.TextTrackCue;for(let b=0;b<i.rows.length;b++)if(s=i.rows[b],o=!0,c=0,u="",!s.isEmpty()){var f;for(let G=0;G<s.chars.length;G++)Tc.test(s.chars[G].uchar)&&o?c++:(u+=s.chars[G].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const x=Ao(u.trim()),T=ma(e,t,x);a!=null&&(f=a.cues)!=null&&f.getCueById(T)||(r=new d(e,t,x),r.id=T,r.line=b+1,r.align="left",r.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(r))}return a&&n.length&&(n.sort((b,x)=>b.line==="auto"||x.line==="auto"?0:b.line>8&&x.line>8?x.line-b.line:b.line-x.line),n.forEach(b=>po(a,b))),n}};function wc(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const Rc=/(\d+)-(\d+)\/(\d+)/;class Mo{constructor(e){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=e.fetchSetup||Cc,this.controller=new self.AbortController,this.stats=new S}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const s=Lc(e,this.controller.signal),r=e.responseType==="arraybuffer",o=r?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=c&&B(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(tr(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var b;this.response=this.loader=f;const x=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},u-(x-n.loading.start)),!f.ok){const{status:G,statusText:$}=f;throw new kc($||"fetch, bad network response",G,f)}n.loading.first=x,n.total=Dc(f.headers)||n.total;const T=(b=this.callbacks)==null?void 0:b.onProgress;return T&&B(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,T):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var b,x;const T=this.response;if(!T)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const G=f[o];G&&(n.loaded=n.total=G);const $={url:T.url,data:f,code:T.status},ue=(b=this.callbacks)==null?void 0:b.onProgress;ue&&!B(t.highWaterMark)&&ue(n,e,f,T),(x=this.callbacks)==null||x.onSuccess($,n,e,T)}).catch(f=>{var b;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const x=f&&f.code||0,T=f?f.message:null;(b=this.callbacks)==null||b.onError({code:x,text:T},e,f?f.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,s){const r=new Ds,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const d=u.value,f=d.length;return t.loaded+=f,f<n||r.dataLength?(r.push(d),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,d.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Lc(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(g({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function Ic(a){const e=Rc.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Dc(a){const e=a.get("Content-Range");if(e){const i=Ic(e);if(B(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function Cc(a,e){return new self.Request(a.url,e)}class kc extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const Pc=/^age:\s*[\d.]+\s*$/im;class No{constructor(e){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=e&&e.xhrSetup||null,this.stats=new S,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return s(i,t.url)}).catch(r=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),s(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(r=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:r.message},t,i,n)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:r}=i.loadPolicy;if(n)for(const o in n)e.setRequestHeader(o,n[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=s&&B(s)?s:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,s=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,d=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const T=d!=null?d:t.response;if(T!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const G=t.responseType==="arraybuffer"?T.byteLength:T.length;i.loaded=i.total=G,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const $=(r=this.callbacks)==null?void 0:r.onProgress;$&&$(i,e,T,t);const ue={url:t.responseURL,data:T,code:u};(o=this.callbacks)==null||o.onSuccess(ue,i,e,t);return}}const f=s.loadPolicy.errorRetry,b=i.retry,x={url:e.url,data:void 0,code:u};if(Ri(f,b,!1,x))this.retry(f);else{var c;te.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ri(e,t,!0))this.retry(e);else{var i;te.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=bi(e,i.retry),i.retry++,te.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Pc.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Oc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Mc=E(E({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:No,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Mt,bufferController:tu,capLevelController:sa,errorController:on,fpsController:Uu,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:vi,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,certLoadPolicy:{default:Oc},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:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Nc()),{},{subtitleStreamController:Xu,subtitleTrackController:Gu,timelineController:Sc,audioStreamController:ql,audioTrackController:Ql,emeController:Ns,cmcdController:Nu,contentSteeringController:Bu,interstitialsController:Yu});function Nc(){return{cueHandler:Ac,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Fc(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=Ea(a),n=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,c=e[o]===void 0,u=[];s.forEach(d=>{const f=`${r}Loading${d}`,b=e[f];if(b!==void 0&&c){u.push(f);const x=i[o].default;switch(e[o]={default:x},d){case"TimeOut":x.maxLoadTimeMs=b,x.maxTimeToFirstByteMs=b;break;case"MaxRetry":x.errorRetry.maxNumRetry=b,x.timeoutRetry.maxNumRetry=b;break;case"RetryDelay":x.errorRetry.retryDelayMs=b,x.timeoutRetry.retryDelayMs=b;break;case"MaxRetryTimeout":x.errorRetry.maxRetryDelayMs=b,x.timeoutRetry.maxRetryDelayMs=b;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${Lt(e[o])}`)}),E(E({},i),e)}function Ea(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(Ea):Object.keys(a).reduce((e,t)=>(e[t]=Ea(a[t]),e),{}):a}function Bc(a,e){const t=a.loader;t!==Mo&&t!==No?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):wc()&&(a.loader=Mo,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const kr=2,Uc=.1,Kc=.05,$c=100;class Gc extends vn{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval($c),this.mediaSource=t.mediaSource;const i=this.media=t.media;cs(i,"playing",this.onMediaPlaying),cs(i,"waiting",this.onMediaWaiting),cs(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(rs(i,"playing",this.onMediaPlaying),rs(i,"waiting",this.onMediaWaiting),rs(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const s=(i=this.hls)==null?void 0:i.config;if(!s)return;const{media:r,stalled:o}=this;if(!r)return;const{seeking:c}=r,u=this.seeking&&!c,d=!this.seeking&&c,f=r.paused&&!c||r.ended||r.playbackRate===0;if(this.seeking=c,e!==t){t&&(this.ended=0),this.moved=!0,c||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||u){u&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1}));return}if(!pi.getBuffered(r).length){this.nudgeRetry=0;return}const b=pi.bufferInfo(r,e,0),x=b.nextStart||0,T=this.fragmentTracker;if(c&&T&&this.hls){const Je=Fo(this.hls.inFlightFragments,e),Me=b.len>kr,ze=!x||Je||x-e>kr&&!T.getPartialFragment(e);if(Me||ze)return;this.moved=!1}const G=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&T){if(!(b.len>0)&&!x)return;const Me=Math.max(x,b.start||0)-e,nt=!!(G!=null&&G.live)?G.targetduration*2:kr,Ne=T.getPartialFragment(e);if(Me>0&&(Me<=nt||Ne)){r.paused||this._trySkipBufferHole(Ne);return}}const $=s.detectStallWithCurrentTimeMs,ue=self.performance.now(),_e=this.waiting;if(o===null){_e>0&&ue-_e<$?this.stalled=_e:this.stalled=ue;return}const fe=ue-o;if(!c&&(fe>=$||_e)&&this.hls){var Pe;if(((Pe=this.mediaSource)==null?void 0:Pe.readyState)==="ended"&&!(G!=null&&G.live)&&Math.abs(e-((G==null?void 0:G.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(b),!this.media||!this.hls)return}const Oe=pi.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(Oe,fe)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const s=pi.bufferedInfo(pi.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=pi.timeRangesToArray(n),o=pi.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=pi.bufferedInfo(r,e,0).bufferedIndex,u=r[o].end,d=r[o+1].start;if((c===-1||c>o)&&d-u<1&&e-u<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${d} buffered index: ${c}`);this.warn(f.message),this.media.currentTime+=1e-6;const b=this.fragmentTracker.getPartialFragment(e)||void 0,x=pi.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:b,buffer:x.len,bufferInfo:x})}}}}}_tryFixBufferStall(e,t){var i,n;const{fragmentTracker:s,media:r}=this,o=(i=this.hls)==null?void 0:i.config;if(!r||!s||!o)return;const c=r.currentTime,u=(n=this.hls)==null?void 0:n.latestLevelDetails,d=s.getPartialFragment(c);if((d||u!=null&&u.live&&c<u.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;const f=e.buffered;(f&&f.length>1&&e.len>o.maxBufferHole||e.nextStart&&e.nextStart-c<o.maxBufferHole)&&(t>o.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:s}=this;if(!n&&s!==null&&i&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Lt(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,s=(t=this.hls)==null?void 0:t.config;if(!n||!i||!s)return 0;const r=n.currentTime,o=pi.bufferInfo(n,r,0),c=r<o.start?o.start:o.nextStart;if(c&&this.hls){const d=o.len<=s.maxBufferHole,f=o.len>0&&o.len<1&&n.readyState<3,b=c-r;if(b>0&&(d||f)){if(b>s.maxBufferHole){let T=!1;if(r===0){const G=i.getAppendedFrag(0,ce.MAIN);G&&c<G.end&&(T=!0)}if(!T){const G=e||i.getAppendedFrag(r,ce.MAIN);if(G){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||Fo(this.hls.inFlightFragments,c))return 0;let ue=!1,_e=G.end;for(;_e<c;){const fe=i.getPartialFragment(_e);if(fe)_e+=fe.duration;else{ue=!0;break}}if(ue)return 0}}}const x=Math.max(c+Kc,r+Uc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${x}`),this.moved=!0,n.currentTime=x,!(e!=null&&e.gap)){const T=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${x}`);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:T,reason:T.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return x}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:n}=this,s=t==null?void 0:t.config;if(!i||!s)return 0;const r=i.currentTime;if(this.nudgeRetry++,n<s.nudgeMaxRetry){const o=r+(n+1)*s.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(c.message),i.currentTime=o,t.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${r} after ${s.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Fo(a,e){const t=Bo(a.main);if(t&&t.start<=e)return t;const i=Bo(a.audio);return i&&i.start<=e?i:null}function Bo(a){if(!a)return null;switch(a.state){case it.IDLE:case it.STOPPED:case it.ENDED:case it.ERROR:return null}return a.frag}const Vc=.25;function ba(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Uo(a,e,t,i,n){let s=new a(e,t,"");try{s.value=i,n&&(s.type=n)}catch(r){s=new a(e,t,Lt(n?E({type:n},i):i))}return s}const Pr=(()=>{const a=ba();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function jc(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Wc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(p.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Fs(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return fo(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:n}}}=this;if(!i&&!n)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=ba();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Bn.emsg&&!i||!n)continue;const u=ka(s[o].data);if(u){const d=s[o].pts;let f=d+s[o].duration;f>Pr&&(f=Pr),f-d<=0&&(f=d+Vc);for(let x=0;x<u.length;x++){const T=u[x];if(!Pa(T)){this.updateId3CueEnds(d,c);const G=Uo(r,d,f,T,c);G&&this.id3Track.addCue(G)}}}}}updateId3CueEnds(e,t){var i;const n=(i=this.id3Track)==null?void 0:i.cues;if(n)for(let s=n.length;s--;){const r=n[s];r.type===t&&r.startTime<e&&r.endTime===Pr&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let u;n==="audio"?u=d=>d.type===Bn.audioId3&&c:n==="video"?u=d=>d.type===Bn.emsg&&o:u=d=>d.type===Bn.audioId3&&c||d.type===Bn.emsg&&o,la(s,t,i,u)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:i}=this,{dateRanges:n}=e,s=Object.keys(n);let r=this.dateRangeCuesAppended;if(i&&t){var o;if((o=i.cues)!=null&&o.length){const d=Object.keys(r).filter(f=>!s.includes(f));for(let f=d.length;f--;){const b=d[f],x=r[b].cues;delete r[b],Object.keys(x).forEach(T=>{try{const G=x[T];G.removeEventListener("enter",this.onEventCueEnter),i.removeCue(G)}catch(G){}})}}else r=this.dateRangeCuesAppended={}}const c=e.fragments[e.fragments.length-1];if(s.length===0||!B(c==null?void 0:c.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const u=ba();for(let d=0;d<s.length;d++){const f=s[d],b=n[f],x=b.startTime,T=r[f],G=(T==null?void 0:T.cues)||{};let $=(T==null?void 0:T.durationKnown)||!1,ue=Pr;const{duration:_e,endDate:fe}=b;if(fe&&_e!==null)ue=x+_e,$=!0;else if(b.endOnNext&&!$){const Oe=s.reduce((Je,Me)=>{if(Me!==b.id){const ze=n[Me];if(ze.class===b.class&&ze.startDate>b.startDate&&(!Je||b.startDate<Je.startDate))return ze}return Je},null);Oe&&(ue=Oe.startTime,$=!0)}const Pe=Object.keys(b.attr);for(let Oe=0;Oe<Pe.length;Oe++){const Je=Pe[Oe];if(!An(Je))continue;const Me=G[Je];if(Me)$&&!T.durationKnown?Me.endTime=ue:Math.abs(Me.startTime-x)>.01&&(Me.startTime=x,Me.endTime=ue);else if(u){let ze=b.attr[Je];as(Je)&&(ze=jc(ze));const Ne=Uo(u,x,ue,{key:Je,data:ze},Bn.dateRange);Ne&&(Ne.id=f,this.id3Track.addCue(Ne),G[Je]=Ne,this.hls.config.interstitialsController&&(Je==="X-ASSET-LIST"||Je==="X-ASSET-URL")&&Ne.addEventListener("enter",this.onEventCueEnter))}}r[f]={cues:G,dateRange:b,durationKnown:$}}}}class Hc{constructor(e){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=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||r===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const c=n-o,u=Math.min(this.maxLatency,o+i.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,r)),b=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,x=Math.min(f,Math.max(1,b));this.changeMediaPlaybackRate(t,x)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*n);const d=n;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,d)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const n=i.edge,s=e-t-this.edgeStalled,r=n-i.totalduration,o=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(r,s),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===j.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Zc extends ta{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],s={},r={};let o=!1,c=!1,u=!1;t.levels.forEach(d=>{var f;const b=d.attrs;let{audioCodec:x,videoCodec:T}=d;x&&(d.audioCodec=x=ai(x,i)||void 0),((f=T)==null?void 0:f.indexOf("avc1"))===0&&(T=d.videoCodec=Ct(T));const{width:G,height:$,unknownCodecs:ue}=d;let _e=ue?ue.length:0;if(ue)for(let At=_e;At--;){const Gt=ue[At];this.isAudioSupported(Gt)?(d.audioCodec=x=x?`${x},${Gt}`:Gt,_e--,Ht.audio[x.substring(0,4)]=2):this.isVideoSupported(Gt)&&(d.videoCodec=T=T?`${T},${Gt}`:Gt,_e--,Ht.video[T.substring(0,4)]=2)}if(o||(o=!!(G&&$)),c||(c=!!T),u||(u=!!x),_e||x&&!this.isAudioSupported(x)||T&&!this.isVideoSupported(T)){this.log(`Some or all CODECS not supported "${b.CODECS}"`);return}const{CODECS:fe,"FRAME-RATE":Pe,"HDCP-LEVEL":Oe,"PATHWAY-ID":Je,RESOLUTION:Me,"VIDEO-RANGE":ze}=b,Ne=`${`${Je||"."}-`}${d.bitrate}-${Me}-${Pe}-${fe}-${ze}-${Oe}`;if(s[Ne])if(s[Ne].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const At=r[Ne]+=1;d.attrs["PATHWAY-ID"]=new Array(At+1).join(".");const Gt=this.createLevel(d);s[Ne]=Gt,n.push(Gt)}else s[Ne].addGroupId("audio",b.AUDIO),s[Ne].addGroupId("text",b.SUBTITLES);else{const At=this.createLevel(d);s[Ne]=At,r[Ne]=1,n.push(At)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new et(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(n.message),t.supportedResult=k(n,[])}return t}isAudioSupported(e){return Et(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Et(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){let r=[],o=[],c=e;if((i||n)&&s&&(c=c.filter(({videoCodec:$,videoRange:ue,width:_e,height:fe})=>(!!$||!!(_e&&fe))&&Zt(ue))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let $="no level with compatible codecs found in manifest",ue=$;t.levels.length&&(ue=`one or more CODECS in variant not supported: ${Lt(t.levels.map(fe=>fe.attrs.CODECS).filter((fe,Pe,Oe)=>Oe.indexOf(fe)===Pe))}`,this.warn(ue),$+=` (${ue})`);const _e=new Error($);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:_e,reason:ue})}});return}t.audioTracks&&(r=t.audioTracks.filter($=>!$.audioCodec||this.isAudioSupported($.audioCodec)),Ko(r)),t.subtitles&&(o=t.subtitles,Ko(o));const u=c.slice(0);c.sort(($,ue)=>{if($.attrs["HDCP-LEVEL"]!==ue.attrs["HDCP-LEVEL"])return($.attrs["HDCP-LEVEL"]||"")>(ue.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&$.height!==ue.height)return $.height-ue.height;if($.frameRate!==ue.frameRate)return $.frameRate-ue.frameRate;if($.videoRange!==ue.videoRange)return Nt.indexOf($.videoRange)-Nt.indexOf(ue.videoRange);if($.videoCodec!==ue.videoCodec){const _e=ti($.videoCodec),fe=ti(ue.videoCodec);if(_e!==fe)return fe-_e}if($.uri===ue.uri&&$.codecSet!==ue.codecSet){const _e=Ot($.codecSet),fe=Ot(ue.codecSet);if(_e!==fe)return fe-_e}return $.averageBitrate!==ue.averageBitrate?$.averageBitrate-ue.averageBitrate:0});let d=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let $=0;$<u.length;$++)if(u[$].pathwayId===c[0].pathwayId){d=u[$];break}}this._levels=c;for(let $=0;$<c.length;$++)if(c[$]===d){var f;this._firstLevel=$;const ue=d.bitrate,_e=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${ue}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const fe=Math.min(ue,this.hls.config.abrEwmaDefaultEstimateMax);fe>_e&&_e===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=fe)}break}const b=s&&!n,x=this.hls.config,T=!!(x.audioStreamController&&x.audioTrackController),G={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:T&&!b&&r.some($=>!!$.url)};this.hls.trigger(p.MANIFEST_PARSED,G)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const d=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:d,reason:d.message}),f)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,s=n?n.attrs["PATHWAY-ID"]:void 0,r=t[e],o=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,i===e&&n&&s===o)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${o?" with Pathway "+o:""} from level ${i}${s?" with Pathway "+s:""}`);const c={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(p.LEVEL_SWITCHING,c);const u=r.details;if(!u||u.live){const d=this.switchParams(r.uri,n==null?void 0:n.details,u);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===me.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ce.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(s=>!!i[s]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:s}=t,r=t.levelInfo;if(!r){var o;this.warn(`Invalid level index ${n}`),(o=t.deliveryDirectives)!=null&&o.skip&&(s.deltaUpdateFailed=!0);return}if(r===this.currentLevel||t.withoutMultiVariant){r.fragmentError===0&&(r.loadError=0);let c=r.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(n,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,o=r==null?void 0:r.age;this.log(`Loading level index ${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${i}`),this.hls.trigger(p.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((s,r)=>r!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(o=>o.level=-1)),!1));Zs(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(p.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Ko(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function $o(){return self.SourceBuffer||self.WebKitSourceBuffer}function Go(){if(!ge())return!1;const e=$o();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function zc(){if(!Go())return!1;const a=ge();return typeof(a==null?void 0:a.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(pt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(pt(e,"audio"))))}function Yc(){var a;const e=$o();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Xc=100;class qc extends Sn{constructor(e,t,i){super(e,t,i,"stream-controller",ce.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const n=this.media,s=n?n.currentTime:null;if(s===null||!B(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(n,s,ce.MAIN,0);if(r===null||r.len===0){this.warn(`Main forward buffer length at ${s} on "seeked" event ${r?r.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(Xc),this.level=-1,!this.startFragRequested){let s=n.startLevel;s===-1&&(n.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=n.firstAutoLevel),n.nextLoadLevel=s,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=it.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=it.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case it.WAITING_LEVEL:{const{levels:t,level:i}=this,n=t==null?void 0:t[i],s=n==null?void 0:n.details;if(s&&(!s.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(s))break;this.state=it.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=it.IDLE;break}break}case it.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:n,level:s}=this,r=n==null?void 0:n[s];this.resetStartWhenNotLoaded(r||null),this.state=it.IDLE}}break}this.state===it.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[s]))return;const r=i[s],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const G={};this.altAudio===2&&(G.type="video"),this.hls.trigger(p.BUFFER_EOS,G),this.state=it.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const u=r.details;if(!u||this.state===it.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=it.WAITING_LEVEL,this.startFragRequested=!1;return}const d=o.len,f=this.getMaxBufferLength(r.maxBitrate);if(d>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const b=this.backtrackFragment?this.backtrackFragment.start:o.end;let x=this.getNextFragment(b,u);if(this.couldBacktrack&&!this.fragPrevious&&x&&ae(x)&&this.fragmentTracker.getState(x)!==Ai.OK){var T;const $=((T=this.backtrackFragment)!=null?T:x).sn-u.startSN,ue=u.fragments[$-1];ue&&x.cc===ue.cc&&(x=ue,this.fragmentTracker.removeFragment(ue))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(x&&this.isLoopLoading(x,b)){if(!x.gap){const $=this.audioOnly&&!this.altAudio?v.AUDIO:v.VIDEO,ue=($===v.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;ue&&this.afterBufferFlushed(ue,$,ce.MAIN)}x=this.getNextFragmentLoopLoading(x,u,o,ce.MAIN,f)}x&&(x.initSegment&&!x.initSegment.data&&!this.bitrateTest&&(x=x.initSegment),this.loadFragment(x,r,b))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Ai.NOT_LOADED||n===Ai.PARTIAL?ae(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ce.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<s.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,c=e[o],u=this.fragLastKbps;u&&this.fragCurrent?i=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:i=0}else i=0;const r=this.getBufferedFrag(t.currentTime+i);if(r){const o=this.followingBufferedFrag(r);if(o){this.abortCurrentFrag();const c=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,d=Math.max(r.end,c+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case it.KEY_LOADING:case it.FRAG_LOADING:case it.FRAG_LOADING_WAITING_RETRY:case it.PARSING:case it.PARSED:this.state=it.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;cs(i,"playing",this.onMediaPlaying),cs(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(rs(i,"playing",this.onMediaPlaying),rs(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(p.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,n=!1;t.levels.forEach(s=>{const r=s.audioCodec;r&&(i=i||r.indexOf("mp4a.40.2")!==-1,n=n||r.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&n&&!Yc(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==it.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=it.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:s}=this,r=t.level,o=t.details,c=o.totalduration;if(!n){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${c}`);const u=t.levelInfo,d=this.fragCurrent;d&&(this.state===it.FRAG_LOADING||this.state===it.FRAG_LOADING_WAITING_RETRY)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let f=0;if(o.live||(i=u.details)!=null&&i.live){var b;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(b=this.levelLastLoaded)==null?void 0:b.details)}if(u.details=o,this.levelLastLoaded=u,s||this.setStartPosition(o,f),this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:r}),this.state===it.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=it.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,o=e.edge,c=s>=r-t.maxFragLookUpTolerance&&s<=o;if(n!==null&&i.duration>n&&(s<n||!c)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!c&&i.readyState<4||s<o-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),i.currentTime=n))}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=r[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const u=o.videoCodec,d=c.PTSKnown||!c.live,f=(t=i.initSegment)==null?void 0:t.data,b=this._getAudioCodec(o),x=this.transmuxer=this.transmuxer||new qa(this.hls,ce.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),T=n?n.index:-1,G=T!==-1,$=new yn(i.level,i.sn,i.stats.chunkCount,s.byteLength,T,G),ue=this.initPTS[i.cc];x.push(s,f,b,u,i,n,c.totalduration,d,$,ue)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(Wt(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(n){this.fragmentTracker.removeAllFragments(),i.once(p.BUFFER_FLUSHED,()=>{var r;(r=this.hls)==null||r.trigger(p.AUDIO_TRACK_SWITCHED,t)}),i.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=Wt(t.url,this.hls);if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,s,r=!1;for(const o in i){const c=i[o];if(c.id==="main"){if(s=o,n=c,o==="video"){const u=i[o];u&&(this.videoBuffer=u.buffer)}}else r=!0}r&&n?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,s=i.type===ce.MAIN;if(s){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===it.PARSED&&(this.state=it.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),ae(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&pi.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=it.ERROR;return}switch(t.details){case j.FRAG_GAP:case j.FRAG_PARSING_ERROR:case j.FRAG_DECRYPT_ERROR:case j.FRAG_LOAD_ERROR:case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_ERROR:case j.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.MAIN,t);break;case j.LEVEL_LOAD_ERROR:case j.LEVEL_LOAD_TIMEOUT:case j.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===it.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===me.LEVEL&&(this.state=it.IDLE);break;case j.BUFFER_ADD_CODEC_ERROR:case j.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case j.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case j.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=it.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==v.AUDIO||!this.altAudio){const i=(t===v.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,ce.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const n=this.timelineOffset;n&&i&&(i+=n);const s=this.getLevelDetails(),r=pi.getBuffered(e),o=r.length?r.start(0):0,c=o-i,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);c>0&&(c<u||this.loadingParts&&c<2*((s==null?void 0:s.partTarget)||0))&&(this.log(`adjusting start position by ${c} to match buffer start`),i+=c,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:n}=this,s=i==null?void 0:i.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=it.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=s.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),n.trigger(p.FRAG_LOADED,i),s.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i=this.playlistType,{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:d}=o,{video:f,text:b,id3:x,initSegment:T}=s,{details:G}=d,$=this.altAudio?void 0:s.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=it.PARSING,T){if(T!=null&&T.tracks){const fe=c.initSegment||c;this._bufferInitSegment(d,T.tracks,fe,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:fe,id:i,tracks:T.tracks})}const ue=T.initPTS,_e=T.timescale;B(ue)&&(this.initPTS[c.cc]={baseTime:ue,timescale:_e},n.trigger(p.INIT_PTS_FOUND,{frag:c,id:i,initPTS:ue,timescale:_e}))}if(f&&G){$&&f.type==="audiovideo"&&this.logMuxedErr(c);const ue=G.fragments[c.sn-1-G.startSN],_e=c.sn===G.startSN,fe=!ue||c.cc>ue.cc;if(s.independent!==!1){const{startPTS:Pe,endPTS:Oe,startDTS:Je,endDTS:Me}=f;if(u)u.elementaryStreams[f.type]={startPTS:Pe,endPTS:Oe,startDTS:Je,endDTS:Me};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!fe&&(this.couldBacktrack=!0),f.dropped&&f.independent){const ze=this.getMainFwdBufferInfo(),nt=(ze?ze.end:this.getLoadPosition())+this.config.maxBufferHole,Ne=f.firstKeyFramePTS?f.firstKeyFramePTS:Pe;if(!_e&&nt<Ne-this.config.maxBufferHole&&!fe){this.backtrack(c);return}else fe&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,Oe,c.start,Me,!0)}else _e&&Pe-(G.appliedTimelineOffset||0)>kr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,Pe,Oe,Je,Me),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,u,r,_e||fe)}else if(_e||fe)c.gap=!0;else{this.backtrack(c);return}}if($){const{startPTS:ue,endPTS:_e,startDTS:fe,endDTS:Pe}=$;u&&(u.elementaryStreams[v.AUDIO]={startPTS:ue,endPTS:_e,startDTS:fe,endDTS:Pe}),c.setElementaryStreamInfo(v.AUDIO,ue,_e,fe,Pe),this.bufferFragmentData($,c,u,r)}if(G&&x!=null&&(t=x.samples)!=null&&t.length){const ue={id:i,frag:c,details:G,samples:x.samples};n.trigger(p.FRAG_PARSING_METADATA,ue)}if(G&&b){const ue={id:i,frag:c,details:G,samples:b.samples};n.trigger(p.FRAG_PARSING_USERDATA,ue)}}logMuxedErr(e){this.warn(`${ae(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==it.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:s,video:r,audiovideo:o}=t;if(s){let u=qt(s.codec,e.audioCodec);u==="mp4a"&&(u="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const f=s.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),e.audioCodec&&e.audioCodec!==u&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${u}"`),s.levelCodec=u,s.id=ce.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${u||""}/${e.audioCodec||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=ce.MAIN;const u=r.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":r.codec="hvc1.1.6.L120.90";break;case"av01":r.codec="av01.0.04M.08";break;case"avc1":r.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${r.codec!==u?" parsed-corrected="+r.codec:""}${r.supplemental?" supplemental="+r.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(p.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const f=t[u].initSegment;f!=null&&f.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:u,data:f,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,ce.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=it.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(pi.isBuffered(e,i)?t=this.getAppendedFrag(i):pi.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,s=t.level;(!n||t.sn!==n.sn||n.level!==s)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!n||n.level!==s)&&this.hls.trigger(p.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return B(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(B(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?mi(null,i.fragments,t):null);if(n){const s=n.programDateTime;if(s!==null){const r=s+(t-n.start)*1e3;return new Date(r)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Qc{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[i].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=j.KEY_LOAD_ERROR,i,n,s){return new Ui({type:he.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:i,networkDetails:n})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:n}=e;for(let s=0;s<t.length;s++){const r=t[s];if(n<=r.cc&&(i==="initSegment"||r.sn==="initSegment"||i<r.sn)){this.emeController.selectKeySystemFormat(r).then(o=>{r.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,j.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,j.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));let o=this.keyUriToKeyInfo[r];if((i=o)!=null&&i.decryptdata.key)return s.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((n=o)!=null&&n.keyLoadPromise){var c;switch((c=o.mediaKeySessionContext)==null?void 0:c.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(u=>(s.key=u.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[r]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,j.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(i);if(n)return(e.keyLoadPromise=n.then(s=>(e.mediaKeySessionContext=s,i))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,s=new n(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((r,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=i.keyLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(b,x,T,G)=>{const{frag:$,keyInfo:ue,url:_e}=T;if(!$.decryptdata||ue!==this.keyUriToKeyInfo[_e])return o(this.createKeyLoadError($,j.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),G));ue.decryptdata.key=$.decryptdata.key=new Uint8Array(b.data),$.keyLoader=null,ue.loader=null,r({frag:$,keyInfo:ue})},onError:(b,x,T,G)=>{this.resetLoader(x),o(this.createKeyLoadError(t,j.KEY_LOAD_ERROR,new Error(`HTTP Error ${b.code} loading key ${b.text}`),T,E({url:c.url,data:void 0},b)))},onTimeout:(b,x,T)=>{this.resetLoader(x),o(this.createKeyLoadError(t,j.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),T))},onAbort:(b,x,T)=>{this.resetLoader(x),o(this.createKeyLoadError(t,j.INTERNAL_ABORTED,new Error("key loading aborted"),T))}};s.load(c,d,f)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,s=i.loader;t.keyLoader===s&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[n],s&&s.destroy()}}function Vo(a){const{type:e}=a;switch(e){case me.AUDIO_TRACK:return ce.AUDIO;case me.SUBTITLE_TRACK:return ce.SUBTITLE;default:return ce.MAIN}}function Sa(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Jc{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,s=i||n,r=new s(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:me.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:c}=t;this.load({id:i,level:n,pathwayId:s,responseType:"text",type:me.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:me.AUDIO_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:me.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[me.LEVEL];if(i){const n=i.context;n&&!t.levels.some(s=>s===n.levelOrTrack)&&(i.abort(),delete this.loaders[me.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const u=this.hls.logger,d=n.context;if(d&&d.levelOrTrack===e.levelOrTrack&&(d.url===e.url||d.deliveryDirectives&&!e.deliveryDirectives)){d.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${d.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let s;if(e.type===me.MANIFEST?s=i.manifestLoadPolicy.default:s=g({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),B((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===me.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===me.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===me.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const d=u.partTarget,f=u.targetduration;if(d&&f){const b=Math.max(d*3,f*.8)*1e3;s=g({},s,{maxTimeToFirstByteMs:Math.min(b,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(b,s.maxTimeToFirstByteMs)})}}}const r=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},c={onSuccess:(u,d,f,b)=>{const x=this.getInternalLoader(f);this.resetInternalLoader(f.type);const T=u.data;if(T.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),b||null,d);return}d.parsing.start=performance.now(),Fn.isMediaPlaylist(T)||f.type!==me.MANIFEST?this.handleTrackOrLevelPlaylist(u,d,f,b||null,x):this.handleMasterPlaylist(u,d,f,b)},onError:(u,d,f,b)=>{this.handleNetworkError(d,f,!1,u,b)},onTimeout:(u,d,f)=>{this.handleNetworkError(d,f,!0,void 0,u)}};n.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const s=this.hls,r=e.data,o=Sa(e,i),c=Fn.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:u,levels:d,sessionData:f,sessionKeys:b,startTimeOffset:x,variableList:T}=c;this.variableList=T;const{AUDIO:G=[],SUBTITLES:$,"CLOSED-CAPTIONS":ue}=Fn.parseMasterPlaylistMedia(r,o,c);G.length&&!G.some(fe=>!fe.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),G.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Wi({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:d,audioTracks:G,subtitles:$,captions:ue,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:b,startTimeOffset:x,variableList:T})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:c,type:u}=i,d=Sa(e,i),f=B(c)?c:B(o)?o:0,b=Vo(i),x=Fn.parseLevelPlaylist(e.data,d,f,b,0,this.variableList);if(u===me.MANIFEST){const T={attrs:new Wi({}),bitrate:0,details:x,name:"",url:d};x.requestScheduled=t.loading.start+Es(x,0),r.trigger(p.MANIFEST_LOADED,{levels:[T],audioTracks:[],url:d,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=x,this.handlePlaylistLoaded(x,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.MANIFEST_PARSING_ERROR,fatal:t.type===me.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:s})}handleNetworkError(e,t,i=!1,n,s){let r=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===me.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===me.AUDIO_TRACK||e.type===me.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=j.UNKNOWN,u=!1;const d=this.getInternalLoader(e);switch(e.type){case me.MANIFEST:c=i?j.MANIFEST_LOAD_TIMEOUT:j.MANIFEST_LOAD_ERROR,u=!0;break;case me.LEVEL:c=i?j.LEVEL_LOAD_TIMEOUT:j.LEVEL_LOAD_ERROR,u=!1;break;case me.AUDIO_TRACK:c=i?j.AUDIO_TRACK_LOAD_TIMEOUT:j.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case me.SUBTITLE_TRACK:c=i?j.SUBTITLE_TRACK_LOAD_TIMEOUT:j.SUBTITLE_LOAD_ERROR,u=!1;break}d&&this.resetInternalLoader(e.type);const f={type:he.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:s};if(n){const b=(t==null?void 0:t.url)||e.url;f.response=E({url:b,data:void 0},n)}this.hls.trigger(p.ERROR,f)}handlePlaylistLoaded(e,t,i,n,s,r){const o=this.hls,{type:c,level:u,id:d,groupId:f,deliveryDirectives:b}=n,x=Sa(t,n),T=Vo(n),G=typeof n.level=="number"&&T===ce.MAIN?u:void 0;if(!e.fragments.length){const ue=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.LEVEL_EMPTY_ERROR,fatal:!1,url:x,error:ue,reason:ue.message,response:t,context:n,level:G,parent:T,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const $=e.playlistParsingError;if($){if(this.hls.logger.warn($),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.LEVEL_PARSING_ERROR,fatal:!1,url:x,error:$,reason:$.message,response:t,context:n,level:G,parent:T,networkDetails:s,stats:i});return}e.playlistParsingError=null}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case me.MANIFEST:case me.LEVEL:o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||o.levels[0],level:G||0,id:d||0,stats:i,networkDetails:s,deliveryDirectives:b,withoutMultiVariant:c===me.MANIFEST});break;case me.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:d||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:b});break;case me.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:d||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:b});break}}}class gs{static get version(){return qs}static isMSESupported(){return Go()}static isSupported(){return zc()}static getMediaSource(){return ge()}static get Events(){return p}static get MetadataSchema(){return Bn}static get ErrorTypes(){return he}static get ErrorDetails(){return j}static get DefaultConfig(){return gs.defaultConfig?gs.defaultConfig:Mc}static set DefaultConfig(e){gs.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Xs,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;const t=this.logger=se(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=Fc(gs.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Bc(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=i,u=new o(this),d=this.abrController=new n(this),f=new sn(this),b=i.interstitialsController,x=b?this.interstitialsController=new b(this,gs):null,T=this.bufferController=new s(this,f),G=this.capLevelController=new r(this),$=new c(this),ue=new Jc(this),_e=i.contentSteeringController,fe=_e?new _e(this):null,Pe=this.levelController=new Zc(this,fe),Oe=new Wc(this),Je=new Qc(this.config),Me=this.streamController=new qc(this,f,Je),ze=this.gapController=new Gc(this,f);G.setStreamController(Me),$.setStreamController(Me);const nt=[ue,Pe,Me];x&&nt.splice(1,0,x),fe&&nt.splice(1,0,fe),this.networkControllers=nt;const Ne=[d,T,ze,G,$,Oe,f];this.audioTrackController=this.createController(i.audioTrackController,nt);const At=i.audioStreamController;At&&nt.push(this.audioStreamController=new At(this,f,Je)),this.subtitleTrackController=this.createController(i.subtitleTrackController,nt);const Gt=i.subtitleStreamController;Gt&&nt.push(this.subtititleStreamController=new Gt(this,f,Je)),this.createController(i.timelineController,Ne),Je.emeController=this.emeController=this.createController(i.emeController,Ne),this.cmcdController=this.createController(i.cmcdController,Ne),this.latencyController=this.createController(Hc,Ne),this.coreComponents=Ne,nt.push(u);const Mi=u.onErrorOut;typeof Mi=="function"&&this.on(p.ERROR,Mi,u),this.on(p.MANIFEST_LOADED,ue.onManifestLoaded,ue)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===p.ERROR;this.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(p.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger(p.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(p.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=ie.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(p.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[ce.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[ce.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[ce.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=pl()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){mt(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n<i;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(t===-1&&e!=null&&e.length?n=e.length-1:n=t,i)for(let s=n;s--;){const r=e[s].attrs["HDCP-LEVEL"];if(r&&r<=i)return s}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=It(t);return be(e,i,navigator.mediaCapabilities)}}gs.defaultConfig=void 0}}]);
}());