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.0f1d57...

121 lines
1.1 MiB

!(function(){var Xo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[6444],{65966:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return He}});var B=K(20439),fe=K(50298),Se=K(62646),he=K(43403),V=K(92310),p=K.n(V),me=K(29301),ce=K(76846),l=K(96452),X=K(6089),P=K(80402),g=K(34280),_=K(49658),b=K(59301),A=K(14809),N=K(77900),j=K(8654);function G(Ee){var De=Ee.prefixCls,ne=Ee.align,Re=Ee.arrow,ke=Ee.arrowPos,ee=Re||{},Y=ee.className,k=ee.content,Q=ke.x,U=Q===void 0?0:Q,M=ke.y,W=M===void 0?0:M,ae=b.useRef();if(!ne||!ne.points)return null;var ue={position:"absolute"};if(ne.autoArrow!==!1){var ye=ne.points[0],Ce=ne.points[1],xe=ye[0],qe=ye[1],Fe=Ce[0],$e=Ce[1];xe===Fe||!["t","b"].includes(xe)?ue.top=W:xe==="t"?ue.top=0:ue.bottom=0,qe===$e||!["l","r"].includes(qe)?ue.left=U:qe==="l"?ue.left=0:ue.right=0}return b.createElement("div",{ref:ae,className:p()("".concat(De,"-arrow"),Y),style:ue},k)}function L(Ee){var De=Ee.prefixCls,ne=Ee.open,Re=Ee.zIndex,ke=Ee.mask,ee=Ee.motion;return ke?b.createElement(N.default,(0,A.Z)({},ee,{motionAppear:!0,visible:ne,removeOnLeave:!0}),function(Y){var k=Y.className;return b.createElement("div",{style:{zIndex:Re},className:p()("".concat(De,"-mask"),k)})}):null}var I=b.memo(function(Ee){var De=Ee.children;return De},function(Ee,De){return De.cache}),w=I,R=b.forwardRef(function(Ee,De){var ne=Ee.popup,Re=Ee.className,ke=Ee.prefixCls,ee=Ee.style,Y=Ee.target,k=Ee.onVisibleChanged,Q=Ee.open,U=Ee.keepDom,M=Ee.fresh,W=Ee.onClick,ae=Ee.mask,ue=Ee.arrow,ye=Ee.arrowPos,Ce=Ee.align,xe=Ee.motion,qe=Ee.maskMotion,Fe=Ee.forceRender,$e=Ee.getPopupContainer,ct=Ee.autoDestroy,Le=Ee.portal,tt=Ee.zIndex,Pt=Ee.onMouseEnter,xt=Ee.onMouseLeave,Ft=Ee.onPointerEnter,Gt=Ee.onPointerDownCapture,ri=Ee.ready,qt=Ee.offsetX,ei=Ee.offsetY,Jt=Ee.offsetR,Tt=Ee.offsetB,ot=Ee.onAlign,dt=Ee.onPrepare,Ot=Ee.stretch,Bt=Ee.targetWidth,nt=Ee.targetHeight,vt=typeof ne=="function"?ne():ne,yt=Q||U,vi=($e==null?void 0:$e.length)>0,Vt=b.useState(!$e||!vi),ai=(0,fe.Z)(Vt,2),wt=ai[0],We=ai[1];if((0,g.Z)(function(){!wt&&vi&&Y&&We(!0)},[wt,vi,Y]),!wt)return null;var h="auto",m={left:"-1000vw",top:"-1000vh",right:h,bottom:h};if(ri||!Q){var y,C=Ce.points,Z=Ce.dynamicInset||((y=Ce._experimental)===null||y===void 0?void 0:y.dynamicInset),pe=Z&&C[0][1]==="r",be=Z&&C[0][0]==="b";pe?(m.right=Jt,m.left=h):(m.left=qt,m.right=h),be?(m.bottom=Tt,m.top=h):(m.top=ei,m.bottom=h)}var at={};return Ot&&(Ot.includes("height")&&nt?at.height=nt:Ot.includes("minHeight")&&nt&&(at.minHeight=nt),Ot.includes("width")&&Bt?at.width=Bt:Ot.includes("minWidth")&&Bt&&(at.minWidth=Bt)),Q||(at.pointerEvents="none"),b.createElement(Le,{open:Fe||yt,getContainer:$e&&function(){return $e(Y)},autoDestroy:ct},b.createElement(L,{prefixCls:ke,open:Q,zIndex:tt,mask:ae,motion:qe}),b.createElement(me.Z,{onResize:ot,disabled:!Q},function(rt){return b.createElement(N.default,(0,A.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Fe,leavedClassName:"".concat(ke,"-hidden")},xe,{onAppearPrepare:dt,onEnterPrepare:dt,visible:Q,onVisibleChanged:function($t){var Ut;xe==null||(Ut=xe.onVisibleChanged)===null||Ut===void 0||Ut.call(xe,$t),k($t)}}),function(_t,$t){var Ut=_t.className,At=_t.style,Zt=p()(ke,Ut,Re);return b.createElement("div",{ref:(0,j.sQ)(rt,De,$t),className:Zt,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),at),At),{},{boxSizing:"border-box",zIndex:tt},ee),onMouseEnter:Pt,onMouseLeave:xt,onPointerEnter:Ft,onClick:W,onPointerDownCapture:Gt},ue&&b.createElement(G,{prefixCls:ke,arrow:ue,arrowPos:ye,align:Ce}),b.createElement(w,{cache:!Q&&!M},vt))})}))}),q=R,se=b.forwardRef(function(Ee,De){var ne=Ee.children,Re=Ee.getTriggerDOMNode,ke=(0,j.Yr)(ne),ee=b.useCallback(function(k){(0,j.mH)(De,Re?Re(k):k)},[Re]),Y=(0,j.x1)(ee,(0,j.C4)(ne));return ke?b.cloneElement(ne,{ref:Y}):ne}),ie=se,_e=b.createContext(null),Ie=_e;function Te(Ee){return Ee?Array.isArray(Ee)?Ee:[Ee]:[]}function Ke(Ee,De,ne,Re){return b.useMemo(function(){var ke=Te(ne!=null?ne:De),ee=Te(Re!=null?Re:De),Y=new Set(ke),k=new Set(ee);return Ee&&(Y.has("hover")&&(Y.delete("hover"),Y.add("click")),k.has("hover")&&(k.delete("hover"),k.add("click"))),[Y,k]},[Ee,De,ne,Re])}var J=K(29194);function D(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ne=arguments.length>2?arguments[2]:void 0;return ne?Ee[0]===De[0]:Ee[0]===De[0]&&Ee[1]===De[1]}function F(Ee,De,ne,Re){for(var ke=ne.points,ee=Object.keys(Ee),Y=0;Y<ee.length;Y+=1){var k,Q=ee[Y];if(D((k=Ee[Q])===null||k===void 0?void 0:k.points,ke,Re))return"".concat(De,"-placement-").concat(Q)}return""}function O(Ee,De,ne,Re){return De||(ne?{motionName:"".concat(Ee,"-").concat(ne)}:Re?{motionName:Re}:null)}function le(Ee){return Ee.ownerDocument.defaultView}function te(Ee){for(var De=[],ne=Ee==null?void 0:Ee.parentElement,Re=["hidden","scroll","clip","auto"];ne;){var ke=le(ne).getComputedStyle(ne),ee=ke.overflowX,Y=ke.overflowY,k=ke.overflow;[ee,Y,k].some(function(Q){return Re.includes(Q)})&&De.push(ne),ne=ne.parentElement}return De}function S(Ee){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ee)?De:Ee}function v(Ee){return S(parseFloat(Ee),0)}function z(Ee,De){var ne=(0,B.Z)({},Ee);return(De||[]).forEach(function(Re){if(!(Re instanceof HTMLBodyElement||Re instanceof HTMLHtmlElement)){var ke=le(Re).getComputedStyle(Re),ee=ke.overflow,Y=ke.overflowClipMargin,k=ke.borderTopWidth,Q=ke.borderBottomWidth,U=ke.borderLeftWidth,M=ke.borderRightWidth,W=Re.getBoundingClientRect(),ae=Re.offsetHeight,ue=Re.clientHeight,ye=Re.offsetWidth,Ce=Re.clientWidth,xe=v(k),qe=v(Q),Fe=v(U),$e=v(M),ct=S(Math.round(W.width/ye*1e3)/1e3),Le=S(Math.round(W.height/ae*1e3)/1e3),tt=(ye-Ce-Fe-$e)*ct,Pt=(ae-ue-xe-qe)*Le,xt=xe*Le,Ft=qe*Le,Gt=Fe*ct,ri=$e*ct,qt=0,ei=0;if(ee==="clip"){var Jt=v(Y);qt=Jt*ct,ei=Jt*Le}var Tt=W.x+Gt-qt,ot=W.y+xt-ei,dt=Tt+W.width+2*qt-Gt-ri-tt,Ot=ot+W.height+2*ei-xt-Ft-Pt;ne.left=Math.max(ne.left,Tt),ne.top=Math.max(ne.top,ot),ne.right=Math.min(ne.right,dt),ne.bottom=Math.min(ne.bottom,Ot)}}),ne}function oe(Ee){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ne="".concat(De),Re=ne.match(/^(.*)\%$/);return Re?Ee*(parseFloat(Re[1])/100):parseFloat(ne)}function Ae(Ee,De){var ne=De||[],Re=(0,fe.Z)(ne,2),ke=Re[0],ee=Re[1];return[oe(Ee.width,ke),oe(Ee.height,ee)]}function Be(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ee[0],Ee[1]]}function ze(Ee,De){var ne=De[0],Re=De[1],ke,ee;return ne==="t"?ee=Ee.y:ne==="b"?ee=Ee.y+Ee.height:ee=Ee.y+Ee.height/2,Re==="l"?ke=Ee.x:Re==="r"?ke=Ee.x+Ee.width:ke=Ee.x+Ee.width/2,{x:ke,y:ee}}function St(Ee,De){var ne={t:"b",b:"t",l:"r",r:"l"};return Ee.map(function(Re,ke){return ke===De?ne[Re]||"c":Re}).join("")}function Nt(Ee,De,ne,Re,ke,ee,Y){var k=b.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ke[Re]||{}}),Q=(0,fe.Z)(k,2),U=Q[0],M=Q[1],W=b.useRef(0),ae=b.useMemo(function(){return De?te(De):[]},[De]),ue=b.useRef({}),ye=function(){ue.current={}};Ee||ye();var Ce=(0,X.Z)(function(){if(De&&ne&&Ee){let an=function(Ui,_n){var Dn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ze,Yn=yt.x+Ui,Xn=yt.y+_n,qn=Yn+be,is=Xn+pe,si=Math.max(Yn,Dn.left),Si=Math.max(Xn,Dn.top),Vi=Math.min(qn,Dn.right),Xi=Math.min(is,Dn.bottom);return Math.max(0,(Vi-si)*(Xi-Si))},bi=function(){tn=yt.y+yi,Gi=tn+pe,nn=yt.x+di,Yi=nn+be};var Fe,$e,ct,Le,tt=De,Pt=tt.ownerDocument,xt=le(tt),Ft=xt.getComputedStyle(tt),Gt=Ft.position,ri=tt.style.left,qt=tt.style.top,ei=tt.style.right,Jt=tt.style.bottom,Tt=tt.style.overflow,ot=(0,B.Z)((0,B.Z)({},ke[Re]),ee),dt=Pt.createElement("div");(Fe=tt.parentElement)===null||Fe===void 0||Fe.appendChild(dt),dt.style.left="".concat(tt.offsetLeft,"px"),dt.style.top="".concat(tt.offsetTop,"px"),dt.style.position=Gt,dt.style.height="".concat(tt.offsetHeight,"px"),dt.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 Ot;if(Array.isArray(ne))Ot={x:ne[0],y:ne[1],width:0,height:0};else{var Bt,nt,vt=ne.getBoundingClientRect();vt.x=(Bt=vt.x)!==null&&Bt!==void 0?Bt:vt.left,vt.y=(nt=vt.y)!==null&&nt!==void 0?nt:vt.top,Ot={x:vt.x,y:vt.y,width:vt.width,height:vt.height}}var yt=tt.getBoundingClientRect(),vi=xt.getComputedStyle(tt),Vt=vi.height,ai=vi.width;yt.x=($e=yt.x)!==null&&$e!==void 0?$e:yt.left,yt.y=(ct=yt.y)!==null&&ct!==void 0?ct:yt.top;var wt=Pt.documentElement,We=wt.clientWidth,h=wt.clientHeight,m=wt.scrollWidth,y=wt.scrollHeight,C=wt.scrollTop,Z=wt.scrollLeft,pe=yt.height,be=yt.width,at=Ot.height,rt=Ot.width,_t={left:0,top:0,right:We,bottom:h},$t={left:-Z,top:-C,right:m-Z,bottom:y-C},Ut=ot.htmlRegion,At="visible",Zt="visibleFirst";Ut!=="scroll"&&Ut!==Zt&&(Ut=At);var Lt=Ut===Zt,ft=z($t,ae),ht=z(_t,ae),Ze=Ut===At?ht:ft,je=Lt?ht:Ze;tt.style.left="auto",tt.style.top="auto",tt.style.right="0",tt.style.bottom="0";var pt=tt.getBoundingClientRect();tt.style.left=ri,tt.style.top=qt,tt.style.right=ei,tt.style.bottom=Jt,tt.style.overflow=Tt,(Le=tt.parentElement)===null||Le===void 0||Le.removeChild(dt);var ti=S(Math.round(be/parseFloat(ai)*1e3)/1e3),Qt=S(Math.round(pe/parseFloat(Vt)*1e3)/1e3);if(ti===0||Qt===0||(0,ce.Sh)(ne)&&!(0,J.Z)(ne))return;var Mt=ot.offset,It=ot.targetOffset,zt=Ae(yt,Mt),ve=(0,fe.Z)(zt,2),Oe=ve[0],Qe=ve[1],Ye=Ae(Ot,It),it=(0,fe.Z)(Ye,2),mt=it[0],lt=it[1];Ot.x-=mt,Ot.y-=lt;var Et=ot.points||[],Xt=(0,fe.Z)(Et,2),Dt=Xt[0],ui=Xt[1],jt=Be(ui),pi=Be(Dt),xi=ze(Ot,jt),ki=ze(yt,pi),Ii=(0,B.Z)({},ot),di=xi.x-ki.x+Oe,yi=xi.y-ki.y+Qe,Di=an(di,yi),wi=an(di,yi,ht),Ti=ze(Ot,["t","l"]),Ni=ze(yt,["t","l"]),mi=ze(Ot,["b","r"]),Li=ze(yt,["b","r"]),Qi=ot.overflow||{},Mi=Qi.adjustX,Ci=Qi.adjustY,zi=Qi.shiftX,ji=Qi.shiftY,Ji=function(_n){return typeof _n=="boolean"?_n:_n>=0},tn,Gi,nn,Yi;bi();var ii=Ji(Ci),Ct=pi[0]===jt[0];if(ii&&pi[0]==="t"&&(Gi>je.bottom||ue.current.bt)){var gi=yi;Ct?gi-=pe-at:gi=Ti.y-Li.y-Qe;var Pi=an(di,gi),Fi=an(di,gi,ht);Pi>Di||Pi===Di&&(!Lt||Fi>=wi)?(ue.current.bt=!0,yi=gi,Qe=-Qe,Ii.points=[St(pi,0),St(jt,0)]):ue.current.bt=!1}if(ii&&pi[0]==="b"&&(tn<je.top||ue.current.tb)){var ln=yi;Ct?ln+=pe-at:ln=mi.y-Ni.y-Qe;var cn=an(di,ln),sn=an(di,ln,ht);cn>Di||cn===Di&&(!Lt||sn>=wi)?(ue.current.tb=!0,yi=ln,Qe=-Qe,Ii.points=[St(pi,0),St(jt,0)]):ue.current.tb=!1}var hn=Ji(Mi),En=pi[1]===jt[1];if(hn&&pi[1]==="l"&&(Yi>je.right||ue.current.rl)){var Zi=di;En?Zi-=be-rt:Zi=Ti.x-Li.x-Oe;var mn=an(Zi,yi),rn=an(Zi,yi,ht);mn>Di||mn===Di&&(!Lt||rn>=wi)?(ue.current.rl=!0,di=Zi,Oe=-Oe,Ii.points=[St(pi,1),St(jt,1)]):ue.current.rl=!1}if(hn&&pi[1]==="r"&&(nn<je.left||ue.current.lr)){var un=di;En?un+=be-rt:un=mi.x-Ni.x-Oe;var gn=an(un,yi),_i=an(un,yi,ht);gn>Di||gn===Di&&(!Lt||_i>=wi)?(ue.current.lr=!0,di=un,Oe=-Oe,Ii.points=[St(pi,1),St(jt,1)]):ue.current.lr=!1}bi();var dn=zi===!0?0:zi;typeof dn=="number"&&(nn<ht.left&&(di-=nn-ht.left-Oe,Ot.x+rt<ht.left+dn&&(di+=Ot.x-ht.left+rt-dn)),Yi>ht.right&&(di-=Yi-ht.right-Oe,Ot.x>ht.right-dn&&(di+=Ot.x-ht.right+dn)));var pn=ji===!0?0:ji;typeof pn=="number"&&(tn<ht.top&&(yi-=tn-ht.top-Qe,Ot.y+at<ht.top+pn&&(yi+=Ot.y-ht.top+at-pn)),Gi>ht.bottom&&(yi-=Gi-ht.bottom-Qe,Ot.y>ht.bottom-pn&&(yi+=Ot.y-ht.bottom+pn)));var bn=yt.x+di,Ln=bn+be,Wn=yt.y+yi,Hn=Wn+pe,Fn=Ot.x,Bi=Fn+rt,ts=Ot.y,as=ts+at,Zn=Math.max(bn,Fn),yn=Math.min(Ln,Bi),os=(Zn+yn)/2,ls=os-bn,Sn=Math.max(Wn,ts),Bn=Math.min(Hn,as),On=(Sn+Bn)/2,In=On-Wn;Y==null||Y(De,Ii);var fn=pt.right-yt.x-(di+yt.width),wn=pt.bottom-yt.y-(yi+yt.height);ti===1&&(di=Math.round(di),fn=Math.round(fn)),Qt===1&&(yi=Math.round(yi),wn=Math.round(wn));var zn={ready:!0,offsetX:di/ti,offsetY:yi/Qt,offsetR:fn/ti,offsetB:wn/Qt,arrowX:ls/ti,arrowY:In/Qt,scaleX:ti,scaleY:Qt,align:Ii};M(zn)}}),xe=function(){W.current+=1;var $e=W.current;Promise.resolve().then(function(){W.current===$e&&Ce()})},qe=function(){M(function($e){return(0,B.Z)((0,B.Z)({},$e),{},{ready:!1})})};return(0,g.Z)(qe,[Re]),(0,g.Z)(function(){Ee||qe()},[Ee]),[U.ready,U.offsetX,U.offsetY,U.offsetR,U.offsetB,U.arrowX,U.arrowY,U.scaleX,U.scaleY,U.align,xe]}var ni=K(95190);function Ve(Ee,De,ne,Re,ke){(0,g.Z)(function(){if(Ee&&De&&ne){let W=function(){Re(),ke()};var ee=De,Y=ne,k=te(ee),Q=te(Y),U=le(Y),M=new Set([U].concat((0,ni.Z)(k),(0,ni.Z)(Q)));return M.forEach(function(ae){ae.addEventListener("scroll",W,{passive:!0})}),U.addEventListener("resize",W,{passive:!0}),Re(),function(){M.forEach(function(ae){ae.removeEventListener("scroll",W),U.removeEventListener("resize",W)})}}},[Ee,De,ne])}var gt=K(48736);function Kt(Ee,De,ne,Re,ke,ee,Y,k){var Q=b.useRef(Ee);Q.current=Ee;var U=b.useRef(!1);b.useEffect(function(){if(De&&Re&&(!ke||ee)){var W=function(){U.current=!1},ae=function(ct){var Le;Q.current&&!Y(((Le=ct.composedPath)===null||Le===void 0||(Le=Le.call(ct))===null||Le===void 0?void 0:Le[0])||ct.target)&&!U.current&&k(!1)},ue=le(Re);ue.addEventListener("pointerdown",W,!0),ue.addEventListener("mousedown",ae,!0),ue.addEventListener("contextmenu",ae,!0);var ye=(0,l.A)(ne);if(ye&&(ye.addEventListener("mousedown",ae,!0),ye.addEventListener("contextmenu",ae,!0)),0)var Ce,xe,qe,Fe;return function(){ue.removeEventListener("pointerdown",W,!0),ue.removeEventListener("mousedown",ae,!0),ue.removeEventListener("contextmenu",ae,!0),ye&&(ye.removeEventListener("mousedown",ae,!0),ye.removeEventListener("contextmenu",ae,!0))}}},[De,ne,Re,ke,ee]);function M(){U.current=!0}return M}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 hi(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:he.Z,De=b.forwardRef(function(ne,Re){var ke=ne.prefixCls,ee=ke===void 0?"rc-trigger-popup":ke,Y=ne.children,k=ne.action,Q=k===void 0?"hover":k,U=ne.showAction,M=ne.hideAction,W=ne.popupVisible,ae=ne.defaultPopupVisible,ue=ne.onPopupVisibleChange,ye=ne.afterPopupVisibleChange,Ce=ne.mouseEnterDelay,xe=ne.mouseLeaveDelay,qe=xe===void 0?.1:xe,Fe=ne.focusDelay,$e=ne.blurDelay,ct=ne.mask,Le=ne.maskClosable,tt=Le===void 0?!0:Le,Pt=ne.getPopupContainer,xt=ne.forceRender,Ft=ne.autoDestroy,Gt=ne.destroyPopupOnHide,ri=ne.popup,qt=ne.popupClassName,ei=ne.popupStyle,Jt=ne.popupPlacement,Tt=ne.builtinPlacements,ot=Tt===void 0?{}:Tt,dt=ne.popupAlign,Ot=ne.zIndex,Bt=ne.stretch,nt=ne.getPopupClassNameFromAlign,vt=ne.fresh,yt=ne.alignPoint,vi=ne.onPopupClick,Vt=ne.onPopupAlign,ai=ne.arrow,wt=ne.popupMotion,We=ne.maskMotion,h=ne.popupTransitionName,m=ne.popupAnimation,y=ne.maskTransitionName,C=ne.maskAnimation,Z=ne.className,pe=ne.getTriggerDOMNode,be=(0,Se.Z)(ne,ut),at=Ft||Gt||!1,rt=b.useState(!1),_t=(0,fe.Z)(rt,2),$t=_t[0],Ut=_t[1];(0,g.Z)(function(){Ut((0,_.Z)())},[]);var At=b.useRef({}),Zt=b.useContext(Ie),Lt=b.useMemo(function(){return{registerSubPopup:function(Si,Vi){At.current[Si]=Vi,Zt==null||Zt.registerSubPopup(Si,Vi)}}},[Zt]),ft=(0,P.Z)(),ht=b.useState(null),Ze=(0,fe.Z)(ht,2),je=Ze[0],pt=Ze[1],ti=b.useRef(null),Qt=(0,X.Z)(function(si){ti.current=si,(0,ce.Sh)(si)&&je!==si&&pt(si),Zt==null||Zt.registerSubPopup(ft,si)}),Mt=b.useState(null),It=(0,fe.Z)(Mt,2),zt=It[0],ve=It[1],Oe=b.useRef(null),Qe=(0,X.Z)(function(si){(0,ce.Sh)(si)&&zt!==si&&(ve(si),Oe.current=si)}),Ye=b.Children.only(Y),it=(Ye==null?void 0:Ye.props)||{},mt={},lt=(0,X.Z)(function(si){var Si,Vi,Xi=zt;return(Xi==null?void 0:Xi.contains(si))||((Si=(0,l.A)(Xi))===null||Si===void 0?void 0:Si.host)===si||si===Xi||(je==null?void 0:je.contains(si))||((Vi=(0,l.A)(je))===null||Vi===void 0?void 0:Vi.host)===si||si===je||Object.values(At.current).some(function(Wi){return(Wi==null?void 0:Wi.contains(si))||si===Wi})}),Et=O(ee,wt,m,h),Xt=O(ee,We,C,y),Dt=b.useState(ae||!1),ui=(0,fe.Z)(Dt,2),jt=ui[0],pi=ui[1],xi=W!=null?W:jt,ki=(0,X.Z)(function(si){W===void 0&&pi(si)});(0,g.Z)(function(){pi(W||!1)},[W]);var Ii=b.useRef(xi);Ii.current=xi;var di=b.useRef([]);di.current=[];var yi=(0,X.Z)(function(si){var Si;ki(si),((Si=di.current[di.current.length-1])!==null&&Si!==void 0?Si:xi)!==si&&(di.current.push(si),ue==null||ue(si))}),Di=b.useRef(),wi=function(){clearTimeout(Di.current)},Ti=function(Si){var Vi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;wi(),Vi===0?yi(Si):Di.current=setTimeout(function(){yi(Si)},Vi*1e3)};b.useEffect(function(){return wi},[]);var Ni=b.useState(!1),mi=(0,fe.Z)(Ni,2),Li=mi[0],Qi=mi[1];(0,g.Z)(function(si){(!si||xi)&&Qi(!0)},[xi]);var Mi=b.useState(null),Ci=(0,fe.Z)(Mi,2),zi=Ci[0],ji=Ci[1],Ji=b.useState(null),tn=(0,fe.Z)(Ji,2),Gi=tn[0],nn=tn[1],Yi=function(Si){nn([Si.clientX,Si.clientY])},ii=Nt(xi,je,yt&&Gi!==null?Gi:zt,Jt,ot,dt,Vt),Ct=(0,fe.Z)(ii,11),gi=Ct[0],Pi=Ct[1],Fi=Ct[2],ln=Ct[3],cn=Ct[4],sn=Ct[5],hn=Ct[6],En=Ct[7],Zi=Ct[8],mn=Ct[9],rn=Ct[10],un=Ke($t,Q,U,M),gn=(0,fe.Z)(un,2),_i=gn[0],dn=gn[1],pn=_i.has("click"),bn=dn.has("click")||dn.has("contextMenu"),Ln=(0,X.Z)(function(){Li||rn()}),Wn=function(){Ii.current&&yt&&bn&&Ti(!1)};Ve(xi,zt,je,Ln,Wn),(0,g.Z)(function(){Ln()},[Gi,Jt]),(0,g.Z)(function(){xi&&!(ot!=null&&ot[Jt])&&Ln()},[JSON.stringify(dt)]);var Hn=b.useMemo(function(){var si=F(ot,ee,mn,yt);return p()(si,nt==null?void 0:nt(mn))},[mn,nt,ot,ee,yt]);b.useImperativeHandle(Re,function(){return{nativeElement:Oe.current,popupElement:ti.current,forceAlign:Ln}});var Fn=b.useState(0),Bi=(0,fe.Z)(Fn,2),ts=Bi[0],as=Bi[1],Zn=b.useState(0),yn=(0,fe.Z)(Zn,2),os=yn[0],ls=yn[1],Sn=function(){if(Bt&&zt){var Si=zt.getBoundingClientRect();as(Si.width),ls(Si.height)}},Bn=function(){Sn(),Ln()},On=function(Si){Qi(!1),rn(),ye==null||ye(Si)},In=function(){return new Promise(function(Si){Sn(),ji(function(){return Si})})};(0,g.Z)(function(){zi&&(rn(),zi(),ji(null))},[zi]);function fn(si,Si,Vi,Xi){mt[si]=function(Wi){var Un;Xi==null||Xi(Wi),Ti(Si,Vi);for(var ps=arguments.length,Cn=new Array(ps>1?ps-1:0),us=1;us<ps;us++)Cn[us-1]=arguments[us];(Un=it[si])===null||Un===void 0||Un.call.apply(Un,[it,Wi].concat(Cn))}}(pn||bn)&&(mt.onClick=function(si){var Si;Ii.current&&bn?Ti(!1):!Ii.current&&pn&&(Yi(si),Ti(!0));for(var Vi=arguments.length,Xi=new Array(Vi>1?Vi-1:0),Wi=1;Wi<Vi;Wi++)Xi[Wi-1]=arguments[Wi];(Si=it.onClick)===null||Si===void 0||Si.call.apply(Si,[it,si].concat(Xi))});var wn=Kt(xi,bn,zt,je,ct,tt,lt,Ti),zn=_i.has("hover"),an=dn.has("hover"),bi,Ui;zn&&(fn("onMouseEnter",!0,Ce,function(si){Yi(si)}),fn("onPointerEnter",!0,Ce,function(si){Yi(si)}),bi=function(Si){(xi||Li)&&je!==null&&je!==void 0&&je.contains(Si.target)&&Ti(!0,Ce)},yt&&(mt.onMouseMove=function(si){var Si;(Si=it.onMouseMove)===null||Si===void 0||Si.call(it,si)})),an&&(fn("onMouseLeave",!1,qe),fn("onPointerLeave",!1,qe),Ui=function(){Ti(!1,qe)}),_i.has("focus")&&fn("onFocus",!0,Fe),dn.has("focus")&&fn("onBlur",!1,$e),_i.has("contextMenu")&&(mt.onContextMenu=function(si){var Si;Ii.current&&dn.has("contextMenu")?Ti(!1):(Yi(si),Ti(!0)),si.preventDefault();for(var Vi=arguments.length,Xi=new Array(Vi>1?Vi-1:0),Wi=1;Wi<Vi;Wi++)Xi[Wi-1]=arguments[Wi];(Si=it.onContextMenu)===null||Si===void 0||Si.call.apply(Si,[it,si].concat(Xi))}),Z&&(mt.className=p()(it.className,Z));var _n=(0,B.Z)((0,B.Z)({},it),mt),Dn={},Yn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Yn.forEach(function(si){be[si]&&(Dn[si]=function(){for(var Si,Vi=arguments.length,Xi=new Array(Vi),Wi=0;Wi<Vi;Wi++)Xi[Wi]=arguments[Wi];(Si=_n[si])===null||Si===void 0||Si.call.apply(Si,[_n].concat(Xi)),be[si].apply(be,Xi)})});var Xn=b.cloneElement(Ye,(0,B.Z)((0,B.Z)({},_n),Dn)),qn={x:sn,y:hn},is=ai?(0,B.Z)({},ai!==!0?ai:{}):null;return b.createElement(b.Fragment,null,b.createElement(me.Z,{disabled:!xi,ref:Qe,onResize:Bn},b.createElement(ie,{getTriggerDOMNode:pe},Xn)),b.createElement(Ie.Provider,{value:Lt},b.createElement(q,{portal:Ee,ref:Qt,prefixCls:ee,popup:ri,className:p()(qt,Hn),style:ei,target:zt,onMouseEnter:bi,onMouseLeave:Ui,onPointerEnter:bi,zIndex:Ot,open:xi,keepDom:Li,fresh:vt,onClick:vi,onPointerDownCapture:wn,mask:ct,motion:Et,maskMotion:Xt,onVisibleChanged:On,onPrepare:In,forceRender:xt,autoDestroy:at,getPopupContainer:Pt,align:mn,arrow:is,arrowPos:qn,ready:gi,offsetX:Pi,offsetY:Fi,offsetR:ln,offsetB:cn,onAlign:Ln,stretch:Bt,targetWidth:ts/En,targetHeight:os/Zi})))});return De}var He=hi(he.Z)},28426:function(Yt,st,K){"use strict";var B=K(59301),fe=K(93314),Se=K(99571),he=Object.defineProperty,V=Object.defineProperties,p=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,X=(b,A,N)=>A in b?he(b,A,{enumerable:!0,configurable:!0,writable:!0,value:N}):b[A]=N,P=(b,A)=>{for(var N in A||(A={}))ce.call(A,N)&&X(b,N,A[N]);if(me)for(var N of me(A))l.call(A,N)&&X(b,N,A[N]);return b},g=(b,A)=>V(b,p(A));const _=({img:b,buttonProps:A={},styles:N={},customText:j,ButtonText:G,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"},N)},B.createElement("img",{src:b||fe,style:g(P({},R),{pointerEvents:"none",userSelect:"none"})}),B.createElement("p",{className:"mt20 font14"},j||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),G&&B.createElement(Se.ZP,P({className:I,onClick:L},A),G),w&&w);st.Z=_},45677:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return I}});var B=K(59301),fe={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},Se=K(99571),he=K(70557),V=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,b=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,j=(w,R,q)=>R in w?_(w,R,{enumerable:!0,configurable:!0,writable:!0,value:q}):w[R]=q,G=(w,R)=>{for(var q in R||(R={}))A.call(R,q)&&j(w,q,R[q]);if(b)for(var q of b(R))N.call(R,q)&&j(w,q,R[q]);return w},L=(w,R,q)=>new Promise((se,ie)=>{var _e=Ke=>{try{Te(q.next(Ke))}catch(J){ie(J)}},Ie=Ke=>{try{Te(q.throw(Ke))}catch(J){ie(J)}},Te=Ke=>Ke.done?se(Ke.value):Promise.resolve(Ke.value).then(_e,Ie);Te((q=q.apply(w,R)).next())}),I=({editOffice:w="view",data:R,issaver:q,onSaver:se,theme:ie,type:_e,filename:Ie,monacoEditor:Te,className:Ke,style:J,close:D,onClose:F,hasMask:O,disabledDownload:le,onImgDimensions:te,showNodata:S,recordInfo:v})=>{const[z,oe]=(0,B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Ae,Be]=(0,B.useState)(""),[ze,St]=(0,B.useState)(),Nt=window.ENV==="build"?"/react/build":"",ni=location.host.startsWith("localhost")?X.Z.PROXY_SERVER:X.Z.API_SERVER,gt=10*(1024*1024),Kt=(0,B.useRef)();R!=null&&R.startsWith("/api")&&_e!=="txt"&&(R=X.Z.API_SERVER+R);const ut=ne=>ne.substring(ne.lastIndexOf("/")+1).split(".").pop();Ie&&Te&&(Te.filename=Ie),(0,B.useEffect)(()=>{var ne,Re;const ke=(Re=(ne=document.cookie)==null?void 0:ne.replace(/\s/g,""))==null?void 0:Re.split(";");ke==null||ke.map(ee=>{let Y=ee.split("=");Y[0]==="_educoder_session"&&Be(Y[1])})},[]),(0,B.useEffect)(()=>{_e==="office"&&(R.indexOf("bigfilescdn.")>-1||R.indexOf("bigfiles1")>-1?St({url:R,fileType:ut(R),model:R.indexOf("model=edit")?"edit":"view"}):He())},[_e,R]);function hi(ne){return L(this,null,function*(){ne.data.type==="pdfdata"&&(se(ne.data.data),window.removeEventListener("message",hi,!1)),console.log("mess---:",ne.data)})}const He=()=>L(void 0,null,function*(){console.log("data:",R);let ne=R;R.startsWith("http")||(ne=location.origin+ne);let Re=new URL(ne).pathname.split("/").pop();const ke=yield(0,ce.gJ)({attachment_id:Re});ke.url=ni+ke.url,St(ke)}),Ee=()=>{if(R.startsWith("http")||R.startsWith("blob:")){De();return}(0,me.Sv)(Ie||"educoder",R,Ie)},De=()=>{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)(Ie||"educoder",decodeURIComponent(R))};return g.createElement("div",{style:G({},J||{}),className:`${O&&fe.bgBlack} ${_e?fe.wrp:"hide"}`},D&&g.createElement("div",{className:fe.close,ref:Kt},!!te&&g.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>Kt.current},g.createElement("span",{onClick:()=>{F(),te()}},g.createElement("i",{className:"icon-yulanpizhu"}))),!le&&g.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>Kt.current},g.createElement("span",{onClick:De},g.createElement("i",{className:"icon-quxiaozhiding"}))),q&&g.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>Kt.current},g.createElement("span",{className:"",onClick:()=>{const ne=document.getElementById("pdfiframe");window.addEventListener("message",hi,!1),setTimeout(()=>{ne.contentWindow.postMessage("getData","*")},300)}},g.createElement("i",{className:"icon-baocun"}))),g.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>Kt.current},g.createElement("span",{className:"",onClick:()=>{F()}},g.createElement("i",{className:"icon-guanbi1"})))),g.createElement("div",{className:`${fe[Ke]} ${Ke} ${fe.monaco} ${_e==="txt"?"show":"hide"}`},_e==="txt"&&g.createElement(g.Fragment,null,g.createElement(V.ZP,G({},Te)))),_e==="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}),_e==="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})),_e==="office"&&ze&&g.createElement("iframe",{src:`${Nt}/office.html?key=${ze.key}&url=${btoa(ze.url)}&callbackUrl=${ni+(ze.callbackUrl||"")}&fileType=${ze.fileType}&title=${ze.title||""}&model=${w}&officeServer=${X.Z.ONLYOFFICE}&disabledDownload=${!!le}`}),_e==="html"&&g.createElement("iframe",{src:R+"&disposition=inline"}),_e==="pdf"&&g.createElement("iframe",{id:"pdfiframe",src:`${Nt}/js/pdfview/index.html?filename=${Ie||"educoder.pdf"}&url=${encodeURIComponent(R)}&disabledDownload=${!!le}&model=${w}`}),_e==="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}`}),(_e==="other"||_e==="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:le},"\u4E0B\u8F7D")}):g.createElement(Se.ZP,{type:"primary",size:"middle",onClick:Ee,disabled:le},g.createElement(he.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},3736:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return A}});var B=K(59301),fe=K(6767),Se=K(75727),he=K(30647),V=K(15360),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=(N,j,G)=>new Promise((L,I)=>{var w=se=>{try{q(G.next(se))}catch(ie){I(ie)}},R=se=>{try{q(G.throw(se))}catch(ie){I(ie)}},q=se=>se.done?L(se.value):Promise.resolve(se.value).then(w,R);q((G=G.apply(N,j)).next())});function P(N){if(isNaN(N))return{minutes:"00",seconds:"00"};const j=new Date(N*1e3).toISOString().substr(11,8);return{hour:j.substr(0,2),minutes:j.substr(3,2),seconds:j.substr(6,2)}}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2}});function g(N,j){return N-j}function _(N){N.sort(g);let j=0;for(let G=0;G<N.length-1;G++){let L=Math.abs(N[G+1]-N[G]);L<21&&(j+=L)}return j}const b=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var A=(0,B.forwardRef)(({allow_skip:N,src:j,toLog:G,videoId:L,logWatchHistory:I,courseId:w=null,startTime:R,handlePause:q=()=>{},handlePlay:se=()=>{},handlePlayEnded:ie=()=>{},autoPlay:_e=!1,onPlayEnded:Ie=()=>{},isShowWaterMark:Te=!0},Ke)=>{var J;j=j==null?void 0:j.replace("http://","https://");const F=((J=j==null?void 0:j.split("."))==null?void 0:J.pop())==="flv",O=(0,B.useRef)(),le=(0,B.useRef)(),te=(0,B.useRef)(),S=(0,B.useRef)(),v=(0,B.useRef)(),z=(0,B.useRef)(),oe=(0,B.useRef)(),Ae=(0,B.useRef)(),Be=(0,B.useRef)(),ze=(0,B.useRef)(),St=(0,B.useRef)(),Nt=(0,B.useRef)(),ni=(0,B.useRef)(),Ve=(0,B.useRef)(),gt=navigator.userAgent.toLowerCase().match(b),Kt=gt?gt[0]:"pc",ut=(0,B.useRef)(!1),hi=(0,p.eY)();let He=0,Ee=0,De=0,ne=null,Re=!1,ke=20,ee=1,Y=!1,k=!1,Q=[];(0,B.useImperativeHandle)(Ke,()=>({getLastUpdatedTime:()=>O.current.currentTime,getDuration:()=>O.current.duration})),fe.ZP.config({maxCount:1,getContainer:()=>te.current});const U=(0,B.useCallback)((xe,qe=!1)=>{let Fe={point:O.current.currentTime};ne?(Fe.log_id=ne,Fe.watch_duration=_(Q),Fe.total_duration=Ee):(w?(Fe.video_id=parseInt(L,10),Fe.course_id=w):Fe.video_id=L,Fe.duration=He,Fe.device=Kt),qe&&(Fe.ed="1");function $e(){return X(this,null,function*(){Y=!0,ne=yield I==null?void 0:I(Fe),Y=!1,xe&&xe()})}$e()},[L,w]);(0,B.useEffect)(()=>{O.current&&(S.current.style.display="none",v.current.style.display="block"),fe.ZP.destroy();let xe=null;return he.Z.isSupported&&F&&j&&(j==null?void 0:j.indexOf(".m3u8"))<0?(xe=he.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:j,muted:!1}),O.current&&(xe.attachMediaElement(O.current),xe.load())):O.current.setAttribute("src",j),W(),()=>{xe&&(xe.unload(),xe.pause(),xe.destroy(),xe=null)}},[O,F,j]);function M(){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(){St.current.style.display="none",ni.current.style.display="none",Nt.current.style.display="none",O.current.muted||O.current.volume===0?St.current.style.display="block":O.current.volume>0&&O.current.volume<=.5?ni.current.style.display="block":Nt.current.style.display="block"}(0,B.useEffect)(()=>{const xe=document.getElementById("play"),qe=document.querySelectorAll(".playback-icons use");function Fe(){se(),R&&!ut.current&&(O.current.currentTime=R),ut.current=!0,Q.push(O.current.currentTime),Re||(Re=!0,G&&U())}function $e(){return X(this,null,function*(){M(),Q.push(O.current.currentTime),G&&U(()=>{ne=null,De=0,Re=!1,Y=!1,k=!1,Q=[],Ee=0,ee=1},!0),Ie()})}function ct(){z.current.value=Math.round(O.current.currentTime),oe.current.value=Math.round(O.current.currentTime)}function Le(){const ot=P(Math.round(O.current.currentTime));Be.current.innerText=`${ot.hour>0?ot.hour+":":""}${ot.minutes}:${ot.seconds}`,Be.current.setAttribute("datetime",`${ot.hour>0?" "+ot.hour+" ":""}${ot.minutes}m ${ot.seconds}s`)}function tt(){var ot,dt,Ot,Bt,nt,vt,yt;const vi=Math.round((ot=O.current)==null?void 0:ot.duration);(Ot=(dt=z.current)==null?void 0:dt.setAttribute)==null||Ot.call(dt,"max",vi),(nt=(Bt=oe.current)==null?void 0:Bt.setAttribute)==null||nt.call(Bt,"max",vi);const Vt=P(vi);Ae.current&&(Ae.current.innerText=`${Vt.hour>0?Vt.hour+":":""}${Vt.minutes}:${Vt.seconds}`,(yt=(vt=Ae.current).setAttribute)==null||yt.call(vt,"datetime",`${Vt.hour>0?" "+Vt.hour+" ":""}${Vt.minutes}m ${Vt.seconds}s`))}function Pt(){try{const ot=Math.round(O.current.duration);z.current.setAttribute("max",ot),oe.current.setAttribute("max",ot);const dt=P(ot);Ae.current.innerText=`${dt.hour>0?dt.hour+":":""}${dt.minutes}:${dt.seconds}`,Ae.current.setAttribute("datetime",`${dt.hour>0?" "+dt.hour+" ":""}${dt.minutes}m ${dt.seconds}s`),ct(),Le();const{width:Ot,height:Bt,x:nt,y:vt}=le.current.getBoundingClientRect();if(nt<0||vt<0,!k){let yt=O.current.currentTime,vi=yt-De;Math.abs(vi)<10?(Ee+=Math.abs(vi),De=yt,Y||Ee-ee*ke>=0&&(ee++,Q.push(De),G&&U())):(De=yt,G&&U())}}catch(ot){console.log("videoplaying:",ot)}}function xt(){k=!0}function Ft(){O.current.playing&&Q.push(O.current.currentTime,De),De=O.current.currentTime,k=!1}function Gt(){He=O.current.duration,He<=20&&(ke=He/3),O.current.addEventListener("play",Fe)}function ri(ot){ot.preventDefault(),(0,ce.vp)()?(O.current.style.width="100%",O.current.style.height="100%"):O.current.style.cssText=""}function qt(){q()}function ei(ot){if(!N){fe.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const dt=ot.target.dataset.seek?ot.target.dataset.seek:ot.target.value;O.current.currentTime=dt,oe.current.value=dt,z.current.value=dt}function Jt(ot){const dt=Math.round(ot.offsetX/ot.target.clientWidth*parseInt(ot.target.getAttribute("max"),10));z.current.setAttribute("data-seek",dt);const Ot=P(dt);ze.current.textContent=`${Ot.hour>0?Ot.hour+":":""}${Ot.minutes}:${Ot.seconds}`;const Bt=O.current.getBoundingClientRect();ze.current.style.left=`${ot.pageX-Bt.left}px`}function Tt(ot){switch(ot.code){case"Space":ot.preventDefault(),ye();break;case"ArrowRight":if(ot.preventDefault(),!N){fe.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,ct();break;case"ArrowLeft":if(ot.preventDefault(),!N){fe.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,ct();break;case"ArrowUp":ot.preventDefault(),O.current.volume<1&&(O.current.volume=(parseInt(O.current.volume*10)+1)/10);break;case"ArrowDown":ot.preventDefault(),O.current.volume>0&&(O.current.volume=(parseInt(O.current.volume*10)-1)/10);break}}return te.current.addEventListener((0,ce.gH)(),ri),O.current.addEventListener("canplay",Gt),O.current.addEventListener("ended",$e),O.current.addEventListener("seeking",xt),O.current.addEventListener("seeked",Ft),O.current.addEventListener("loadedmetadata",tt),z.current.addEventListener("mousemove",Jt),z.current.addEventListener("input",ei),O.current.addEventListener("timeupdate",Pt),O.current.addEventListener("pause",qt),O.current.addEventListener("volumechange",W),document.addEventListener("keydown",Tt),()=>{var ot,dt,Ot,Bt,nt,vt,yt,vi,Vt,ai,wt,We;(ot=O.current)==null||ot.removeEventListener("canplay",Gt),(dt=O.current)==null||dt.removeEventListener("play",Fe),(Ot=O.current)==null||Ot.removeEventListener("ended",$e),(Bt=O.current)==null||Bt.removeEventListener("seeking",xt),(nt=O.current)==null||nt.removeEventListener("seeked",Ft),(vt=z.current)==null||vt.removeEventListener("mousemove",Jt),(yt=z.current)==null||yt.removeEventListener("input",ei),(vi=O.current)==null||vi.removeEventListener("timeupdate",Pt),(Vt=O.current)==null||Vt.removeEventListener("pause",qt),(ai=O.current)==null||ai.removeEventListener("loadedmetadata",tt),(wt=O.current)==null||wt.removeEventListener("volumechange",W),document.removeEventListener("keydown",Tt),(We=O.current)!=null&&We.playing&&(Q.push(De,O.current.currentTime),G&&U())}},[O,j]),(0,B.useEffect)(()=>{if(O.current.onended=()=>{ie(O)},O.current.oncontextmenu=()=>!1,(j==null?void 0:j.indexOf(".m3u8"))>-1){if(O.current.canPlayType("application/vnd.apple.mpegurl"))O.current.src=j;else if(V.ZP.isSupported()){var xe=new V.ZP;xe.loadSource(j),xe.attachMedia(O.current)}}},[j]);const[ae,ue]=(0,B.useState)(1),ye=()=>{O.current.paused||O.current.ended?O.current.play():O.current.pause(),M()};function Ce(){O.current.muted=!O.current.muted,O.current.muted?(Ve.current.setAttribute("data-volume",volume.value),Ve.current.value=0):Ve.current.value=Ve.current.dataset.volume}return B.createElement("div",{style:{position:"relative"},ref:te},B.createElement("div",{ref:le,className:`${l.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${l.animate__loop}`},Te&&hi?hi.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:_e}),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:Be},"00:00"),B.createElement("span",null," / "),B.createElement("time",{id:"duration",ref:Ae},"00:00"))),B.createElement("div",{className:l["right-controls"]},N&&B.createElement(Se.Z,{placement:"top",overlayClassName:l.rateOverlay,getPopupContainer:xe=>xe.parentNode,menu:{items:[{key:"1",label:B.createElement("span",{onClick:()=>{ue(1),O.current.playbackRate=1}},"1.0x")},{key:"2",label:B.createElement("span",{onClick:()=>{ue(1.5),O.current.playbackRate=1.5}},"1.5x")},{key:"3",label:B.createElement("span",{onClick:()=>{ue(2),O.current.playbackRate=2}},"2.0x")}]}},B.createElement("div",{className:`${l.controlText} mr5`},"\u500D\u901F")),B.createElement(me.CopyToClipboard,{text:j,onCopy:()=>fe.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:Ce},B.createElement("i",{ref:St,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),B.createElement("i",{ref:ni,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),B.createElement("i",{ref:Nt,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:Ve,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)(te.current)}},B.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),B.createElement("div",{className:l["video-progress"]},B.createElement("progress",{ref:oe,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:ze,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(Yt,st,K){"use strict";K.d(st,{SV:function(){return Y},ZP:function(){return ee}});var B=K(59301),fe=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"]},V={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,b=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,N=(k,Q,U)=>Q in k?X(k,Q,{enumerable:!0,configurable:!0,writable:!0,value:U}):k[Q]=U,j=(k,Q)=>{for(var U in Q||(Q={}))b.call(Q,U)&&N(k,U,Q[U]);if(_)for(var U of _(Q))A.call(Q,U)&&N(k,U,Q[U]);return k},G=(k,Q)=>P(k,g(Q)),L=(k,Q,U)=>new Promise((M,W)=>{var ae=Ce=>{try{ye(U.next(Ce))}catch(xe){W(xe)}},ue=Ce=>{try{ye(U.throw(Ce))}catch(xe){W(xe)}},ye=Ce=>Ce.done?M(Ce.value):Promise.resolve(Ce.value).then(ae,ue);ye((U=U.apply(k,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=(k,Q)=>Q.map(U=>({label:U,kind:k.languages.CompletionItemKind.Keyword,insertText:U})),R=k=>Object.keys(I.tables).map(Q=>({label:Q,kind:k.languages.CompletionItemKind.Variable,insertText:Q})),q=(k,Q)=>{const U=I.tables[k];return U?U.map(M=>({label:M,kind:Q.languages.CompletionItemKind.Field,insertText:M})):[]};function se(k,Q,U,M,W){let ae=Q.getWordUntilPosition(U),ue={startLineNumber:U.lineNumber,endLineNumber:U.lineNumber,startColumn:ae.startColumn,endColumn:ae.endColumn},ye=M.map(Ce=>({label:Ce,kind:k.languages.CompletionItemKind.Keyword,insertText:Ce,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ue}));return W.map(Ce=>{ye.push(G(j({},Ce),{range:ue}))}),ye}var ie=k=>{I.languages.map(W=>(k.languages.registerDocumentFormattingEditProvider(W,{provideDocumentFormattingEdits(ae,ue,ye){return L(this,null,function*(){const Ce=l()(ae.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:ae.getFullModelRange(),text:Ce}]})}}),W));const Q=V.quickKey.map(W=>({label:W.label,kind:k.languages.CompletionItemKind.Method,insertText:W.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet})),U=p.quickKey.map(W=>({label:W.label,kind:k.languages.CompletionItemKind.Method,insertText:W.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet})),M=he.quickKey.map(W=>({label:W.label,kind:k.languages.CompletionItemKind.Method,insertText:W.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet}));k.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(W,ae){var ue=W.getWordUntilPosition(ae),ye={startLineNumber:ae.lineNumber,endLineNumber:ae.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn},Ce=W.getLineContent(ae.lineNumber).substring(ue.startColumn-2,ue.endColumn);return{suggestions:[...V.keywords.map(xe=>({label:xe,kind:k.languages.CompletionItemKind.Function,documentation:xe,insertText:xe,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...V.quickKey.map(xe=>({label:xe.label,kind:k.languages.CompletionItemKind.Function,documentation:xe.content,insertText:Ce.startsWith("#")?xe.content.replace(/#/,""):xe.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),k.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(W,ae){var ue=W.getWordUntilPosition(ae),ye={startLineNumber:ae.lineNumber,endLineNumber:ae.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn};return{suggestions:[...Se.keywords.map(Ce=>({label:Ce,kind:k.languages.CompletionItemKind.Function,documentation:Ce,insertText:Ce,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),k.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(W,ae){var ue=W.getWordUntilPosition(ae),ye={startLineNumber:ae.lineNumber,endLineNumber:ae.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn},Ce=W.getLineContent(ae.lineNumber).substring(ue.startColumn-2,ue.endColumn);return{suggestions:[...he.keywords.map(xe=>({label:xe,kind:k.languages.CompletionItemKind.Function,documentation:xe,insertText:xe,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...he.quickKey.map(xe=>({label:xe.label,kind:k.languages.CompletionItemKind.Function,documentation:xe.content,insertText:Ce.startsWith("#")?xe.content.replace(/#/,""):xe.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),k.languages.registerCompletionItemProvider("scala",{provideCompletionItems:function(W,ae){var ue=W.getWordUntilPosition(ae),ye={startLineNumber:ae.lineNumber,endLineNumber:ae.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn},Ce=W.getLineContent(ae.lineNumber).substring(ue.startColumn-2,ue.endColumn);return{suggestions:[...me.keywords.map(xe=>({label:xe,kind:k.languages.CompletionItemKind.Function,documentation:xe,insertText:xe,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...me.quickKey.map(xe=>({label:xe.label,kind:k.languages.CompletionItemKind.Function,documentation:xe.content,insertText:Ce.startsWith("#")?xe.content.replace(/#/,""):xe.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}}),k.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(W,ae){var ue=W.getWordUntilPosition(ae),ye={startLineNumber:ae.lineNumber,endLineNumber:ae.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn},Ce=W.getLineContent(ae.lineNumber).substring(ue.startColumn-2,ue.endColumn);return{suggestions:[...p.keywords.map(xe=>({label:xe,kind:k.languages.CompletionItemKind.Function,documentation:xe,insertText:xe,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye})),...p.quickKey.map(xe=>({label:xe.label,kind:k.languages.CompletionItemKind.Function,documentation:xe.content,insertText:Ce.startsWith("#")?xe.content.replace(/#/,""):xe.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}))]}}})};const _e="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var Ie=Object.defineProperty,Te=(k,Q,U)=>Q in k?Ie(k,Q,{enumerable:!0,configurable:!0,writable:!0,value:U}):k[Q]=U,Ke=(k,Q,U)=>Te(k,typeof Q!="symbol"?Q+"":Q,U);const J=class qo{constructor(Q,U,M){this.placeholder=Q,this.editor=U,this.monaco=M,U.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)}};Ke(J,"ID","editor.widget.placeholderHint");var F=J,O=K(96236),le=K(6767),te=K(25399),S=K(89392),v=K(49535),z=K(56102),oe=Object.defineProperty,Ae=Object.defineProperties,Be=Object.getOwnPropertyDescriptors,ze=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,ni=(k,Q,U)=>Q in k?oe(k,Q,{enumerable:!0,configurable:!0,writable:!0,value:U}):k[Q]=U,Ve=(k,Q)=>{for(var U in Q||(Q={}))St.call(Q,U)&&ni(k,U,Q[U]);if(ze)for(var U of ze(Q))Nt.call(Q,U)&&ni(k,U,Q[U]);return k},gt=(k,Q)=>Ae(k,Be(Q)),Kt=(k,Q)=>{var U={};for(var M in k)St.call(k,M)&&Q.indexOf(M)<0&&(U[M]=k[M]);if(k!=null&&ze)for(var M of ze(k))Q.indexOf(M)<0&&Nt.call(k,M)&&(U[M]=k[M]);return U},ut=(k,Q,U)=>new Promise((M,W)=>{var ae=Ce=>{try{ye(U.next(Ce))}catch(xe){W(xe)}},ue=Ce=>{try{ye(U.throw(Ce))}catch(xe){W(xe)}},ye=Ce=>Ce.done?M(Ce.value):Promise.resolve(Ce.value).then(ae,ue);ye((U=U.apply(k,Q)).next())});function hi(k){return/^\d+$/.test(k)?`${k}px`:k}function He(){}let Ee=!1;const De={"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(k=[]){let Q=k;if(Array.isArray(k)){for(let U=0;U<k.length;U++){let M=De[k[U]];if(M)return M}return Q[0]}return De[Q]||Q}let Re=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(k){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",k)}});var ee=k=>{var Q=k,{width:U="100%",height:M="100%",value:W,language:ae="javascript",style:ue={},options:ye={},overrideServices:Ce={},theme:xe="vs-dark",onEditBlur:qe,isCopy:Fe=!1,onSave:$e,autoHeight:ct=!1,forbidCopy:Le=!1,onChange:tt=He,editorDidMount:Pt=He,onFocus:xt=He,onBreakPoint:Ft=He,breakPointValue:Gt=[],filename:ri="educoder.txt",errorLine:qt,errorContent:ei="",highlightLine:Jt,openBreakPoint:Tt=!1,placeholder:ot="",showMiniMap:dt=!0}=Q,Ot=Kt(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 Bt=(0,B.useRef)(),nt=(0,B.useRef)({}),vt=(0,B.useRef)(),yt=(0,B.useRef)(),vi=(0,B.useRef)([]),Vt=(0,B.useRef)(!1),ai=(0,B.useRef)(),wt=(0,B.useRef)(),We=(0,B.useRef)(!1),[h,m]=(0,B.useState)(!1);function y(){let Ze;return Bt.current&&(Ze=new fe.Z(je=>{for(let pt of je)(pt.target.offsetHeight>0||pt.target.offsetWidth>0)&&nt.current.instance.layout()}),Ze.observe(Bt.current)),Ze}function C(){le.ZP.warning({content:decodeURIComponent(_e),key:"monaco-editor-tip"})}const Z=()=>{let Ze=nt.current.instance;if(W!=null&&Ze&&h){const je=Ze.getModel();je&&W!==je.getValue()&&(Ee=!0,je.setValue(W),Ze.layout(),Ee=!1)}};(0,B.useEffect)(()=>{const Ze=v.Z.subscribe("formatDocument",je=>{var pt;let ti=nt.current.instance;(pt=ti==null?void 0:ti.getAction)==null||pt.call(ti,"editor.action.formatDocument").run()});return window.updateMonacoValue=je=>{tt(je)},Ze},[]),(0,B.useEffect)(()=>{var Ze;let je=nt.current.instance;yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>{Z()},500),W&&(W!=null&&W.length)&&((Ze=je==null?void 0:je.updateOptions)==null||Ze.call(je,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(W.split(/\r\n|\r|\n/g).length))+3,5)}))},[W,h,nt.current]),(0,B.useEffect)(()=>{if(qt&&nt.current&&nt.current.instance){let je=nt.current.instance;je.changeViewZones(function(pt){var ti=document.createElement("div");ti.style.padding="10px 20px",ti.style.width="calc(100% - 20px)",ti.className="my-error-line-wrp",ti.innerHTML=ei,pt.addZone({afterLineNumber:qt||11,heightInLines:3,domNode:ti})});var Ze={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}};je.addOverlayWidget(Ze),je.revealPositionInCenter({lineNumber:20,column:1})}},[qt,nt.current,h]);const pe=(Ze="",je)=>{if(!Ze||Ze.trim()==="")return!0;const ti=nt.current.instance.getModel().getLineTokens(je);let Qt=!1;for(let Mt=0;Mt<2;Mt++)ti.getStandardTokenType(Mt)===1&&(Qt=!0);return Qt};(0,B.useEffect)(()=>{var Ze;const je=(Ze=nt.current)==null?void 0:Ze.instance;if(je&&h&&Le){const pt=je.onDidBlurEditorWidget(()=>{We.current=!1}),ti=je.onDidFocusEditorText(()=>{We.current=!0});return()=>{pt.dispose(),ti.dispose()}}},[nt.current,h,Le]),(0,B.useEffect)(()=>{var Ze;if((Ze=nt.current)!=null&&Ze.instance&&h&&Tt){let je=nt.current.instance,pt=je.getModel();if(!pt)return;(()=>{var lt;let Et=[],Xt=[];const Dt=pt.getAllDecorations();for(let jt of Dt)jt.options.className==="highlighted-line"&&(Et.push((lt=jt==null?void 0:jt.range)==null?void 0:lt.startLineNumber),Xt.push(jt==null?void 0:jt.id));if(Jt===Et[0])return;pt.deltaDecorations(Xt,[]);const ui=pt.getLineCount();Jt&&Jt<=ui&&(je.deltaDecorations([],[{range:new Re.Range(Jt,1,Jt,pt.getLineMaxColumn(Jt)),options:{isWholeLine:!0,className:"highlighted-line"}}]),je.revealLineInCenter(Jt))})();const Qt=(lt=!1)=>{var Et;let Xt=[],Dt=[];const ui=pt.getAllDecorations();for(let jt of ui)jt.options.linesDecorationsClassName==="breakpoints-select"&&(Xt.push((Et=jt==null?void 0:jt.range)==null?void 0:Et.startLineNumber),Dt.push(jt==null?void 0:jt.id));if(lt)return{lines:Xt,ids:Dt};Ft(Xt)},Mt=lt=>ut(void 0,null,function*(){let Et={range:new Re.Range(lt,1,lt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield pt.deltaDecorations([],[Et]),Qt()}),It=lt=>ut(void 0,null,function*(){let Et=[];const Xt=je.getLineDecorations(lt);for(let Dt of Xt)Dt.options.linesDecorationsClassName==="breakpoints-select"&&Et.push(Dt.id);yield pt.deltaDecorations(Et,[]),Qt()}),zt=lt=>{let Et=je.getLineDecorations(lt);for(let Xt of Et)if(Xt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,S.isEqual)(Gt,Qt(!0).lines)){pt.deltaDecorations(Qt(!0).ids,[]);const lt=Gt.map(Et=>({range:new Re.Range(Et,1,Et,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));pt.deltaDecorations([],lt)}const ve=je.onDidChangeModelContent(lt=>{let Et=je.getPosition();if(Et){let Xt=Et.lineNumber;clearTimeout(wt.current),wt.current=setTimeout(()=>{pe(pt.getLineContent(Xt),Xt)?It(Xt):zt(Xt)?(It(Xt),Mt(Xt)):Qt()},100)}}),Oe=je.onMouseDown(lt=>{var Et,Xt,Dt;if(lt.target.detail&&((Dt=(Xt=(Et=lt.target)==null?void 0:Et.element)==null?void 0:Xt.className)!=null&&Dt.includes("line-numbers"))){let ui=lt.target.position.lineNumber;if(pe(pt.getLineContent(ui),ui))return;zt(ui)?It(ui):Mt(ui)}}),Qe=lt=>{let Et={range:new Re.Range(lt,1,lt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};vi.current=je.deltaDecorations(vi.current,[Et])},Ye=()=>{vi.current=je.deltaDecorations(vi.current,[])},it=je.onMouseMove(lt=>{var Et,Xt,Dt;if(Ye(),lt.target.detail&&((Dt=(Xt=(Et=lt.target)==null?void 0:Et.element)==null?void 0:Xt.className)!=null&&Dt.includes("line-numbers"))){let ui=lt.target.position.lineNumber;if(pe(pt.getLineContent(ui),ui))return;Qe(ui)}}),mt=je.onMouseLeave(()=>{Ye()});return()=>{ve.dispose(),Oe.dispose(),it.dispose(),mt.dispose()}}},[nt.current,h,Gt,Jt,Tt,ae]),(0,B.useEffect)(()=>{var Ze;(Ze=nt.current)!=null&&Ze.instance&&Tt&&nt.current.instance.setPosition({lineNumber:0,column:0})},[Jt]);function be(){let Ze=nt.current.instance;if(Ze){const je=Ze.getSelection(),pt=nt.current.pastePos||{},ti=new Re.Range(pt.startLineNumber||je.endLineNumber,pt.startColumn||je.endColumn,pt.endLineNumber||je.endLineNumber,pt.endColumn||je.endColumn);setTimeout(()=>{Ze.executeEdits("",[{range:ti,text:""}])},300)}}function at(Ze){(window.navigator.platform.match("Mac")?Ze.metaKey:Ze.ctrlKey)&&Ze.keyCode==83&&(Ze.preventDefault(),$e())}const rt=()=>{if(ct&&nt.current.instance){const Ze=nt.current.instance.getContentHeight();ft(Ze<M?M:Ze)}else ft(M)};function _t(Ze){var je=document.createEvent("MouseEvents");je.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ze.dispatchEvent(je)}const $t=Ze=>{if(!We.current)return;const{keyCode:je,ctrlKey:pt,metaKey:ti,target:Qt,type:Mt}=Ze;return(Mt==="paste"||(je===67||je===86)&&(ti||pt))&&Qt.nodeName==="TEXTAREA"&&(C(),Ze.preventDefault()),!1};function Ut(Ze,je){var pt=window.URL||window.webkitURL||window,ti=new Blob([je]),Qt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Qt.href=pt.createObjectURL(ti),Qt.download=Ze,_t(Qt)}(0,B.useEffect)(()=>{rt()},[rt]),(0,B.useEffect)(()=>{Bt.current&&!h&&Promise.all([K.e(8909),K.e(6656)]).then(K.bind(K,71448)).then(Ze=>{try{Re=Ze,nt.current.instance=Re.editor.create(Bt.current,{value:W,language:ne(ae),theme:xe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:dt||!1}},Ce);const je=nt.current.instance;let Qt=[...O.BH._menuItems].find(ve=>ve[0]._debugName=="EditorContext")[1],Mt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],It=(ve,Oe)=>{var Qe,Ye;let it=ve._first;do Oe.includes((Ye=(Qe=it.element)==null?void 0:Qe.command)==null?void 0:Ye.id)&&ve._remove(it);while(it=it.next)};if(Pt(je,Re),setTimeout(()=>{rt(),nt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Ut(ri||"educoder.txt",je.getValue())}})},500),nt.current.subscription=je.onDidChangeModelContent(ve=>{Vt.current?clearTimeout(ai.current):(rt(),tt(je.getValue(),ve)),ai.current=setTimeout(()=>{Vt.current=!1},500)}),window.Monaco||ie(Re,ne(ae)),Le&&(It(Qt,Mt),Bt.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",$t),window.removeEventListener("paste",$t),window.addEventListener("keydown",$t),window.addEventListener("paste",$t)),window.Monaco=Re,qe&&je.onDidBlurEditorWidget(()=>{qe(je.getValue())}),xt&&je.onDidFocusEditorText(()=>{Le&&ke(),xt(je.getValue())}),Le){ke();try{je.onDidPaste(ve=>{const Oe=je.getSelection(),Qe=nt.current.pastePos||{},Ye=new Re.Range(Qe.startLineNumber||Oe.endLineNumber,Qe.startColumn||Oe.endColumn,Qe.endLineNumber||Oe.endLineNumber,Qe.endColumn||Oe.endColumn);je.executeEdits("",[{range:ve.range,text:""}])})}catch(ve){}}let zt=y();return ot&&typeof ot=="string"&&new F(ot,je,Re),m(!0),()=>{const ve=nt.current.instance;ve.dispose();const Oe=ve.getModel();Oe&&Oe.dispose(),nt.current.subscription&&nt.current.subscription.dispose(),zt.unobserve(Bt.current)}}catch(je){}})},[]),(0,B.useEffect)(()=>{if(nt.current.instance&&h)return document.addEventListener("keydown",at,!1),()=>{document.removeEventListener("keydown",at)}},[$e,h]),(0,B.useEffect)(()=>{let Ze=nt.current.instance;if(Ze&&h){let je=ne(ae);Re.editor.setModelLanguage(Ze.getModel(),je)}},[ae,h]),(0,B.useEffect)(()=>{nt.current.instance&&h&&Re.editor.setTheme(xe)},[xe,h]),(0,B.useEffect)(()=>{let Ze=nt.current.instance;vt.current=ye,Ze&&h&&(Ze.updateOptions(Ve({},ye)),setTimeout(()=>{Ze.getModel().updateOptions(Ve({},ye))},200))},[JSON.stringify(ye),h]),(0,B.useEffect)(()=>{let Ze=nt.current.instance;Ze&&h&&Ze.layout()},[U,M,h]);const[At,Zt]=(0,B.useState)(hi(U)),[Lt,ft]=(0,B.useState)(hi(M)),ht=gt(Ve({},ue),{width:At,height:Lt,position:"relative"});return B.createElement("div",{className:"my-monaco-editor",ref:Bt,style:ht},Fe&&B.createElement(z.CopyToClipboard,{text:W,onCopy:()=>le.ZP.success("\u590D\u5236\u6210\u529F")},B.createElement(te.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:k="100%",height:Q="100%",original:U,modified:M,language:W,options:ae={}}){const ue=(0,B.useRef)(),[ye,Ce]=(0,B.useState)(null);function xe(ct){let Le;return ue.current&&(Le=new fe.Z(tt=>{for(let Pt of tt)(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&ct.layout()}),Le.observe(ue.current)),Le}(0,B.useEffect)(()=>(ue.current&&Promise.all([K.e(8909),K.e(9404)]).then(K.bind(K,2550)).then(ct=>{Re=ct;const Le=Re.editor.createDiffEditor(ue.current,gt(Ve({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},ae),{wordWrap:!0}));Ce(Le);let tt=xe(Le);return()=>{Le.dispose();const Pt=Le.getModel();Pt&&Pt.dispose(),tt.unobserve(ue.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,B.useEffect)(()=>{ye&&ye.setModel({original:Re.editor.createModel(U,W),modified:Re.editor.createModel(M,W)})},[U,M,W,ye]);const qe=hi(k),Fe=hi(Q),$e={width:qe,height:Fe};return B.createElement("div",{className:"my-diff-editor",ref:ue,style:$e})}},37808:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return fe}});var B=K(59301);function fe(Se,he){const V=(0,B.useRef)();(0,B.useEffect)(()=>{V.current=Se}),(0,B.useEffect)(()=>{function p(){V.current()}if(he!==null){let me=setInterval(p,he);return()=>clearInterval(me)}},[he])}},62904:function(Yt,st,K){"use strict";K.r(st),K.d(st,{default:function(){return M},formatQuery:function(){return Q}});var B=K(59301),fe=K(25690),Se=K(29787),he={bg:"bg___eq_Aq",container:"container___j770l",widthle:"widthle___ouh1T"},V=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),b=K(51257),A=K(59301),N=Object.defineProperty,j=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,I=(W,ae,ue)=>ae in W?N(W,ae,{enumerable:!0,configurable:!0,writable:!0,value:ue}):W[ae]=ue,w=(W,ae)=>{for(var ue in ae||(ae={}))G.call(ae,ue)&&I(W,ue,ae[ue]);if(j)for(var ue of j(ae))L.call(ae,ue)&&I(W,ue,ae[ue]);return W},R=(W,ae)=>{var ue={};for(var ye in W)G.call(W,ye)&&ae.indexOf(ye)<0&&(ue[ye]=W[ye]);if(W!=null&&j)for(var ye of j(W))ae.indexOf(ye)<0&&L.call(W,ye)&&(ue[ye]=W[ye]);return ue},q=(W,ae,ue)=>new Promise((ye,Ce)=>{var xe=$e=>{try{Fe(ue.next($e))}catch(ct){Ce(ct)}},qe=$e=>{try{Fe(ue.throw($e))}catch(ct){Ce(ct)}},Fe=$e=>$e.done?ye($e.value):Promise.resolve($e.value).then(xe,qe);Fe((ue=ue.apply(W,ae)).next())});const se=W=>{var ae=W,{videoDetail:ue,globalSetting:ye,loading:Ce,dispatch:xe}=ae,qe=R(ae,["videoDetail","globalSetting","loading","dispatch"]);const{queryParams:Fe,selectParams:$e,videoList:ct}=ue,{subject_id:Le,videoId:tt}=Fe,{checkBoxValue:Pt,radioValue:xt}=$e,Ft={videoId:tt},Gt={query:Fe},ri=(0,B.useRef)(),qt=(0,B.useRef)(),ei=(0,B.useRef)(),Jt=(0,B.useRef)(5),{video_item:Tt}=ue.detail||{};(0,g.Z)(()=>q(void 0,null,function*(){qt.current&&(console.log("videoRef lastUpdatedTime: ",ri.current.getLastUpdatedTime()),console.log(ri.current),yield ot())}),Jt.current*1e3);const ot=(Vt=!1)=>{const ai=Vt?{is_f:1}:{};return(0,_.DH)(w(w({},ai),{id:Ft.videoId,point:ri.current.getLastUpdatedTime(),total:ri.current.getDuration()}))},dt=Vt=>(Vt.ed==="1"&&(qt.current=!1,ot(!0)),!qt.current&&!Vt.ed&&(qt.current=!0,Jt.current=ri.current.getDuration()<=5?1:5,ot()),xe({type:"userDetail/logWatchHistory",payload:Vt})),Ot=()=>{qt.current=!1},Bt=()=>{qt.current=!0},nt=()=>{ei.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:ei.current,onChange:Vt=>ei.current=Vt,className:P.modalRating})),onOk:()=>q(void 0,null,function*(){if((yield(0,_.jK)({id:Ft.videoId,star:ei.current})).status===0){const{course_id:ai}=(0,b.oP)();xe({type:"videoDetail/getVideoDetail",payload:{id:Ft.videoId,videoId:Ft.videoId,course_id:ai,subject_id:Le}})}})})},vt=Vt=>{const ai=window.filterVideoSign,wt=ai.findIndex(Z=>Z.id===tt);if(wt===ai.length-1)return;const h=ai[wt+1].id,m=ai[wt+1].can_view,y=ai[wt+1].link,C=ai[wt+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(!C){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}xe({type:"videoDetail/handleListItemClick",payload:{videoId:h}}),window.videoTimer=setTimeout(()=>{Vt.current.play()},2e3)}},yt=(Vt,ai)=>{if(Vt==="checkBox"){const wt=ai;window.checkBoxValue=wt,xe({type:"videoDetail/setSelectValue",payload:{radioValue:xt,checkBoxValue:wt}});return}xe({type:"videoDetail/setSelectValue",payload:{checkBoxValue:Pt,radioValue:ai.target.value}})},vi=()=>ct.findIndex(wt=>wt.id===tt)===ct.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:wt=>{yt("checkBox",wt)},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},Tt==null?void 0:Tt.name),!(Tt!=null&&Tt.can_edit)&&!(Tt!=null&&Tt.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:ri,startTime:Tt==null?void 0:Tt.last_point,src:Tt!=null&&Tt.is_link?Tt==null?void 0:Tt.link:(Tt==null?void 0:Tt.play_url)&&V.Base64.decode(Tt==null?void 0:Tt.play_url),videoId:Tt==null?void 0:Tt.video_id,logWatchHistory:dt,handlePause:Ot,handlePlay:Bt,allow_skip:Tt==null?void 0:Tt.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:Tt==null?void 0:Tt.star,disabled:!0,className:P.rating,style:{color:"#FFA100",fontSize:12,marginLeft:10}}),A.createElement("div",{className:P.fenshu},(Tt==null?void 0:Tt.star)||0,"\u5206")),!(Tt!=null&&Tt.can_edit)&&!(Tt!=null&&Tt.is_public)?null:A.createElement("div",null,A.createElement("div",{className:P.checkBox},vi()))),A.createElement("div",{className:"mt10"},(Tt==null?void 0:Tt.description)&&A.createElement("span",{className:P.introName},"\u7B80\u4ECB\uFF1A",Tt.description))))};var ie=(0,fe.connect)(({videoDetail:W,loading:ae,globalSetting:ue})=>({videoDetail:W,globalSetting:ue,loading:ae}))(se),_e=K(6767),Ie=K(18287),Te={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"},Ke=K(81722),J=K(75736),D=K(346),F=K(59301),O=Object.defineProperty,le=Object.defineProperties,te=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,oe=(W,ae,ue)=>ae in W?O(W,ae,{enumerable:!0,configurable:!0,writable:!0,value:ue}):W[ae]=ue,Ae=(W,ae)=>{for(var ue in ae||(ae={}))v.call(ae,ue)&&oe(W,ue,ae[ue]);if(S)for(var ue of S(ae))z.call(ae,ue)&&oe(W,ue,ae[ue]);return W},Be=(W,ae)=>le(W,te(ae)),ze=(W,ae)=>{var ue={};for(var ye in W)v.call(W,ye)&&ae.indexOf(ye)<0&&(ue[ye]=W[ye]);if(W!=null&&S)for(var ye of S(W))ae.indexOf(ye)<0&&z.call(W,ye)&&(ue[ye]=W[ye]);return ue},St=(W,ae,ue)=>new Promise((ye,Ce)=>{var xe=$e=>{try{Fe(ue.next($e))}catch(ct){Ce(ct)}},qe=$e=>{try{Fe(ue.throw($e))}catch(ct){Ce(ct)}},Fe=$e=>$e.done?ye($e.value):Promise.resolve($e.value).then(xe,qe);Fe((ue=ue.apply(W,ae)).next())});const Nt=[{name:"\u5B9E\u8DF5\u9879\u76EE",type:"Shixun",icon:F.createElement("i",{className:"iconfont icon-shixun2 font20"}),bq:F.createElement("span",{style:{border:"1px solid #FF9D18",color:"#FF9D18"},className:Te.s1},"\u5B9E\u8BAD")},{name:"\u89C6\u9891\u9879\u76EE",type:"VideoItem",icon:F.createElement("i",{className:"iconfont icon-shipin font20"}),bq:F.createElement("span",{style:{border:"1px solid #9B18FF",color:"#9B18FF"},className:Te.s1},"\u89C6\u9891")},{name:"\u6559\u5B66\u8BFE\u4EF6",type:"Attachment",icon:F.createElement("i",{className:"iconfont icon-jiaoxueanli font20"}),bq:F.createElement("span",{style:{border:"1px solid #3061D0",color:"#3061D0"},className:Te.s1},"\u8D44\u6599")},{name:"\u7A7A\u76EE\u5F55",type:"StageCatalog",icon:F.createElement("i",{className:"iconfont icon-kongbai font20"}),bq:F.createElement("span",null)}],ni=W=>{var ae=W,{dispatch:ue,pathsDetail:ye,videoDetail:Ce,user:xe}=ae,qe=ze(ae,["dispatch","pathsDetail","videoDetail","user"]);const{queryParams:Fe,stages:$e,cust_seq:ct,active:Le}=Ce,{subject_id:tt,course_id:Pt}=Fe,xt=(0,fe.useParams)(),[Ft]=(0,fe.useSearchParams)(),[Gt,ri]=(0,B.useState)([]),[qt,ei]=(0,B.useState)([(Le==null?void 0:Le.id)||Number(xt.videoId)]),[Jt,Tt]=(0,B.useState)("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"),ot=[".PDF",".DOC",".DOCX",".XLS",".XLSX",".PPT",".PPTX"];(0,B.useEffect)(()=>{ue(tt?{type:"videoDetail/getStageData",payload:{subject_id:tt,page_type:"video"}}:{type:"videoDetail/getCourseStageData",payload:{coursesId:Pt}})},[]),(0,B.useEffect)(()=>{dt()},[Ce==null?void 0:Ce.stages]);const dt=()=>{let wt=Gt;$e.forEach((We,h)=>{wt.push({title:F.createElement("div",{title:We.stage_name,className:Te.title},We.stage_name),value:We==null?void 0:We.stage_id,key:We==null?void 0:We.stage_id,icon:F.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Ot(We.items||[])})}),ri(wt)},Ot=wt=>{function We(h){var m;const y=h.children,C=Array.isArray(y)&&y.length>0,Z=h==null?void 0:h.id,{name:pe,item_type:be,id:at}=h,rt=(m=Nt.find(Ut=>Ut.type===be))==null?void 0:m.bq,_t=Te.brght,$t=Le.id===at?`${_t} ${Te.active}`:_t;return{title:F.createElement("div",{onClick:()=>yt(h),className:_t,title:pe},rt,F.createElement("div",{className:Te.s3},pe)),value:Z,key:Z,icon:F.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:C?y==null?void 0:y.map(Ut=>We(Ut)):[]}}return wt==null?void 0:wt.map(h=>We(h))},Bt=(wt,We)=>St(void 0,null,function*(){ue({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF0C\u8BF7\u7A0D\u540E..."}});const h=We?yield(0,J.BK)({id:wt}):yield(0,J.Ir)({id:wt});if(ue({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}}),h!=null&&h.game_identifier||h!=null&&h.identifier){(0,b.xg)(We?`/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&&nt(h==null?void 0:h.message)}),nt=wt=>{me.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:F.createElement("div",{className:"tc font16"},"\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E",wt,"\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")})},vt=wt=>{wt=wt!=null&&wt.includes(".json")?wt:`${wt}.json`,me.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:F.createElement("div",{className:"tc font16"},"\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"),onOk:()=>St(void 0,null,function*(){const We=yield(0,Ke.L8)({url:wt});if(!We)return;_e.ZP.success("\u91CD\u7F6E\u6210\u529F\uFF0C\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF01");const h=yield(0,J.Ir)({id:We.shixun_identifier});if(h!=null&&h.game_identifier){(0,b.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&&nt(h==null?void 0:h.message)})})},yt=wt=>{var We,h,m,y,C;if((wt==null?void 0:wt.item_type)==="StageCatalog")return;clearTimeout(window.videoTimer);const{id:Z,item_type:pe,identifier:be,is_jupyter:at,url:rt,link:_t}=wt;if(pe==="VideoItem"&&!_t){if(!((We=xe.userInfo)!=null&&We.admin)&&!((h=xe.userInfo)!=null&&h.business)&&!wt.can_view){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:F.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}ue({type:"videoDetail/handleListItemClick",payload:{videoId:Z}}),ue({type:"videoDetail/getVideoDetail",payload:Be(Ae({id:Z},Fe),{videoId:Z}),callback:$t=>{if($t&&$t.video_item&&!$t.video_item.can_edit&&!wt.is_public){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:F.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}}});return}if(pe==="VideoItem"&&_t){wt.link&&(0,_.DH)({is_f:1,id:wt.id,point:0,total:0}),window.open(_t);return}if(pe==="Shixun"){Bt(be,at);return}if(pe==="Attachment"){if(_t){(0,b.xg)(_t);return}let $t=(y=wt==null?void 0:wt.name)==null?void 0:y.substr((m=wt==null?void 0:wt.name)==null?void 0:m.lastIndexOf("."));if(ot.includes($t.toUpperCase())){ue({type:"videoDetail/handleListItemClick",payload:{attachmentId:Z}});return}else{if(!((C=ye.detail)!=null&&C.allow_download)){_e.ZP.info("\u6559\u5B66\u8BFE\u4EF6\u4E0D\u652F\u6301\u4E0B\u8F7D");return}(0,b.FH)(wt.name,D.Z.API_SERVER+wt.url);return}}window.open(D.Z.IMG_SERVER+rt)},vi=wt=>{let We=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],h=["","\u5341","\u767E","\u5343","\u4E07"];wt=parseInt(wt);let m=Z=>{let pe=Z.toString().split("").reverse(),be="";for(var at=0;at<pe.length;at++)be=(at==0&&pe[at]==0||at>0&&pe[at]==0&&pe[at-1]==0?"":We[pe[at]]+(pe[at]==0?h[0]:h[at]))+be;return be},y=Math.floor(wt/1e4),C=wt%1e4;return C.toString().length<4&&(C="0"+C),y?m(y)+"\u4E07"+m(C):m(wt)},Vt=(wt,We,h,m)=>{var y;const{name:C,item_type:Z,id:pe}=wt,be=`${We+1}-${h+1}-${m+1}`,at=(y=Nt.find($t=>$t.type===Z))==null?void 0:y.icon,rt=Te.brght,_t=Le.id===pe?`${rt} ${Te.active}`:rt;return F.createElement("div",{key:be,onClick:()=>yt(wt),className:_t,style:{paddingLeft:52}},F.createElement("span",{className:Te.s1},at),!!ct&&F.createElement("span",{className:Te.s2},be),F.createElement("span",{className:Te.s3},"\u203B ",C))},ai=(wt,We,h)=>{var m;const{name:y,item_type:C,id:Z,children:pe}=wt,be=`${We+1}-${h+1}`,at=(m=Nt.find($t=>$t.type===C))==null?void 0:m.icon,rt=Te.brght,_t=Le.id===Z?`${rt} ${Te.active}`:rt;return F.createElement(B.Fragment,{key:be},F.createElement("div",{onClick:()=>yt(wt),className:_t},F.createElement("span",{className:Te.s1},at),!!ct&&F.createElement("span",{className:Te.s2},be),F.createElement("span",{className:Te.s3},"\u203B ",y)),!!pe.length&&pe.map(($t,Ut)=>Vt($t,We,h,Ut)))};return F.createElement("aside",{className:Te.list},F.createElement("div",{className:Te.tabs_style},F.createElement("div",{className:Te.tabs_item,onClick:()=>{Tt("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55")}},"\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55",Jt=="\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"&&F.createElement("div",{className:Te.tabs_item_active}))),F.createElement("div",{className:Te.tree_style},(Gt==null?void 0:Gt.length)>0&&F.createElement(Ie.default,{selectedKeys:qt,onSelect:(wt,We)=>{ei([...wt])},blockNode:!0,treeData:Gt,defaultExpandAll:!0,className:Te.tree_line})))};var Ve=(0,fe.connect)(({user:W,videoDetail:ae,loading:ue,globalSetting:ye,pathsDetail:Ce})=>({user:W,videoDetail:ae,globalSetting:ye,loading:ue,pathsDetail:Ce}))(ni),gt=K(45677),Kt=K(59301),ut=Object.defineProperty,hi=Object.defineProperties,He=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,Re=(W,ae,ue)=>ae in W?ut(W,ae,{enumerable:!0,configurable:!0,writable:!0,value:ue}):W[ae]=ue,ke=(W,ae)=>{for(var ue in ae||(ae={}))De.call(ae,ue)&&Re(W,ue,ae[ue]);if(Ee)for(var ue of Ee(ae))ne.call(ae,ue)&&Re(W,ue,ae[ue]);return W},ee=(W,ae)=>hi(W,He(ae)),Y=(W,ae)=>{var ue={};for(var ye in W)De.call(W,ye)&&ae.indexOf(ye)<0&&(ue[ye]=W[ye]);if(W!=null&&Ee)for(var ye of Ee(W))ae.indexOf(ye)<0&&ne.call(W,ye)&&(ue[ye]=W[ye]);return ue},k=(W,ae,ue)=>new Promise((ye,Ce)=>{var xe=$e=>{try{Fe(ue.next($e))}catch(ct){Ce(ct)}},qe=$e=>{try{Fe(ue.throw($e))}catch(ct){Ce(ct)}},Fe=$e=>$e.done?ye($e.value):Promise.resolve($e.value).then(xe,qe);Fe((ue=ue.apply(W,ae)).next())});const Q=W=>{const{subject_id:ae}=W;return{subject_id:ae,course_id:ae}},U=W=>{var ae=W,{videoDetail:ue,globalSetting:ye,loading:Ce,pathsDetail:xe,dispatch:qe}=ae,Fe=Y(ae,["videoDetail","globalSetting","loading","pathsDetail","dispatch"]),$e,ct;const{queryParams:Le,videoList:tt,attachmentList:Pt,active:xt}=ue,{subject_id:Ft,videoId:Gt}=Le,ri={videoId:Gt};(0,B.useEffect)(()=>{if(xt){const{item_type:Jt,id:Tt}=xt;Jt==="VideoItem"&&qe({type:"videoDetail/getVideoDetail",payload:ee(ke({},Le),{id:Tt})})}},[xt.id]),console.log("---",xt),(0,B.useEffect)(()=>{Ft&&qt()},[]);function qt(){return k(this,null,function*(){const Jt=yield qe({type:"pathsDetail/getPathsDetail",payload:{id:Ft}})})}(0,B.useEffect)(()=>{var Jt,Tt;(0,b.Dk)((Tt=(Jt=ue.detail)==null?void 0:Jt.video_item)==null?void 0:Tt.name)},[ue]);let ei={width:1200};return xt&&xt.item_type==="Attachment"&&xt.content_type==="application/pdf"&&(ei={width:1250,marginLeft:(document.body.clientWidth-1200)/2}),Kt.createElement(Se.Z,{spinning:!1},Kt.createElement("section",{className:he.bg},Kt.createElement("div",{className:he.container,style:ei},Kt.createElement(Ve,null),xt&&xt.item_type==="VideoItem"&&Kt.createElement(ie,null),xt&&xt.item_type==="Attachment"&&xt.content_type==="application/pdf"&&xt.url&&Kt.createElement("div",{className:he.widthle},Kt.createElement(gt.Z,{disabledDownload:!(($e=xe.detail)!=null&&$e.allow_download),type:"pdf",filename:xt.name,data:D.Z.API_SERVER+xt.url,style:{position:"absolute",zIndex:1}})),xt&&xt.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(xt.content_type)&&xt.url&&Kt.createElement("div",{className:he.widthle},Kt.createElement(gt.Z,{disabledDownload:!((ct=xe.detail)!=null&&ct.allow_download),type:"office",data:D.Z.API_SERVER+xt.url,style:{position:"absolute",zIndex:1}})))))};var M=(0,fe.connect)(({videoDetail:W,loading:ae,globalSetting:ue,pathsDetail:ye})=>({videoDetail:W,globalSetting:ue,loading:ae,pathsDetail:ye}))(U)},84989:function(Yt,st,K){"use strict";K.d(st,{BU:function(){return fe},Dj:function(){return B},gH:function(){return Se},vp:function(){return he}});function B(V){try{V.mozRequestFullScreen?V.mozRequestFullScreen():V.webkitRequestFullScreen&&V.webkitRequestFullScreen()}catch(p){console.log(p,":e")}}function fe(){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 V=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement,p=document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",V),window.isFullScreen?window.isFullScreen:V!=null}},30647:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return wt}});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 C=arguments[y];if(C!=null)for(let Z in C)C.hasOwnProperty(Z)&&(m[Z]=C[Z])}return m},typeof self.Promise!="function"&&K(3867).polyfill()}}B.install();var fe=B,Se=K(86204),he=K.n(Se);class V{static e(h,m){(!h||V.FORCE_GLOBAL_TAG)&&(h=V.GLOBAL_TAG);let y=`[${h}] > ${m}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","error",y),V.ENABLE_ERROR&&(console.error?console.error(y):console.warn?console.warn(y):console.log(y))}static i(h,m){(!h||V.FORCE_GLOBAL_TAG)&&(h=V.GLOBAL_TAG);let y=`[${h}] > ${m}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","info",y),V.ENABLE_INFO&&(console.info?console.info(y):console.log(y))}static w(h,m){(!h||V.FORCE_GLOBAL_TAG)&&(h=V.GLOBAL_TAG);let y=`[${h}] > ${m}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","warn",y),V.ENABLE_WARN&&(console.warn?console.warn(y):console.log(y))}static d(h,m){(!h||V.FORCE_GLOBAL_TAG)&&(h=V.GLOBAL_TAG);let y=`[${h}] > ${m}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","debug",y),V.ENABLE_DEBUG&&(console.debug?console.debug(y):console.log(y))}static v(h,m){(!h||V.FORCE_GLOBAL_TAG)&&(h=V.GLOBAL_TAG);let y=`[${h}] > ${m}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","verbose",y),V.ENABLE_VERBOSE&&console.log(y)}}V.GLOBAL_TAG="flv.js",V.FORCE_GLOBAL_TAG=!1,V.ENABLE_ERROR=!0,V.ENABLE_INFO=!0,V.ENABLE_WARN=!0,V.ENABLE_DEBUG=!0,V.ENABLE_VERBOSE=!0,V.ENABLE_CALLBACK=!1,V.emitter=new(he());var p=V;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},b={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 N={};function j(){let We=self.navigator.userAgent.toLowerCase(),h=/(edge)\/([\w.]+)/.exec(We)||/(opr)[\/]([\w.]+)/.exec(We)||/(chrome)[ \/]([\w.]+)/.exec(We)||/(iemobile)[\/]([\w.]+)/.exec(We)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(We)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(We)||/(webkit)[ \/]([\w.]+)/.exec(We)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(We)||/(msie) ([\w.]+)/.exec(We)||We.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(We)||We.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(We)||[],m=/(ipad)/.exec(We)||/(ipod)/.exec(We)||/(windows phone)/.exec(We)||/(iphone)/.exec(We)||/(kindle)/.exec(We)||/(android)/.exec(We)||/(windows)/.exec(We)||/(mac)/.exec(We)||/(linux)/.exec(We)||/(cros)/.exec(We)||[],y={browser:h[5]||h[3]||h[1]||"",version:h[2]||h[4]||"0",majorVersion:h[4]||h[2]||"0",platform:m[0]||""},C={};if(y.browser){C[y.browser]=!0;let Z=y.majorVersion.split(".");C.version={major:parseInt(y.majorVersion,10),string:y.version},Z.length>1&&(C.version.minor=parseInt(Z[1],10)),Z.length>2&&(C.version.build=parseInt(Z[2],10))}if(y.platform&&(C[y.platform]=!0),(C.chrome||C.opr||C.safari)&&(C.webkit=!0),C.rv||C.iemobile){C.rv&&delete C.rv;let Z="msie";y.browser=Z,C[Z]=!0}if(C.edge){delete C.edge;let Z="msedge";y.browser=Z,C[Z]=!0}if(C.opr){let Z="opera";y.browser=Z,C[Z]=!0}if(C.safari&&C.android){let Z="android";y.browser=Z,C[Z]=!0}C.name=y.browser,C.platform=y.platform;for(let Z in N)N.hasOwnProperty(Z)&&delete N[Z];Object.assign(N,C)}j();var G=N;class L extends A{static isSupported(){try{let h=G.msedge&&G.version.minor>=15048,m=G.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 C=this._seekHandler.getConfig(y,m),Z=new self.Headers;if(typeof C.headers=="object"){let be=C.headers;for(let at in be)be.hasOwnProperty(at)&&Z.append(at,be[at])}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(C.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!==C.url&&this._onURLRedirect){let rt=this._seekHandler.removeURLParameters(be.url);this._onURLRedirect(rt)}let at=be.headers.get("Content-Length");return at!=null&&(this._contentLength=parseInt(at),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(b.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(b.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=b.EARLY_EOF,C={code:-1,msg:"Fetch stream meet Early-EOF"};if(this._onError)this._onError(y,C);else throw new l(C.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,C=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength,this._onDataArrival&&this._onDataArrival(y,C,this._receivedLength),this._pump(h)}}).catch(m=>{if(m.code===11&&G.msedge)return;this._status=_.kError;let y=0,C=null;if((m.code===19||m.message==="network error")&&(this._contentLength===null||this._contentLength!==null&&this._receivedLength<this._contentLength)?(y=b.EARLY_EOF,C={code:m.code,msg:"Fetch stream meet Early-EOF"}):(y=b.EXCEPTION,C={code:m.code,msg:m.message}),this._onError)this._onError(y,C);else throw new l(C.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 C=this._seekHandler.getConfig(y,m);this._requestURL=C.url;let Z=this._xhr=new XMLHttpRequest;if(Z.open("GET",C.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 C.headers=="object"){let pe=C.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(b.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=b.EARLY_EOF,y={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(m=b.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 C=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?C=this._currentRedirectedURL:h.redirectedURL!=null&&(C=h.redirectedURL));let Z=this._seekHandler.getConfig(C,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 at=Z.headers;for(let rt in at)at.hasOwnProperty(rt)&&be.setRequestHeader(rt,at[rt])}if(typeof this._config.headers=="object"){let at=this._config.headers;for(let rt in at)at.hasOwnProperty(rt)&&be.setRequestHeader(rt,at[rt])}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 C=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&C!==this._currentRedirectedURL&&(this._currentRedirectedURL=C,this._onURLRedirect&&this._onURLRedirect(C))}let y=m.getResponseHeader("Content-Length");if(y!=null&&this._contentLength==null){let C=parseInt(y);C>0&&(this._contentLength=C,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 C=y.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=y.byteLength;let Z=this._totalRange.from+this._receivedLength;this._receivedLength+=C.byteLength,this._onDataArrival&&this._onDataArrival(C,Z,this._receivedLength),y.byteLength>=this._bufferLimit&&(Log.v(this.TAG,`MSStream buffer exceeded max size near ${Z+C.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 ie 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 C=this._seekHandler.getConfig(y,m);this._currentRequestURL=C.url;let Z=this._xhr=new XMLHttpRequest;if(Z.open("GET",C.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 C.headers=="object"){let pe=C.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(b.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 C=h.total;this._internalAbort(),C!=null&C!==0&&(this._totalLength=C)}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,C=0,Z=0,pe=y;if(h<m[0])return m[0];for(;Z<=pe;){if(C=Z+Math.floor((pe-Z)/2),C===y||h>=m[C]&&h<m[C+1])return m[C];m[C]<h?Z=C+1:pe=C-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,C=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,C,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=b.EARLY_EOF,y={code:-1,msg:"RangeLoader meet Early-Eof"}):(m=b.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new l(y.msg)}}var _e=ie;class Ie 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(b.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(b.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(b.EXCEPTION,m);else throw new l(m.msg)}}var Te=Ie;class Ke{constructor(h){this._zeroStart=h||!1}getConfig(h,m){let y={};if(m.from!==0||m.to!==-1){let C;m.to!==-1?C=`bytes=${m.from.toString()}-${m.to.toString()}`:C=`bytes=${m.from.toString()}-`,y.Range=C}else this._zeroStart&&(y.Range="bytes=0-");return{url:h,headers:y}}removeURLParameters(h){return h}}var J=Ke;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 C=!0;y.indexOf("?")===-1&&(y+="?",C=!1),C&&(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,C=h.indexOf("?");C!==-1&&(y=h.substring(C+1));let Z="";if(y!=null&&y.length>0){let pe=y.split("&");for(let be=0;be<pe.length;be++){let at=pe[be].split("="),rt=be>0;at[0]!==this._startName&&at[0]!==this._endName&&(rt&&(Z+="&"),Z+=pe[be])}}return Z.length===0?m:m+"?"+Z}}var F=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===_e?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 F(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=Te;else if(I.isSupported())this._loaderClass=I;else if(R.isSupported())this._loaderClass=R;else if(_e.isSupported())this._loaderClass=_e;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 C=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(y,0,m).set(C,0)}this._stashBuffer=y,this._bufferSize=m}_normalizeSpeed(h){let m=this._speedNormalizeList,y=m.length-1,C=0,Z=0,pe=y;if(h<m[0])return m[0];for(;Z<=pe;){if(C=Z+Math.floor((pe-Z)/2),C===y||h>=m[C]&&h<m[C+1])return m[C];m[C]<h?Z=C+1:pe=C-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 C=this._speedSampler.lastSecondKBps;if(C!==0){let Z=this._normalizeSpeed(C);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 at=new Uint8Array(pe,be);Z.set(at,0),this._stashUsed=at.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),C=m.byteLength-y;if(y<m.byteLength)if(h)p.w(this.TAG,`${C} 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,C}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=b.UNRECOVERABLE_EARLY_EOF),h){case b.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=b.UNRECOVERABLE_EARLY_EOF;break}case b.UNRECOVERABLE_EARLY_EOF:case b.CONNECTING_TIMEOUT:case b.HTTP_STATUS_CODE_INVALID:case b.EXCEPTION:break}if(this._onError)this._onError(h,m);else throw new l("IOException: "+m.msg)}}var le=O;const te={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({},te)}class v{static supportMSEH264Playback(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}static supportNetworkStreamIO(){let h=new le({},S()),m=h.loaderType;return h.destroy(),m=="fetch-stream-loader"||m=="xhr-moz-chunked-loader"}static getNetworkLoaderTypeName(){let h=new le({},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,Ae={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 Be{static get forceGlobalTag(){return p.FORCE_GLOBAL_TAG}static set forceGlobalTag(h){p.FORCE_GLOBAL_TAG=h,Be._notifyChange()}static get globalTag(){return p.GLOBAL_TAG}static set globalTag(h){p.GLOBAL_TAG=h,Be._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,Be._notifyChange()}static get enableDebug(){return p.ENABLE_DEBUG}static set enableDebug(h){p.ENABLE_DEBUG=h,Be._notifyChange()}static get enableVerbose(){return p.ENABLE_VERBOSE}static set enableVerbose(h){p.ENABLE_VERBOSE=h,Be._notifyChange()}static get enableInfo(){return p.ENABLE_INFO}static set enableInfo(h){p.ENABLE_INFO=h,Be._notifyChange()}static get enableWarn(){return p.ENABLE_WARN}static set enableWarn(h){p.ENABLE_WARN=h,Be._notifyChange()}static get enableError(){return p.ENABLE_ERROR}static set enableError(h){p.ENABLE_ERROR=h,Be._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=Be.emitter;if(h.listenerCount("change")>0){let m=Be.getConfig();h.emit("change",m)}}static registerListener(h){Be.emitter.addListener("change",h)}static removeListener(h){Be.emitter.removeListener("change",h)}static addLogListener(h){p.emitter.addListener("log",h),p.emitter.listenerCount("log")>0&&(p.ENABLE_CALLBACK=!0,Be._notifyChange())}static removeLogListener(h){p.emitter.removeListener("log",h),p.emitter.listenerCount("log")===0&&(p.ENABLE_CALLBACK=!1,Be._notifyChange())}}Be.emitter=new(he());var ze=Be;class St{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,C=h.length-1,Z=0,pe=0,be=C;for(m<h[0]&&(y=0,pe=be+1);pe<=be;)if(Z=pe+Math.floor((be-pe)/2),Z===C||m>=h[Z]&&m<h[Z+1]){y=Z;break}else h[Z]<m?pe=Z+1:be=Z-1;return y}}var Nt=St;function ni(We,h,m){let y=We;if(h+m<y.length){for(;m--;)if((y[++h]&192)!==128)return!1;return!0}else return!1}function Ve(We){let h=[],m=We,y=0,C=We.length;for(;y<C;){if(m[y]<128){h.push(String.fromCharCode(m[y])),++y;continue}else if(!(m[y]<192)){if(m[y]<224){if(ni(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(ni(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&&ni(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 gt=Ve;let Kt=function(){let We=new ArrayBuffer(2);return new DataView(We).setInt16(0,256,!0),new Int16Array(We)[0]===256}();class ut{static parseScriptData(h,m,y){let C={};try{let Z=ut.parseValue(h,m,y),pe=ut.parseValue(h,m+Z.size,y-Z.size);C[Z.data]=pe.data}catch(Z){p.e("AMF",Z.toString())}return C}static parseObject(h,m,y){if(y<3)throw new X("Data not enough when parse ScriptDataObject");let C=ut.parseString(h,m,y),Z=ut.parseValue(h,m+C.size,y-C.size),pe=Z.objectEnd;return{data:{name:C.data,value:Z.data},size:C.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,!Kt),pe;return Z>0?pe=gt(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,!Kt),pe;return Z>0?pe=gt(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 C=new DataView(h,m,y),Z=C.getFloat64(0,!Kt),pe=C.getInt16(8,!Kt);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 C=new DataView(h,m,y),Z=1,pe=C.getUint8(0),be,at=!1;try{switch(pe){case 0:be=C.getFloat64(1,!Kt),Z+=8;break;case 1:{be=!!C.getUint8(1),Z+=1;break}case 2:{let rt=ut.parseString(h,m+1,y-1);be=rt.data,Z+=rt.size;break}case 3:{be={};let rt=0;for((C.getUint32(y-4,!Kt)&16777215)===9&&(rt=3);Z<y-4;){let _t=ut.parseObject(h,m+Z,y-Z-rt);if(_t.objectEnd)break;be[_t.data.name]=_t.data.value,Z+=_t.size}Z<=y-3&&(C.getUint32(Z-1,!Kt)&16777215)===9&&(Z+=3);break}case 8:{be={},Z+=4;let rt=0;for((C.getUint32(y-4,!Kt)&16777215)===9&&(rt=3);Z<y-8;){let _t=ut.parseVariable(h,m+Z,y-Z-rt);if(_t.objectEnd)break;be[_t.data.name]=_t.data.value,Z+=_t.size}Z<=y-3&&(C.getUint32(Z-1,!Kt)&16777215)===9&&(Z+=3);break}case 9:be=void 0,Z=1,at=!0;break;case 10:{be=[];let rt=C.getUint32(1,!Kt);Z+=4;for(let _t=0;_t<rt;_t++){let $t=ut.parseValue(h,m+Z,y-Z);be.push($t.data),Z+=$t.size}break}case 11:{let rt=ut.parseDate(h,m+1,y-1);be=rt.data,Z+=rt.size;break}case 12:{let rt=ut.parseString(h,m+1,y-1);be=rt.data,Z+=rt.size;break}default:Z=y,p.w("AMF","Unsupported AMF value type "+pe)}}catch(rt){p.e("AMF",rt.toString())}return{data:be,size:Z,objectEnd:at}}}var hi=ut;class He{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 C=Math.min(y,this._current_word_bits_left),Z=this._current_word>>>32-C;return this._current_word<<=C,this._current_word_bits_left-=C,m=m<<C|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=He;class De{static _ebsp2rbsp(h){let m=h,y=m.byteLength,C=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||(C[Z]=m[pe],Z++);return new Uint8Array(C.buffer,0,Z)}static parseSPS(h){let m=De._ebsp2rbsp(h),y=new Ee(m);y.readByte();let C=y.readByte();y.readByte();let Z=y.readByte();y.readUEG();let pe=De.getProfileString(C),be=De.getLevelString(Z),at=1,rt=420,_t=[0,420,422,444],$t=8;if((C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128||C===138||C===144)&&(at=y.readUEG(),at===3&&y.readBits(1),at<=3&&(rt=_t[at]),$t=y.readUEG()+8,y.readUEG(),y.readBits(1),y.readBool())){let Dt=at!==3?8:12;for(let ui=0;ui<Dt;ui++)y.readBool()&&(ui<6?De._skipScalingList(y,16):De._skipScalingList(y,64))}y.readUEG();let Ut=y.readUEG();if(Ut===0)y.readUEG();else if(Ut===1){y.readBits(1),y.readSEG(),y.readSEG();let Dt=y.readUEG();for(let ui=0;ui<Dt;ui++)y.readSEG()}let At=y.readUEG();y.readBits(1);let Zt=y.readUEG(),Lt=y.readUEG(),ft=y.readBits(1);ft===0&&y.readBits(1),y.readBits(1);let ht=0,Ze=0,je=0,pt=0;y.readBool()&&(ht=y.readUEG(),Ze=y.readUEG(),je=y.readUEG(),pt=y.readUEG());let Qt=1,Mt=1,It=0,zt=!0,ve=0,Oe=0;if(y.readBool()){if(y.readBool()){let Dt=y.readByte(),ui=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],jt=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Dt>0&&Dt<16?(Qt=ui[Dt-1],Mt=jt[Dt-1]):Dt===255&&(Qt=y.readByte()<<8|y.readByte(),Mt=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 Dt=y.readBits(32),ui=y.readBits(32);zt=y.readBool(),ve=ui,Oe=Dt*2,It=ve/Oe}}let Ye=1;(Qt!==1||Mt!==1)&&(Ye=Qt/Mt);let it=0,mt=0;if(at===0)it=1,mt=2-ft;else{let Dt=at===3?1:2,ui=at===1?2:1;it=Dt,mt=ui*(2-ft)}let lt=(Zt+1)*16,Et=(2-ft)*((Lt+1)*16);lt-=(ht+Ze)*it,Et-=(je+pt)*mt;let Xt=Math.ceil(lt*Ye);return y.destroy(),y=null,{profile_string:pe,level_string:be,bit_depth:$t,ref_frames:At,chroma_format:rt,chroma_format_string:De.getChromaFormatString(rt),frame_rate:{fixed:zt,fps:It,fps_den:Oe,fps_num:ve},sar_ratio:{width:Qt,height:Mt},codec_size:{width:lt,height:Et},present_size:{width:Xt,height:Et}}}static _skipScalingList(h,m){let y=8,C=8,Z=0;for(let pe=0;pe<m;pe++)C!==0&&(Z=h.readSEG(),C=(y+Z+256)%256),y=C===0?y:C}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=De,ke={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};function ee(We){return We>>>8&255|(We&255)<<8}function Y(We){return(We&4278190080)>>>24|(We&16711680)>>>8|(We&65280)<<8|(We&255)<<24}function k(We,h){return We[h]<<24|We[h+1]<<16|We[h+2]<<8|We[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 Nt,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 C=(m[4]&4)>>>2!==0,Z=(m[4]&1)!==0,pe=k(m,5);return pe<9?y:{match:!0,consumed:pe,dataOffset:pe,hasAudioTrack:C,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 Nt}_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,C=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,!C)!==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,!C)&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 at=Z.getUint8(4),rt=Z.getUint8(5),_t=Z.getUint8(6),$t=Z.getUint8(7),Ut=_t|rt<<8|at<<16|$t<<24;(Z.getUint32(7,!C)&16777215)!==0&&p.w(this.TAG,"Meet tag which has StreamID != 0!");let Zt=y+11;switch(pe){case 8:this._parseAudioData(h,Zt,be,Ut);break;case 9:this._parseVideoData(h,Zt,be,Ut,m+y);break;case 18:this._parseScriptData(h,Zt,be);break}let Lt=Z.getUint32(11+be,!C);Lt!==11+be&&p.w(this.TAG,`Invalid PrevTagSize ${Lt}`),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 C=hi.parseScriptData(h,m,y);if(C.hasOwnProperty("onMetaData")){if(C.onMetaData==null||typeof C.onMetaData!="object"){p.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&p.w(this.TAG,"Found another onMetaData tag!"),this._metadata=C;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(C).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},C))}_parseKeyframesIndex(h){let m=[],y=[];for(let C=1;C<h.times.length;C++){let Z=this._timestampBase+Math.floor(h.times[C]*1e3);m.push(Z),y.push(h.filepositions[C])}return{times:m,filepositions:y}}_parseAudioData(h,m,y,C){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),at=be>>>4;if(at!==2&&at!==10){this._onError(ke.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+at);return}let rt=0,_t=(be&12)>>>2;if(_t>=0&&_t<=4)rt=this._flvSoundRateTable[_t];else{this._onError(ke.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+_t);return}let $t=(be&2)>>>1,Ut=be&1,At=this._audioMetadata,Zt=this._audioTrack;if(At||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),At=this._audioMetadata={},At.type="audio",At.id=Zt.id,At.timescale=this._timescale,At.duration=this._duration,At.audioSampleRate=rt,At.channelCount=Ut===0?1:2),at===10){let Lt=this._parseAACAudioData(h,m+1,y-1);if(Lt==null)return;if(Lt.packetType===0){At.config&&p.w(this.TAG,"Found another AudioSpecificConfig!");let ft=Lt.data;At.audioSampleRate=ft.samplingRate,At.channelCount=ft.channelCount,At.codec=ft.codec,At.originalCodec=ft.originalCodec,At.config=ft.config,At.refSampleDuration=1024/At.audioSampleRate*At.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",At);let ht=this._mediaInfo;ht.audioCodec=At.originalCodec,ht.audioSampleRate=At.audioSampleRate,ht.audioChannelCount=At.channelCount,ht.hasVideo?ht.videoCodec!=null&&(ht.mimeType='video/x-flv; codecs="'+ht.videoCodec+","+ht.audioCodec+'"'):ht.mimeType='video/x-flv; codecs="'+ht.audioCodec+'"',ht.isComplete()&&this._onMediaInfo(ht)}else if(Lt.packetType===1){let ft=this._timestampBase+C,ht={unit:Lt.data,length:Lt.data.byteLength,dts:ft,pts:ft};Zt.samples.push(ht),Zt.length+=Lt.data.length}else p.e(this.TAG,`Flv: Unsupported AAC data type ${Lt.packetType}`)}else if(at===2){if(!At.codec){let Ze=this._parseMP3AudioData(h,m+1,y-1,!0);if(Ze==null)return;At.audioSampleRate=Ze.samplingRate,At.channelCount=Ze.channelCount,At.codec=Ze.codec,At.originalCodec=Ze.originalCodec,At.refSampleDuration=1152/At.audioSampleRate*At.timescale,p.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",At);let je=this._mediaInfo;je.audioCodec=At.codec,je.audioSampleRate=At.audioSampleRate,je.audioChannelCount=At.channelCount,je.audioDataRate=Ze.bitRate,je.hasVideo?je.videoCodec!=null&&(je.mimeType='video/x-flv; codecs="'+je.videoCodec+","+je.audioCodec+'"'):je.mimeType='video/x-flv; codecs="'+je.audioCodec+'"',je.isComplete()&&this._onMediaInfo(je)}let Lt=this._parseMP3AudioData(h,m+1,y-1,!1);if(Lt==null)return;let ft=this._timestampBase+C,ht={unit:Lt,length:Lt.byteLength,dts:ft,pts:ft};Zt.samples.push(ht),Zt.length+=Lt.length}}_parseAACAudioData(h,m,y){if(y<=1){p.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}let C={},Z=new Uint8Array(h,m,y);return C.packetType=Z[0],Z[0]===0?C.data=this._parseAACAudioSpecificConfig(h,m+1,y-1):C.data=Z.subarray(1),C}_parseAACAudioSpecificConfig(h,m,y){let C=new Uint8Array(h,m,y),Z=null,pe=0,be=0,at=null,rt=0,_t=null;if(pe=be=C[0]>>>3,rt=(C[0]&7)<<1|C[1]>>>7,rt<0||rt>=this._mpegSamplingRates.length){this._onError(ke.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}let $t=this._mpegSamplingRates[rt],Ut=(C[1]&120)>>>3;if(Ut<0||Ut>=8){this._onError(ke.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}pe===5&&(_t=(C[1]&7)<<1|C[2]>>>7,at=(C[2]&124)>>>2);let At=self.navigator.userAgent.toLowerCase();return At.indexOf("firefox")!==-1?rt>=6?(pe=5,Z=new Array(4),_t=rt-3):(pe=2,Z=new Array(2),_t=rt):At.indexOf("android")!==-1?(pe=2,Z=new Array(2),_t=rt):(pe=5,_t=rt,Z=new Array(4),rt>=6?_t=rt-3:Ut===1&&(pe=2,Z=new Array(2),_t=rt)),Z[0]=pe<<3,Z[0]|=(rt&15)>>>1,Z[1]=(rt&15)<<7,Z[1]|=(Ut&15)<<3,pe===5&&(Z[1]|=(_t&15)>>>1,Z[2]=(_t&1)<<7,Z[2]|=8,Z[3]=0),{config:Z,samplingRate:$t,channelCount:Ut,codec:"mp4a.40."+pe,originalCodec:"mp4a.40."+be}}_parseMP3AudioData(h,m,y,C){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(C){if(pe[0]!==255)return;let at=pe[1]>>>3&3,rt=(pe[1]&6)>>1,_t=(pe[2]&240)>>>4,$t=(pe[2]&12)>>>2,At=(pe[3]>>>6&3)!==3?2:1,Zt=0,Lt=0,ft=34,ht="mp3";switch(at){case 0:Zt=this._mpegAudioV25SampleRateTable[$t];break;case 2:Zt=this._mpegAudioV20SampleRateTable[$t];break;case 3:Zt=this._mpegAudioV10SampleRateTable[$t];break}switch(rt){case 1:ft=34,_t<this._mpegAudioL3BitRateTable.length&&(Lt=this._mpegAudioL3BitRateTable[_t]);break;case 2:ft=33,_t<this._mpegAudioL2BitRateTable.length&&(Lt=this._mpegAudioL2BitRateTable[_t]);break;case 3:ft=32,_t<this._mpegAudioL1BitRateTable.length&&(Lt=this._mpegAudioL1BitRateTable[_t]);break}be={bitRate:Lt,samplingRate:Zt,channelCount:At,codec:ht,originalCodec:ht}}else be=pe;return be}_parseVideoData(h,m,y,C,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,at=pe&15;if(at!==7){this._onError(ke.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${at}`);return}this._parseAVCVideoPacket(h,m+1,y-1,C,Z,be)}_parseAVCVideoPacket(h,m,y,C,Z,pe){if(y<4){p.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}let be=this._littleEndian,at=new DataView(h,m,y),rt=at.getUint8(0),$t=(at.getUint32(0,!be)&16777215)<<8>>8;if(rt===0)this._parseAVCDecoderConfigurationRecord(h,m+4,y-4);else if(rt===1)this._parseAVCVideoData(h,m+4,y-4,C,Z,pe,$t);else if(rt!==2){this._onError(ke.FORMAT_ERROR,`Flv: Invalid video packet type ${rt}`);return}}_parseAVCDecoderConfigurationRecord(h,m,y){if(y<7){p.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}let C=this._videoMetadata,Z=this._videoTrack,pe=this._littleEndian,be=new DataView(h,m,y);C?typeof C.avcc!="undefined"&&p.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),C=this._videoMetadata={},C.type="video",C.id=Z.id,C.timescale=this._timescale,C.duration=this._duration);let at=be.getUint8(0),rt=be.getUint8(1),_t=be.getUint8(2),$t=be.getUint8(3);if(at!==1||rt===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 Ut=be.getUint8(5)&31;if(Ut===0){this._onError(ke.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else Ut>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${Ut}`);let At=6;for(let Lt=0;Lt<Ut;Lt++){let ft=be.getUint16(At,!pe);if(At+=2,ft===0)continue;let ht=new Uint8Array(h,m+At,ft);At+=ft;let Ze=ne.parseSPS(ht);if(Lt!==0)continue;C.codecWidth=Ze.codec_size.width,C.codecHeight=Ze.codec_size.height,C.presentWidth=Ze.present_size.width,C.presentHeight=Ze.present_size.height,C.profile=Ze.profile_string,C.level=Ze.level_string,C.bitDepth=Ze.bit_depth,C.chromaFormat=Ze.chroma_format,C.sarRatio=Ze.sar_ratio,C.frameRate=Ze.frame_rate,(Ze.frame_rate.fixed===!1||Ze.frame_rate.fps_num===0||Ze.frame_rate.fps_den===0)&&(C.frameRate=this._referenceFrameRate);let je=C.frameRate.fps_den,pt=C.frameRate.fps_num;C.refSampleDuration=C.timescale*(je/pt);let ti=ht.subarray(1,4),Qt="avc1.";for(let It=0;It<3;It++){let zt=ti[It].toString(16);zt.length<2&&(zt="0"+zt),Qt+=zt}C.codec=Qt;let Mt=this._mediaInfo;Mt.width=C.codecWidth,Mt.height=C.codecHeight,Mt.fps=C.frameRate.fps,Mt.profile=C.profile,Mt.level=C.level,Mt.refFrames=Ze.ref_frames,Mt.chromaFormat=Ze.chroma_format_string,Mt.sarNum=C.sarRatio.width,Mt.sarDen=C.sarRatio.height,Mt.videoCodec=Qt,Mt.hasAudio?Mt.audioCodec!=null&&(Mt.mimeType='video/x-flv; codecs="'+Mt.videoCodec+","+Mt.audioCodec+'"'):Mt.mimeType='video/x-flv; codecs="'+Mt.videoCodec+'"',Mt.isComplete()&&this._onMediaInfo(Mt)}let Zt=be.getUint8(At);if(Zt===0){this._onError(ke.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");return}else Zt>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${Zt}`);At++;for(let Lt=0;Lt<Zt;Lt++){let ft=be.getUint16(At,!pe);At+=2,ft!==0&&(At+=ft)}C.avcc=new Uint8Array(y),C.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",C)}_parseAVCVideoData(h,m,y,C,Z,pe,be){let at=this._littleEndian,rt=new DataView(h,m,y),_t=[],$t=0,Ut=0;const At=this._naluLengthSize;let Zt=this._timestampBase+C,Lt=pe===1;for(;Ut<y;){if(Ut+4>=y){p.w(this.TAG,`Malformed Nalu near timestamp ${Zt}, offset = ${Ut}, dataSize = ${y}`);break}let ft=rt.getUint32(Ut,!at);if(At===3&&(ft>>>=8),ft>y-At){p.w(this.TAG,`Malformed Nalus near timestamp ${Zt}, NaluSize > DataSize!`);return}let ht=rt.getUint8(Ut+At)&31;ht===5&&(Lt=!0);let Ze=new Uint8Array(h,m+Ut,At+ft),je={type:ht,data:Ze};_t.push(je),$t+=Ze.byteLength,Ut+=At+ft}if(_t.length){let ft=this._videoTrack,ht={units:_t,length:$t,isKeyframe:Lt,dts:Zt,cts:be,pts:Zt+be};Lt&&(ht.fileposition=Z),ft.samples.push(ht),ft.length+=$t}}}var U=Q;class M{static init(){M.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 M.types)M.types.hasOwnProperty(m)&&(M.types[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);let h=M.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,C=Array.prototype.slice.call(arguments,1),Z=C.length;for(let be=0;be<Z;be++)m+=C[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(C[be],pe),pe+=C[be].byteLength;return y}static generateInitSegment(h){let m=M.box(M.types.ftyp,M.constants.FTYP),y=M.moov(h),C=new Uint8Array(m.byteLength+y.byteLength);return C.set(m,0),C.set(y,m.byteLength),C}static moov(h){let m=M.mvhd(h.timescale,h.duration),y=M.trak(h),C=M.mvex(h);return M.box(M.types.moov,m,y,C)}static mvhd(h,m){return M.box(M.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 M.box(M.types.trak,M.tkhd(h),M.mdia(h))}static tkhd(h){let m=h.id,y=h.duration,C=h.presentWidth,Z=h.presentHeight;return M.box(M.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,C>>>8&255,C&255,0,0,Z>>>8&255,Z&255,0,0]))}static mdia(h){return M.box(M.types.mdia,M.mdhd(h),M.hdlr(h),M.minf(h))}static mdhd(h){let m=h.timescale,y=h.duration;return M.box(M.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=M.constants.HDLR_AUDIO:m=M.constants.HDLR_VIDEO,M.box(M.types.hdlr,m)}static minf(h){let m=null;return h.type==="audio"?m=M.box(M.types.smhd,M.constants.SMHD):m=M.box(M.types.vmhd,M.constants.VMHD),M.box(M.types.minf,m,M.dinf(),M.stbl(h))}static dinf(){return M.box(M.types.dinf,M.box(M.types.dref,M.constants.DREF))}static stbl(h){return M.box(M.types.stbl,M.stsd(h),M.box(M.types.stts,M.constants.STTS),M.box(M.types.stsc,M.constants.STSC),M.box(M.types.stsz,M.constants.STSZ),M.box(M.types.stco,M.constants.STCO))}static stsd(h){return h.type==="audio"?h.codec==="mp3"?M.box(M.types.stsd,M.constants.STSD_PREFIX,M.mp3(h)):M.box(M.types.stsd,M.constants.STSD_PREFIX,M.mp4a(h)):M.box(M.types.stsd,M.constants.STSD_PREFIX,M.avc1(h))}static mp3(h){let m=h.channelCount,y=h.audioSampleRate,C=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 M.box(M.types[".mp3"],C)}static mp4a(h){let m=h.channelCount,y=h.audioSampleRate,C=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 M.box(M.types.mp4a,C,M.esds(h))}static esds(h){let m=h.config||[],y=m.length,C=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 M.box(M.types.esds,C)}static avc1(h){let m=h.avcc,y=h.codecWidth,C=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,C>>>8&255,C&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 M.box(M.types.avc1,Z,M.box(M.types.avcC,m))}static mvex(h){return M.box(M.types.mvex,M.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 M.box(M.types.trex,y)}static moof(h,m){return M.box(M.types.moof,M.mfhd(h.sequenceNumber),M.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 M.box(M.types.mfhd,m)}static traf(h,m){let y=h.id,C=M.box(M.types.tfhd,new Uint8Array([0,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&255])),Z=M.box(M.types.tfdt,new Uint8Array([0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255])),pe=M.sdtp(h),be=M.trun(h,pe.byteLength+16+16+8+16+8+8);return M.box(M.types.traf,C,Z,be,pe)}static sdtp(h){let m=h.samples||[],y=m.length,C=new Uint8Array(4+y);for(let Z=0;Z<y;Z++){let pe=m[Z].flags;C[Z+4]=pe.isLeading<<6|pe.dependsOn<<4|pe.isDependedOn<<2|pe.hasRedundancy}return M.box(M.types.sdtp,C)}static trun(h,m){let y=h.samples||[],C=y.length,Z=12+16*C,pe=new Uint8Array(Z);m+=8+Z,pe.set([0,0,15,1,C>>>24&255,C>>>16&255,C>>>8&255,C&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255],0);for(let be=0;be<C;be++){let at=y[be].duration,rt=y[be].size,_t=y[be].flags,$t=y[be].cts;pe.set([at>>>24&255,at>>>16&255,at>>>8&255,at&255,rt>>>24&255,rt>>>16&255,rt>>>8&255,rt&255,_t.isLeading<<2|_t.dependsOn,_t.isDependedOn<<6|_t.hasRedundancy<<4|_t.isNonSync,0,0,$t>>>24&255,$t>>>16&255,$t>>>8&255,$t&255],12+16*be)}return M.box(M.types.trun,pe)}static mdat(h){return M.box(M.types.mdat,h)}}M.init();var W=M;class ae{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 ue=ae;class ye{constructor(h,m,y,C,Z){this.dts=h,this.pts=m,this.duration=y,this.originalDts=C,this.isSyncPoint=Z,this.fileposition=null}}class Ce{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 xe{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,C=m.length-1,Z=0,pe=0,be=C;for(h<m[0].dts&&(y=0,pe=be+1);pe<=be;)if(Z=pe+Math.floor((be-pe)/2),Z===C||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 qe{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,C=0,Z=0,pe=y,be=0;if(h<m[0].originalBeginDts)return be=-1,be;for(;Z<=pe;)if(C=Z+Math.floor((pe-Z)/2),C===y||h>m[C].lastSample.originalDts&&h<m[C+1].originalBeginDts){be=C;break}else m[C].originalBeginDts<h?Z=C+1:pe=C-1;return be}_searchNearestSegmentAfter(h){return this._searchNearestSegmentBefore(h)+1}append(h){let m=this._list,y=h,C=this._lastAppendLocation,Z=0;C!==-1&&C<m.length&&y.originalBeginDts>=m[C].lastSample.originalDts&&(C===m.length-1||C<m.length-1&&y.originalBeginDts<m[C+1].originalBeginDts)?Z=C+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 Fe{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 qe("audio"),this._videoSegmentInfoList=new qe("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(G.chrome&&(G.version.major<50||G.version.major===50&&G.version.build<2661)),this._fillSilentAfterSeek=G.msedge||G.msie,this._mp3UseMpegAudio=!G.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,C="mp4",Z=m.codec;if(h==="audio")this._audioMeta=m,m.codec==="mp3"&&this._mp3UseMpegAudio?(C="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}/${C}`,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 C={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};m!=null&&(C.samples.push(m),C.length=m.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(y,!0),this._remuxAudio(C,!0)}_remuxAudio(h,m){if(this._audioMeta==null)return;let y=h,C=y.samples,Z,pe=-1,be=-1,at=-1,rt=this._audioMeta.refSampleDuration,_t=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,$t=this._dtsBaseInited&&this._audioNextDts===void 0,Ut=!1;if(!C||C.length===0||C.length===1&&!m)return;let At=0,Zt=null,Lt=0;_t?(At=0,Lt=y.length):(At=8,Lt=8+y.length);let ft=null;if(C.length>1&&(ft=C.pop(),Lt-=ft.length),this._audioStashedLastSample!=null){let Mt=this._audioStashedLastSample;this._audioStashedLastSample=null,C.unshift(Mt),Lt+=Mt.length}ft!=null&&(this._audioStashedLastSample=ft);let ht=C[0].dts-this._dtsBase;if(this._audioNextDts)Z=ht-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())Z=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(Ut=!0);else{let Mt=this._audioSegmentInfoList.getLastSampleBefore(ht);if(Mt!=null){let It=ht-(Mt.originalDts+Mt.duration);It<=3&&(It=0);let zt=Mt.dts+Mt.duration+It;Z=ht-zt}else Z=0}if(Ut){let Mt=ht-Z,It=this._videoSegmentInfoList.getLastSegmentBefore(ht);if(It!=null&&It.beginDts<Mt){let zt=ue.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(zt){let ve=It.beginDts,Oe=Mt-It.beginDts;p.v(this.TAG,`InsertPrefixSilentAudio: dts: ${ve}, duration: ${Oe}`),C.unshift({unit:zt,dts:ve,pts:ve}),Lt+=zt.byteLength}}else Ut=!1}let Ze=[];for(let Mt=0;Mt<C.length;Mt++){let It=C[Mt],zt=It.unit,ve=It.dts-this._dtsBase,Oe=ve-Z;pe===-1&&(pe=Oe);let Qe=0;Mt!==C.length-1?Qe=C[Mt+1].dts-this._dtsBase-Z-Oe:ft!=null?Qe=ft.dts-this._dtsBase-Z-Oe:Ze.length>=1?Qe=Ze[Ze.length-1].duration:Qe=Math.floor(rt);let Ye=!1,it=null;if(Qe>rt*1.5&&this._audioMeta.codec!=="mp3"&&this._fillAudioTimestampGap&&!G.safari){Ye=!0;let mt=Math.abs(Qe-rt),lt=Math.ceil(mt/rt),Et=Oe+rt;p.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
dts: ${Oe+Qe} ms, expected: ${Oe+Math.round(rt)} ms, delta: ${Math.round(mt)} ms, generate: ${lt} frames`);let Xt=ue.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);Xt==null&&(p.w(this.TAG,`Unable to generate silent frame for ${this._audioMeta.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),Xt=zt),it=[];for(let ui=0;ui<lt;ui++){let jt=Math.round(Et);if(it.length>0){let xi=it[it.length-1];xi.duration=jt-xi.dts}let pi={dts:jt,pts:jt,cts:0,unit:Xt,size:Xt.byteLength,duration:0,originalDts:ve,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};it.push(pi),Lt+=pi.size,Et+=rt}let Dt=it[it.length-1];Dt.duration=Oe+Qe-Dt.dts,Qe=Math.round(rt)}Ze.push({dts:Oe,pts:Oe,cts:0,unit:It.unit,size:It.unit.byteLength,duration:Qe,originalDts:ve,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),Ye&&Ze.push.apply(Ze,it)}_t?Zt=new Uint8Array(Lt):(Zt=new Uint8Array(Lt),Zt[0]=Lt>>>24&255,Zt[1]=Lt>>>16&255,Zt[2]=Lt>>>8&255,Zt[3]=Lt&255,Zt.set(W.types.mdat,4));for(let Mt=0;Mt<Ze.length;Mt++){let It=Ze[Mt].unit;Zt.set(It,At),At+=It.byteLength}let je=Ze[Ze.length-1];be=je.dts+je.duration,this._audioNextDts=be;let pt=new Ce;pt.beginDts=pe,pt.endDts=be,pt.beginPts=pe,pt.endPts=be,pt.originalBeginDts=Ze[0].originalDts,pt.originalEndDts=je.originalDts+je.duration,pt.firstSample=new ye(Ze[0].dts,Ze[0].pts,Ze[0].duration,Ze[0].originalDts,!1),pt.lastSample=new ye(je.dts,je.pts,je.duration,je.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(pt),y.samples=Ze,y.sequenceNumber++;let ti=null;_t?ti=new Uint8Array:ti=W.moof(y,pe),y.samples=[],y.length=0;let Qt={type:"audio",data:this._mergeBoxes(ti,Zt).buffer,sampleCount:Ze.length,info:pt};_t&&$t&&(Qt.timestampOffset=pe),this._onMediaSegment("audio",Qt)}_remuxVideo(h,m){if(this._videoMeta==null)return;let y=h,C=y.samples,Z,pe=-1,be=-1,at=-1,rt=-1;if(!C||C.length===0||C.length===1&&!m)return;let _t=8,$t=null,Ut=8+h.length,At=null;if(C.length>1&&(At=C.pop(),Ut-=At.length),this._videoStashedLastSample!=null){let je=this._videoStashedLastSample;this._videoStashedLastSample=null,C.unshift(je),Ut+=je.length}At!=null&&(this._videoStashedLastSample=At);let Zt=C[0].dts-this._dtsBase;if(this._videoNextDts)Z=Zt-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())Z=0;else{let je=this._videoSegmentInfoList.getLastSampleBefore(Zt);if(je!=null){let pt=Zt-(je.originalDts+je.duration);pt<=3&&(pt=0);let ti=je.dts+je.duration+pt;Z=Zt-ti}else Z=0}let Lt=new Ce,ft=[];for(let je=0;je<C.length;je++){let pt=C[je],ti=pt.dts-this._dtsBase,Qt=pt.isKeyframe,Mt=ti-Z,It=pt.cts,zt=Mt+It;pe===-1&&(pe=Mt,at=zt);let ve=0;if(je!==C.length-1?ve=C[je+1].dts-this._dtsBase-Z-Mt:At!=null?ve=At.dts-this._dtsBase-Z-Mt:ft.length>=1?ve=ft[ft.length-1].duration:ve=Math.floor(this._videoMeta.refSampleDuration),Qt){let Oe=new ye(Mt,zt,ve,pt.dts,!0);Oe.fileposition=pt.fileposition,Lt.appendSyncPoint(Oe)}ft.push({dts:Mt,pts:zt,cts:It,units:pt.units,size:pt.length,isKeyframe:Qt,duration:ve,originalDts:ti,flags:{isLeading:0,dependsOn:Qt?2:1,isDependedOn:Qt?1:0,hasRedundancy:0,isNonSync:Qt?0:1}})}$t=new Uint8Array(Ut),$t[0]=Ut>>>24&255,$t[1]=Ut>>>16&255,$t[2]=Ut>>>8&255,$t[3]=Ut&255,$t.set(W.types.mdat,4);for(let je=0;je<ft.length;je++){let pt=ft[je].units;for(;pt.length;){let Qt=pt.shift().data;$t.set(Qt,_t),_t+=Qt.byteLength}}let ht=ft[ft.length-1];if(be=ht.dts+ht.duration,rt=ht.pts+ht.duration,this._videoNextDts=be,Lt.beginDts=pe,Lt.endDts=be,Lt.beginPts=at,Lt.endPts=rt,Lt.originalBeginDts=ft[0].originalDts,Lt.originalEndDts=ht.originalDts+ht.duration,Lt.firstSample=new ye(ft[0].dts,ft[0].pts,ft[0].duration,ft[0].originalDts,ft[0].isKeyframe),Lt.lastSample=new ye(ht.dts,ht.pts,ht.duration,ht.originalDts,ht.isKeyframe),this._isLive||this._videoSegmentInfoList.append(Lt),y.samples=ft,y.sequenceNumber++,this._forceFirstIDR){let je=ft[0].flags;je.dependsOn=2,je.isNonSync=0}let Ze=W.moof(y,pe);y.samples=[],y.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(Ze,$t).buffer,sampleCount:ft.length,info:Lt})}_mergeBoxes(h,m){let y=new Uint8Array(h.byteLength+m.byteLength);return y.set(h,0),y.set(m,h.byteLength),y}}var $e=Fe,Le={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(C=>{C.timestampBase=y,y+=C.duration,C.cors=h.cors,C.withCredentials=h.withCredentials,m.referrerPolicy&&(C.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],C=this._ioctl=new le(y,this._config,h);C.onError=this._onIOException.bind(this),C.onSeeked=this._onIOSeeked.bind(this),C.onComplete=this._onIOComplete.bind(this),C.onRedirect=this._onIORedirect.bind(this),C.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),m?this._demuxer.bindDataSource(this._ioctl):C.onDataArrival=this._onInitChunkArrival.bind(this),C.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 C=y.getNearestKeyframe(h);this._remuxer.seek(C.milliseconds),this._ioctl.seek(C.fileposition),this._pendingResolveSeekPoint=C.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 C=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,C.fileposition),this._pendingResolveSeekPoint=C.milliseconds,this._reportSegmentMediaInfo(m)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(h){let m=this._mediaDataSource.segments,y=m.length-1;for(let C=0;C<m.length;C++)if(h<m[C].timestampBase){y=C-1;break}return y}_onInitChunkArrival(h,m){let y=null,C=0;if(m>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,C=this._demuxer.parseChunks(h,m);else if((y=U.probe(h)).match){this._demuxer=new U(y,this._config),this._remuxer||(this._remuxer=new $e(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),C=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(Le.DEMUX_ERROR,ke.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),C=0;return C}_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,Nt.prototype));let m=Object.assign({},h);Object.setPrototypeOf(m,Nt.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(Le.METADATA_ARRIVED,h)}_onScriptDataArrived(h){this._emitter.emit(Le.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(Le.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(h){let m=this._ioctl.extraData;this._mediaDataSource.segments[m].redirectedURL=h}_onIORecoveredEarlyEof(){this._emitter.emit(Le.RECOVERED_EARLY_EOF)}_onIOException(h,m){p.e(this.TAG,`IOException: type = ${h}, code = ${m.code}, msg = ${m.msg}`),this._emitter.emit(Le.IO_ERROR,h,m),this._disableStatisticsReporter()}_onDemuxException(h,m){p.e(this.TAG,`DemuxException: type = ${h}, info = ${m}`),this._emitter.emit(Le.DEMUX_ERROR,h,m)}_onRemuxerInitSegmentArrival(h,m){this._emitter.emit(Le.INIT_SEGMENT,h,m)}_onRemuxerMediaSegmentArrival(h,m){if(this._pendingSeekTime==null&&(this._emitter.emit(Le.MEDIA_SEGMENT,h,m),this._pendingResolveSeekPoint!=null&&h==="video")){let y=m.info.syncPoints,C=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,G.safari&&y.length>0&&y[0].originalDts===C&&(C=y[0].pts),this._emitter.emit(Le.RECOMMEND_SEEKPOINT,C)}}_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(Le.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(Le.STATISTICS_INFO,h)}}var Pt=tt,Ft=function(We){let h="TransmuxingWorker",m=null,y=Lt.bind(this);fe.install(),We.addEventListener("message",function(ft){switch(ft.data.cmd){case"init":m=new Pt(ft.data.param[0],ft.data.param[1]),m.on(Le.IO_ERROR,Ut.bind(this)),m.on(Le.DEMUX_ERROR,At.bind(this)),m.on(Le.INIT_SEGMENT,C.bind(this)),m.on(Le.MEDIA_SEGMENT,Z.bind(this)),m.on(Le.LOADING_COMPLETE,pe.bind(this)),m.on(Le.RECOVERED_EARLY_EOF,be.bind(this)),m.on(Le.MEDIA_INFO,at.bind(this)),m.on(Le.METADATA_ARRIVED,rt.bind(this)),m.on(Le.SCRIPTDATA_ARRIVED,_t.bind(this)),m.on(Le.STATISTICS_INFO,$t.bind(this)),m.on(Le.RECOMMEND_SEEKPOINT,Zt.bind(this));break;case"destroy":m&&(m.destroy(),m=null),We.postMessage({msg:"destroyed"});break;case"start":m.start();break;case"stop":m.stop();break;case"seek":m.seek(ft.data.param);break;case"pause":m.pause();break;case"resume":m.resume();break;case"logging_config":{let ht=ft.data.param;ze.applyConfig(ht),ht.enableCallback===!0?ze.addLogListener(y):ze.removeLogListener(y);break}}});function C(ft,ht){let Ze={msg:Le.INIT_SEGMENT,data:{type:ft,data:ht}};We.postMessage(Ze,[ht.data])}function Z(ft,ht){let Ze={msg:Le.MEDIA_SEGMENT,data:{type:ft,data:ht}};We.postMessage(Ze,[ht.data])}function pe(){let ft={msg:Le.LOADING_COMPLETE};We.postMessage(ft)}function be(){let ft={msg:Le.RECOVERED_EARLY_EOF};We.postMessage(ft)}function at(ft){let ht={msg:Le.MEDIA_INFO,data:ft};We.postMessage(ht)}function rt(ft){let ht={msg:Le.METADATA_ARRIVED,data:ft};We.postMessage(ht)}function _t(ft){let ht={msg:Le.SCRIPTDATA_ARRIVED,data:ft};We.postMessage(ht)}function $t(ft){let ht={msg:Le.STATISTICS_INFO,data:ft};We.postMessage(ht)}function Ut(ft,ht){We.postMessage({msg:Le.IO_ERROR,data:{type:ft,info:ht}})}function At(ft,ht){We.postMessage({msg:Le.DEMUX_ERROR,data:{type:ft,info:ht}})}function Zt(ft){We.postMessage({msg:Le.RECOMMEND_SEEKPOINT,data:ft})}function Lt(ft,ht){We.postMessage({msg:"logcat_callback",data:{type:ft,logcat:ht}})}};class Gt{constructor(h,m){if(this.TAG="Transmuxer",this._emitter=new(he()),m.enableWorker&&typeof Worker!="undefined")try{let y=K(82059);this._worker=y(Ft),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)},ze.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:ze.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(Le.IO_ERROR,this._onIOError.bind(this)),y.on(Le.DEMUX_ERROR,this._onDemuxError.bind(this)),y.on(Le.INIT_SEGMENT,this._onInitSegment.bind(this)),y.on(Le.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),y.on(Le.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),y.on(Le.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),y.on(Le.MEDIA_INFO,this._onMediaInfo.bind(this)),y.on(Le.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),y.on(Le.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),y.on(Le.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),y.on(Le.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),ze.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(Le.INIT_SEGMENT,h,m)})}_onMediaSegment(h,m){Promise.resolve().then(()=>{this._emitter.emit(Le.MEDIA_SEGMENT,h,m)})}_onLoadingComplete(){Promise.resolve().then(()=>{this._emitter.emit(Le.LOADING_COMPLETE)})}_onRecoveredEarlyEof(){Promise.resolve().then(()=>{this._emitter.emit(Le.RECOVERED_EARLY_EOF)})}_onMediaInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Le.MEDIA_INFO,h)})}_onMetaDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Le.METADATA_ARRIVED,h)})}_onScriptDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Le.SCRIPTDATA_ARRIVED,h)})}_onStatisticsInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Le.STATISTICS_INFO,h)})}_onIOError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Le.IO_ERROR,h,m)})}_onDemuxError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Le.DEMUX_ERROR,h,m)})}_onRecommendSeekpoint(h){Promise.resolve().then(()=>{this._emitter.emit(Le.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 Le.INIT_SEGMENT:case Le.MEDIA_SEGMENT:this._emitter.emit(m.msg,y.type,y.data);break;case Le.LOADING_COMPLETE:case Le.RECOVERED_EARLY_EOF:this._emitter.emit(m.msg);break;case Le.MEDIA_INFO:Object.setPrototypeOf(y,Nt.prototype),this._emitter.emit(m.msg,y);break;case Le.METADATA_ARRIVED:case Le.SCRIPTDATA_ARRIVED:case Le.STATISTICS_INFO:this._emitter.emit(m.msg,y);break;case Le.IO_ERROR:case Le.DEMUX_ERROR:this._emitter.emit(m.msg,y.type,y.info);break;case Le.RECOMMEND_SEEKPOINT:this._emitter.emit(m.msg,y);break;case"logcat_callback":p.emitter.emit("log",y.type,y.logcat);break;default:break}}}var ri=Gt,ei={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};class Jt{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 xe}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 C=this._sourceBuffers[m];if(C){if(h.readyState!=="closed"){try{h.removeSourceBuffer(C)}catch(Z){p.e(this.TAG,Z.message)}C.removeEventListener("error",this.e.onSourceBufferError),C.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,C=`${y.container}`;y.codec&&y.codec.length>0&&(C+=`;codecs=${y.codec}`);let Z=!1;if(p.v(this.TAG,"Received Initialization Segment, mimeType: "+C),this._lastInitSegments[y.type]=y,C!==this._mimeTypes[y.type]){if(this._mimeTypes[y.type])p.v(this.TAG,`Notice: ${y.type} mimeType changed, origin: ${this._mimeTypes[y.type]}, target: ${C}`);else{Z=!0;try{let pe=this._sourceBuffers[y.type]=this._mediaSource.addSourceBuffer(C);pe.addEventListener("error",this.e.onSourceBufferError),pe.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(pe){p.e(this.TAG,pe.message),this._emitter.emit(ei.ERROR,{code:pe.code,msg:pe.message});return}}this._mimeTypes[y.type]=C}m||this._pendingSegments[y.type].push(y),Z||this._sourceBuffers[y.type]&&!this._sourceBuffers[y.type].updating&&this._doAppendSegments(),G.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 C=this._pendingSegments[m];if(C.splice(0,C.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(),G.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 C=y.buffered;if(C.length>=1&&h-C.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 C=y.buffered,Z=!1;for(let pe=0;pe<C.length;pe++){let be=C.start(pe),at=C.end(pe);if(be<=h&&h<at+3){if(h-be>=this._config.autoCleanupMaxBackwardDuration){Z=!0;let rt=h-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[m].push({start:be,end:rt})}}else at<h&&(Z=!0,this._pendingRemoveRanges[m].push({start:be,end:at}))}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 C=y.shift();m.remove(C.start,C.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 C=this._sourceBuffers[m].timestampOffset,Z=y.timestampOffset/1e3;Math.abs(C-Z)>.1&&(p.v(this.TAG,`Update MPEG audio timestampOffset from ${C} 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(C){this._pendingSegments[m].unshift(y),C.code===22?(this._isBufferFull||this._emitter.emit(ei.BUFFER_FULL),this._isBufferFull=!0):(p.e(this.TAG,C.message),this._emitter.emit(ei.ERROR,{code:C.code,msg:C.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(ei.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(ei.UPDATE_END)}_onSourceBufferError(h){p.e(this.TAG,`SourceBuffer Error: ${h}`)}}var Tt=Jt;const ot={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},dt={NETWORK_EXCEPTION:b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:b.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 Ot{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=G.chrome&&(G.version.major<50||G.version.major===50&&G.version.build<2661);this._alwaysSeekKeyframe=!!(y||G.msedge||G.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===Ae.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Ae.MEDIA_INFO,this.mediaInfo)}):h===Ae.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Ae.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 Tt(this._config),this._msectl.on(ei.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(ei.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(ei.SOURCE_OPEN,()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())}),this._msectl.on(ei.ERROR,m=>{this._emitter.emit(Ae.ERROR,ot.MEDIA_ERROR,dt.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 ri(this._mediaDataSource,this._config),this._transmuxer.on(Le.INIT_SEGMENT,(h,m)=>{this._msectl.appendInitSegment(m)}),this._transmuxer.on(Le.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(Le.LOADING_COMPLETE,()=>{this._msectl.endOfStream(),this._emitter.emit(Ae.LOADING_COMPLETE)}),this._transmuxer.on(Le.RECOVERED_EARLY_EOF,()=>{this._emitter.emit(Ae.RECOVERED_EARLY_EOF)}),this._transmuxer.on(Le.IO_ERROR,(h,m)=>{this._emitter.emit(Ae.ERROR,ot.NETWORK_ERROR,h,m)}),this._transmuxer.on(Le.DEMUX_ERROR,(h,m)=>{this._emitter.emit(Ae.ERROR,ot.MEDIA_ERROR,h,{code:-1,msg:m})}),this._transmuxer.on(Le.MEDIA_INFO,h=>{this._mediaInfo=h,this._emitter.emit(Ae.MEDIA_INFO,Object.assign({},h))}),this._transmuxer.on(Le.METADATA_ARRIVED,h=>{this._emitter.emit(Ae.METADATA_ARRIVED,h)}),this._transmuxer.on(Le.SCRIPTDATA_ARRIVED,h=>{this._emitter.emit(Ae.SCRIPTDATA_ARRIVED,h)}),this._transmuxer.on(Le.STATISTICS_INFO,h=>{this._statisticsInfo=this._fillStatisticsInfo(h),this._emitter.emit(Ae.STATISTICS_INFO,Object.assign({},this._statisticsInfo))}),this._transmuxer.on(Le.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,C=0;if(this._mediaElement.getVideoPlaybackQuality){let Z=this._mediaElement.getVideoPlaybackQuality();y=Z.totalVideoFrames,C=Z.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,C=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=C),h}_onmseUpdateEnd(){if(!this._config.lazyLoad||this._config.isLive)return;let h=this._mediaElement.buffered,m=this._mediaElement.currentTime,y=0,C=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,C=be;break}}C>=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 C=0;C<m.length;C++){let Z=m.start(C),pe=m.end(C);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 C=m.start(y),Z=m.end(y);if(h>=C&&h<Z)return!0}return!1}_internalSeek(h){let m=this._isTimepointBuffered(h),y=!1,C=0;if(h<1&&this._mediaElement.buffered.length>0){let Z=this._mediaElement.buffered.start(0);(Z<1&&h<Z||G.safari)&&(y=!0,C=G.safari?.1:Z)}if(y)this._requestSetTime=!0,this._mediaElement.currentTime=C;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 C=y.start(0);if(C<1&&m<C||G.safari){this._requestSetTime=!0,this._mediaElement.currentTime=G.safari?.1:C;return}}if(this._isTimepointBuffered(m)){if(this._alwaysSeekKeyframe){let C=this._msectl.getNearestKeyframe(Math.floor(m*1e3));C!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=C.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 Bt=Ot;class nt{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===Ae.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Ae.MEDIA_INFO,this.mediaInfo)}):h===Ae.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Ae.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,C=0;if(this._mediaElement.getVideoPlaybackQuality){let Z=this._mediaElement.getVideoPlaybackQuality();y=Z.totalVideoFrames,C=Z.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,C=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=C),h}_onvLoadedMetadata(h){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(Ae.MEDIA_INFO,this.mediaInfo)}_reportStatisticsInfo(){this._emitter.emit(Ae.STATISTICS_INFO,this.statisticsInfo)}}var vt=nt;fe.install();function yt(We,h){let m=We;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 Bt(m,h);default:return new vt(m,h)}}function vi(){return z.supportMSEH264Playback()}function Vt(){return z.getFeatureList()}let ai={};ai.createPlayer=yt,ai.isSupported=vi,ai.getFeatureList=Vt,ai.BaseLoader=A,ai.LoaderStatus=_,ai.LoaderErrors=b,ai.Events=Ae,ai.ErrorTypes=ot,ai.ErrorDetails=dt,ai.FlvPlayer=Bt,ai.NativePlayer=vt,ai.LoggingControl=ze,Object.defineProperty(ai,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var wt=ai},25769:function(Yt,st,K){"use strict";var B=K(98040),fe={"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 V(p,me){var ce,l,X,P,g,_,b=!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(N){if(N.stopPropagation(),me.format)if(N.preventDefault(),typeof N.clipboardData=="undefined"){ce&&console.warn("unable to use e.clipboardData"),ce&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var j=fe[me.format]||fe.default;window.clipboardData.setData(j,p)}else N.clipboardData.clearData(),N.clipboardData.setData(me.format,p);me.onCopy&&(N.preventDefault(),me.onCopy(N.clipboardData))}),document.body.appendChild(_),P.selectNodeContents(_),g.addRange(P);var A=document.execCommand("copy");if(!A)throw new Error("copy command was unsuccessful");b=!0}catch(N){ce&&console.error("unable to copy using execCommand: ",N),ce&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(me.format||"text",p),me.onCopy&&me.onCopy(window.clipboardData),b=!0}catch(j){ce&&console.error("unable to copy using clipboardData: ",j),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 b}Yt.exports=V},3867:function(Yt,st,K){var B=K(97671);(function(fe,Se){Yt.exports=Se()})(this,function(){"use strict";function fe(k){var Q=typeof k;return k!==null&&(Q==="object"||Q==="function")}function Se(k){return typeof k=="function"}var he=void 0;Array.isArray?he=Array.isArray:he=function(k){return Object.prototype.toString.call(k)==="[object Array]"};var V=he,p=0,me=void 0,ce=void 0,l=function(Q,U){R[p]=Q,R[p+1]=U,p+=2,p===2&&(ce?ce(q):ie())};function X(k){ce=k}function P(k){l=k}var g=typeof window!="undefined"?window:void 0,_=g||{},b=_.MutationObserver||_.WebKitMutationObserver,A=typeof self=="undefined"&&typeof B!="undefined"&&{}.toString.call(B)==="[object process]",N=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function j(){return function(){return B.nextTick(q)}}function G(){return typeof me!="undefined"?function(){me(q)}:w()}function L(){var k=0,Q=new b(q),U=document.createTextNode("");return Q.observe(U,{characterData:!0}),function(){U.data=k=++k%2}}function I(){var k=new MessageChannel;return k.port1.onmessage=q,function(){return k.port2.postMessage(0)}}function w(){var k=setTimeout;return function(){return k(q,1)}}var R=new Array(1e3);function q(){for(var k=0;k<p;k+=2){var Q=R[k],U=R[k+1];Q(U),R[k]=void 0,R[k+1]=void 0}p=0}function se(){try{var k=Function("return this")().require("vertx");return me=k.runOnLoop||k.runOnContext,G()}catch(Q){return w()}}var ie=void 0;A?ie=j():b?ie=L():N?ie=I():g===void 0?ie=se():ie=w();function _e(k,Q){var U=this,M=new this.constructor(Ke);M[Te]===void 0&&ut(M);var W=U._state;if(W){var ae=arguments[W-1];l(function(){return ni(W,M,ae,U._result)})}else St(U,M,k,Q);return M}function Ie(k){var Q=this;if(k&&typeof k=="object"&&k.constructor===Q)return k;var U=new Q(Ke);return oe(U,k),U}var Te=Math.random().toString(36).substring(2);function Ke(){}var J=void 0,D=1,F=2;function O(){return new TypeError("You cannot resolve a promise with itself")}function le(){return new TypeError("A promises callback cannot return that same promise.")}function te(k,Q,U,M){try{k.call(Q,U,M)}catch(W){return W}}function S(k,Q,U){l(function(M){var W=!1,ae=te(U,Q,function(ue){W||(W=!0,Q!==ue?oe(M,ue):Be(M,ue))},function(ue){W||(W=!0,ze(M,ue))},"Settle: "+(M._label||" unknown promise"));!W&&ae&&(W=!0,ze(M,ae))},k)}function v(k,Q){Q._state===D?Be(k,Q._result):Q._state===F?ze(k,Q._result):St(Q,void 0,function(U){return oe(k,U)},function(U){return ze(k,U)})}function z(k,Q,U){Q.constructor===k.constructor&&U===_e&&Q.constructor.resolve===Ie?v(k,Q):U===void 0?Be(k,Q):Se(U)?S(k,Q,U):Be(k,Q)}function oe(k,Q){if(k===Q)ze(k,O());else if(fe(Q)){var U=void 0;try{U=Q.then}catch(M){ze(k,M);return}z(k,Q,U)}else Be(k,Q)}function Ae(k){k._onerror&&k._onerror(k._result),Nt(k)}function Be(k,Q){k._state===J&&(k._result=Q,k._state=D,k._subscribers.length!==0&&l(Nt,k))}function ze(k,Q){k._state===J&&(k._state=F,k._result=Q,l(Ae,k))}function St(k,Q,U,M){var W=k._subscribers,ae=W.length;k._onerror=null,W[ae]=Q,W[ae+D]=U,W[ae+F]=M,ae===0&&k._state&&l(Nt,k)}function Nt(k){var Q=k._subscribers,U=k._state;if(Q.length!==0){for(var M=void 0,W=void 0,ae=k._result,ue=0;ue<Q.length;ue+=3)M=Q[ue],W=Q[ue+U],M?ni(U,M,W,ae):W(ae);k._subscribers.length=0}}function ni(k,Q,U,M){var W=Se(U),ae=void 0,ue=void 0,ye=!0;if(W){try{ae=U(M)}catch(Ce){ye=!1,ue=Ce}if(Q===ae){ze(Q,le());return}}else ae=M;Q._state!==J||(W&&ye?oe(Q,ae):ye===!1?ze(Q,ue):k===D?Be(Q,ae):k===F&&ze(Q,ae))}function Ve(k,Q){try{Q(function(M){oe(k,M)},function(M){ze(k,M)})}catch(U){ze(k,U)}}var gt=0;function Kt(){return gt++}function ut(k){k[Te]=gt++,k._state=void 0,k._result=void 0,k._subscribers=[]}function hi(){return new Error("Array Methods must be provided an Array")}var He=function(){function k(Q,U){this._instanceConstructor=Q,this.promise=new Q(Ke),this.promise[Te]||ut(this.promise),V(U)?(this.length=U.length,this._remaining=U.length,this._result=new Array(this.length),this.length===0?Be(this.promise,this._result):(this.length=this.length||0,this._enumerate(U),this._remaining===0&&Be(this.promise,this._result))):ze(this.promise,hi())}return k.prototype._enumerate=function(U){for(var M=0;this._state===J&&M<U.length;M++)this._eachEntry(U[M],M)},k.prototype._eachEntry=function(U,M){var W=this._instanceConstructor,ae=W.resolve;if(ae===Ie){var ue=void 0,ye=void 0,Ce=!1;try{ue=U.then}catch(qe){Ce=!0,ye=qe}if(ue===_e&&U._state!==J)this._settledAt(U._state,M,U._result);else if(typeof ue!="function")this._remaining--,this._result[M]=U;else if(W===ee){var xe=new W(Ke);Ce?ze(xe,ye):z(xe,U,ue),this._willSettleAt(xe,M)}else this._willSettleAt(new W(function(qe){return qe(U)}),M)}else this._willSettleAt(ae(U),M)},k.prototype._settledAt=function(U,M,W){var ae=this.promise;ae._state===J&&(this._remaining--,U===F?ze(ae,W):this._result[M]=W),this._remaining===0&&Be(ae,this._result)},k.prototype._willSettleAt=function(U,M){var W=this;St(U,void 0,function(ae){return W._settledAt(D,M,ae)},function(ae){return W._settledAt(F,M,ae)})},k}();function Ee(k){return new He(this,k).promise}function De(k){var Q=this;return V(k)?new Q(function(U,M){for(var W=k.length,ae=0;ae<W;ae++)Q.resolve(k[ae]).then(U,M)}):new Q(function(U,M){return M(new TypeError("You must pass an array to race."))})}function ne(k){var Q=this,U=new Q(Ke);return ze(U,k),U}function Re(){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 k(Q){this[Te]=Kt(),this._result=this._state=void 0,this._subscribers=[],Ke!==Q&&(typeof Q!="function"&&Re(),this instanceof k?Ve(this,Q):ke())}return k.prototype.catch=function(U){return this.then(null,U)},k.prototype.finally=function(U){var M=this,W=M.constructor;return Se(U)?M.then(function(ae){return W.resolve(U()).then(function(){return ae})},function(ae){return W.resolve(U()).then(function(){throw ae})}):M.then(U,U)},k}();ee.prototype.then=_e,ee.all=Ee,ee.race=De,ee.resolve=Ie,ee.reject=ne,ee._setScheduler=X,ee._setAsap=P,ee._asap=l;function Y(){var k=void 0;if(typeof K.g!="undefined")k=K.g;else if(typeof self!="undefined")k=self;else try{k=Function("return this")()}catch(M){throw new Error("polyfill failed because global object is unavailable in this environment")}var Q=k.Promise;if(Q){var U=null;try{U=Object.prototype.toString.call(Q.resolve())}catch(M){}if(U==="[object Promise]"&&!Q.cast)return}k.Promise=ee}return ee.polyfill=Y,ee.Promise=ee,ee})},86204:function(Yt){"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 fe(L){console&&console.warn&&console.warn(L)}var Se=Number.isNaN||function(I){return I!==I};function he(){he.init.call(this)}Yt.exports=he,Yt.exports.once=N,he.EventEmitter=he,he.prototype._events=void 0,he.prototype._eventsCount=0,he.prototype._maxListeners=void 0;var V=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 V},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+".");V=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 ie;if(w.length>0&&(ie=w[0]),ie instanceof Error)throw ie;var _e=new Error("Unhandled error."+(ie?" ("+ie.message+")":""));throw _e.context=ie,_e}var Ie=se[I];if(Ie===void 0)return!1;if(typeof Ie=="function")K(Ie,this,w);else for(var Te=Ie.length,Ke=_(Ie,Te),R=0;R<Te;++R)K(Ke[R],this,w);return!0};function ce(L,I,w,R){var q,se,ie;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),ie=se[I]),ie===void 0)ie=se[I]=w,++L._eventsCount;else if(typeof ie=="function"?ie=se[I]=R?[w,ie]:[ie,w]:R?ie.unshift(w):ie.push(w),q=me(L),q>0&&ie.length>q&&!ie.warned){ie.warned=!0;var _e=new Error("Possible EventEmitter memory leak detected. "+ie.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");_e.name="MaxListenersExceededWarning",_e.emitter=L,_e.type=I,_e.count=ie.length,fe(_e)}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,ie,_e;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,ie=R.length-1;ie>=0;ie--)if(R[ie]===w||R[ie].listener===w){_e=R[ie].listener,se=ie;break}if(se<0)return this;se===0?R.shift():b(R,se),R.length===1&&(q[I]=R[0]),q.removeListener!==void 0&&this.emit("removeListener",I,_e||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),ie;for(q=0;q<se.length;++q)ie=se[q],ie!=="removeListener"&&this.removeAllListeners(ie);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 b(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 N(L,I){return new Promise(function(w,R){function q(ie){L.removeListener(I,se),R(ie)}function se(){typeof L.removeListener=="function"&&L.removeListener("error",q),w([].slice.call(arguments))}G(L,I,se,{once:!0}),I!=="error"&&j(L,q,{once:!0})})}function j(L,I,w){typeof L.on=="function"&&G(L,"error",I,w)}function G(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(Yt,st,K){var B,fe;(function(Se,he){Yt.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,V="2.6.4",p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",me=function(D){for(var F={},O=0,le=D.length;O<le;O++)F[D.charAt(O)]=O;return F}(p),ce=String.fromCharCode,l=function(D){if(D.length<2){var F=D.charCodeAt(0);return F<128?D:F<2048?ce(192|F>>>6)+ce(128|F&63):ce(224|F>>>12&15)+ce(128|F>>>6&63)+ce(128|F&63)}else{var F=65536+(D.charCodeAt(0)-55296)*1024+(D.charCodeAt(1)-56320);return ce(240|F>>>18&7)+ce(128|F>>>12&63)+ce(128|F>>>6&63)+ce(128|F&63)}},X=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,P=function(D){return D.replace(X,l)},g=function(D){var F=[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),le=[p.charAt(O>>>18),p.charAt(O>>>12&63),F>=2?"=":p.charAt(O>>>6&63),F>=1?"=":p.charAt(O&63)];return le.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)},b=function(D){return _(P(String(D)))},A=function(D){return D.replace(/[+\/]/g,function(F){return F=="+"?"-":"_"}).replace(/=/g,"")},N=function(D,F){return F?A(b(D)):b(D)},j=function(D){return N(D,!0)},G;Se.Uint8Array&&(G=function(D,F){for(var O="",le=0,te=D.length;le<te;le+=3){var S=D[le],v=D[le+1],z=D[le+2],oe=S<<16|v<<8|z;O+=p.charAt(oe>>>18)+p.charAt(oe>>>12&63)+(typeof v!="undefined"?p.charAt(oe>>>6&63):"=")+(typeof z!="undefined"?p.charAt(oe&63):"=")}return F?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 F=(7&D.charCodeAt(0))<<18|(63&D.charCodeAt(1))<<12|(63&D.charCodeAt(2))<<6|63&D.charCodeAt(3),O=F-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 F=D.length,O=F%4,le=(F>0?me[D.charAt(0)]<<18:0)|(F>1?me[D.charAt(1)]<<12:0)|(F>2?me[D.charAt(2)]<<6:0)|(F>3?me[D.charAt(3)]:0),te=[ce(le>>>16),ce(le>>>8&255),ce(le&255)];return te.length-=[0,0,2,1][O],te.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,""))},ie=function(D){return w(q(D))},_e=function(D){return String(D).replace(/[-_]/g,function(F){return F=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},Ie=function(D){return ie(_e(D))},Te;Se.Uint8Array&&(Te=function(D){return Uint8Array.from(se(_e(D)),function(F){return F.charCodeAt(0)})});var Ke=function(){var D=Se.Base64;return Se.Base64=he,D};if(Se.Base64={VERSION:V,atob:se,btoa:_,fromBase64:Ie,toBase64:N,utob:P,encode:N,encodeURI:j,btou:w,decode:Ie,noConflict:Ke,fromUint8Array:G,toUint8Array:Te},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 Ie(this)})),Object.defineProperty(String.prototype,"toBase64",J(function(D){return N(this,D)})),Object.defineProperty(String.prototype,"toBase64URI",J(function(){return N(this,!0)}))}}return Se.Meteor&&(Base64=Se.Base64),Yt.exports?Yt.exports.Base64=Se.Base64:(B=[],fe=function(){return Se.Base64}.apply(st,B),fe!==void 0&&(Yt.exports=fe)),{Base64:Se.Base64}})},53184:function(Yt,st,K){"use strict";var B,fe;function Se(he,V,p){var me=function(ce,l){return he.js_beautify(ce,l)};return me.js=he.js_beautify,me.css=V.css_beautify,me.html=p.html_beautify,me.js_beautify=he.js_beautify,me.css_beautify=V.css_beautify,me.html_beautify=p.html_beautify,me}B=[K(58553),K(87804),K(40998)],fe=function(he,V,p){return Se(he,V,p)}.apply(st,B),fe!==void 0&&(Yt.exports=fe)},87804:function(Yt,st){var K,B;(function(){var fe;(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 b=this.__base_string_length;return _=_||0,g<0&&(b=0),b+=g*this.__indent_size,b+=_,b},X.prototype.get_indent_string=function(g,_){var b=this.__base_string;return _=_||0,g<0&&(g=0,b=""),_+=g*this.__indent_size,this.__ensure_cache(_),b+=this.__cache[_],b},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,b="";this.__indent_size&&g>=this.__indent_size&&(_=Math.floor(g/this.__indent_size),g-=_*this.__indent_size,b=new Array(_+1).join(this.__indent_string)),g&&(b+=new Array(g+1).join(" ")),this.__cache.push(b)};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 b=this.__lines.join(`
`);return g!==`
`&&(b=b.replace(/[\n]/g,g)),b},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 b=this.__lines.length-2;b>=0;){var A=this.__lines[b];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==_){this.__lines.splice(b+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}b--}},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 b=this.raw_options[g],A=_||[];return typeof b=="object"?b!==null&&typeof b.concat=="function"&&(A=b.concat()):typeof b=="string"&&(A=b.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,_){var b=this.raw_options[g],A=b===void 0?!!_:!!b;return A},l.prototype._get_characters=function(g,_){var b=this.raw_options[g],A=_||"";return typeof b=="string"&&(A=b.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,_){var b=this.raw_options[g];_=parseInt(_,10),isNaN(_)&&(_=0);var A=parseInt(b,10);return isNaN(A)&&(A=_),A},l.prototype._get_selection=function(g,_,b){var A=this._get_selection_list(g,_,b);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,_,b){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(b=b||[_[0]],!this._is_valid_selection(b,_))throw new Error("Invalid Default Value!");var A=this._get_array(g,b);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(b){return _.indexOf(b)===-1})};function X(g,_){var b={};g=P(g);var A;for(A in g)A!==_&&(b[A]=g[A]);if(_&&g[_])for(A in g[_])b[A]=g[_][A];return b}function P(g){var _={},b;for(b in g){var A=b.replace(/-/g,"_");_[A]=g[b]}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 b="",A;return P&&(A=this.match(P),A&&(b+=A[0])),g&&(A||!P)&&(b+=this.readUntil(g,_)),b},X.prototype.readUntil=function(P,g){var _="",b=this.__position;P.lastIndex=this.__position;var A=P.exec(this.__input);return A?(b=A.index,g&&(b+=A[0].length)):b=this.__input_length,_=this.__input.substring(this.__position,b),this.__position=b,_},X.prototype.readUntilAfter=function(P){return this.readUntil(P,!0)},X.prototype.get_regexp=function(P,g){var _=null,b="g";return g&&l&&(b="y"),typeof P=="string"&&P!==""?_=new RegExp(P,b):P&&(_=new RegExp(P.source,b)),_},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 _(b,A){var N=new P(b,A);return N.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,b=X(13).Directives,A=new b(/\/\*/,/\*\//),N=/\r\n|[\r\n]/,j=/\r\n|[\r\n]/g,G=/\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=G.test(this._input.peek()),ie=0;G.test(this._input.peek());)this._ch=this._input.next(),q&&this._ch===`
`&&(ie===0||ie<this._options.max_preserve_newlines)&&(ie++,this._output.add_new_line(!0));return se},R.prototype.foundNestedPseudoClass=function(){for(var q=0,se=1,ie=this._input.peek(se);ie;){if(ie==="{")return!0;if(ie==="(")q+=1;else if(ie===")"){if(q===0)return!1;q-=1}else if(ie===";"||ie==="}")return!1;se++,ie=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&&N.test(q||"")&&(se=q.match(N)[0])),q=q.replace(j,`
`);var ie=q.match(/^[\t ]*/)[0];this._output=new g(this._options,ie),this._input=new _(q),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var _e=0,Ie=!1,Te=!1,Ke=!1,J=!1,D=!1,F=this._ch,O=!1,le,te,S;le=this._input.read(L),te=le!=="",S=F,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),F=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(te),this.print_string(this._ch);var oe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);oe.match(/[ :]$/)&&(oe=this.eatString(": ").replace(/\s+$/,""),this.print_string(oe),this._output.space_before_token=!0),_e===0&&oe.indexOf(":")!==-1&&(Te=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(te),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{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),_e===0&&Ae.indexOf(":")!==-1?(Te=!0,this.indent()):Ae in this.NESTED_AT_RULE?(this._nestedLevel+=1,Ae in this.CONDITIONAL_GROUP_RULE&&(Ke=!0)):_e===0&&!Te&&(J=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(te),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Te&&(Te=!1,this.outdent()),J=!1,Ke?(Ke=!1,Ie=this._indentLevel>=this._nestedLevel):Ie=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&Ie&&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),Te&&(this.outdent(),Te=!1),this.print_string(this._ch),Ie=!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 Be=0;Be<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Be++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Be])){O=!0;break}(Ie||Ke)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!J&&_e===0?(this.print_string(":"),Te||(Te=!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 ze=S==='"'||S==="'";this.preserveSingleSpace(ze||te),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")O=!1,_e===0?(Te&&(this.outdent(),Te=!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(),_e++,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(")")),_e&&(_e--,this.outdent()));else{var St=!1;this._input.lookBack("with")&&(St=!0),this.preserveSingleSpace(te||St),this.print_string(this._ch),Te&&S==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),D=!0):(this.eatWhitespace(),_e++,this.indent())}else if(this._ch===")")_e&&(_e--,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&&(!Te||D)&&_e===0&&!J?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Te&&_e===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&&G.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(te),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),G.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 Nt=S==='"'||S==="'";this.preserveSingleSpace(Nt||te),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&O&&this._output.add_new_line()}var ni=this._output.get_code(se);return ni},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 b=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||b;var A=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var N=0;N<A.length;N++)A[N]!=="expand"?this.brace_style="collapse":this.brace_style=A[N]}g.prototype=new P,ce.exports.Options=g}],V={};function p(ce){var l=V[ce];if(l!==void 0)return l.exports;var X=V[ce]={exports:{}};return he[ce](X,X.exports,p),X.exports}var me=p(15);fe=me})();var Se=fe;K=[],B=function(){return{css_beautify:Se}}.apply(st,K),B!==void 0&&(Yt.exports=B)})()},40998:function(Yt,st,K){var B,fe;(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 N=this.__items.length-1;N>=0;N--)if(this.__items[N].match(A))return!0;return!1},g.prototype.set_indent=function(A,N){this.is_empty()&&(this.__indent_count=A||0,this.__alignment_count=N||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 N=A.lastIndexOf(`
`);N!==-1?this.__character_count=A.length-N: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,N){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)),N=N||"",A.indent_level>0&&(N=new Array(A.indent_level+1).join(this.__indent_string)),this.__base_string=N,this.__base_string_length=N.length}_.prototype.get_indent_size=function(A,N){var j=this.__base_string_length;return N=N||0,A<0&&(j=0),j+=A*this.__indent_size,j+=N,j},_.prototype.get_indent_string=function(A,N){var j=this.__base_string;return N=N||0,A<0&&(A=0,j=""),N+=A*this.__indent_size,this.__ensure_cache(N),j+=this.__cache[N],j},_.prototype.__ensure_cache=function(A){for(;A>=this.__cache.length;)this.__add_column()},_.prototype.__add_column=function(){var A=this.__cache.length,N=0,j="";this.__indent_size&&A>=this.__indent_size&&(N=Math.floor(A/this.__indent_size),A-=N*this.__indent_size,j=new Array(N+1).join(this.__indent_string)),A&&(j+=new Array(A+1).join(" ")),this.__cache.push(j)};function b(A,N){this.__indent_cache=new _(A,N),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()}b.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},b.prototype.get_line_number=function(){return this.__lines.length},b.prototype.get_indent_string=function(A,N){return this.__indent_cache.get_indent_string(A,N)},b.prototype.get_indent_size=function(A,N){return this.__indent_cache.get_indent_size(A,N)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(A){return this.is_empty()||!A&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(A){this.trim(!0);var N=this.current_line.pop();N&&(N[N.length-1]===`
`&&(N=N.replace(/\n+$/g,"")),this.current_line.push(N)),this._end_with_newline&&this.__add_outputline();var j=this.__lines.join(`
`);return A!==`
`&&(j=j.replace(/[\n]/g,A)),j},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(A,N){return A=A||0,N=N||0,this.next_line.set_indent(A,N),this.__lines.length>1?(this.current_line.set_indent(A,N),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(A){for(var N=0;N<A.newlines;N++)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},b.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()},b.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(" "))},b.prototype.remove_indent=function(A){for(var N=this.__lines.length;A<N;)this.__lines[A]._remove_indent(),A++;this.current_line._remove_wrap_indent()},b.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},b.prototype.just_added_newline=function(){return this.current_line.is_empty()},b.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},b.prototype.ensure_empty_line_above=function(A,N){for(var j=this.__lines.length-2;j>=0;){var G=this.__lines[j];if(G.is_empty())break;if(G.item(0).indexOf(A)!==0&&G.item(-1)!==N){this.__lines.splice(j+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}j--}},P.exports.Output=b},function(P){function g(_,b,A,N){this.type=_,this.text=b,this.comments_before=null,this.newlines=A||0,this.whitespace_before=N||"",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,N){this.raw_options=_(A,N),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,N){var j=this.raw_options[A],G=N||[];return typeof j=="object"?j!==null&&typeof j.concat=="function"&&(G=j.concat()):typeof j=="string"&&(G=j.split(/[^a-zA-Z0-9_\/\-]+/)),G},g.prototype._get_boolean=function(A,N){var j=this.raw_options[A],G=j===void 0?!!N:!!j;return G},g.prototype._get_characters=function(A,N){var j=this.raw_options[A],G=N||"";return typeof j=="string"&&(G=j.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),G},g.prototype._get_number=function(A,N){var j=this.raw_options[A];N=parseInt(N,10),isNaN(N)&&(N=0);var G=parseInt(j,10);return isNaN(G)&&(G=N),G},g.prototype._get_selection=function(A,N,j){var G=this._get_selection_list(A,N,j);if(G.length!==1)throw new Error("Invalid Option Value: The option '"+A+`' can only be one of the following values:
`+N+`
You passed in: '`+this.raw_options[A]+"'");return G[0]},g.prototype._get_selection_list=function(A,N,j){if(!N||N.length===0)throw new Error("Selection list cannot be empty.");if(j=j||[N[0]],!this._is_valid_selection(j,N))throw new Error("Invalid Default Value!");var G=this._get_array(A,j);if(!this._is_valid_selection(G,N))throw new Error("Invalid Option Value: The option '"+A+`' can contain only the following values:
`+N+`
You passed in: '`+this.raw_options[A]+"'");return G},g.prototype._is_valid_selection=function(A,N){return A.length&&N.length&&!A.some(function(j){return N.indexOf(j)===-1})};function _(A,N){var j={};A=b(A);var G;for(G in A)G!==N&&(j[G]=A[G]);if(N&&A[N])for(G in A[N])j[G]=A[N][G];return j}function b(A){var N={},j;for(j in A){var G=j.replace(/-/g,"_");N[G]=A[j]}return N}P.exports.Options=g,P.exports.normalizeOpts=b,P.exports.mergeOpts=_},,function(P){var g=RegExp.prototype.hasOwnProperty("sticky");function _(b){this.__input=b||"",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 b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},_.prototype.peek=function(b){var A=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(A=this.__input.charAt(b)),A},_.prototype.__match=function(b,A){b.lastIndex=A;var N=b.exec(this.__input);return N&&!(g&&b.sticky)&&N.index!==A&&(N=null),N},_.prototype.test=function(b,A){return A=A||0,A+=this.__position,A>=0&&A<this.__input_length?!!this.__match(b,A):!1},_.prototype.testChar=function(b,A){var N=this.peek(A);return b.lastIndex=0,N!==null&&b.test(N)},_.prototype.match=function(b){var A=this.__match(b,this.__position);return A?this.__position+=A[0].length:A=null,A},_.prototype.read=function(b,A,N){var j="",G;return b&&(G=this.match(b),G&&(j+=G[0])),A&&(G||!b)&&(j+=this.readUntil(A,N)),j},_.prototype.readUntil=function(b,A){var N="",j=this.__position;b.lastIndex=this.__position;var G=b.exec(this.__input);return G?(j=G.index,A&&(j+=G[0].length)):j=this.__input_length,N=this.__input.substring(this.__position,j),this.__position=j,N},_.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},_.prototype.get_regexp=function(b,A){var N=null,j="g";return A&&g&&(j="y"),typeof b=="string"&&b!==""?N=new RegExp(b,j):b&&(N=new RegExp(b.source,j)),N},_.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(b){var A=this.__position,N=this.readUntilAfter(b);return this.__position=A,N},_.prototype.lookBack=function(b){var A=this.__position-1;return A>=b.length&&this.__input.substring(A-b.length,A).toLowerCase()===b},P.exports.InputScanner=_},function(P,g,_){var b=_(8).InputScanner,A=_(3).Token,N=_(10).TokenStream,j=_(11).WhitespacePattern,G={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},L=function(I,w){this._input=new b(I),this._options=w||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new j(this._input)};L.prototype.tokenize=function(){this._input.restart(),this.__tokens=new N,this._reset();for(var I,w=new A(G.START,""),R=null,q=[],se=new N;w.type!==G.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 N),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(G.RAW,R):this._create_token(G.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=G},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 b=null;return _=_||0,_+=this.__position,_>=0&&_<this.__tokens_length&&(b=this.__tokens[_]),b},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 b=_(12).Pattern;function A(N,j){b.call(this,N,j),j?this._line_regexp=this._input.get_regexp(j._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}A.prototype=new b,A.prototype.__set_whitespace_patterns=function(N,j){N+="\\t ",j+="\\n\\r",this._match_pattern=this._input.get_regexp("["+N+j+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+j+"]")},A.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var N=this._input.read(this._match_pattern);if(N===" ")this.whitespace_before_token=" ";else if(N){var j=this.__split(this._newline_regexp,N);this.newline_count=j.length-1,this.whitespace_before_token=j[this.newline_count]}return N},A.prototype.matching=function(N,j){var G=this._create();return G.__set_whitespace_patterns(N,j),G._update(),G},A.prototype._create=function(){return new A(this._input,this)},A.prototype.__split=function(N,j){N.lastIndex=0;for(var G=0,L=[],I=N.exec(j);I;)L.push(j.substring(G,I.index)),G=I.index+I[0].length,I=N.exec(j);return G<j.length?L.push(j.substring(G,j.length)):L.push(""),L},P.exports.WhitespacePattern=A},function(P){function g(_,b){this._input=_,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,b&&(this._starting_pattern=this._input.get_regexp(b._starting_pattern,!0),this._match_pattern=this._input.get_regexp(b._match_pattern,!0),this._until_pattern=this._input.get_regexp(b._until_pattern),this._until_after=b._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 b=this._create();return b._until_after=!0,b._until_pattern=this._input.get_regexp(_),b._update(),b},g.prototype.until=function(_){var b=this._create();return b._until_after=!1,b._until_pattern=this._input.get_regexp(_),b._update(),b},g.prototype.starting_with=function(_){var b=this._create();return b._starting_pattern=this._input.get_regexp(_,!0),b._update(),b},g.prototype.matching=function(_){var b=this._create();return b._match_pattern=this._input.get_regexp(_,!0),b._update(),b},g.prototype._create=function(){return new g(this._input,this)},g.prototype._update=function(){},P.exports.Pattern=g},function(P){function g(_,b){_=typeof _=="string"?_:_.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+b,"g")}g.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var A=this.__directive_pattern.exec(_);A;)b[A[1]]=A[2],A=this.__directive_pattern.exec(_);return b},g.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=g},function(P,g,_){var b=_(12).Pattern,A={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function N(j,G){b.call(this,j,G),this.__template_pattern=null,this._disabled=Object.assign({},A),this._excluded=Object.assign({},A),G&&(this.__template_pattern=this._input.get_regexp(G.__template_pattern),this._excluded=Object.assign(this._excluded,G._excluded),this._disabled=Object.assign(this._disabled,G._disabled));var L=new b(j);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}/)}}N.prototype=new b,N.prototype._create=function(){return new N(this._input,this)},N.prototype._update=function(){this.__set_templated_pattern()},N.prototype.disable=function(j){var G=this._create();return G._disabled[j]=!0,G._update(),G},N.prototype.read_options=function(j){var G=this._create();for(var L in A)G._disabled[L]=j.templating.indexOf(L)===-1;return G._update(),G},N.prototype.exclude=function(j){var G=this._create();return G._excluded[j]=!0,G._update(),G},N.prototype.read=function(){var j="";this._match_pattern?j=this._input.read(this._starting_pattern):j=this._input.read(this._starting_pattern,this.__template_pattern);for(var G=this._read_template();G;)this._match_pattern?G+=this._input.read(this._match_pattern):G+=this._input.readUntil(this.__template_pattern),j+=G,G=this._read_template();return this._until_after&&(j+=this._input.readUntilAfter(this._until_pattern)),j},N.prototype.__set_templated_pattern=function(){var j=[];this._disabled.php||j.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||j.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||j.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||j.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(j.push(this.__patterns.django._starting_pattern.source),j.push(this.__patterns.django_value._starting_pattern.source),j.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||j.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&j.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+j.join("|")+")")},N.prototype._read_template=function(){var j="",G=this._input.peek();if(G==="<"){var L=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&L==="?"&&(j=j||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&L==="%"&&(j=j||this.__patterns.erb.read())}else G==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(j=j||this.__patterns.handlebars_comment.read(),j=j||this.__patterns.handlebars_unescaped.read(),j=j||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(j=j||this.__patterns.django_value.read()),this._excluded.django||(j=j||this.__patterns.django_comment.read(),j=j||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(j=j||this.__patterns.smarty_comment.read(),j=j||this.__patterns.smarty_literal.read(),j=j||this.__patterns.smarty.read()));return j},P.exports.TemplatablePattern=N},,,,function(P,g,_){var b=_(19).Beautifier,A=_(20).Options;function N(j,G,L,I){var w=new b(j,G,L,I);return w.beautify()}P.exports=N,P.exports.defaultOptions=function(){return new A}},function(P,g,_){var b=_(20).Options,A=_(2).Output,N=_(21).Tokenizer,j=_(21).TOKEN,G=/\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!==j.TEXT&&J.previous.type!==j.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 F=0;F<D;F++)this.print_newline(F>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,F=J.next;F.type!==j.EOF&&J.closed!==F;){if(F.type===j.ATTRIBUTE&&F.text==="type"){F.next&&F.next.type===j.EQUALS&&F.next.next&&F.next.next.type===j.VALUE&&(D=F.next.next.text);break}F=F.next}return D},R=function(J,D){var F=null,O=null;return D.closed?(J==="script"?F="text/javascript":J==="style"&&(F="text/css"),F=w(D)||F,F.search("text/css")>-1?O="css":F.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?O="javascript":F.search(/(text|application|dojo)\/(x-)?(html)/)>-1?O="html":F.search(/test\/null/)>-1&&(O="null"),O):null};function q(J,D){return D.indexOf(J)!==-1}function se(J,D,F){this.parent=J||null,this.tag=D?D.tag_name:"",this.indent_level=F||0,this.parser_token=D||null}function ie(J){this._printer=J,this._current_frame=null}ie.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},ie.prototype.record_tag=function(J){var D=new se(this._current_frame,J,this._printer.indent_level);this._current_frame=D},ie.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},ie.prototype._get_frame=function(J,D){for(var F=this._current_frame;F&&J.indexOf(F.tag)===-1;){if(D&&D.indexOf(F.tag)!==-1){F=null;break}F=F.parent}return F},ie.prototype.try_pop=function(J,D){var F=this._get_frame([J],D);return this._try_pop_frame(F)},ie.prototype.indent_to_tag=function(J){var D=this._get_frame(J);D&&(this._printer.indent_level=D.indent_level)};function _e(J,D,F,O){this._source_text=J||"",D=D||{},this._js_beautify=F,this._css_beautify=O,this._tag_stack=null;var le=new b(D,"html");this._options=le,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"}_e.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&&G.test(J)&&(D=J.match(G)[0])),J=J.replace(L,`
`);var F=J.match(/^[\t ]*/)[0],O={text:"",type:""},le=new Ie(this._options),te=new I(this._options,F),S=new N(J,this._options).tokenize();this._tag_stack=new ie(te);for(var v=null,z=S.next();z.type!==j.EOF;)z.type===j.TAG_OPEN||z.type===j.COMMENT?(v=this._handle_tag_open(te,z,le,O,S),le=v):z.type===j.ATTRIBUTE||z.type===j.EQUALS||z.type===j.VALUE||z.type===j.TEXT&&!le.tag_complete?v=this._handle_inside_tag(te,z,le,O):z.type===j.TAG_CLOSE?v=this._handle_tag_close(te,z,le):z.type===j.TEXT?v=this._handle_text(te,z,le):z.type===j.CONTROL_FLOW_OPEN?v=this._handle_control_flow_open(te,z):z.type===j.CONTROL_FLOW_CLOSE?v=this._handle_control_flow_close(te,z):te.add_raw_token(z),O=v,z=S.next();var oe=te._output.get_code(D);return oe},_e.prototype._handle_control_flow_open=function(J,D){var F={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(),F},_e.prototype._handle_control_flow_close=function(J,D){var F={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),F},_e.prototype._handle_tag_close=function(J,D,F){var O={text:D.text,type:D.type};return J.alignment_size=0,F.tag_complete=!0,J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),F.is_unformatted?J.add_raw_token(D):(F.tag_start_char==="<"&&(J.set_space_before_token(D.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&F.has_wrapped_attrs&&J.print_newline(!1)),J.print_token(D)),F.indent_content&&!(F.is_unformatted||F.is_content_unformatted)&&(J.indent(),F.indent_content=!1),!F.is_inline_element&&!(F.is_unformatted||F.is_content_unformatted)&&J.set_wrap_point(),O},_e.prototype._handle_inside_tag=function(J,D,F,O){var le=F.has_wrapped_attrs,te={text:D.text,type:D.type};return J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),F.is_unformatted?J.add_raw_token(D):F.tag_start_char==="{"&&D.type===j.TEXT?J.print_preserved_newlines(D)?(D.newlines=0,J.add_raw_token(D)):J.print_token(D):(D.type===j.ATTRIBUTE?J.set_space_before_token(!0):(D.type===j.EQUALS||D.type===j.VALUE&&D.previous.type===j.EQUALS)&&J.set_space_before_token(!1),D.type===j.ATTRIBUTE&&F.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(J.traverse_whitespace(D),le=le||D.newlines!==0),this._is_wrap_attributes_force&&F.attr_count>=this._options.wrap_attributes_min_attrs&&(O.type!==j.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(J.print_newline(!1),le=!0)),J.print_token(D),le=le||J.previous_token_wrapped(),F.has_wrapped_attrs=le),te},_e.prototype._handle_text=function(J,D,F){var O={text:D.text,type:"TK_CONTENT"};return F.custom_beautifier_name?this._print_custom_beatifier_text(J,D,F):F.is_unformatted||F.is_content_unformatted?J.add_raw_token(D):(J.traverse_whitespace(D),J.print_token(D)),O},_e.prototype._print_custom_beatifier_text=function(J,D,F){var O=this;if(D.text!==""){var le=D.text,te,S=1,v="",z="";F.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?te=this._js_beautify:F.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?te=this._css_beautify:F.custom_beautifier_name==="html"&&(te=function(Nt,ni){var Ve=new _e(Nt,ni,O._js_beautify,O._css_beautify);return Ve.beautify()}),this._options.indent_scripts==="keep"?S=0:this._options.indent_scripts==="separate"&&(S=-J.indent_level);var oe=J.get_full_indent(S);if(le=le.replace(/\n[ \t]*$/,""),F.custom_beautifier_name!=="html"&&le[0]==="<"&&le.match(/^(<!--|<!\[CDATA\[)/)){var Ae=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(le);if(!Ae){J.add_raw_token(D);return}v=oe+Ae[1]+`
`,le=Ae[4],Ae[5]&&(z=oe+Ae[5]),le=le.replace(/\n[ \t]*$/,""),(Ae[2]||Ae[3].indexOf(`
`)!==-1)&&(Ae=Ae[3].match(/[ \t]+$/),Ae&&(D.whitespace_before=Ae[0]))}if(le)if(te){var Be=function(){this.eol=`
`};Be.prototype=this._options.raw_options;var ze=new Be;le=te(oe+le,ze)}else{var St=D.whitespace_before;St&&(le=le.replace(new RegExp(`
(`+St+")?","g"),`
`)),le=oe+le.replace(/\n/g,`
`+oe)}v&&(le?le=v+le+`
`+z:le=v+z),J.print_newline(!1),le&&(D.text=le,D.whitespace_before="",D.newlines=0,J.add_raw_token(D),J.print_newline(!0))}},_e.prototype._handle_tag_open=function(J,D,F,O,le){var te=this._get_tag_open_token(D);if((F.is_unformatted||F.is_content_unformatted)&&!F.is_empty_element&&D.type===j.TAG_OPEN&&!te.is_start_tag?(J.add_raw_token(D),te.start_tag_token=this._tag_stack.try_pop(te.tag_name)):(J.traverse_whitespace(D),this._set_tag_position(J,D,te,F,O),te.is_inline_element||J.set_wrap_point(),J.print_token(D)),te.is_start_tag&&this._is_wrap_attributes_force){var S=0,v;do v=le.peek(S),v.type===j.ATTRIBUTE&&(te.attr_count+=1),S+=1;while(v.type!==j.EOF&&v.type!==j.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(te.alignment_size=D.text.length+1),!te.tag_complete&&!te.is_unformatted&&(J.alignment_size=te.alignment_size),te};var Ie=function(J,D,F){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="",!F)this.tag_complete=!0;else{var O;this.tag_start_char=F.text[0],this.text=F.text,this.tag_start_char==="<"?(O=F.text.match(/^<([^\s>]*)/),this.tag_check=O?O[1]:""):(O=F.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=O?O[1]:"",(F.text.startsWith("{{#>")||F.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&F.next!==null?this.tag_check=F.next.text.split(" ")[0]:this.tag_check=F.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),F.type===j.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||F.closed&&F.closed.text==="/>";var le=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(le=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!J.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(le)))}};_e.prototype._get_tag_open_token=function(J){var D=new Ie(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},_e.prototype._set_tag_position=function(J,D,F,O,le){if(F.is_empty_element||(F.is_end_tag?F.start_tag_token=this._tag_stack.try_pop(F.tag_name):(this._do_optional_end_element(F)&&(F.is_inline_element||J.print_newline(!1)),this._tag_stack.record_tag(F),(F.tag_name==="script"||F.tag_name==="style")&&!(F.is_unformatted||F.is_content_unformatted)&&(F.custom_beautifier_name=R(F.tag_check,D)))),q(F.tag_check,this._options.extra_liners)&&(J.print_newline(!1),J._output.just_added_blankline()||J.print_newline(!0)),F.is_empty_element){if(F.tag_start_char==="{"&&F.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),F.indent_content=!0;var te=J.current_line_has_match(/{{#if/);te||J.print_newline(!1)}F.tag_name==="!--"&&le.type===j.TAG_CLOSE&&O.is_end_tag&&F.text.indexOf(`
`)===-1||(F.is_inline_element||F.is_unformatted||J.print_newline(!1),this._calcluate_parent_multiline(J,F))}else if(F.is_end_tag){var S=!1;S=F.start_tag_token&&F.start_tag_token.multiline_content,S=S||!F.is_inline_element&&!(O.is_inline_element||O.is_unformatted)&&!(le.type===j.TAG_CLOSE&&F.start_tag_token===O)&&le.type!=="TK_CONTENT",(F.is_content_unformatted||F.is_unformatted)&&(S=!1),S&&J.print_newline(!1)}else F.indent_content=!F.custom_beautifier_name,F.tag_start_char==="<"&&(F.tag_name==="html"?F.indent_content=this._options.indent_inner_html:F.tag_name==="head"?F.indent_content=this._options.indent_head_inner_html:F.tag_name==="body"&&(F.indent_content=this._options.indent_body_inner_html)),!(F.is_inline_element||F.is_unformatted)&&(le.type!=="TK_CONTENT"||F.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,F)},_e.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 Te=["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"],Ke=["a","audio","del","ins","map","noscript","video"];_e.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"&&Te.indexOf(J.tag_name)!==-1){var F=J.parent.parent;(!F||Ke.indexOf(F.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=_e},function(P,g,_){var b=_(6).Options;function A(N){b.call(this,N,"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 b,P.exports.Options=A},function(P,g,_){var b=_(9).Tokenizer,A=_(9).TOKEN,N=_(13).Directives,j=_(14).TemplatablePattern,G=_(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 N(/<\!--/,/-->/),w=function(R,q){b.call(this,R,q),this._current_tag_name="";var se=new j(this._input).read_options(this._options),ie=new G(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:ie.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:ie.starting_with(/{{!--/).until_after(/--}}/),handlebars:ie.starting_with(/{{/).until_after(/}}/),handlebars_open:ie.until(/[\n\r\t }]/),handlebars_raw_close:ie.until(/}}/),comment:ie.starting_with(/<!--/).until_after(/-->/),cdata:ie.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:ie.starting_with(/<!\[/).until_after(/]>/),processing:ie.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 _e=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=ie.matching(_e).until_after(_e)}};w.prototype=new b,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 ie=this._input.peek();return ie===null?this._create_token(L.EOF,""):(se=se||this._read_open_handlebars(ie,q),se=se||this._read_attribute(ie,R,q),se=se||this._read_close(ie,q),se=se||this._read_script_and_style(ie,R),se=se||this._read_control_flows(ie,q),se=se||this._read_raw_content(ie,R,q),se=se||this._read_content_word(ie,q),se=se||this._read_comment_or_cdata(ie),se=se||this._read_processing(ie),se=se||this._read_open(ie,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,ie=null;if(R==="<"){var _e=this._input.peek(1);_e==="!"&&(se=this.__patterns.comment.read(),se?(ie=I.get_directives(se),ie&&ie.ignore==="start"&&(se+=I.readIgnored(this._input))):se=this.__patterns.cdata.read()),se&&(q=this._create_token(L.COMMENT,se),q.directives=ie)}return q},w.prototype._read_processing=function(R){var q=null,se=null,ie=null;if(R==="<"){var _e=this._input.peek(1);(_e==="!"||_e==="?")&&(se=this.__patterns.conditional_comment.read(),se=se||this.__patterns.processing.read()),se&&(q=this._create_token(L.COMMENT,se),q.directives=ie)}return q},w.prototype._read_open=function(R,q){var se=null,ie=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(),ie=this._create_token(L.TAG_OPEN,se)),ie},w.prototype._read_open_handlebars=function(R,q){var se=null,ie=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(),ie=this._create_token(L.COMMENT,se)):(se=this.__patterns.handlebars_open.read(),ie=this._create_token(L.TAG_OPEN,se))),ie},w.prototype._read_control_flows=function(R,q){var se="",ie=null;if(!this._options.templating.includes("angular"))return ie;if(R==="@"){if(se=this.__patterns.angular_control_flow_start.read(),se==="")return ie;for(var _e=se.endsWith("(")?1:0,Ie=0;!(se.endsWith("{")&&_e===Ie);){var Te=this._input.next();if(Te===null)break;Te==="("?_e++:Te===")"&&Ie++,se+=Te}ie=this._create_token(L.CONTROL_FLOW_OPEN,se)}else R==="}"&&q&&q.type===L.CONTROL_FLOW_OPEN&&(se=this._input.next(),ie=this._create_token(L.CONTROL_FLOW_CLOSE,se));return ie},w.prototype._read_close=function(R,q){var se=null,ie=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()),ie=this._create_token(L.TAG_CLOSE,se)):q.text[0]==="{"&&R==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),ie=this._create_token(L.TAG_CLOSE,"}}"))),ie},w.prototype._read_attribute=function(R,q,se){var ie=null,_e="";if(se&&se.text[0]==="<")if(R==="=")ie=this._create_token(L.EQUALS,this._input.next());else if(R==='"'||R==="'"){var Ie=this._input.next();R==='"'?Ie+=this.__patterns.double_quote.read():Ie+=this.__patterns.single_quote.read(),ie=this._create_token(L.VALUE,Ie)}else _e=this.__patterns.attribute.read(),_e&&(q.type===L.EQUALS?ie=this._create_token(L.VALUE,_e):ie=this._create_token(L.ATTRIBUTE,_e));return ie},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 ie="";if(se&&se.text[0]==="{")ie=this.__patterns.handlebars_raw_close.read();else if(q.type===L.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var _e=q.opened.text.substr(1).toLowerCase();this._is_content_unformatted(_e)&&(ie=this._input.readUntil(new RegExp("</"+_e+"[\\n\\r\\t ]*?>","ig")))}return ie?this._create_token(L.TEXT,ie):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 ie=this._read_comment_or_cdata(R);if(ie)return ie.type=L.TEXT,ie;var _e=this._input.readUntil(new RegExp("</"+se+"[\\n\\r\\t ]*?>","ig"));if(_e)return this._create_token(L.TEXT,_e)}}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)],fe=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),fe!==void 0&&(Yt.exports=fe);else var V,p})()},58553:function(Yt,st){var K,B;(function(){var fe;(function(){"use strict";var he=[function(ce,l,X){var P=X(1).Beautifier,g=X(5).Options;function _(b,A){var N=new P(b,A);return N.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),b=X(5).Options,A=X(7).Tokenizer,N=X(7).line_starters,j=X(7).positionable_operators,G=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={},oe=0;oe<v.length;oe++)z[v[oe].replace(/-/g,"_")]=v[oe];return z}function R(v,z){return v&&v.type===G.RESERVED&&v.text===z}function q(v,z){return v&&v.type===G.RESERVED&&L(v.text,z)}var se=["case","return","do","if","throw","else","await","break","continue","async"],ie=["before-newline","after-newline","preserve-newline"],_e=w(ie),Ie=[_e.before_newline,_e.preserve_newline],Te={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Ke(v,z){z.multiline_frame||z.mode===Te.ForInitializer||z.mode===Te.Conditional||v.remove_indent(z.start_line_index)}function J(v){v=v.replace(_.allLineBreaks,`
`);for(var z=[],oe=v.indexOf(`
`);oe!==-1;)z.push(v.substring(0,oe)),v=v.substring(oe+1),oe=v.indexOf(`
`);return v.length&&z.push(v),z}function D(v){return v===Te.ArrayLiteral}function F(v){return L(v,[Te.Expression,Te.ForInitializer,Te.Conditional])}function O(v,z){for(var oe=0;oe<v.length;oe++){var Ae=v[oe].trim();if(Ae.charAt(0)!==z)return!1}return!0}function le(v,z){for(var oe=0,Ae=v.length,Be;oe<Ae;oe++)if(Be=v[oe],Be&&Be.indexOf(z)!==0)return!1;return!0}function te(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 b(z)}te.prototype.create_flags=function(v,z){var oe=0;v&&(oe=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>oe&&(oe=v.line_indent_level));var Ae={mode:z,parent:v,last_token:v?v.last_token:new g(G.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:oe,alignment:0,line_indent_level:v?v.line_indent_level:oe,start_line_index:this._output.get_line_number(),ternary_depth:0};return Ae},te.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(Te.BlockStatement);var oe=new A(v,this._options);return this._tokens=oe.tokenize(),v},te.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,z=this._reset(this._source_text),oe=this._options.eol;this._options.eol==="auto"&&(oe=`
`,z&&_.lineBreak.test(z||"")&&(oe=z.match(_.lineBreak)[0]));for(var Ae=this._tokens.next();Ae;)this.handle_token(Ae),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Ae,Ae=this._tokens.next();return v=this._output.get_code(oe),v},te.prototype.handle_token=function(v,z){v.type===G.START_EXPR?this.handle_start_expr(v):v.type===G.END_EXPR?this.handle_end_expr(v):v.type===G.START_BLOCK?this.handle_start_block(v):v.type===G.END_BLOCK?this.handle_end_block(v):v.type===G.WORD?this.handle_word(v):v.type===G.RESERVED?this.handle_word(v):v.type===G.SEMICOLON?this.handle_semicolon(v):v.type===G.STRING?this.handle_string(v):v.type===G.EQUALS?this.handle_equals(v):v.type===G.OPERATOR?this.handle_operator(v):v.type===G.COMMA?this.handle_comma(v):v.type===G.BLOCK_COMMENT?this.handle_block_comment(v,z):v.type===G.COMMENT?this.handle_comment(v,z):v.type===G.DOT?this.handle_dot(v):v.type===G.EOF?this.handle_eof(v):v.type===G.UNKNOWN?this.handle_unknown(v,z):this.handle_unknown(v,z)},te.prototype.handle_whitespace_and_comments=function(v,z){var oe=v.newlines,Ae=this._options.keep_array_indentation&&D(this._flags.mode);if(v.comments_before)for(var Be=v.comments_before.next();Be;)this.handle_whitespace_and_comments(Be,z),this.handle_token(Be,z),Be=v.comments_before.next();if(Ae)for(var ze=0;ze<oe;ze+=1)this.print_newline(ze>0,z);else if(this._options.max_preserve_newlines&&oe>this._options.max_preserve_newlines&&(oe=this._options.max_preserve_newlines),this._options.preserve_newlines&&oe>1){this.print_newline(!1,z);for(var St=1;St<oe;St+=1)this.print_newline(!0,z)}};var S=["async","break","continue","return","throw","yield"];te.prototype.allow_wrap_or_preserved_newline=function(v,z){if(z=z===void 0?!1:z,!this._output.just_added_newline()){var oe=this._options.preserve_newlines&&v.newlines||z,Ae=L(this._flags.last_token.text,j)||L(v.text,j);if(Ae){var Be=L(this._flags.last_token.text,j)&&L(this._options.operator_position,Ie)||L(v.text,j);oe=oe&&Be}if(oe)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()}}},te.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!==G.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var oe=this._tokens.peek();this._flags.mode===Te.Statement&&!(this._flags.if_block&&R(oe,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},te.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))},te.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===G.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)},te.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},te.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))},te.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)},te.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Te.Statement&&Ke(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},te.prototype.start_of_object_property=function(){return this._flags.parent.mode===Te.ObjectLiteral&&this._flags.mode===Te.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"]))},te.prototype.start_of_statement=function(v){var z=!1;return z=z||q(this._flags.last_token,["var","let","const"])&&v.type===G.WORD,z=z||R(this._flags.last_token,"do"),z=z||!(this._flags.parent.mode===Te.ObjectLiteral&&this._flags.mode===Te.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===G.END_EXPR&&(this._previous_flags.mode===Te.ForInitializer||this._previous_flags.mode===Te.Conditional),z=z||this._flags.last_token.type===G.WORD&&this._flags.mode===Te.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==G.WORD&&v.type!==G.RESERVED,z=z||this._flags.mode===Te.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"])),z?(this.set_mode(Te.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},te.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var z=Te.Expression;if(v.text==="["){if(this._flags.last_token.type===G.WORD||this._flags.last_token.text===")"){q(this._flags.last_token,N)&&(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=Te.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,[G.START_EXPR,G.END_EXPR,G.WORD,G.OPERATOR,G.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===G.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,z=Te.ForInitializer):L(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,z=Te.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,N)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===G.EQUALS||this._flags.last_token.type===G.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===G.WORD){this._output.space_before_token=!1;var oe=this._tokens.peek(-3);if(this._options.space_after_named_function&&oe){var Ae=this._tokens.peek(-4);q(oe,["async","function"])||oe.text==="*"&&q(Ae,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Te.ObjectLiteral?(oe.text==="{"||oe.text===","||oe.text==="*"&&(Ae.text==="{"||Ae.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===G.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===Te.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===G.START_BLOCK?this.print_newline():(this._flags.last_token.type===G.END_EXPR||this._flags.last_token.type===G.START_EXPR||this._flags.last_token.type===G.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===G.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()},te.prototype.handle_end_expr=function(v){for(;this._flags.mode===Te.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===G.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(),Ke(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Te.Conditional&&(this._previous_flags.mode=Te.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},te.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var z=this._tokens.peek(),oe=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===G.END_EXPR?(this.set_mode(Te.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Te.BlockStatement):oe&&(L(oe.text,[":",","])&&L(z.type,[G.STRING,G.WORD,G.RESERVED])||L(z.text,["get","set","..."])&&L(oe.type,[G.WORD,G.RESERVED]))?L(this._last_last_text,["class","interface"])&&!L(oe.text,[":",","])?this.set_mode(Te.BlockStatement):this.set_mode(Te.ObjectLiteral):this._flags.last_token.type===G.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Te.BlockStatement):L(this._flags.last_token.type,[G.EQUALS,G.START_EXPR,G.COMMA,G.OPERATOR])||q(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Te.ObjectLiteral):this.set_mode(Te.BlockStatement),this._flags.last_token&&q(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Ae=!z.comments_before&&z.text==="}",Be=Ae&&this._flags.last_word==="function"&&this._flags.last_token.type===G.END_EXPR;if(this._options.brace_preserve_inline){var ze=0,St=null;this._flags.inline_frame=!0;do if(ze+=1,St=this._tokens.peek(ze-1),St.newlines){this._flags.inline_frame=!1;break}while(St.type!==G.EOF&&!(St.type===G.END_BLOCK&&St.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==G.OPERATOR&&(Be||this._flags.last_token.type===G.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===G.START_EXPR||this._flags.last_token.type===G.COMMA)&&((this._flags.last_token.type===G.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===G.COMMA||this._flags.last_token.type===G.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!==G.OPERATOR&&this._flags.last_token.type!==G.START_EXPR&&(L(this._flags.last_token.type,[G.START_BLOCK,G.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!Ae&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},te.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===Te.Statement;)this.restore_mode();var z=this._flags.last_token.type===G.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)},te.prototype.handle_word=function(v){if(v.type===G.RESERVED){if(L(v.text,["set","get"])&&this._flags.mode!==Te.ObjectLiteral)v.type=G.WORD;else if(v.text==="import"&&L(this._tokens.peek().text,["(","."]))v.type=G.WORD;else if(L(v.text,["as","from"])&&!this._flags.import_block)v.type=G.WORD;else if(this._flags.mode===Te.ObjectLiteral){var z=this._tokens.peek();z.text===":"&&(v.type=G.WORD)}}if(this.start_of_statement(v)?q(this._flags.last_token,["var","let","const"])&&v.type===G.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!F(this._flags.mode)&&(this._flags.last_token.type!==G.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==G.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===Te.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===G.COMMA||this._flags.last_token.type===G.START_EXPR||this._flags.last_token.type===G.EQUALS||this._flags.last_token.type===G.OPERATOR)&&!this.start_of_object_property()&&!(L(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===Te.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===G.OPERATOR))&&!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===G.RESERVED||this._flags.last_token.type===G.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===G.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(F(this._flags.mode)||D(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var oe="NONE";if(this._flags.last_token.type===G.END_BLOCK?this._previous_flags.inline_frame?oe="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?oe="NEWLINE":(oe="SPACE",this._output.space_before_token=!0):oe="NEWLINE":this._flags.last_token.type===G.SEMICOLON&&this._flags.mode===Te.BlockStatement?oe="NEWLINE":this._flags.last_token.type===G.SEMICOLON&&F(this._flags.mode)?oe="SPACE":this._flags.last_token.type===G.STRING?oe="NEWLINE":this._flags.last_token.type===G.RESERVED||this._flags.last_token.type===G.WORD||this._flags.last_token.text==="*"&&(L(this._last_last_text,["function","yield"])||this._flags.mode===Te.ObjectLiteral&&L(this._last_last_text,["{",","]))?oe="SPACE":this._flags.last_token.type===G.START_BLOCK?this._flags.inline_frame?oe="SPACE":oe="NEWLINE":this._flags.last_token.type===G.END_EXPR&&(this._output.space_before_token=!0,oe="NEWLINE"),q(v,N)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?oe="SPACE":oe="NEWLINE"),q(v,["else","catch","finally"]))if((!(this._flags.last_token.type===G.END_BLOCK&&this._previous_flags.mode===Te.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 Ae=this._output.current_line;Ae.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else oe==="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!==G.END_EXPR?(this._flags.last_token.type!==G.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,N)&&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():oe==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===G.WORD||v.previous.type===G.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===G.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))},te.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===Te.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)},te.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===G.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===G.RESERVED||this._flags.last_token.type===G.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===G.COMMA||this._flags.last_token.type===G.START_EXPR||this._flags.last_token.type===G.EQUALS||this._flags.last_token.type===G.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===G.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},te.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},te.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?(F(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===Te.ObjectLiteral||this._flags.mode===Te.Statement&&this._flags.parent.mode===Te.ObjectLiteral?(this._flags.mode===Te.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},te.prototype.handle_operator=function(v){var z=v.text==="*"&&(q(this._flags.last_token,["function","yield"])||L(this._flags.last_token.type,[G.START_BLOCK,G.COMMA,G.END_BLOCK,G.SEMICOLON])),oe=L(v.text,["-","+"])&&(L(this._flags.last_token.type,[G.START_BLOCK,G.START_EXPR,G.EQUALS,G.OPERATOR])||L(this._flags.last_token.text,N)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var Ae=!z;this.handle_whitespace_and_comments(v,Ae)}if(v.text==="*"&&this._flags.last_token.type===G.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===G.OPERATOR&&L(this._options.operator_position,Ie)&&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!==G.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 Be=!0,ze=!0,St=!1;if(v.text===":"?this._flags.ternary_depth===0?Be=!1:(this._flags.ternary_depth-=1,St=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!oe&&!z&&this._options.preserve_newlines&&L(v.text,j)){var Nt=v.text===":",ni=Nt&&St,Ve=Nt&&!St;switch(this._options.operator_position){case _e.before_newline:this._output.space_before_token=!Ve,this.print_token(v),(!Nt||ni)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case _e.after_newline:this._output.space_before_token=!0,!Nt||ni?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 _e.preserve_newline:Ve||this.allow_wrap_or_preserved_newline(v),Be=!(this._output.just_added_newline()||Ve),this._output.space_before_token=Be,this.print_token(v),this._output.space_before_token=!0;return}}if(z){this.allow_wrap_or_preserved_newline(v),Be=!1;var gt=this._tokens.peek();ze=gt&&L(gt.type,[G.WORD,G.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),Be=this._flags.last_token.type===G.START_BLOCK,ze=!1;else if(L(v.text,["--","++","!","~"])||oe){if((this._flags.last_token.type===G.COMMA||this._flags.last_token.type===G.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),Be=!1,ze=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var Kt=q(this._flags.last_token,se)&&v.newlines;Kt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(Kt,!0)}this._flags.last_token.text===";"&&F(this._flags.mode)&&(Be=!0),this._flags.last_token.type===G.RESERVED?Be=!0:this._flags.last_token.type===G.END_EXPR?Be=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===G.OPERATOR&&(Be=L(v.text,["--","-","++","+"])&&L(this._flags.last_token.text,["--","-","++","+"]),L(v.text,["+","-"])&&L(this._flags.last_token.text,["--","++"])&&(ze=!0)),(this._flags.mode===Te.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Te.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Be,this.print_token(v),this._output.space_before_token=ze},te.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)},te.prototype.print_block_commment=function(v,z){var oe=J(v.text),Ae,Be=!1,ze=!1,St=v.whitespace_before,Nt=St.length;if(this.print_newline(!1,z),this.print_token_line_indentation(v),this._output.add_token(oe[0]),this.print_newline(!1,z),oe.length>1){for(oe=oe.slice(1),Be=O(oe,"*"),ze=le(oe,St),Be&&(this._flags.alignment=1),Ae=0;Ae<oe.length;Ae++)Be?(this.print_token_line_indentation(v),this._output.add_token(I(oe[Ae]))):ze&&oe[Ae]?(this.print_token_line_indentation(v),this._output.add_token(oe[Ae].substring(Nt))):(this._output.current_line.set_indent(-1),this._output.add_token(oe[Ae])),this.print_newline(!1,z);this._flags.alignment=0}},te.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)},te.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)},te.prototype.handle_unknown=function(v,z){this.print_token(v),v.text[v.text.length-1]===`
`&&this.print_newline(!1,z)},te.prototype.handle_eof=function(v){for(;this._flags.mode===Te.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},ce.exports.Beautifier=te},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 b=this.__base_string_length;return _=_||0,g<0&&(b=0),b+=g*this.__indent_size,b+=_,b},X.prototype.get_indent_string=function(g,_){var b=this.__base_string;return _=_||0,g<0&&(g=0,b=""),_+=g*this.__indent_size,this.__ensure_cache(_),b+=this.__cache[_],b},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,b="";this.__indent_size&&g>=this.__indent_size&&(_=Math.floor(g/this.__indent_size),g-=_*this.__indent_size,b=new Array(_+1).join(this.__indent_string)),g&&(b+=new Array(g+1).join(" ")),this.__cache.push(b)};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 b=this.__lines.join(`
`);return g!==`
`&&(b=b.replace(/[\n]/g,g)),b},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 b=this.__lines.length-2;b>=0;){var A=this.__lines[b];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==_){this.__lines.splice(b+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}b--}},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",b="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",A="(?:"+b+"|["+X+g+"])",N="(?:"+b+"|["+P+g+_+"])*";l.identifier=new RegExp(A+N,"g"),l.identifierStart=new RegExp(A),l.identifierMatch=new RegExp("(?:"+b+"|["+P+g+_+"])+");var j=/[\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 _(b){P.call(this,b,"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 N=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var j=0;j<N.length;j++)N[j]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=N[j];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 b=this.raw_options[g],A=_||[];return typeof b=="object"?b!==null&&typeof b.concat=="function"&&(A=b.concat()):typeof b=="string"&&(A=b.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,_){var b=this.raw_options[g],A=b===void 0?!!_:!!b;return A},l.prototype._get_characters=function(g,_){var b=this.raw_options[g],A=_||"";return typeof b=="string"&&(A=b.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,_){var b=this.raw_options[g];_=parseInt(_,10),isNaN(_)&&(_=0);var A=parseInt(b,10);return isNaN(A)&&(A=_),A},l.prototype._get_selection=function(g,_,b){var A=this._get_selection_list(g,_,b);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,_,b){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(b=b||[_[0]],!this._is_valid_selection(b,_))throw new Error("Invalid Default Value!");var A=this._get_array(g,b);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(b){return _.indexOf(b)===-1})};function X(g,_){var b={};g=P(g);var A;for(A in g)A!==_&&(b[A]=g[A]);if(_&&g[_])for(A in g[_])b[A]=g[_][A];return b}function P(g){var _={},b;for(b in g){var A=b.replace(/-/g,"_");_[A]=g[b]}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,b=X(13).Directives,A=X(4),N=X(12).Pattern,j=X(14).TemplatablePattern;function G(O,le){return le.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 b(/\/\*/,/\*\//),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(" "),ie=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";ie=ie.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),ie="\\?\\.(?!\\d) "+ie,ie=ie.replace(/ /g,"|");var _e=new RegExp(ie),Ie="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Te=Ie.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Ke=new RegExp("^(?:"+Te.join("|")+")$"),J,D=function(O,le){g.call(this,O,le),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var te=new N(this._input),S=new j(this._input).read_options(this._options);this.__patterns={template:S,identifier:S.starting_with(A.identifier).matching(A.identifierMatch),number:te.matching(w),punct:te.matching(_e),comment:te.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:te.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:te.matching(/<!--/),html_comment_end:te.matching(/-->/),include:te.starting_with(/#include/).until_after(A.lineBreak),shebang:te.starting_with(/#!/).until_after(A.lineBreak),xml:te.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,le){return(O.type===L.END_BLOCK||O.type===L.END_EXPR)&&le&&(O.text==="]"&&le.text==="["||O.text===")"&&le.text==="("||O.text==="}"&&le.text==="{")},D.prototype._reset=function(){J=!1},D.prototype._get_next_token=function(O,le){var te=null;this._readWhitespace();var S=this._input.peek();return S===null?this._create_token(L.EOF,""):(te=te||this._read_non_javascript(S),te=te||this._read_string(S),te=te||this._read_pair(S,this._input.peek(1)),te=te||this._read_word(O),te=te||this._read_singles(S),te=te||this._read_comment(S),te=te||this._read_regexp(S,O),te=te||this._read_xml(S,O),te=te||this._read_punctuation(),te=te||this._create_token(L.UNKNOWN,this._input.next()),te)},D.prototype._read_word=function(O){var le;if(le=this.__patterns.identifier.read(),le!=="")return le=le.replace(A.allLineBreaks,`
`),!(O.type===L.DOT||O.type===L.RESERVED&&(O.text==="set"||O.text==="get"))&&Ke.test(le)?(le==="in"||le==="of")&&(O.type===L.WORD||O.type===L.STRING)?this._create_token(L.OPERATOR,le):this._create_token(L.RESERVED,le):this._create_token(L.WORD,le);if(le=this.__patterns.number.read(),le!=="")return this._create_token(L.WORD,le)},D.prototype._read_singles=function(O){var le=null;return O==="("||O==="["?le=this._create_token(L.START_EXPR,O):O===")"||O==="]"?le=this._create_token(L.END_EXPR,O):O==="{"?le=this._create_token(L.START_BLOCK,O):O==="}"?le=this._create_token(L.END_BLOCK,O):O===";"?le=this._create_token(L.SEMICOLON,O):O==="."&&q.test(this._input.peek(1))?le=this._create_token(L.DOT,O):O===","&&(le=this._create_token(L.COMMA,O)),le&&this._input.next(),le},D.prototype._read_pair=function(O,le){var te=null;return O==="#"&&le==="{"&&(te=this._create_token(L.START_BLOCK,O+le)),te&&(this._input.next(),this._input.next()),te},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 le="";if(O==="#"){if(this._is_first_token()&&(le=this.__patterns.shebang.read(),le))return this._create_token(L.UNKNOWN,le.trim()+`
`);if(le=this.__patterns.include.read(),le)return this._create_token(L.UNKNOWN,le.trim()+`
`);O=this._input.next();var te="#";if(this._input.hasNext()&&this._input.testChar(R)){do O=this._input.next(),te+=O;while(this._input.hasNext()&&O!=="#"&&O!=="=");return O==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(te+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(te+="{}",this._input.next(),this._input.next())),this._create_token(L.WORD,te)}this._input.back()}else if(O==="<"&&this._is_first_token()){if(le=this.__patterns.html_comment_start.read(),le){for(;this._input.hasNext()&&!this._input.testChar(A.newline);)le+=this._input.next();return J=!0,this._create_token(L.COMMENT,le)}}else if(J&&O==="-"&&(le=this.__patterns.html_comment_end.read(),le))return J=!1,this._create_token(L.COMMENT,le);return null},D.prototype._read_comment=function(O){var le=null;if(O==="/"){var te="";if(this._input.peek(1)==="*"){te=this.__patterns.block_comment.read();var S=I.get_directives(te);S&&S.ignore==="start"&&(te+=I.readIgnored(this._input)),te=te.replace(A.allLineBreaks,`
`),le=this._create_token(L.BLOCK_COMMENT,te),le.directives=S}else this._input.peek(1)==="/"&&(te=this.__patterns.comment.read(),le=this._create_token(L.COMMENT,te))}return le},D.prototype._read_string=function(O){if(O==="`"||O==="'"||O==='"'){var le=this._input.next();return this.has_char_escapes=!1,O==="`"?le+=this._read_string_recursive("`",!0,"${"):le+=this._read_string_recursive(O),this.has_char_escapes&&this._options.unescape_strings&&(le=F(le)),this._input.peek()===O&&(le+=this._input.next()),le=le.replace(A.allLineBreaks,`
`),this._create_token(L.STRING,le)}return null},D.prototype._allow_regexp_or_xml=function(O){return O.type===L.RESERVED&&G(O.text,["return","case","throw","else","do","typeof","yield"])||O.type===L.END_EXPR&&O.text===")"&&O.opened.previous.type===L.RESERVED&&G(O.opened.previous.text,["if","while","for"])||G(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,le){if(O==="/"&&this._allow_regexp_or_xml(le)){for(var te=this._input.next(),S=!1,v=!1;this._input.hasNext()&&(S||v||this._input.peek()!==O)&&!this._input.testChar(A.newline);)te+=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&&(te+=this._input.next(),te+=this._input.read(A.identifier)),this._create_token(L.STRING,te)}return null},D.prototype._read_xml=function(O,le){if(this._options.e4x&&O==="<"&&this._allow_regexp_or_xml(le)){var te="",S=this.__patterns.xml.read_match();if(S){for(var v=S[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),z=v.indexOf("{")===0,oe=0;S;){var Ae=!!S[1],Be=S[2],ze=!!S[S.length-1]||Be.slice(0,8)==="![CDATA[";if(!ze&&(Be===v||z&&Be.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Ae?--oe:++oe),te+=S[0],oe<=0)break;S=this.__patterns.xml.read_match()}return S||(te+=this._input.match(/[\s\S]*/g)[0]),te=te.replace(A.allLineBreaks,`
`),this._create_token(L.STRING,te)}}return null};function F(O){for(var le="",te=0,S=new P(O),v=null;S.hasNext();)if(v=S.match(/([\s]|[^\\]|\\\\)+/g),v&&(le+=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{le+="\\",S.hasNext()&&(le+=S.next());continue}if(!v||(te=parseInt(v[1],16),te>126&&te<=255&&v[0].indexOf("x")===0))return O;te>=0&&te<32||te>1114111?le+="\\"+v[0]:te===34||te===39||te===92?le+="\\"+String.fromCharCode(te):le+=String.fromCharCode(te)}return le}D.prototype._read_string_recursive=function(O,le,te){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(),oe="";this._input.hasNext();){if(oe=this._input.next(),oe===O||!le&&A.newline.test(oe)){this._input.back();break}else oe==="\\"&&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(),oe+=this._input.next()):te&&(te==="${"&&oe==="$"&&this._input.peek()==="{"&&(oe+=this._input.next()),te===oe&&(O==="`"?oe+=this._read_string_recursive("}",le,"`"):oe+=this._read_string_recursive("`",le,"${"),this._input.hasNext()&&(oe+=this._input.next())));oe+=v.read(),z+=oe}return z},ce.exports.Tokenizer=D,ce.exports.TOKEN=L,ce.exports.positionable_operators=se.slice(),ce.exports.line_starters=Ie.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 b="",A;return P&&(A=this.match(P),A&&(b+=A[0])),g&&(A||!P)&&(b+=this.readUntil(g,_)),b},X.prototype.readUntil=function(P,g){var _="",b=this.__position;P.lastIndex=this.__position;var A=P.exec(this.__input);return A?(b=A.index,g&&(b+=A[0].length)):b=this.__input_length,_=this.__input.substring(this.__position,b),this.__position=b,_},X.prototype.readUntilAfter=function(P){return this.readUntil(P,!0)},X.prototype.get_regexp=function(P,g){var _=null,b="g";return g&&l&&(b="y"),typeof P=="string"&&P!==""?_=new RegExp(P,b):P&&(_=new RegExp(P.source,b)),_},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,b=X(11).WhitespacePattern,A={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},N=function(j,G){this._input=new P(j),this._options=G||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new b(this._input)};N.prototype.tokenize=function(){this._input.restart(),this.__tokens=new _,this._reset();for(var j,G=new g(A.START,""),L=null,I=[],w=new _;G.type!==A.EOF;){for(j=this._get_next_token(G,L);this._is_comment(j);)w.add(j),j=this._get_next_token(G,L);w.isEmpty()||(j.comments_before=w,w=new _),j.parent=L,this._is_opening(j)?(I.push(L),L=j):L&&this._is_closing(j,L)&&(j.opened=L,L.closed=j,L=I.pop(),j.parent=L),j.previous=G,G.next=j,this.__tokens.add(j),G=j}return this.__tokens},N.prototype._is_first_token=function(){return this.__tokens.isEmpty()},N.prototype._reset=function(){},N.prototype._get_next_token=function(j,G){this._readWhitespace();var L=this._input.read(/.+/g);return L?this._create_token(A.RAW,L):this._create_token(A.EOF,"")},N.prototype._is_comment=function(j){return!1},N.prototype._is_opening=function(j){return!1},N.prototype._is_closing=function(j,G){return!1},N.prototype._create_token=function(j,G){var L=new g(j,G,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return L},N.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},ce.exports.Tokenizer=N,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(_,b){P.call(this,_,b),b?this._line_regexp=this._input.get_regexp(b._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new P,g.prototype.__set_whitespace_patterns=function(_,b){_+="\\t ",b+="\\n\\r",this._match_pattern=this._input.get_regexp("["+_+b+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+b+"]")},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 b=this.__split(this._newline_regexp,_);this.newline_count=b.length-1,this.whitespace_before_token=b[this.newline_count]}return _},g.prototype.matching=function(_,b){var A=this._create();return A.__set_whitespace_patterns(_,b),A._update(),A},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(_,b){_.lastIndex=0;for(var A=0,N=[],j=_.exec(b);j;)N.push(b.substring(A,j.index)),A=j.index+j[0].length,j=_.exec(b);return A<b.length?N.push(b.substring(A,b.length)):N.push(""),N},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 _(b,A){P.call(this,b,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 N=new P(b);this.__patterns={handlebars_comment:N.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:N.starting_with(/{{{/).until_after(/}}}/),handlebars:N.starting_with(/{{/).until_after(/}}/),php:N.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:N.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:N.starting_with(/{%/).until_after(/%}/),django_value:N.starting_with(/{{/).until_after(/}}/),django_comment:N.starting_with(/{#/).until_after(/#}/),smarty:N.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:N.starting_with(/{\*/).until_after(/\*}/),smarty_literal:N.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(b){var A=this._create();return A._disabled[b]=!0,A._update(),A},_.prototype.read_options=function(b){var A=this._create();for(var N in g)A._disabled[N]=b.templating.indexOf(N)===-1;return A._update(),A},_.prototype.exclude=function(b){var A=this._create();return A._excluded[b]=!0,A._update(),A},_.prototype.read=function(){var b="";this._match_pattern?b=this._input.read(this._starting_pattern):b=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),b+=A,A=this._read_template();return this._until_after&&(b+=this._input.readUntilAfter(this._until_pattern)),b},_.prototype.__set_templated_pattern=function(){var b=[];this._disabled.php||b.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||b.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||b.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||b.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(b.push(this.__patterns.django._starting_pattern.source),b.push(this.__patterns.django_value._starting_pattern.source),b.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||b.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&b.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+b.join("|")+")")},_.prototype._read_template=function(){var b="",A=this._input.peek();if(A==="<"){var N=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&N==="?"&&(b=b||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&N==="%"&&(b=b||this.__patterns.erb.read())}else A==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(b=b||this.__patterns.handlebars_comment.read(),b=b||this.__patterns.handlebars_unescaped.read(),b=b||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(b=b||this.__patterns.django_value.read()),this._excluded.django||(b=b||this.__patterns.django_comment.read(),b=b||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(b=b||this.__patterns.smarty_comment.read(),b=b||this.__patterns.smarty_literal.read(),b=b||this.__patterns.smarty.read()));return b},ce.exports.TemplatablePattern=_}],V={};function p(ce){var l=V[ce];if(l!==void 0)return l.exports;var X=V[ce]={exports:{}};return he[ce](X,X.exports,p),X.exports}var me=p(0);fe=me})();var Se=fe;K=[],B=function(){return{js_beautify:Se}}.apply(st,K),B!==void 0&&(Yt.exports=B)})()},75918:function(Yt,st,K){"use strict";K.d(st,{Wi:function(){return p},Z0:function(){return me},aU:function(){return V},eZ:function(){return l},wY:function(){return ce}});var B=K(4348),fe=K(69323),Se=K(13268),he=function(X,P,g,_){function b(A){return A instanceof g?A:new g(function(N){N(A)})}return new(g||(g=Promise))(function(A,N){function j(I){try{L(_.next(I))}catch(w){N(w)}}function G(I){try{L(_.throw(I))}catch(w){N(w)}}function L(I){I.done?A(I.value):b(I.value).then(j,G)}L((_=_.apply(X,P||[])).next())})};class V extends fe.JT{constructor(P,g="",_="",b=!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=b,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 fe.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(b){_=b}this._onDidRun.fire({action:P,error:_})})}runAction(P,g){return he(this,void 0,void 0,function*(){yield P.run(g)})}}class me extends V{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,_,b){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=P,this.label=g,this.class=b,this._actions=_}get actions(){return this._actions}dispose(){}run(){return he(this,void 0,void 0,function*(){})}}class l extends V{constructor(){super(l.ID,Se.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Yt,st,K){"use strict";K.d(st,{ok:function(){return B}});function B(fe,Se){if(!fe)throw new Error(Se?`Assertion failed (${Se})`:"Assertion Failed")}},52615:function(Yt,st,K){"use strict";K.d(st,{CM:function(){return V},JL:function(){return p},dT:function(){return ce},fK:function(){return he},lA:function(){return me}});var B=K(4348);class fe{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 fe,he=Se;function V(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(b){if(b instanceof me)return["codicon","codicon-"+b.id];const A=X.exec(b.id);if(!A)return P(me.error);let[,N,j]=A;const G=["codicon","codicon-"+N];return j&&G.push("codicon-modifier-"+j.substr(1)),G}l.asClassNameArray=P;function g(b){return P(b).join(" ")}l.asClassName=g;function _(b){return"."+P(b).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(Yt,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 V}});class B{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(_){setTimeout(()=>{throw _.stack?new Error(_.message+`
`+_.stack):_},0)}}emit(_){this.listeners.forEach(b=>{b(_)})}onUnexpectedError(_){this.unexpectedErrorHandler(_),this.emit(_)}onUnexpectedExternalError(_){this.unexpectedErrorHandler(_)}}const fe=new B;function Se(g){me(g)||fe.onUnexpectedError(g)}function he(g){me(g)||fe.onUnexpectedExternalError(g)}function V(g){if(g instanceof Error){let{name:_,message:b}=g;const A=g.stacktrace||g.stack;return{$isError:!0,name:_,message:b,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(Yt,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 V}});var B=K(79881),fe=K(69323),Se=K(34502),he=K(95830),V;(function(b){b.None=()=>fe.JT.None;function A(F){return(O,le=null,te)=>{let S=!1,v;return v=F(z=>{if(!S)return v?v.dispose():S=!0,O.call(le,z)},null,te),S&&v.dispose(),v}}b.once=A;function N(F,O){return R((le,te=null,S)=>F(v=>le.call(te,O(v)),null,S))}b.map=N;function j(F,O){return R((le,te=null,S)=>F(v=>{O(v),le.call(te,v)},null,S))}b.forEach=j;function G(F,O){return R((le,te=null,S)=>F(v=>O(v)&&le.call(te,v),null,S))}b.filter=G;function L(F){return F}b.signal=L;function I(...F){return(O,le=null,te)=>(0,fe.F8)(...F.map(S=>S(v=>O.call(le,v),null,te)))}b.any=I;function w(F,O,le){let te=le;return N(F,S=>(te=O(te,S),te))}b.reduce=w;function R(F){let O;const le=new l({onFirstListenerAdd(){O=F(le.fire,le)},onLastListenerRemove(){O.dispose()}});return le.event}function q(F,O,le=100,te=!1,S){let v,z,oe,Ae=0;const Be=new l({leakWarningThreshold:S,onFirstListenerAdd(){v=F(ze=>{Ae++,z=O(z,ze),te&&!oe&&(Be.fire(z),z=void 0),clearTimeout(oe),oe=setTimeout(()=>{const St=z;z=void 0,oe=void 0,(!te||Ae>1)&&Be.fire(St),Ae=0},le)})},onLastListenerRemove(){v.dispose()}});return Be.event}b.debounce=q;function se(F,O=(le,te)=>le===te){let le=!0,te;return G(F,S=>{const v=le||!O(S,te);return le=!1,te=S,v})}b.latch=se;function ie(F,O){return[b.filter(F,O),b.filter(F,le=>!O(le))]}b.split=ie;function _e(F,O=!1,le=[]){let te=le.slice(),S=F(oe=>{te?te.push(oe):z.fire(oe)});const v=()=>{te&&te.forEach(oe=>z.fire(oe)),te=null},z=new l({onFirstListenerAdd(){S||(S=F(oe=>z.fire(oe)))},onFirstListenerDidAdd(){te&&(O?setTimeout(v):v())},onLastListenerRemove(){S&&S.dispose(),S=null}});return z.event}b.buffer=_e;class Ie{constructor(O){this.event=O}map(O){return new Ie(N(this.event,O))}forEach(O){return new Ie(j(this.event,O))}filter(O){return new Ie(G(this.event,O))}reduce(O,le){return new Ie(w(this.event,O,le))}latch(){return new Ie(se(this.event))}debounce(O,le=100,te=!1,S){return new Ie(q(this.event,O,le,te,S))}on(O,le,te){return this.event(O,le,te)}once(O,le,te){return A(this.event)(O,le,te)}}function Te(F){return new Ie(F)}b.chain=Te;function Ke(F,O,le=te=>te){const te=(...oe)=>z.fire(le(...oe)),S=()=>F.on(O,te),v=()=>F.removeListener(O,te),z=new l({onFirstListenerAdd:S,onLastListenerRemove:v});return z.event}b.fromNodeEventEmitter=Ke;function J(F,O,le=te=>te){const te=(...oe)=>z.fire(le(...oe)),S=()=>F.addEventListener(O,te),v=()=>F.removeEventListener(O,te),z=new l({onFirstListenerAdd:S,onLastListenerRemove:v});return z.event}b.fromDOMEventEmitter=J;function D(F){return new Promise(O=>A(F)(O))}b.toPromise=D})(V||(V={}));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,N=Math.random().toString(18).slice(2,5)){this.customThreshold=A,this.name=N,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(A){let N=me;if(typeof this.customThreshold=="number"&&(N=this.customThreshold),N<=0||A<N)return;this._stacks||(this._stacks=new Map);const j=new Error().stack.split(`
`).slice(3).join(`
`),G=this._stacks.get(j)||0;if(this._stacks.set(j,G+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=N*.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(j)||0;this._stacks.set(j,L-1)}}}class l{constructor(A){var N;this._disposed=!1,this._options=A,this._leakageMon=me>0?new ce(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((N=this._options)===null||N===void 0)&&N._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(A,N,j)=>{var G;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(N?[A,N]:A);L&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,A,N);const w=(G=this._leakageMon)===null||G===void 0?void 0:G.check(this._listeners.size),R=(0,fe.OF)(()=>{w&&w(),this._disposed||(I(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return j instanceof fe.SL?j.add(R):Array.isArray(j)&&j.push(R),R}),this._event}fire(A){var N,j;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Se.S);for(let G of this._listeners)this._deliveryQueue.push([G,A]);for((N=this._perfMon)===null||N===void 0||N.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[G,L]=this._deliveryQueue.shift();try{typeof G=="function"?G.call(void 0,L):G[0].call(G[1],L)}catch(I){(0,B.dL)(I)}}(j=this._perfMon)===null||j===void 0||j.stop()}}dispose(){var A,N,j,G,L;this._disposed||(this._disposed=!0,(A=this._listeners)===null||A===void 0||A.clear(),(N=this._deliveryQueue)===null||N===void 0||N.clear(),(G=(j=this._options)===null||j===void 0?void 0:j.onLastListenerRemove)===null||G===void 0||G.call(j),(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 N;super(A),this._delay=(N=A.delay)!==null&&N!==void 0?N: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(N,j,G)=>A(L=>{const I=this.buffers[this.buffers.length-1];I?I.push(()=>N.call(j,L)):N.call(j,L)},void 0,G)}bufferEvents(A){const N=[];this.buffers.push(N);const j=A();return this.buffers.pop(),N.forEach(G=>G()),j}}class _{constructor(){this.listening=!1,this.inputEvent=V.None,this.inputEventListener=fe.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(Yt,st,K){"use strict";K.d(st,{I:function(){return B}});function B(fe){const Se=this;let he=!1,V;return function(){return he||(he=!0,V=fe.apply(Se,arguments)),V}}},88226:function(Yt,st,K){"use strict";K.d(st,{$:function(){return B}});var B;(function(fe){function Se(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}fe.is=Se;const he=Object.freeze([]);function V(){return he}fe.empty=V;function*p(I){yield I}fe.single=p;function me(I){return I||he}fe.from=me;function ce(I){return!I||I[Symbol.iterator]().next().done===!0}fe.isEmpty=ce;function l(I){return I[Symbol.iterator]().next().value}fe.first=l;function X(I,w){for(const R of I)if(w(R))return!0;return!1}fe.some=X;function P(I,w){for(const R of I)if(w(R))return R}fe.find=P;function*g(I,w){for(const R of I)w(R)&&(yield R)}fe.filter=g;function*_(I,w){let R=0;for(const q of I)yield w(q,R++)}fe.map=_;function*b(...I){for(const w of I)for(const R of w)yield R}fe.concat=b;function*A(I){for(const w of I)for(const R of w)yield R}fe.concatNested=A;function N(I,w,R){let q=R;for(const se of I)q=w(q,se);return q}fe.reduce=N;function*j(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]}fe.slice=j;function G(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 ie=q.next();if(ie.done)return[R,fe.empty()];R.push(ie.value)}return[R,{[Symbol.iterator](){return q}}]}fe.consume=G;function L(I,w,R=(q,se)=>q===se){const q=I[Symbol.iterator](),se=w[Symbol.iterator]();for(;;){const ie=q.next(),_e=se.next();if(ie.done!==_e.done)return!1;if(ie.done)return!0;if(!R(ie.value,_e.value))return!1}}fe.equals=L})(B||(B={}))},69323:function(Yt,st,K){"use strict";K.d(st,{B9:function(){return _},F8:function(){return b},JT:function(){return j},Jz:function(){return L},OF:function(){return A},SL:function(){return N},Wf:function(){return g},XK:function(){return G},dk:function(){return X}});var B=K(17845),fe=K(88226);const Se=!1;let he=null;function V(I){he=I}if(Se){const I="__is_disposable_tracked__";V(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!==j.None)try{w[I]=!0}catch(q){}}markAsDisposed(w){if(w&&w!==j.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(fe.$.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 b(...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 N{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?N.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}}N.DISABLE_DISPOSED_WARNING=!1;class j{constructor(){this._store=new N,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)}}j.None=Object.freeze({dispose(){}});class G{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(Yt,st,K){"use strict";K.d(st,{S:function(){return fe}});class B{constructor(he){this.element=he,this.next=B.Undefined,this.prev=B.Undefined}}B.Undefined=new B(void 0);class fe{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 V=he.next;he.prev=B.Undefined,he.next=B.Undefined,he=V}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,V){const p=new B(he);if(this._first===B.Undefined)this._first=p,this._last=p;else if(V){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 V=he.prev;V.next=he.next,he.next.prev=V}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(Yt,st,K){"use strict";K.d(st,{$L:function(){return q},ED:function(){return L},IJ:function(){return w},OS:function(){return Ie},WE:function(){return ie},dz:function(){return I},gn:function(){return se},li:function(){return A},r:function(){return J},tY:function(){return R},xS:function(){return _e}});var B=K(97671),fe;const Se="en";let he=!1,V=!1,p=!1,me=!1,ce=!1,l=!1,X=!1,P,g=null,_=null,b;const A=typeof self=="object"?self:typeof K.g=="object"?K.g:{};let N;typeof A.vscode!="undefined"&&typeof A.vscode.process!="undefined"?N=A.vscode.process:typeof B!="undefined"&&(N=B);const j=typeof((fe=N==null?void 0:N.versions)===null||fe===void 0?void 0:fe.electron)=="string"&&N.type==="renderer";if(typeof navigator=="object"&&!j)b=navigator.userAgent,he=b.indexOf("Windows")>=0,V=b.indexOf("Macintosh")>=0,X=(b.indexOf("Macintosh")>=0||b.indexOf("iPad")>=0||b.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=b.indexOf("Linux")>=0,l=!0,P=navigator.language,g=P;else if(typeof N=="object"){he=N.platform==="win32",V=N.platform==="darwin",p=N.platform==="linux",me=p&&!!N.env.SNAP&&!!N.env.SNAP_REVISION,P=Se,g=Se;const D=N.env.VSCODE_NLS_CONFIG;if(D)try{const F=JSON.parse(D),O=F.availableLanguages["*"];P=F.locale,g=O||Se,_=F._translationsConfigFile}catch(F){}ce=!0}else console.error("Unable to resolve platform.");let G=0;V?G=1:he?G=3:p&&(G=2);const L=he,I=V,w=p,R=ce,q=l,se=X,ie=b,_e=function(){if(A.setImmediate)return A.setImmediate.bind(A);if(typeof A.postMessage=="function"&&!A.importScripts){let O=[];A.addEventListener("message",te=>{if(te.data&&te.data.vscodeSetImmediateId)for(let S=0,v=O.length;S<v;S++){const z=O[S];if(z.id===te.data.vscodeSetImmediateId){O.splice(S,1),z.callback();return}}});let le=0;return te=>{const S=++le;O.push({id:S,callback:te}),A.postMessage({vscodeSetImmediateId:S},"*")}}if(typeof(N==null?void 0:N.nextTick)=="function")return N.nextTick.bind(N);const F=Promise.resolve();return O=>F.then(O)}(),Ie=V||X?2:he?1:3;let Te=!0,Ke=!1;function J(){if(!Ke){Ke=!0;const D=new Uint8Array(2);D[0]=1,D[1]=2,Te=new Uint16Array(D.buffer)[0]===513}return Te}},95830:function(Yt,st,K){"use strict";K.d(st,{G:function(){return Se}});var B=K(23345);const fe=B.li.performance&&typeof B.li.performance.now=="function";class Se{constructor(V){this._highResolution=fe&&V,this._startTime=this._now(),this._stopTime=-1}static create(V=!0){return new Se(V)}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(Yt,st,K){"use strict";K.d(st,{$i:function(){return Ae},C8:function(){return ni},GF:function(){return P},HO:function(){return le},IO:function(){return g},K7:function(){return Nt},Kw:function(){return Kt},LC:function(){return A},Mh:function(){return _e},P1:function(){return Ie},PJ:function(){return ut},Qe:function(){return Be},R1:function(){return X},RP:function(){return z},S6:function(){return hi},TT:function(){return L},Ut:function(){return S},V8:function(){return N},WU:function(){return Se},YK:function(){return Ke},YU:function(){return he},ZG:function(){return Te},ZH:function(){return D},ab:function(){return ze},c1:function(){return Ve},df:function(){return q},ec:function(){return V},fi:function(){return He},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 ie},ow:function(){return j},qq:function(){return se},qu:function(){return G},rL:function(){return J},uS:function(){return gt},un:function(){return l},uq:function(){return b},vH:function(){return O},xe:function(){return St},zY:function(){return I}});function B(Y){return!Y||typeof Y!="string"?!0:Y.trim().length===0}const fe=/{(\d+)}/g;function Se(Y,...k){return k.length===0?Y:Y.replace(fe,function(Q,U){const M=parseInt(U,10);return isNaN(M)||M<0||M>=k.length?Q:k[M]})}function he(Y){return Y.replace(/[<>&]/g,function(k){switch(k){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return k}})}function V(Y){return Y.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(Y,k=" "){const Q=me(Y,k);return ce(Q,k)}function me(Y,k){if(!Y||!k)return Y;const Q=k.length;if(Q===0||Y.length===0)return Y;let U=0;for(;Y.indexOf(k,U)===U;)U=U+Q;return Y.substring(U)}function ce(Y,k){if(!Y||!k)return Y;const Q=k.length,U=Y.length;if(Q===0||U===0)return Y;let M=U,W=-1;for(;W=Y.lastIndexOf(k,M-1),!(W===-1||W+Q!==M);){if(W===0)return"";M=W}return Y.substring(0,M)}function l(Y){return Y.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function X(Y){return Y.replace(/\*/g,"")}function P(Y,k,Q={}){if(!Y)throw new Error("Cannot create regex from empty string");k||(Y=V(Y)),Q.wholeWord&&(/\B/.test(Y.charAt(0))||(Y="\\b"+Y),/\B/.test(Y.charAt(Y.length-1))||(Y=Y+"\\b"));let U="";return Q.global&&(U+="g"),Q.matchCase||(U+="i"),Q.multiline&&(U+="m"),Q.unicode&&(U+="u"),new RegExp(Y,U)}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 b(Y){return Y.split(/\r\n|\r|\n/)}function A(Y){for(let k=0,Q=Y.length;k<Q;k++){const U=Y.charCodeAt(k);if(U!==32&&U!==9)return k}return-1}function N(Y,k=0,Q=Y.length){for(let U=k;U<Q;U++){const M=Y.charCodeAt(U);if(M!==32&&M!==9)return Y.substring(k,U)}return Y.substring(k,Q)}function j(Y,k=Y.length-1){for(let Q=k;Q>=0;Q--){const U=Y.charCodeAt(Q);if(U!==32&&U!==9)return Q}return-1}function G(Y,k){return Y<k?-1:Y>k?1:0}function L(Y,k,Q=0,U=Y.length,M=0,W=k.length){for(;Q<U&&M<W;Q++,M++){let ye=Y.charCodeAt(Q),Ce=k.charCodeAt(M);if(ye<Ce)return-1;if(ye>Ce)return 1}const ae=U-Q,ue=W-M;return ae<ue?-1:ae>ue?1:0}function I(Y,k){return w(Y,k,0,Y.length,0,k.length)}function w(Y,k,Q=0,U=Y.length,M=0,W=k.length){for(;Q<U&&M<W;Q++,M++){let ye=Y.charCodeAt(Q),Ce=k.charCodeAt(M);if(ye===Ce)continue;if(ye>=128||Ce>=128)return L(Y.toLowerCase(),k.toLowerCase(),Q,U,M,W);R(ye)&&(ye-=32),R(Ce)&&(Ce-=32);const xe=ye-Ce;if(xe!==0)return xe}const ae=U-Q,ue=W-M;return ae<ue?-1:ae>ue?1:0}function R(Y){return Y>=97&&Y<=122}function q(Y){return Y>=65&&Y<=90}function se(Y,k){return Y.length===k.length&&w(Y,k)===0}function ie(Y,k){const Q=k.length;return k.length>Y.length?!1:w(Y,k,0,Q)===0}function _e(Y,k){let Q,U=Math.min(Y.length,k.length);for(Q=0;Q<U;Q++)if(Y.charCodeAt(Q)!==k.charCodeAt(Q))return Q;return U}function Ie(Y,k){let Q,U=Math.min(Y.length,k.length);const M=Y.length-1,W=k.length-1;for(Q=0;Q<U;Q++)if(Y.charCodeAt(M-Q)!==k.charCodeAt(W-Q))return Q;return U}function Te(Y){return 55296<=Y&&Y<=56319}function Ke(Y){return 56320<=Y&&Y<=57343}function J(Y,k){return(Y-55296<<10)+(k-56320)+65536}function D(Y,k,Q){const U=Y.charCodeAt(Q);if(Te(U)&&Q+1<k){const M=Y.charCodeAt(Q+1);if(Ke(M))return J(U,M)}return U}function F(Y,k){const Q=Y.charCodeAt(k-1);if(Ke(Q)&&k>1){const U=Y.charCodeAt(k-2);if(Te(U))return J(U,Q)}return Q}function O(Y,k){const Q=Ee.getInstance(),U=k,M=Y.length,W=D(Y,M,k);k+=W>=65536?2:1;let ae=Q.getGraphemeBreakType(W);for(;k<M;){const ue=D(Y,M,k),ye=Q.getGraphemeBreakType(ue);if(He(ae,ye))break;k+=ue>=65536?2:1,ae=ye}return k-U}function le(Y,k){const Q=Ee.getInstance(),U=k,M=F(Y,k);k-=M>=65536?2:1;let W=Q.getGraphemeBreakType(M);for(;k>0;){const ae=F(Y,k),ue=Q.getGraphemeBreakType(ae);if(He(ue,W))break;k-=ae>=65536?2:1,W=ue}return U-k}const te=/(?:[\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 te.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 oe=/^[\t\n\r\x20-\x7E]*$/;function Ae(Y){return oe.test(Y)}const Be=/[\u2028\u2029]/;function ze(Y){return Be.test(Y)}function St(Y){for(let k=0,Q=Y.length;k<Q;k++)if(Nt(Y.charCodeAt(k)))return!0;return!1}function Nt(Y){return Y=+Y,Y>=11904&&Y<=55215||Y>=63744&&Y<=64255||Y>=65281&&Y<=65374}function ni(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 Ve="\uFEFF";function gt(Y){return!!(Y&&Y.length>0&&Y.charCodeAt(0)===65279)}function Kt(Y,k=!1){return Y?(k&&(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 hi(Y){return Ee.getInstance().getGraphemeBreakType(Y)}function He(Y,k){return Y===0?k!==5&&k!==7:Y===2&&k===3?!1:Y===4||Y===2||Y===3||k===4||k===2||k===3?!0:!(Y===8&&(k===8||k===9||k===11||k===12)||(Y===11||Y===9)&&(k===9||k===10)||(Y===12||Y===10)&&k===10||k===5||k===13||k===7||Y===1||Y===13&&k===14||Y===6&&k===6)}class Ee{constructor(){this._data=De()}static getInstance(){return Ee._INSTANCE||(Ee._INSTANCE=new Ee),Ee._INSTANCE}getGraphemeBreakType(k){if(k<32)return k===10?3:k===13?2:4;if(k<127)return 0;const Q=this._data,U=Q.length/3;let M=1;for(;M<=U;)if(k<Q[3*M])M=2*M;else if(k>Q[3*M+1])M=2*M+1;else return Q[3*M+2];return 0}}Ee._INSTANCE=null;function De(){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,k){if(Y===0)return 0;const Q=Re(Y,k);if(Q!==void 0)return Q;const U=F(k,Y);return Y-=ke(U),Y}function Re(Y,k){let Q=F(k,Y);for(Y-=ke(Q);ee(Q)||Q===65039||Q===8419;){if(Y===0)return;Q=F(k,Y),Y-=ke(Q)}if(ni(Q)){if(Y>=0){const U=F(k,Y);U===8205&&(Y-=ke(U))}return Y}}function ke(Y){return Y>=65536?2:1}function ee(Y){return 127995<=Y&&Y<=127999}},72999:function(Yt,st,K){"use strict";K.d(st,{$E:function(){return A},$K:function(){return me},D8:function(){return g},HD:function(){return fe},IU:function(){return N},Jp:function(){return ce},Kn:function(){return Se},cW:function(){return X},f6:function(){return j},hj:function(){return he},jn:function(){return V},kJ:function(){return B},mf:function(){return P},o8:function(){return p},p_:function(){return l},vE:function(){return G}});function B(L){return Array.isArray(L)}function fe(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 V(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(fe(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 b(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 b(L))typeof L[w]=="function"&&I.push(w);return I}function N(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 j(L){return L===null?void 0:L}function G(L,I="Unreachable"){throw new Error(I)}},13268:function(Yt,st,K){"use strict";K.d(st,{N:function(){return fe}});function B(Se,he){let V;return he.length===0?V=Se:V=Se.replace(/\{(\d+)\}/g,function(p,me){const ce=me[0];return typeof he[ce]!="undefined"?he[ce]:p}),V}function fe(Se,he,...V){return B(he,V)}},96236:function(Yt,st,K){"use strict";K.d(st,{BH:function(){return N},NZ:function(){return j},U8:function(){return G},co:function(){return A},eH:function(){return b},vr:function(){return _}});var B=K(75918),fe=K(52615),Se=K(4348),he=K(88226),V=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,ie;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")se=Reflect.decorate(L,I,w,R);else for(var _e=L.length-1;_e>=0;_e--)(ie=L[_e])&&(se=(q<3?ie(se):q>3?ie(I,w,se):ie(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 b{constructor(I){this.id=b._idPool++,this._debugName=I}}b._idPool=0,b.CommandPalette=new b("CommandPalette"),b.EditorContext=new b("EditorContext"),b.SimpleEditorContext=new b("SimpleEditorContext"),b.EditorContextCopy=new b("EditorContextCopy"),b.EditorContextPeek=new b("EditorContextPeek"),b.MenubarEditMenu=new b("MenubarEditMenu"),b.MenubarCopy=new b("MenubarCopy"),b.MenubarGoMenu=new b("MenubarGoMenu"),b.MenubarSelectionMenu=new b("MenubarSelectionMenu"),b.InlineCompletionsActions=new b("InlineCompletionsActions");const A=(0,l.yh)("menuService"),N=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===b.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,V.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,V.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===b.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 j 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 G=class Qo{constructor(I,w,R,q,se){var ie,_e;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=(_e=typeof I.tooltip=="string"?I.tooltip:(ie=I.tooltip)===null||ie===void 0?void 0:ie.value)!==null&&_e!==void 0?_e:"",this.enabled=!I.precondition||q.contextMatchesRules(I.precondition),this.checked=void 0,I.toggled){const Ie=I.toggled.condition?I.toggled:{condition:I.toggled};this.checked=q.contextMatchesRules(Ie.condition),this.checked&&Ie.tooltip&&(this.tooltip=typeof Ie.tooltip=="string"?Ie.tooltip:Ie.tooltip.value),Ie.title&&(this.label=typeof Ie.title=="string"?Ie.title:Ie.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=fe.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)}};G=P([g(3,ce.i6),g(4,me.H)],G)},35884:function(Yt,st,K){"use strict";K.d(st,{H:function(){return me},P:function(){return ce}});var B=K(4348),fe=K(88226),Se=K(69323),he=K(34502),V=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 j of l.description.args)A.push(j.constraint);const N=l.handler;l.handler=function(j,...G){return(0,V.D8)(G,A),N(j,...G)}}const{id:P}=l;let g=this._commands.get(P);g||(g=new he.S,this._commands.set(P,g));let _=g.unshift(l),b=(0,Se.OF)(()=>{_();const A=this._commands.get(P);A!=null&&A.isEmpty()&&this._commands.delete(P)});return this._onDidRegisterCommand.fire(P),b}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 fe.$.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(Yt,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 Ke},uy:function(){return Te}});var B=K(23345),fe=K(82983),Se=K(16925);let he=B.WE||"";const V=new Map;V.set("false",!1),V.set("true",!0),V.set("isMac",B.dz),V.set("isLinux",B.IJ),V.set("isWindows",B.ED),V.set("isWeb",B.$L),V.set("isMacNative",B.dz&&!B.$L),V.set("isEdge",he.indexOf("Edg/")>=0),V.set("isFirefox",he.indexOf("Firefox")>=0),V.set("isChrome",he.indexOf("Chrome")>=0),V.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 j.create(S)}static and(...S){return _e.create(S,null)}static or(...S){return Ie.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 Ie.create(z.map(oe=>this._deserializeAndExpression(oe,v)),null,!0)}static _deserializeAndExpression(S,v){let z=S.split("&&");return _e.create(z.map(oe=>this._deserializeOne(oe,v)),null)}static _deserializeOne(S,v){if(S=S.trim(),S.indexOf("!=")>=0){let z=S.split("!=");return N.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 b.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)?j.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,fe.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("/"),oe=S.lastIndexOf("/");if(z===oe||z<0){if(v)throw new Error(`bad regexp-value '${S}', missing /-enclosure`);return console.warn(`bad regexp-value '${S}', missing /-enclosure`),null}let Ae=S.slice(z+1,oe),Be=S[oe+1]==="i"?"i":"";try{return new RegExp(Ae,Be)}catch(ze){if(v)throw new Error(`bad regexp-value '${S}', parse error: ${ze}`);return console.warn(`bad regexp-value '${S}', parse error: ${ze}`),null}}}function ce(te,S){const v=te?te.substituteConstants():void 0,z=S?S.substituteConstants():void 0;return!v&&!z?!0:!v||!z?!1:v.equals(z)}function l(te,S){return te.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=V.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=V.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=j.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):j.create(S,z);const oe=V.get(S);return typeof oe=="boolean"?v===(oe?"true":"false")?P.INSTANCE:X.INSTANCE:new _(S,v,z)}cmp(S){return S.type!==this.type?this.type-S.type:F(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=V.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=N.create(this.key,this.value,this)),this.negated}}class b{constructor(S,v){this.key=S,this.valueKey=v,this.type=10,this.negated=null}static create(S,v){return new b(S,v)}cmp(S){return S.type!==this.type?this.type-S.type:F(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 N{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?j.create(S,z):g.create(S,z);const oe=V.get(S);return typeof oe=="boolean"?v===(oe?"true":"false")?X.INSTANCE:P.INSTANCE:new N(S,v,z)}cmp(S){return S.type!==this.type?this.type-S.type:F(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=V.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 j{constructor(S,v){this.key=S,this.negated=v,this.type=3}static create(S,v=null){const z=V.get(S);return typeof z=="boolean"?z?X.INSTANCE:P.INSTANCE:new j(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=V.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 G(te,S){if(typeof te=="string"){const v=parseFloat(te);isNaN(v)||(te=v)}return typeof te=="string"||typeof te=="number"?S(te):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 G(v,oe=>new L(S,oe,z))}cmp(S){return S.type!==this.type?this.type-S.type:F(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 G(v,oe=>new I(S,oe,z))}cmp(S){return S.type!==this.type?this.type-S.type:F(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 G(v,oe=>new w(S,oe,z))}cmp(S){return S.type!==this.type?this.type-S.type:F(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 G(v,oe=>new R(S,oe,z))}cmp(S){return S.type!==this.type?this.type-S.type:F(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 ie(te){let S=null;for(let v=0,z=te.length;v<z;v++){const oe=te[v].substituteConstants();if(te[v]!==oe&&S===null){S=[];for(let Ae=0;Ae<v;Ae++)S[Ae]=te[Ae]}S!==null&&(S[v]=oe)}return S===null?te:S}class _e{constructor(S,v){this.expr=S,this.negated=v,this.type=6}static create(S,v){return _e._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 oe=l(this.expr[v],S.expr[v]);if(oe!==0)return oe}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=ie(this.expr);return S===this.expr?this:_e.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 oe=!1;for(const Ae of S)if(Ae){if(Ae.type===1){oe=!0;continue}if(Ae.type===0)return X.INSTANCE;if(Ae.type===6){z.push(...Ae.expr);continue}z.push(Ae)}if(z.length===0&&oe)return P.INSTANCE;if(z.length!==0){if(z.length===1)return z[0];z.sort(l);for(let Ae=1;Ae<z.length;Ae++)z[Ae-1].equals(z[Ae])&&(z.splice(Ae,1),Ae--);if(z.length===1)return z[0];for(;z.length>1;){const Ae=z[z.length-1];if(Ae.type!==9)break;z.pop();const Be=z.pop(),ze=z.length===0,St=Ie.create(Ae.expr.map(Nt=>_e.create([Nt,Be],null)),null,ze);St&&(z.push(St),z.sort(l))}return z.length===1?z[0]:new _e(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=Ie.create(S,this,!0)}return this.negated}}class Ie{constructor(S,v){this.expr=S,this.negated=v,this.type=9}static create(S,v,z){return Ie._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 oe=l(this.expr[v],S.expr[v]);if(oe!==0)return oe}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=ie(this.expr);return S===this.expr?this:Ie.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 oe=[],Ae=!1;if(S){for(let Be=0,ze=S.length;Be<ze;Be++){const St=S[Be];if(St){if(St.type===0){Ae=!0;continue}if(St.type===1)return P.INSTANCE;if(St.type===9){oe=oe.concat(St.expr);continue}oe.push(St)}}if(oe.length===0&&Ae)return X.INSTANCE;oe.sort(l)}if(oe.length!==0){if(oe.length===1)return oe[0];for(let Be=1;Be<oe.length;Be++)oe[Be-1].equals(oe[Be])&&(oe.splice(Be,1),Be--);if(oe.length===1)return oe[0];if(z){for(let Be=0;Be<oe.length;Be++)for(let ze=Be+1;ze<oe.length;ze++)O(oe[Be],oe[ze])&&(oe.splice(ze,1),ze--);if(oe.length===1)return oe[0]}return new Ie(oe,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(),oe=[];for(const Be of le(v))for(const ze of le(z))oe.push(_e.create([Be,ze],null));const Ae=S.length===0;S.unshift(Ie.create(oe,null,Ae))}this.negated=S[0]}return this.negated}}class Te extends g{constructor(S,v,z){super(S,null),this._defaultValue=v,typeof z=="object"?Te._info.push(Object.assign(Object.assign({},z),{key:S})):z!==!0&&Te._info.push({key:S,description:z,type:v!=null?typeof v:void 0})}static all(){return Te._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)}}Te._info=[];const Ke=(0,Se.yh)("contextKeyService"),J="setContext";function D(te,S){return te<S?-1:te>S?1:0}function F(te,S,v,z){return te<v?-1:te>v?1:S<z?-1:S>z?1:0}function O(te,S){if(S.type===6&&te.type!==9&&te.type!==6){for(const oe of S.expr)if(te.equals(oe))return!0}const v=te.negate(),z=le(v).concat(le(S));z.sort(l);for(let oe=0;oe<z.length;oe++){const Be=z[oe].negate();for(let ze=oe+1;ze<z.length;ze++){const St=z[ze];if(Be.equals(St))return!0}}return!1}function le(te){return te.type===9?te.expr:[te]}},16925:function(Yt,st,K){"use strict";K.d(st,{I8:function(){return B},TG:function(){return fe},jt:function(){return V},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 fe=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 V(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(Yt,st,K){"use strict";K.d(st,{B:function(){return he}});var B=K(76068),fe=K(72999);class Se{constructor(){this.data=new Map}add(p,me){B.ok(fe.HD(p)),B.ok(fe.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(Yt,st,K){"use strict";K.d(st,{e:function(){return B}});var B;(function(fe){fe.DARK="dark",fe.LIGHT="light",fe.HIGH_CONTRAST="hc"})(B||(B={}))},49055:function(Yt,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 N},kS:function(){return X},m6:function(){return P}});var B=K(52615),fe=K(4348),Se=K(69323),he=K(16925),V=K(44650),p=K(66213);const me=(0,he.yh)("themeService");var ce;(function(j){function G(L){return L&&typeof L=="object"&&typeof L.id=="string"}j.isThemeColor=G})(ce||(ce={}));function l(j){return{id:j}}var X;(function(j){function G(se){return se&&typeof se=="object"&&typeof se.id=="string"&&(typeof se.color=="undefined"||ce.isThemeColor(se.color))}j.isThemeIcon=G;const L=new RegExp(`^\\$\\((${B.dT.iconNameExpression}(?:${B.dT.iconModifierExpression})?)\\)$`);function I(se){const ie=L.exec(se);if(!ie)return;let[,_e]=ie;return{id:_e}}j.fromString=I;function w(se,ie){let _e=se.id;const Ie=_e.lastIndexOf("~");return Ie!==-1&&(_e=_e.substring(0,Ie)),ie&&(_e=`${_e}~${ie}`),{id:_e}}j.modify=w;function R(se,ie){var _e,Ie;return se.id===ie.id&&((_e=se.color)===null||_e===void 0?void 0:_e.id)===((Ie=ie.color)===null||Ie===void 0?void 0:Ie.id)}j.isEqual=R;function q(se,ie){return{id:se.id,color:ie?l(ie):void 0}}j.asThemeIcon=q,j.asClassNameArray=B.dT.asClassNameArray,j.asClassName=B.dT.asClassName,j.asCSSSelector=B.dT.asCSSSelector})(X||(X={}));function P(j){switch(j){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 fe.Q5}onColorThemeChange(G){return this.themingParticipants.push(G),this.onThemingParticipantAddedEmitter.fire(G),(0,Se.OF)(()=>{const L=this.themingParticipants.indexOf(G);this.themingParticipants.splice(L,1)})}getThemingParticipants(){return this.themingParticipants}}let b=new _;V.B.add(g.ThemingContribution,b);function A(j){return b.onColorThemeChange(j)}class N extends Se.JT{constructor(G){super(),this.themeService=G,this.theme=G.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(L=>this.onThemeChange(L)))}onThemeChange(G){this.theme=G,this.updateStyles()}updateStyles(){}}},96478:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return se}});var B=K(14809),fe=K(4635),Se=K(50298),he=K(62646),V=K(65966),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 b(ie){var _e=ie.visible,Ie=ie.triggerRef,Te=ie.onVisibleChange,Ke=ie.autoFocus,J=ie.overlayRef,D=l.useRef(!1),F=function(){if(_e){var S,v;(S=Ie.current)===null||S===void 0||(v=S.focus)===null||v===void 0||v.call(S),Te==null||Te(!1)}},O=function(){var S;return(S=J.current)!==null&&S!==void 0&&S.focus?(J.current.focus(),D.current=!0,!0):!1},le=function(S){switch(S.keyCode){case g:F();break;case _:{var v=!1;D.current||(v=O()),v?S.preventDefault():F();break}}};l.useEffect(function(){return _e?(window.addEventListener("keydown",le),Ke&&(0,P.Z)(O,3),function(){window.removeEventListener("keydown",le),D.current=!1}):function(){D.current=!1}},[_e])}var A=(0,l.forwardRef)(function(ie,_e){var Ie=ie.overlay,Te=ie.arrow,Ke=ie.prefixCls,J=(0,l.useMemo)(function(){var F;return typeof Ie=="function"?F=Ie():F=Ie,F},[Ie]),D=(0,ce.sQ)(_e,(0,ce.C4)(J));return l.createElement(l.Fragment,null,Te&&l.createElement("div",{className:"".concat(Ke,"-arrow")}),l.cloneElement(J,{ref:(0,ce.Yr)(J)?D:void 0}))}),N=A,j={adjustX:1,adjustY:1},G=[0,0],L={topLeft:{points:["bl","tl"],overflow:j,offset:[0,-4],targetOffset:G},top:{points:["bc","tc"],overflow:j,offset:[0,-4],targetOffset:G},topRight:{points:["br","tr"],overflow:j,offset:[0,-4],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:j,offset:[0,4],targetOffset:G},bottom:{points:["tc","bc"],overflow:j,offset:[0,4],targetOffset:G},bottomRight:{points:["tr","br"],overflow:j,offset:[0,4],targetOffset:G}},I=L,w=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function R(ie,_e){var Ie,Te=ie.arrow,Ke=Te===void 0?!1:Te,J=ie.prefixCls,D=J===void 0?"rc-dropdown":J,F=ie.transitionName,O=ie.animation,le=ie.align,te=ie.placement,S=te===void 0?"bottomLeft":te,v=ie.placements,z=v===void 0?I:v,oe=ie.getPopupContainer,Ae=ie.showAction,Be=ie.hideAction,ze=ie.overlayClassName,St=ie.overlayStyle,Nt=ie.visible,ni=ie.trigger,Ve=ni===void 0?["hover"]:ni,gt=ie.autoFocus,Kt=ie.overlay,ut=ie.children,hi=ie.onVisibleChange,He=(0,he.Z)(ie,w),Ee=l.useState(),De=(0,Se.Z)(Ee,2),ne=De[0],Re=De[1],ke="visible"in ie?Nt:ne,ee=l.useRef(null),Y=l.useRef(null),k=l.useRef(null);l.useImperativeHandle(_e,function(){return ee.current});var Q=function(qe){Re(qe),hi==null||hi(qe)};b({visible:ke,triggerRef:k,onVisibleChange:Q,autoFocus:gt,overlayRef:Y});var U=function(qe){var Fe=ie.onOverlayClick;Re(!1),Fe&&Fe(qe)},M=function(){return l.createElement(N,{ref:Y,overlay:Kt,prefixCls:D,arrow:Ke})},W=function(){return typeof Kt=="function"?M:M()},ae=function(){var qe=ie.minOverlayWidthMatchTrigger,Fe=ie.alignPoint;return"minOverlayWidthMatchTrigger"in ie?qe:!Fe},ue=function(){var qe=ie.openClassName;return qe!==void 0?qe:"".concat(D,"-open")},ye=l.cloneElement(ut,{className:me()((Ie=ut.props)===null||Ie===void 0?void 0:Ie.className,ke&&ue()),ref:(0,ce.Yr)(ut)?(0,ce.sQ)(k,(0,ce.C4)(ut)):void 0}),Ce=Be;return!Ce&&Ve.indexOf("contextMenu")!==-1&&(Ce=["click"]),l.createElement(V.Z,(0,B.Z)({builtinPlacements:z},He,{prefixCls:D,ref:ee,popupClassName:me()(ze,(0,fe.Z)({},"".concat(D,"-show-arrow"),Ke)),popupStyle:St,action:Ve,showAction:Ae,hideAction:Ce,popupPlacement:S,popupAlign:le,popupTransitionName:F,popupAnimation:O,popupVisible:ke,stretch:ae()?"minWidth":"",popup:W(),onPopupVisibleChange:Q,onPopupClick:U,getPopupContainer:oe}),ye)}var q=l.forwardRef(R),se=q},28321:function(Yt,st,K){"use strict";K.d(st,{iz:function(){return Ut},ck:function(){return ot},BW:function(){return ft},sN:function(){return ot},Wd:function(){return _t},ZP:function(){return zt},Xl:function(){return Ie}});var B=K(14809),fe=K(4635),Se=K(20439),he=K(95190),V=K(50298),p=K(62646),me=K(92310),ce=K.n(me),l=K(11780),X=K(18929),P=K(13697),g=K(48736),_=K(59301),b=K(4676),A=_.createContext(null);function N(ve,Oe){return ve===void 0?null:"".concat(ve,"-").concat(Oe)}function j(ve){var Oe=_.useContext(A);return N(Oe,ve)}var G=K(80547),L=["children","locked"],I=_.createContext(null);function w(ve,Oe){var Qe=(0,Se.Z)({},ve);return Object.keys(Oe).forEach(function(Ye){var it=Oe[Ye];it!==void 0&&(Qe[Ye]=it)}),Qe}function R(ve){var Oe=ve.children,Qe=ve.locked,Ye=(0,p.Z)(ve,L),it=_.useContext(I),mt=(0,G.Z)(function(){return w(it,Ye)},[it,Ye],function(lt,Et){return!Qe&&(lt[0]!==Et[0]||!(0,P.Z)(lt[1],Et[1],!0))});return _.createElement(I.Provider,{value:mt},Oe)}var q=[],se=_.createContext(null);function ie(){return _.useContext(se)}var _e=_.createContext(q);function Ie(ve){var Oe=_.useContext(_e);return _.useMemo(function(){return ve!==void 0?[].concat((0,he.Z)(Oe),[ve]):Oe},[Oe,ve])}var Te=_.createContext(null),Ke=_.createContext({}),J=Ke,D=K(29194);function F(ve){var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,D.Z)(ve)){var Qe=ve.nodeName.toLowerCase(),Ye=["input","select","textarea","button"].includes(Qe)||ve.isContentEditable||Qe==="a"&&!!ve.getAttribute("href"),it=ve.getAttribute("tabindex"),mt=Number(it),lt=null;return it&&!Number.isNaN(mt)?lt=mt:Ye&&lt===null&&(lt=0),Ye&&ve.disabled&&(lt=null),lt!==null&&(lt>=0||Oe&&lt<0)}return!1}function O(ve){var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Qe=(0,he.Z)(ve.querySelectorAll("*")).filter(function(Ye){return F(Ye,Oe)});return F(ve,Oe)&&Qe.unshift(ve),Qe}var le=null;function te(){le=document.activeElement}function S(){le=null}function v(){if(le)try{le.focus()}catch(ve){}}function z(ve,Oe){if(Oe.keyCode===9){var Qe=O(ve),Ye=Qe[Oe.shiftKey?0:Qe.length-1],it=Ye===document.activeElement||ve===document.activeElement;if(it){var mt=Qe[Oe.shiftKey?Qe.length-1:0];mt.focus(),Oe.preventDefault()}}}var oe=K(10228),Ae=K(16089),Be=oe.Z.LEFT,ze=oe.Z.RIGHT,St=oe.Z.UP,Nt=oe.Z.DOWN,ni=oe.Z.ENTER,Ve=oe.Z.ESC,gt=oe.Z.HOME,Kt=oe.Z.END,ut=[St,Nt,Be,ze];function hi(ve,Oe,Qe,Ye){var it,mt="prev",lt="next",Et="children",Xt="parent";if(ve==="inline"&&Ye===ni)return{inlineTrigger:!0};var Dt=(0,fe.Z)((0,fe.Z)({},St,mt),Nt,lt),ui=(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)({},Be,Qe?lt:mt),ze,Qe?mt:lt),Nt,Et),ni,Et),jt=(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)({},St,mt),Nt,lt),ni,Et),Ve,Xt),Be,Qe?Et:Xt),ze,Qe?Xt:Et),pi={inline:Dt,horizontal:ui,vertical:jt,inlineSub:Dt,horizontalSub:jt,verticalSub:jt},xi=(it=pi["".concat(ve).concat(Oe?"":"Sub")])===null||it===void 0?void 0:it[Ye];switch(xi){case mt:return{offset:-1,sibling:!0};case lt:return{offset:1,sibling:!0};case Xt:return{offset:-1,sibling:!1};case Et:return{offset:1,sibling:!1};default:return null}}function He(ve){for(var Oe=ve;Oe;){if(Oe.getAttribute("data-menu-list"))return Oe;Oe=Oe.parentElement}return null}function Ee(ve,Oe){for(var Qe=ve||document.activeElement;Qe;){if(Oe.has(Qe))return Qe;Qe=Qe.parentElement}return null}function De(ve,Oe){var Qe=O(ve,!0);return Qe.filter(function(Ye){return Oe.has(Ye)})}function ne(ve,Oe,Qe){var Ye=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!ve)return null;var it=De(ve,Oe),mt=it.length,lt=it.findIndex(function(Et){return Qe===Et});return Ye<0?lt===-1?lt=mt-1:lt-=1:Ye>0&&(lt+=1),lt=(lt+mt)%mt,it[lt]}var Re=function(Oe,Qe){var Ye=new Set,it=new Map,mt=new Map;return Oe.forEach(function(lt){var Et=document.querySelector("[data-menu-id='".concat(N(Qe,lt),"']"));Et&&(Ye.add(Et),mt.set(Et,lt),it.set(lt,Et))}),{elements:Ye,key2element:it,element2key:mt}};function ke(ve,Oe,Qe,Ye,it,mt,lt,Et,Xt,Dt){var ui=_.useRef(),jt=_.useRef();jt.current=Oe;var pi=function(){Ae.Z.cancel(ui.current)};return _.useEffect(function(){return function(){pi()}},[]),function(xi){var ki=xi.which;if([].concat(ut,[ni,Ve,gt,Kt]).includes(ki)){var Ii=mt(),di=Re(Ii,Ye),yi=di,Di=yi.elements,wi=yi.key2element,Ti=yi.element2key,Ni=wi.get(Oe),mi=Ee(Ni,Di),Li=Ti.get(mi),Qi=hi(ve,lt(Li,!0).length===1,Qe,ki);if(!Qi&&ki!==gt&&ki!==Kt)return;(ut.includes(ki)||[gt,Kt].includes(ki))&&xi.preventDefault();var Mi=function(Yi){if(Yi){var ii=Yi,Ct=Yi.querySelector("a");Ct!=null&&Ct.getAttribute("href")&&(ii=Ct);var gi=Ti.get(Yi);Et(gi),pi(),ui.current=(0,Ae.Z)(function(){jt.current===gi&&ii.focus()})}};if([gt,Kt].includes(ki)||Qi.sibling||!mi){var Ci;!mi||ve==="inline"?Ci=it.current:Ci=He(mi);var zi,ji=De(Ci,Di);ki===gt?zi=ji[0]:ki===Kt?zi=ji[ji.length-1]:zi=ne(Ci,Di,mi,Qi.offset),Mi(zi)}else if(Qi.inlineTrigger)Xt(Li);else if(Qi.offset>0)Xt(Li,!0),pi(),ui.current=(0,Ae.Z)(function(){di=Re(Ii,Ye);var nn=mi.getAttribute("aria-controls"),Yi=document.getElementById(nn),ii=ne(Yi,di.elements);Mi(ii)},5);else if(Qi.offset<0){var Ji=lt(Li,!0),tn=Ji[Ji.length-2],Gi=wi.get(tn);Xt(tn,!1),Mi(Gi)}}Dt==null||Dt(xi)}}function ee(ve){Promise.resolve().then(ve)}var Y="__RC_UTIL_PATH_SPLIT__",k=function(Oe){return Oe.join(Y)},Q=function(Oe){return Oe.split(Y)},U="rc-menu-more";function M(){var ve=_.useState({}),Oe=(0,V.Z)(ve,2),Qe=Oe[1],Ye=(0,_.useRef)(new Map),it=(0,_.useRef)(new Map),mt=_.useState([]),lt=(0,V.Z)(mt,2),Et=lt[0],Xt=lt[1],Dt=(0,_.useRef)(0),ui=(0,_.useRef)(!1),jt=function(){ui.current||Qe({})},pi=(0,_.useCallback)(function(wi,Ti){var Ni=k(Ti);it.current.set(Ni,wi),Ye.current.set(wi,Ni),Dt.current+=1;var mi=Dt.current;ee(function(){mi===Dt.current&&jt()})},[]),xi=(0,_.useCallback)(function(wi,Ti){var Ni=k(Ti);it.current.delete(Ni),Ye.current.delete(wi)},[]),ki=(0,_.useCallback)(function(wi){Xt(wi)},[]),Ii=(0,_.useCallback)(function(wi,Ti){var Ni=Ye.current.get(wi)||"",mi=Q(Ni);return Ti&&Et.includes(mi[0])&&mi.unshift(U),mi},[Et]),di=(0,_.useCallback)(function(wi,Ti){return wi.filter(function(Ni){return Ni!==void 0}).some(function(Ni){var mi=Ii(Ni,!0);return mi.includes(Ti)})},[Ii]),yi=function(){var Ti=(0,he.Z)(Ye.current.keys());return Et.length&&Ti.push(U),Ti},Di=(0,_.useCallback)(function(wi){var Ti="".concat(Ye.current.get(wi)).concat(Y),Ni=new Set;return(0,he.Z)(it.current.keys()).forEach(function(mi){mi.startsWith(Ti)&&Ni.add(it.current.get(mi))}),Ni},[]);return _.useEffect(function(){return function(){ui.current=!0}},[]),{registerPath:pi,unregisterPath:xi,refreshOverflowKeys:ki,isSubPathKey:di,getKeyPath:Ii,getKeys:yi,getSubPathKeys:Di}}function W(ve){var Oe=_.useRef(ve);Oe.current=ve;var Qe=_.useCallback(function(){for(var Ye,it=arguments.length,mt=new Array(it),lt=0;lt<it;lt++)mt[lt]=arguments[lt];return(Ye=Oe.current)===null||Ye===void 0?void 0:Ye.call.apply(Ye,[Oe].concat(mt))},[]);return ve?Qe:void 0}var ae=Math.random().toFixed(5).toString().slice(2),ue=0;function ye(ve){var Oe=(0,X.Z)(ve,{value:ve}),Qe=(0,V.Z)(Oe,2),Ye=Qe[0],it=Qe[1];return _.useEffect(function(){ue+=1;var mt="".concat(ae,"-").concat(ue);it("rc-menu-uuid-".concat(mt))},[]),Ye}var Ce=K(99153),xe=K(84851),qe=K(19257),Fe=K(93046),$e=K(2738),ct=K(8654);function Le(ve,Oe,Qe,Ye){var it=_.useContext(I),mt=it.activeKey,lt=it.onActive,Et=it.onInactive,Xt={active:mt===ve};return Oe||(Xt.onMouseEnter=function(Dt){Qe==null||Qe({key:ve,domEvent:Dt}),lt(ve)},Xt.onMouseLeave=function(Dt){Ye==null||Ye({key:ve,domEvent:Dt}),Et(ve)}),Xt}function tt(ve){var Oe=_.useContext(I),Qe=Oe.mode,Ye=Oe.rtl,it=Oe.inlineIndent;if(Qe!=="inline")return null;var mt=ve;return Ye?{paddingRight:mt*it}:{paddingLeft:mt*it}}function Pt(ve){var Oe=ve.icon,Qe=ve.props,Ye=ve.children,it;return Oe===null||Oe===!1?null:(typeof Oe=="function"?it=_.createElement(Oe,(0,Se.Z)({},Qe)):typeof Oe!="boolean"&&(it=Oe),it||Ye||null)}var xt=["item"];function Ft(ve){var Oe=ve.item,Qe=(0,p.Z)(ve,xt);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."),Oe}}),Qe}var Gt=["title","attribute","elementRef"],ri=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],qt=["active"],ei=function(ve){(0,qe.Z)(Qe,ve);var Oe=(0,Fe.Z)(Qe);function Qe(){return(0,Ce.Z)(this,Qe),Oe.apply(this,arguments)}return(0,xe.Z)(Qe,[{key:"render",value:function(){var it=this.props,mt=it.title,lt=it.attribute,Et=it.elementRef,Xt=(0,p.Z)(it,Gt),Dt=(0,$e.Z)(Xt,["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 mt=="string"?mt:void 0},Dt,{ref:Et}))}}]),Qe}(_.Component),Jt=_.forwardRef(function(ve,Oe){var Qe=ve.style,Ye=ve.className,it=ve.eventKey,mt=ve.warnKey,lt=ve.disabled,Et=ve.itemIcon,Xt=ve.children,Dt=ve.role,ui=ve.onMouseEnter,jt=ve.onMouseLeave,pi=ve.onClick,xi=ve.onKeyDown,ki=ve.onFocus,Ii=(0,p.Z)(ve,ri),di=j(it),yi=_.useContext(I),Di=yi.prefixCls,wi=yi.onItemClick,Ti=yi.disabled,Ni=yi.overflowDisabled,mi=yi.itemIcon,Li=yi.selectedKeys,Qi=yi.onActive,Mi=_.useContext(J),Ci=Mi._internalRenderMenuItem,zi="".concat(Di,"-item"),ji=_.useRef(),Ji=_.useRef(),tn=Ti||lt,Gi=(0,ct.x1)(Oe,Ji),nn=Ie(it),Yi=function(rn){return{key:it,keyPath:(0,he.Z)(nn).reverse(),item:ji.current,domEvent:rn}},ii=Et||mi,Ct=Le(it,tn,ui,jt),gi=Ct.active,Pi=(0,p.Z)(Ct,qt),Fi=Li.includes(it),ln=tt(nn.length),cn=function(rn){if(!tn){var un=Yi(rn);pi==null||pi(Ft(un)),wi(un)}},sn=function(rn){if(xi==null||xi(rn),rn.which===oe.Z.ENTER){var un=Yi(rn);pi==null||pi(Ft(un)),wi(un)}},hn=function(rn){Qi(it),ki==null||ki(rn)},En={};ve.role==="option"&&(En["aria-selected"]=Fi);var Zi=_.createElement(ei,(0,B.Z)({ref:ji,elementRef:Gi,role:Dt===null?"none":Dt||"menuitem",tabIndex:lt?null:-1,"data-menu-id":Ni&&di?null:di},(0,$e.Z)(Ii,["extra"]),Pi,En,{component:"li","aria-disabled":lt,style:(0,Se.Z)((0,Se.Z)({},ln),Qe),className:ce()(zi,(0,fe.Z)((0,fe.Z)((0,fe.Z)({},"".concat(zi,"-active"),gi),"".concat(zi,"-selected"),Fi),"".concat(zi,"-disabled"),tn),Ye),onClick:cn,onKeyDown:sn,onFocus:hn}),Xt,_.createElement(Pt,{props:(0,Se.Z)((0,Se.Z)({},ve),{},{isSelected:Fi}),icon:ii}));return Ci&&(Zi=Ci(Zi,ve,{selected:Fi})),Zi});function Tt(ve,Oe){var Qe=ve.eventKey,Ye=ie(),it=Ie(Qe);return _.useEffect(function(){if(Ye)return Ye.registerPath(Qe,it),function(){Ye.unregisterPath(Qe,it)}},[it]),Ye?null:_.createElement(Jt,(0,B.Z)({},ve,{ref:Oe}))}var ot=_.forwardRef(Tt),dt=["className","children"],Ot=function(Oe,Qe){var Ye=Oe.className,it=Oe.children,mt=(0,p.Z)(Oe,dt),lt=_.useContext(I),Et=lt.prefixCls,Xt=lt.mode,Dt=lt.rtl;return _.createElement("ul",(0,B.Z)({className:ce()(Et,Dt&&"".concat(Et,"-rtl"),"".concat(Et,"-sub"),"".concat(Et,"-").concat(Xt==="inline"?"inline":"vertical"),Ye),role:"menu"},mt,{"data-menu-list":!0,ref:Qe}),it)},Bt=_.forwardRef(Ot);Bt.displayName="SubMenuList";var nt=Bt,vt=K(11592);function yt(ve,Oe){return(0,vt.Z)(ve).map(function(Qe,Ye){if(_.isValidElement(Qe)){var it,mt,lt=Qe.key,Et=(it=(mt=Qe.props)===null||mt===void 0?void 0:mt.eventKey)!==null&&it!==void 0?it:lt,Xt=Et==null;Xt&&(Et="tmp_key-".concat([].concat((0,he.Z)(Oe),[Ye]).join("-")));var Dt={key:Et,eventKey:Et};return _.cloneElement(Qe,Dt)}return Qe})}var vi=K(65966),Vt={adjustX:1,adjustY:1},ai={topLeft:{points:["bl","tl"],overflow:Vt},topRight:{points:["br","tr"],overflow:Vt},bottomLeft:{points:["tl","bl"],overflow:Vt},bottomRight:{points:["tr","br"],overflow:Vt},leftTop:{points:["tr","tl"],overflow:Vt},leftBottom:{points:["br","bl"],overflow:Vt},rightTop:{points:["tl","tr"],overflow:Vt},rightBottom:{points:["bl","br"],overflow:Vt}},wt={topLeft:{points:["bl","tl"],overflow:Vt},topRight:{points:["br","tr"],overflow:Vt},bottomLeft:{points:["tl","bl"],overflow:Vt},bottomRight:{points:["tr","br"],overflow:Vt},rightTop:{points:["tr","tl"],overflow:Vt},rightBottom:{points:["br","bl"],overflow:Vt},leftTop:{points:["tl","tr"],overflow:Vt},leftBottom:{points:["bl","br"],overflow:Vt}},We=null;function h(ve,Oe,Qe){if(Oe)return Oe;if(Qe)return Qe[ve]||Qe.other}var m={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function y(ve){var Oe=ve.prefixCls,Qe=ve.visible,Ye=ve.children,it=ve.popup,mt=ve.popupStyle,lt=ve.popupClassName,Et=ve.popupOffset,Xt=ve.disabled,Dt=ve.mode,ui=ve.onVisibleChange,jt=_.useContext(I),pi=jt.getPopupContainer,xi=jt.rtl,ki=jt.subMenuOpenDelay,Ii=jt.subMenuCloseDelay,di=jt.builtinPlacements,yi=jt.triggerSubMenuAction,Di=jt.forceSubMenuRender,wi=jt.rootClassName,Ti=jt.motion,Ni=jt.defaultMotions,mi=_.useState(!1),Li=(0,V.Z)(mi,2),Qi=Li[0],Mi=Li[1],Ci=xi?(0,Se.Z)((0,Se.Z)({},wt),di):(0,Se.Z)((0,Se.Z)({},ai),di),zi=m[Dt],ji=h(Dt,Ti,Ni),Ji=_.useRef(ji);Dt!=="inline"&&(Ji.current=ji);var tn=(0,Se.Z)((0,Se.Z)({},Ji.current),{},{leavedClassName:"".concat(Oe,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Gi=_.useRef();return _.useEffect(function(){return Gi.current=(0,Ae.Z)(function(){Mi(Qe)}),function(){Ae.Z.cancel(Gi.current)}},[Qe]),_.createElement(vi.Z,{prefixCls:Oe,popupClassName:ce()("".concat(Oe,"-popup"),(0,fe.Z)({},"".concat(Oe,"-rtl"),xi),lt,wi),stretch:Dt==="horizontal"?"minWidth":null,getPopupContainer:pi,builtinPlacements:Ci,popupPlacement:zi,popupVisible:Qi,popup:it,popupStyle:mt,popupAlign:Et&&{offset:Et},action:Xt?[]:[yi],mouseEnterDelay:ki,mouseLeaveDelay:Ii,onPopupVisibleChange:ui,forceRender:Di,popupMotion:tn,fresh:!0},Ye)}var C=K(77900);function Z(ve){var Oe=ve.id,Qe=ve.open,Ye=ve.keyPath,it=ve.children,mt="inline",lt=_.useContext(I),Et=lt.prefixCls,Xt=lt.forceSubMenuRender,Dt=lt.motion,ui=lt.defaultMotions,jt=lt.mode,pi=_.useRef(!1);pi.current=jt===mt;var xi=_.useState(!pi.current),ki=(0,V.Z)(xi,2),Ii=ki[0],di=ki[1],yi=pi.current?Qe:!1;_.useEffect(function(){pi.current&&di(!1)},[jt]);var Di=(0,Se.Z)({},h(mt,Dt,ui));Ye.length>1&&(Di.motionAppear=!1);var wi=Di.onVisibleChanged;return Di.onVisibleChanged=function(Ti){return!pi.current&&!Ti&&di(!0),wi==null?void 0:wi(Ti)},Ii?null:_.createElement(R,{mode:mt,locked:!pi.current},_.createElement(C.default,(0,B.Z)({visible:yi},Di,{forceRender:Xt,removeOnLeave:!1,leavedClassName:"".concat(Et,"-hidden")}),function(Ti){var Ni=Ti.className,mi=Ti.style;return _.createElement(nt,{id:Oe,className:Ni,style:mi},it)}))}var pe=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],be=["active"],at=_.forwardRef(function(ve,Oe){var Qe=ve.style,Ye=ve.className,it=ve.title,mt=ve.eventKey,lt=ve.warnKey,Et=ve.disabled,Xt=ve.internalPopupClose,Dt=ve.children,ui=ve.itemIcon,jt=ve.expandIcon,pi=ve.popupClassName,xi=ve.popupOffset,ki=ve.popupStyle,Ii=ve.onClick,di=ve.onMouseEnter,yi=ve.onMouseLeave,Di=ve.onTitleClick,wi=ve.onTitleMouseEnter,Ti=ve.onTitleMouseLeave,Ni=(0,p.Z)(ve,pe),mi=j(mt),Li=_.useContext(I),Qi=Li.prefixCls,Mi=Li.mode,Ci=Li.openKeys,zi=Li.disabled,ji=Li.overflowDisabled,Ji=Li.activeKey,tn=Li.selectedKeys,Gi=Li.itemIcon,nn=Li.expandIcon,Yi=Li.onItemClick,ii=Li.onOpenChange,Ct=Li.onActive,gi=_.useContext(J),Pi=gi._internalRenderSubMenuItem,Fi=_.useContext(Te),ln=Fi.isSubPathKey,cn=Ie(),sn="".concat(Qi,"-submenu"),hn=zi||Et,En=_.useRef(),Zi=_.useRef(),mn=ui!=null?ui:Gi,rn=jt!=null?jt:nn,un=Ci.includes(mt),gn=!ji&&un,_i=ln(tn,mt),dn=Le(mt,hn,wi,Ti),pn=dn.active,bn=(0,p.Z)(dn,be),Ln=_.useState(!1),Wn=(0,V.Z)(Ln,2),Hn=Wn[0],Fn=Wn[1],Bi=function(Ui){hn||Fn(Ui)},ts=function(Ui){Bi(!0),di==null||di({key:mt,domEvent:Ui})},as=function(Ui){Bi(!1),yi==null||yi({key:mt,domEvent:Ui})},Zn=_.useMemo(function(){return pn||(Mi!=="inline"?Hn||ln([Ji],mt):!1)},[Mi,pn,Ji,Hn,mt,ln]),yn=tt(cn.length),os=function(Ui){hn||(Di==null||Di({key:mt,domEvent:Ui}),Mi==="inline"&&ii(mt,!un))},ls=W(function(bi){Ii==null||Ii(Ft(bi)),Yi(bi)}),Sn=function(Ui){Mi!=="inline"&&ii(mt,Ui)},Bn=function(){Ct(mt)},On=mi&&"".concat(mi,"-popup"),In=_.useMemo(function(){return _.createElement(Pt,{icon:Mi!=="horizontal"?rn:void 0,props:(0,Se.Z)((0,Se.Z)({},ve),{},{isOpen:gn,isSubMenu:!0})},_.createElement("i",{className:"".concat(sn,"-arrow")}))},[Mi,rn,ve,gn,sn]),fn=_.createElement("div",(0,B.Z)({role:"menuitem",style:yn,className:"".concat(sn,"-title"),tabIndex:hn?null:-1,ref:En,title:typeof it=="string"?it:null,"data-menu-id":ji&&mi?null:mi,"aria-expanded":gn,"aria-haspopup":!0,"aria-controls":On,"aria-disabled":hn,onClick:os,onFocus:Bn},bn),it,In),wn=_.useRef(Mi);if(Mi!=="inline"&&cn.length>1?wn.current="vertical":wn.current=Mi,!ji){var zn=wn.current;fn=_.createElement(y,{mode:zn,prefixCls:sn,visible:!Xt&&gn&&Mi!=="inline",popupClassName:pi,popupOffset:xi,popupStyle:ki,popup:_.createElement(R,{mode:zn==="horizontal"?"vertical":zn},_.createElement(nt,{id:On,ref:Zi},Dt)),disabled:hn,onVisibleChange:Sn},fn)}var an=_.createElement(l.Z.Item,(0,B.Z)({ref:Oe,role:"none"},Ni,{component:"li",style:Qe,className:ce()(sn,"".concat(sn,"-").concat(Mi),Ye,(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)({},"".concat(sn,"-open"),gn),"".concat(sn,"-active"),Zn),"".concat(sn,"-selected"),_i),"".concat(sn,"-disabled"),hn)),onMouseEnter:ts,onMouseLeave:as}),fn,!ji&&_.createElement(Z,{id:On,open:gn,keyPath:cn},Dt));return Pi&&(an=Pi(an,ve,{selected:_i,active:Zn,open:gn,disabled:hn})),_.createElement(R,{onItemClick:ls,mode:Mi==="horizontal"?"vertical":Mi,itemIcon:mn,expandIcon:rn},an)}),rt=_.forwardRef(function(ve,Oe){var Qe=ve.eventKey,Ye=ve.children,it=Ie(Qe),mt=yt(Ye,it),lt=ie();_.useEffect(function(){if(lt)return lt.registerPath(Qe,it),function(){lt.unregisterPath(Qe,it)}},[it]);var Et;return lt?Et=mt:Et=_.createElement(at,(0,B.Z)({ref:Oe},ve),mt),_.createElement(_e.Provider,{value:it},Et)}),_t=rt,$t=K(93664);function Ut(ve){var Oe=ve.className,Qe=ve.style,Ye=_.useContext(I),it=Ye.prefixCls,mt=ie();return mt?null:_.createElement("li",{role:"separator",className:ce()("".concat(it,"-item-divider"),Oe),style:Qe})}var At=["className","title","eventKey","children"],Zt=_.forwardRef(function(ve,Oe){var Qe=ve.className,Ye=ve.title,it=ve.eventKey,mt=ve.children,lt=(0,p.Z)(ve,At),Et=_.useContext(I),Xt=Et.prefixCls,Dt="".concat(Xt,"-item-group");return _.createElement("li",(0,B.Z)({ref:Oe,role:"presentation"},lt,{onClick:function(jt){return jt.stopPropagation()},className:ce()(Dt,Qe)}),_.createElement("div",{role:"presentation",className:"".concat(Dt,"-title"),title:typeof Ye=="string"?Ye:void 0},Ye),_.createElement("ul",{role:"group",className:"".concat(Dt,"-list")},mt))}),Lt=_.forwardRef(function(ve,Oe){var Qe=ve.eventKey,Ye=ve.children,it=Ie(Qe),mt=yt(Ye,it),lt=ie();return lt?mt:_.createElement(Zt,(0,B.Z)({ref:Oe},(0,$e.Z)(ve,["warnKey"])),mt)}),ft=Lt,ht=["label","children","key","type","extra"];function Ze(ve,Oe,Qe){var Ye=Oe.item,it=Oe.group,mt=Oe.submenu,lt=Oe.divider;return(ve||[]).map(function(Et,Xt){if(Et&&(0,$t.Z)(Et)==="object"){var Dt=Et,ui=Dt.label,jt=Dt.children,pi=Dt.key,xi=Dt.type,ki=Dt.extra,Ii=(0,p.Z)(Dt,ht),di=pi!=null?pi:"tmp-".concat(Xt);return jt||xi==="group"?xi==="group"?_.createElement(it,(0,B.Z)({key:di},Ii,{title:ui}),Ze(jt,Oe,Qe)):_.createElement(mt,(0,B.Z)({key:di},Ii,{title:ui}),Ze(jt,Oe,Qe)):xi==="divider"?_.createElement(lt,(0,B.Z)({key:di},Ii)):_.createElement(Ye,(0,B.Z)({key:di},Ii,{extra:ki}),ui,(!!ki||ki===0)&&_.createElement("span",{className:"".concat(Qe,"-item-extra")},ki))}return null}).filter(function(Et){return Et})}function je(ve,Oe,Qe,Ye,it){var mt=ve,lt=(0,Se.Z)({divider:Ut,item:ot,group:ft,submenu:_t},Ye);return Oe&&(mt=Ze(Oe,lt,it)),yt(mt,Qe)}var pt=["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"],ti=[],Qt=_.forwardRef(function(ve,Oe){var Qe,Ye=ve,it=Ye.prefixCls,mt=it===void 0?"rc-menu":it,lt=Ye.rootClassName,Et=Ye.style,Xt=Ye.className,Dt=Ye.tabIndex,ui=Dt===void 0?0:Dt,jt=Ye.items,pi=Ye.children,xi=Ye.direction,ki=Ye.id,Ii=Ye.mode,di=Ii===void 0?"vertical":Ii,yi=Ye.inlineCollapsed,Di=Ye.disabled,wi=Ye.disabledOverflow,Ti=Ye.subMenuOpenDelay,Ni=Ti===void 0?.1:Ti,mi=Ye.subMenuCloseDelay,Li=mi===void 0?.1:mi,Qi=Ye.forceSubMenuRender,Mi=Ye.defaultOpenKeys,Ci=Ye.openKeys,zi=Ye.activeKey,ji=Ye.defaultActiveFirst,Ji=Ye.selectable,tn=Ji===void 0?!0:Ji,Gi=Ye.multiple,nn=Gi===void 0?!1:Gi,Yi=Ye.defaultSelectedKeys,ii=Ye.selectedKeys,Ct=Ye.onSelect,gi=Ye.onDeselect,Pi=Ye.inlineIndent,Fi=Pi===void 0?24:Pi,ln=Ye.motion,cn=Ye.defaultMotions,sn=Ye.triggerSubMenuAction,hn=sn===void 0?"hover":sn,En=Ye.builtinPlacements,Zi=Ye.itemIcon,mn=Ye.expandIcon,rn=Ye.overflowedIndicator,un=rn===void 0?"...":rn,gn=Ye.overflowedIndicatorPopupClassName,_i=Ye.getPopupContainer,dn=Ye.onClick,pn=Ye.onOpenChange,bn=Ye.onKeyDown,Ln=Ye.openAnimation,Wn=Ye.openTransitionName,Hn=Ye._internalRenderMenuItem,Fn=Ye._internalRenderSubMenuItem,Bi=Ye._internalComponents,ts=(0,p.Z)(Ye,pt),as=_.useMemo(function(){return[je(pi,jt,ti,Bi,mt),je(pi,jt,ti,{},mt)]},[pi,jt,Bi]),Zn=(0,V.Z)(as,2),yn=Zn[0],os=Zn[1],ls=_.useState(!1),Sn=(0,V.Z)(ls,2),Bn=Sn[0],On=Sn[1],In=_.useRef(),fn=ye(ki),wn=xi==="rtl",zn=(0,X.Z)(Mi,{value:Ci,postState:function(Xe){return Xe||ti}}),an=(0,V.Z)(zn,2),bi=an[0],Ui=an[1],_n=function(Xe){var qi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function xn(){Ui(Xe),pn==null||pn(Xe)}qi?(0,b.flushSync)(xn):xn()},Dn=_.useState(bi),Yn=(0,V.Z)(Dn,2),Xn=Yn[0],qn=Yn[1],is=_.useRef(!1),si=_.useMemo(function(){return(di==="inline"||di==="vertical")&&yi?["vertical",yi]:[di,!1]},[di,yi]),Si=(0,V.Z)(si,2),Vi=Si[0],Xi=Si[1],Wi=Vi==="inline",Un=_.useState(Vi),ps=(0,V.Z)(Un,2),Cn=ps[0],us=ps[1],Br=_.useState(Xi),Is=(0,V.Z)(Br,2),Ur=Is[0],Kn=Is[1];_.useEffect(function(){us(Vi),Kn(Xi),is.current&&(Wi?Ui(Xn):_n(ti))},[Vi,Xi]);var nr=_.useState(0),sr=(0,V.Z)(nr,2),bs=sr[0],rr=sr[1],Ds=bs>=yn.length-1||Cn!=="horizontal"||wi;_.useEffect(function(){Wi&&qn(bi)},[bi]),_.useEffect(function(){return is.current=!0,function(){is.current=!1}},[]);var ns=M(),ar=ns.registerPath,Cs=ns.unregisterPath,or=ns.refreshOverflowKeys,Vs=ns.isSubPathKey,Qn=ns.getKeyPath,js=ns.getKeys,Ws=ns.getSubPathKeys,lr=_.useMemo(function(){return{registerPath:ar,unregisterPath:Cs}},[ar,Cs]),Kr=_.useMemo(function(){return{isSubPathKey:Vs}},[Vs]);_.useEffect(function(){or(Ds?ti:yn.slice(bs+1).map(function(on){return on.key}))},[bs,Ds]);var $r=(0,X.Z)(zi||ji&&((Qe=yn[0])===null||Qe===void 0?void 0:Qe.key),{value:zi}),ur=(0,V.Z)($r,2),Ss=ur[0],ks=ur[1],cr=W(function(on){ks(on)}),Hs=W(function(){ks(void 0)});(0,_.useImperativeHandle)(Oe,function(){return{list:In.current,focus:function(Xe){var qi,xn=js(),Tn=Re(xn,fn),Os=Tn.elements,As=Tn.key2element,vr=Tn.element2key,yr=De(In.current,Os),Er=Ss!=null?Ss:yr[0]?vr.get(yr[0]):(qi=yn.find(function(ms){return!ms.props.disabled}))===null||qi===void 0?void 0:qi.key,cs=As.get(Er);if(Er&&cs){var hs;cs==null||(hs=cs.focus)===null||hs===void 0||hs.call(cs,Xe)}}}});var hr=(0,X.Z)(Yi||[],{value:ii,postState:function(Xe){return Array.isArray(Xe)?Xe:Xe==null?ti:[Xe]}}),Zs=(0,V.Z)(hr,2),xs=Zs[0],dr=Zs[1],fr=function(Xe){if(tn){var qi=Xe.key,xn=xs.includes(qi),Tn;nn?xn?Tn=xs.filter(function(As){return As!==qi}):Tn=[].concat((0,he.Z)(xs),[qi]):Tn=[qi],dr(Tn);var Os=(0,Se.Z)((0,Se.Z)({},Xe),{},{selectedKeys:Tn});xn?gi==null||gi(Os):Ct==null||Ct(Os)}!nn&&bi.length&&Cn!=="inline"&&_n(ti)},Ts=W(function(on){dn==null||dn(Ft(on)),fr(on)}),pr=W(function(on,Xe){var qi=bi.filter(function(Tn){return Tn!==on});if(Xe)qi.push(on);else if(Cn!=="inline"){var xn=Ws(on);qi=qi.filter(function(Tn){return!xn.has(Tn)})}(0,P.Z)(bi,qi,!0)||_n(qi,!0)}),mr=function(Xe,qi){var xn=qi!=null?qi:!bi.includes(Xe);pr(Xe,xn)},gr=ke(Cn,Ss,wn,fn,In,js,Qn,ks,mr,bn);_.useEffect(function(){On(!0)},[]);var Gr=_.useMemo(function(){return{_internalRenderMenuItem:Hn,_internalRenderSubMenuItem:Fn}},[Hn,Fn]),_r=Cn!=="horizontal"||wi?yn:yn.map(function(on,Xe){return _.createElement(R,{key:on.key,overflowDisabled:Xe>bs},on)}),Ps=_.createElement(l.Z,(0,B.Z)({id:ki,ref:In,prefixCls:"".concat(mt,"-overflow"),component:"ul",itemComponent:ot,className:ce()(mt,"".concat(mt,"-root"),"".concat(mt,"-").concat(Cn),Xt,(0,fe.Z)((0,fe.Z)({},"".concat(mt,"-inline-collapsed"),Ur),"".concat(mt,"-rtl"),wn),lt),dir:xi,style:Et,role:"menu",tabIndex:ui,data:_r,renderRawItem:function(Xe){return Xe},renderRawRest:function(Xe){var qi=Xe.length,xn=qi?yn.slice(-qi):null;return _.createElement(_t,{eventKey:U,title:un,disabled:Ds,internalPopupClose:qi===0,popupClassName:gn},xn)},maxCount:Cn!=="horizontal"||wi?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Xe){rr(Xe)},onKeyDown:gr},ts));return _.createElement(J.Provider,{value:Gr},_.createElement(A.Provider,{value:fn},_.createElement(R,{prefixCls:mt,rootClassName:lt,mode:Cn,openKeys:bi,rtl:wn,disabled:Di,motion:Bn?ln:null,defaultMotions:Bn?cn:null,activeKey:Ss,onActive:cr,onInactive:Hs,selectedKeys:xs,inlineIndent:Fi,subMenuOpenDelay:Ni,subMenuCloseDelay:Li,forceSubMenuRender:Qi,builtinPlacements:En,triggerSubMenuAction:hn,getPopupContainer:_i,itemIcon:Zi,expandIcon:mn,onItemClick:Ts,onOpenChange:pr},_.createElement(Te.Provider,{value:Kr},Ps),_.createElement("div",{style:{display:"none"},"aria-hidden":!0},_.createElement(se.Provider,{value:lr},os)))))}),Mt=Qt,It=Mt;It.Item=ot,It.SubMenu=_t,It.ItemGroup=ft,It.Divider=Ut;var zt=It},11780:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return te}});var B=K(14809),fe=K(20439),Se=K(50298),he=K(62646),V=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,oe=S.invalidate,Ae=S.item,Be=S.renderItem,ze=S.responsive,St=S.responsiveDisabled,Nt=S.registerSize,ni=S.itemKey,Ve=S.className,gt=S.style,Kt=S.children,ut=S.display,hi=S.order,He=S.component,Ee=He===void 0?"div":He,De=(0,he.Z)(S,X),ne=ze&&!ut;function Re(Q){Nt(ni,Q)}V.useEffect(function(){return function(){Re(null)}},[]);var ke=Be&&Ae!==P?Be(Ae,{index:hi}):Kt,ee;oe||(ee={opacity:ne?0:1,height:ne?0:P,overflowY:ne?"hidden":P,order:ze?hi:P,pointerEvents:ne?"none":P,position:ne?"absolute":P});var Y={};ne&&(Y["aria-hidden"]=!0);var k=V.createElement(Ee,(0,B.Z)({className:me()(!oe&&z,Ve),style:(0,fe.Z)((0,fe.Z)({},ee),gt)},Y,De,{ref:v}),ke);return ze&&(k=V.createElement(ce.Z,{onResize:function(U){var M=U.offsetWidth;Re(M)},disabled:St},k)),k}var _=V.forwardRef(g);_.displayName="Item";var b=_,A=K(6089),N=K(4676),j=K(16089);function G(S){if(typeof MessageChannel=="undefined")(0,j.Z)(S);else{var v=new MessageChannel;v.port1.onmessage=function(){return S()},v.port2.postMessage(void 0)}}function L(){var S=V.useRef(null),v=function(oe){S.current||(S.current=[],G(function(){(0,N.unstable_batchedUpdates)(function(){S.current.forEach(function(Ae){Ae()}),S.current=null})})),S.current.push(oe)};return v}function I(S,v){var z=V.useState(v),oe=(0,Se.Z)(z,2),Ae=oe[0],Be=oe[1],ze=(0,A.Z)(function(St){S(function(){Be(St)})});return[Ae,ze]}var w=V.createContext(null),R=["component"],q=["className"],se=["className"],ie=function(v,z){var oe=V.useContext(w);if(!oe){var Ae=v.component,Be=Ae===void 0?"div":Ae,ze=(0,he.Z)(v,R);return V.createElement(Be,(0,B.Z)({},ze,{ref:z}))}var St=oe.className,Nt=(0,he.Z)(oe,q),ni=v.className,Ve=(0,he.Z)(v,se);return V.createElement(w.Provider,{value:null},V.createElement(b,(0,B.Z)({ref:z,className:me()(St,ni)},Nt,Ve)))},_e=V.forwardRef(ie);_e.displayName="RawItem";var Ie=_e,Te=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Ke="responsive",J="invalidate";function D(S){return"+ ".concat(S.length," ...")}function F(S,v){var z=S.prefixCls,oe=z===void 0?"rc-overflow":z,Ae=S.data,Be=Ae===void 0?[]:Ae,ze=S.renderItem,St=S.renderRawItem,Nt=S.itemKey,ni=S.itemWidth,Ve=ni===void 0?10:ni,gt=S.ssr,Kt=S.style,ut=S.className,hi=S.maxCount,He=S.renderRest,Ee=S.renderRawRest,De=S.suffix,ne=S.component,Re=ne===void 0?"div":ne,ke=S.itemComponent,ee=S.onVisibleChange,Y=(0,he.Z)(S,Te),k=gt==="full",Q=L(),U=I(Q,null),M=(0,Se.Z)(U,2),W=M[0],ae=M[1],ue=W||0,ye=I(Q,new Map),Ce=(0,Se.Z)(ye,2),xe=Ce[0],qe=Ce[1],Fe=I(Q,0),$e=(0,Se.Z)(Fe,2),ct=$e[0],Le=$e[1],tt=I(Q,0),Pt=(0,Se.Z)(tt,2),xt=Pt[0],Ft=Pt[1],Gt=I(Q,0),ri=(0,Se.Z)(Gt,2),qt=ri[0],ei=ri[1],Jt=(0,V.useState)(null),Tt=(0,Se.Z)(Jt,2),ot=Tt[0],dt=Tt[1],Ot=(0,V.useState)(null),Bt=(0,Se.Z)(Ot,2),nt=Bt[0],vt=Bt[1],yt=V.useMemo(function(){return nt===null&&k?Number.MAX_SAFE_INTEGER:nt||0},[nt,W]),vi=(0,V.useState)(!1),Vt=(0,Se.Z)(vi,2),ai=Vt[0],wt=Vt[1],We="".concat(oe,"-item"),h=Math.max(ct,xt),m=hi===Ke,y=Be.length&&m,C=hi===J,Z=y||typeof hi=="number"&&Be.length>hi,pe=(0,V.useMemo)(function(){var It=Be;return y?W===null&&k?It=Be:It=Be.slice(0,Math.min(Be.length,ue/Ve)):typeof hi=="number"&&(It=Be.slice(0,hi)),It},[Be,Ve,W,hi,y]),be=(0,V.useMemo)(function(){return y?Be.slice(yt+1):Be.slice(pe.length)},[Be,pe,y,yt]),at=(0,V.useCallback)(function(It,zt){var ve;return typeof Nt=="function"?Nt(It):(ve=Nt&&(It==null?void 0:It[Nt]))!==null&&ve!==void 0?ve:zt},[Nt]),rt=(0,V.useCallback)(ze||function(It){return It},[ze]);function _t(It,zt,ve){nt===It&&(zt===void 0||zt===ot)||(vt(It),ve||(wt(It<Be.length-1),ee==null||ee(It)),zt!==void 0&&dt(zt))}function $t(It,zt){ae(zt.clientWidth)}function Ut(It,zt){qe(function(ve){var Oe=new Map(ve);return zt===null?Oe.delete(It):Oe.set(It,zt),Oe})}function At(It,zt){Ft(zt),Le(xt)}function Zt(It,zt){ei(zt)}function Lt(It){return xe.get(at(pe[It],It))}(0,l.Z)(function(){if(ue&&typeof h=="number"&&pe){var It=qt,zt=pe.length,ve=zt-1;if(!zt){_t(0,null);return}for(var Oe=0;Oe<zt;Oe+=1){var Qe=Lt(Oe);if(k&&(Qe=Qe||0),Qe===void 0){_t(Oe-1,void 0,!0);break}if(It+=Qe,ve===0&&It<=ue||Oe===ve-1&&It+Lt(ve)<=ue){_t(ve,null);break}else if(It+h>ue){_t(Oe-1,It-Qe-qt+xt);break}}De&&Lt(0)+qt>ue&&dt(null)}},[ue,xe,xt,qt,at,pe]);var ft=ai&&!!be.length,ht={};ot!==null&&y&&(ht={position:"absolute",left:ot,top:0});var Ze={prefixCls:We,responsive:y,component:ke,invalidate:C},je=St?function(It,zt){var ve=at(It,zt);return V.createElement(w.Provider,{key:ve,value:(0,fe.Z)((0,fe.Z)({},Ze),{},{order:zt,item:It,itemKey:ve,registerSize:Ut,display:zt<=yt})},St(It,zt))}:function(It,zt){var ve=at(It,zt);return V.createElement(b,(0,B.Z)({},Ze,{order:zt,key:ve,item:It,renderItem:rt,itemKey:ve,registerSize:Ut,display:zt<=yt}))},pt={order:ft?yt:Number.MAX_SAFE_INTEGER,className:"".concat(We,"-rest"),registerSize:At,display:ft},ti=He||D,Qt=Ee?V.createElement(w.Provider,{value:(0,fe.Z)((0,fe.Z)({},Ze),pt)},Ee(be)):V.createElement(b,(0,B.Z)({},Ze,pt),typeof ti=="function"?ti(be):ti),Mt=V.createElement(Re,(0,B.Z)({className:me()(!C&&oe,ut),style:Kt,ref:v},Y),pe.map(je),Z?Qt:null,De&&V.createElement(b,(0,B.Z)({},Ze,{responsive:m,responsiveDisabled:!y,order:yt,className:"".concat(We,"-suffix"),registerSize:Zt,display:!0,style:ht}),De));return m?V.createElement(ce.Z,{onResize:$t,disabled:!y},Mt):Mt}var O=V.forwardRef(F);O.displayName="Overflow",O.Item=Ie,O.RESPONSIVE=Ke,O.INVALIDATE=J;var le=O,te=le},738:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return I}});var B=K(14809),fe=K(4635),Se=K(50298),he=K(62646),V=K(92310),p=K.n(V),me=K(18929),ce=K(10228),l=K(26112),X=K(59301);function P(w,R){var q=w.disabled,se=w.prefixCls,ie=w.character,_e=w.characterRender,Ie=w.index,Te=w.count,Ke=w.value,J=w.allowHalf,D=w.focused,F=w.onHover,O=w.onClick,le=function(ze){F(ze,Ie)},te=function(ze){O(ze,Ie)},S=function(ze){ze.keyCode===ce.Z.ENTER&&O(ze,Ie)},v=Ie+1,z=new Set([se]);Ke===0&&Ie===0&&D?z.add("".concat(se,"-focused")):J&&Ke+.5>=v&&Ke<v?(z.add("".concat(se,"-half")),z.add("".concat(se,"-active")),D&&z.add("".concat(se,"-focused"))):(v<=Ke?z.add("".concat(se,"-full")):z.add("".concat(se,"-zero")),v===Ke&&D&&z.add("".concat(se,"-focused")));var oe=typeof ie=="function"?ie(w):ie,Ae=X.createElement("li",{className:p()(Array.from(z)),ref:R},X.createElement("div",{onClick:q?null:te,onKeyDown:q?null:S,onMouseMove:q?null:le,role:"radio","aria-checked":Ke>Ie?"true":"false","aria-posinset":Ie+1,"aria-setsize":Te,tabIndex:q?-1:0},X.createElement("div",{className:"".concat(se,"-first")},oe),X.createElement("div",{className:"".concat(se,"-second")},oe)));return _e&&(Ae=_e(Ae,w)),Ae}var g=X.forwardRef(P);function _(){var w=X.useRef({});function R(se){return w.current[se]}function q(se){return function(ie){w.current[se]=ie}}return[R,q]}function b(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,ie=se.body,_e=se&&se.documentElement,Ie=w.getBoundingClientRect();return R=Ie.left,q=Ie.top,R-=_e.clientLeft||ie.clientLeft||0,q-=_e.clientTop||ie.clientTop||0,{left:R,top:q}}function N(w){var R=A(w),q=w.ownerDocument,se=q.defaultView||q.parentWindow;return R.left+=b(se),R.left}var j=["prefixCls","className","defaultValue","value","count","allowHalf","allowClear","keyboard","character","characterRender","disabled","direction","tabIndex","autoFocus","onHoverChange","onChange","onFocus","onBlur","onKeyDown","onMouseLeave"];function G(w,R){var q=w.prefixCls,se=q===void 0?"rc-rate":q,ie=w.className,_e=w.defaultValue,Ie=w.value,Te=w.count,Ke=Te===void 0?5:Te,J=w.allowHalf,D=J===void 0?!1:J,F=w.allowClear,O=F===void 0?!0:F,le=w.keyboard,te=le===void 0?!0:le,S=w.character,v=S===void 0?"\u2605":S,z=w.characterRender,oe=w.disabled,Ae=w.direction,Be=Ae===void 0?"ltr":Ae,ze=w.tabIndex,St=ze===void 0?0:ze,Nt=w.autoFocus,ni=w.onHoverChange,Ve=w.onChange,gt=w.onFocus,Kt=w.onBlur,ut=w.onKeyDown,hi=w.onMouseLeave,He=(0,he.Z)(w,j),Ee=_(),De=(0,Se.Z)(Ee,2),ne=De[0],Re=De[1],ke=X.useRef(null),ee=function(){if(!oe){var dt;(dt=ke.current)===null||dt===void 0||dt.focus()}};X.useImperativeHandle(R,function(){return{focus:ee,blur:function(){if(!oe){var dt;(dt=ke.current)===null||dt===void 0||dt.blur()}}}});var Y=(0,me.Z)(_e||0,{value:Ie}),k=(0,Se.Z)(Y,2),Q=k[0],U=k[1],M=(0,me.Z)(null),W=(0,Se.Z)(M,2),ae=W[0],ue=W[1],ye=function(dt,Ot){var Bt=Be==="rtl",nt=dt+1;if(D){var vt=ne(dt),yt=N(vt),vi=vt.clientWidth;(Bt&&Ot-yt>vi/2||!Bt&&Ot-yt<vi/2)&&(nt-=.5)}return nt},Ce=function(dt){U(dt),Ve==null||Ve(dt)},xe=X.useState(!1),qe=(0,Se.Z)(xe,2),Fe=qe[0],$e=qe[1],ct=function(){$e(!0),gt==null||gt()},Le=function(){$e(!1),Kt==null||Kt()},tt=X.useState(null),Pt=(0,Se.Z)(tt,2),xt=Pt[0],Ft=Pt[1],Gt=function(dt,Ot){var Bt=ye(Ot,dt.pageX);Bt!==ae&&(Ft(Bt),ue(null)),ni==null||ni(Bt)},ri=function(dt){oe||(Ft(null),ue(null),ni==null||ni(void 0)),dt&&(hi==null||hi(dt))},qt=function(dt,Ot){var Bt=ye(Ot,dt.pageX),nt=!1;O&&(nt=Bt===Q),ri(),Ce(nt?0:Bt),ue(nt?Bt:null)},ei=function(dt){var Ot=dt.keyCode,Bt=Be==="rtl",nt=D?.5:1;te&&(Ot===ce.Z.RIGHT&&Q<Ke&&!Bt?(Ce(Q+nt),dt.preventDefault()):Ot===ce.Z.LEFT&&Q>0&&!Bt||Ot===ce.Z.RIGHT&&Q>0&&Bt?(Ce(Q-nt),dt.preventDefault()):Ot===ce.Z.LEFT&&Q<Ke&&Bt&&(Ce(Q+nt),dt.preventDefault())),ut==null||ut(dt)};X.useEffect(function(){Nt&&!oe&&ee()},[]);var Jt=new Array(Ke).fill(0).map(function(ot,dt){return X.createElement(g,{ref:Re(dt),index:dt,count:Ke,disabled:oe,prefixCls:"".concat(se,"-star"),allowHalf:D,value:xt===null?Q:xt,onClick:qt,onHover:Gt,key:ot||dt,character:v,characterRender:z,focused:Fe})}),Tt=p()(se,ie,(0,fe.Z)((0,fe.Z)({},"".concat(se,"-disabled"),oe),"".concat(se,"-rtl"),Be==="rtl"));return X.createElement("ul",(0,B.Z)({className:Tt,onMouseLeave:ri,tabIndex:oe?-1:St,onFocus:oe?null:ct,onBlur:oe?null:Le,onKeyDown:oe?null:ei,ref:ke},(0,l.Z)(He,{aria:!0,data:!0,attr:!0})),Jt)}var L=X.forwardRef(G),I=L},29301:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return J}});var B=K(14809),fe=K(59301),Se=K(11592),he=K(48736),V=K(20439),p=K(93664),me=K(76846),ce=K(8654),l=fe.createContext(null);function X(D){var F=D.children,O=D.onBatchResize,le=fe.useRef(0),te=fe.useRef([]),S=fe.useContext(l),v=fe.useCallback(function(z,oe,Ae){le.current+=1;var Be=le.current;te.current.push({size:z,element:oe,data:Ae}),Promise.resolve().then(function(){Be===le.current&&(O==null||O(te.current),te.current=[])}),S==null||S(z,oe,Ae)},[O,S]);return fe.createElement(l.Provider,{value:v},F)}var P=K(76374),g=new Map;function _(D){D.forEach(function(F){var O,le=F.target;(O=g.get(le))===null||O===void 0||O.forEach(function(te){return te(le)})})}var b=new P.Z(_),A=null,N=null;function j(D,F){g.has(D)||(g.set(D,new Set),b.observe(D)),g.get(D).add(F)}function G(D,F){g.has(D)&&(g.get(D).delete(F),g.get(D).size||(b.unobserve(D),g.delete(D)))}var L=K(99153),I=K(84851),w=K(19257),R=K(93046),q=function(D){(0,w.Z)(O,D);var F=(0,R.Z)(O);function O(){return(0,L.Z)(this,O),F.apply(this,arguments)}return(0,I.Z)(O,[{key:"render",value:function(){return this.props.children}}]),O}(fe.Component);function se(D,F){var O=D.children,le=D.disabled,te=fe.useRef(null),S=fe.useRef(null),v=fe.useContext(l),z=typeof O=="function",oe=z?O(te):O,Ae=fe.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Be=!z&&fe.isValidElement(oe)&&(0,ce.Yr)(oe),ze=Be?(0,ce.C4)(oe):null,St=(0,ce.x1)(ze,te),Nt=function(){var Kt;return(0,me.ZP)(te.current)||(te.current&&(0,p.Z)(te.current)==="object"?(0,me.ZP)((Kt=te.current)===null||Kt===void 0?void 0:Kt.nativeElement):null)||(0,me.ZP)(S.current)};fe.useImperativeHandle(F,function(){return Nt()});var ni=fe.useRef(D);ni.current=D;var Ve=fe.useCallback(function(gt){var Kt=ni.current,ut=Kt.onResize,hi=Kt.data,He=gt.getBoundingClientRect(),Ee=He.width,De=He.height,ne=gt.offsetWidth,Re=gt.offsetHeight,ke=Math.floor(Ee),ee=Math.floor(De);if(Ae.current.width!==ke||Ae.current.height!==ee||Ae.current.offsetWidth!==ne||Ae.current.offsetHeight!==Re){var Y={width:ke,height:ee,offsetWidth:ne,offsetHeight:Re};Ae.current=Y;var k=ne===Math.round(Ee)?Ee:ne,Q=Re===Math.round(De)?De:Re,U=(0,V.Z)((0,V.Z)({},Y),{},{offsetWidth:k,offsetHeight:Q});v==null||v(U,gt,hi),ut&&Promise.resolve().then(function(){ut(U,gt)})}},[]);return fe.useEffect(function(){var gt=Nt();return gt&&!le&&j(gt,Ve),function(){return G(gt,Ve)}},[te.current,le]),fe.createElement(q,{ref:S},Be?fe.cloneElement(oe,{ref:St}):oe)}var ie=fe.forwardRef(se),_e=ie,Ie="rc-observer-key";function Te(D,F){var O=D.children,le=typeof O=="function"?[O]:(0,Se.Z)(O);return le.map(function(te,S){var v=(te==null?void 0:te.key)||"".concat(Ie,"-").concat(S);return fe.createElement(_e,(0,B.Z)({},D,{key:v,ref:S===0?F:void 0}),te)})}var Ke=fe.forwardRef(Te);Ke.Collection=X;var J=Ke},63158:function(Yt,st,K){"use strict";var B=K(14809),fe=K(4635),Se=K(50298),he=K(62646),V=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=V.forwardRef(function(g,_){var b,A=g.prefixCls,N=A===void 0?"rc-switch":A,j=g.className,G=g.checked,L=g.defaultChecked,I=g.disabled,w=g.loadingIcon,R=g.checkedChildren,q=g.unCheckedChildren,se=g.onClick,ie=g.onChange,_e=g.onKeyDown,Ie=(0,he.Z)(g,X),Te=(0,ce.Z)(!1,{value:G,defaultValue:L}),Ke=(0,Se.Z)(Te,2),J=Ke[0],D=Ke[1];function F(S,v){var z=J;return I||(z=S,D(z),ie==null||ie(z,v)),z}function O(S){S.which===l.Z.LEFT?F(!1,S):S.which===l.Z.RIGHT&&F(!0,S),_e==null||_e(S)}function le(S){var v=F(!J,S);se==null||se(v,S)}var te=me()(N,j,(b={},(0,fe.Z)(b,"".concat(N,"-checked"),J),(0,fe.Z)(b,"".concat(N,"-disabled"),I),b));return V.createElement("button",(0,B.Z)({},Ie,{type:"button",role:"switch","aria-checked":J,disabled:I,className:te,ref:_,onKeyDown:O,onClick:le}),w,V.createElement("span",{className:"".concat(N,"-inner")},V.createElement("span",{className:"".concat(N,"-inner-checked")},R),V.createElement("span",{className:"".concat(N,"-inner-unchecked")},q)))});P.displayName="Switch",st.Z=P},29125:function(Yt,st,K){"use strict";K.d(st,{G:function(){return he},Z:function(){return G}});var B=K(92310),fe=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,ie=L.className,_e=L.style;return Se.createElement("div",{className:fe()("".concat(w,"-content"),ie),style:_e},Se.createElement("div",{className:fe()("".concat(w,"-inner"),se),id:R,role:"tooltip",style:q},typeof I=="function"?I():I))}var V=K(14809),p=K(20439),me=K(62646),ce=K(65966),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,b=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"],N=function(I,w){var R=I.overlayClassName,q=I.trigger,se=q===void 0?["hover"]:q,ie=I.mouseEnterDelay,_e=ie===void 0?0:ie,Ie=I.mouseLeaveDelay,Te=Ie===void 0?.1:Ie,Ke=I.overlayStyle,J=I.prefixCls,D=J===void 0?"rc-tooltip":J,F=I.children,O=I.onVisibleChange,le=I.afterVisibleChange,te=I.transitionName,S=I.animation,v=I.motion,z=I.placement,oe=z===void 0?"right":z,Ae=I.align,Be=Ae===void 0?{}:Ae,ze=I.destroyTooltipOnHide,St=ze===void 0?!1:ze,Nt=I.defaultVisible,ni=I.getTooltipContainer,Ve=I.overlayInnerStyle,gt=I.arrowContent,Kt=I.overlay,ut=I.id,hi=I.showArrow,He=hi===void 0?!0:hi,Ee=I.classNames,De=I.styles,ne=(0,me.Z)(I,A),Re=(0,b.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:Re,bodyClassName:Ee==null?void 0:Ee.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},Ve),De==null?void 0:De.body)},Kt)},k=function(){var U=Se.Children.only(F),M=(U==null?void 0:U.props)||{},W=(0,p.Z)((0,p.Z)({},M),{},{"aria-describedby":Kt?Re:null});return Se.cloneElement(F,W)};return Se.createElement(ce.Z,(0,V.Z)({popupClassName:fe()(R,Ee==null?void 0:Ee.root),prefixCls:D,popup:Y,action:se,builtinPlacements:g,popupPlacement:oe,ref:ke,popupAlign:Be,getPopupContainer:ni,onPopupVisibleChange:O,afterPopupVisibleChange:le,popupTransitionName:te,popupAnimation:S,popupMotion:v,defaultPopupVisible:Nt,autoDestroy:St,mouseLeaveDelay:Te,popupStyle:(0,p.Z)((0,p.Z)({},Ke),De==null?void 0:De.root),mouseEnterDelay:_e,arrow:He},ee),k())},j=(0,Se.forwardRef)(N),G=j},639:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return I}});var B=K(14809),fe=K(4635),Se=K(20439),he=K(50298),V=K(62646),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,ie=R.isStart,_e=R.isEnd,Ie="".concat(q,"-indent-unit"),Te=[],Ke=0;Ke<se;Ke+=1)Te.push(p.createElement("span",{key:Ke,className:ce()(Ie,(0,fe.Z)((0,fe.Z)({},"".concat(Ie,"-start"),ie[Ke]),"".concat(Ie,"-end"),_e[Ke]))}));return p.createElement("span",{"aria-hidden":"true",className:"".concat(q,"-indent")},Te)},g=p.memo(P),_=K(65065),b=K(34061),A=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],N="open",j="close",G="---",L=function(R){var q,se,ie,_e=R.eventKey,Ie=R.className,Te=R.style,Ke=R.dragOver,J=R.dragOverGapTop,D=R.dragOverGapBottom,F=R.isLeaf,O=R.isStart,le=R.isEnd,te=R.expanded,S=R.selected,v=R.checked,z=R.halfChecked,oe=R.loading,Ae=R.domRef,Be=R.active,ze=R.data,St=R.onMouseMove,Nt=R.selectable,ni=(0,V.Z)(R,A),Ve=p.useContext(X.k),gt=p.useContext(X.y),Kt=p.useRef(null),ut=p.useState(!1),hi=(0,he.Z)(ut,2),He=hi[0],Ee=hi[1],De=!!(Ve.disabled||R.disabled||(q=gt.nodeDisabled)!==null&&q!==void 0&&q.call(gt,ze)),ne=p.useMemo(function(){return!Ve.checkable||R.checkable===!1?!1:Ve.checkable},[Ve.checkable,R.checkable]),Re=function(vt){De||Ve.onNodeSelect(vt,(0,b.F)(R))},ke=function(vt){De||!ne||R.disableCheckbox||Ve.onNodeCheck(vt,(0,b.F)(R),!v)},ee=p.useMemo(function(){return typeof Nt=="boolean"?Nt:Ve.selectable},[Nt,Ve.selectable]),Y=function(vt){Ve.onNodeClick(vt,(0,b.F)(R)),ee?Re(vt):ke(vt)},k=function(vt){Ve.onNodeDoubleClick(vt,(0,b.F)(R))},Q=function(vt){Ve.onNodeMouseEnter(vt,(0,b.F)(R))},U=function(vt){Ve.onNodeMouseLeave(vt,(0,b.F)(R))},M=function(vt){Ve.onNodeContextMenu(vt,(0,b.F)(R))},W=p.useMemo(function(){return!!(Ve.draggable&&(!Ve.draggable.nodeDraggable||Ve.draggable.nodeDraggable(ze)))},[Ve.draggable,ze]),ae=function(vt){vt.stopPropagation(),Ee(!0),Ve.onNodeDragStart(vt,R);try{vt.dataTransfer.setData("text/plain","")}catch(yt){}},ue=function(vt){vt.preventDefault(),vt.stopPropagation(),Ve.onNodeDragEnter(vt,R)},ye=function(vt){vt.preventDefault(),vt.stopPropagation(),Ve.onNodeDragOver(vt,R)},Ce=function(vt){vt.stopPropagation(),Ve.onNodeDragLeave(vt,R)},xe=function(vt){vt.stopPropagation(),Ee(!1),Ve.onNodeDragEnd(vt,R)},qe=function(vt){vt.preventDefault(),vt.stopPropagation(),Ee(!1),Ve.onNodeDrop(vt,R)},Fe=function(vt){oe||Ve.onNodeExpand(vt,(0,b.F)(R))},$e=p.useMemo(function(){var nt=(0,_.Z)(Ve.keyEntities,_e)||{},vt=nt.children;return!!(vt||[]).length},[Ve.keyEntities,_e]),ct=p.useMemo(function(){return F===!1?!1:F||!Ve.loadData&&!$e||Ve.loadData&&R.loaded&&!$e},[F,Ve.loadData,$e,R.loaded]);p.useEffect(function(){oe||typeof Ve.loadData=="function"&&te&&!ct&&!R.loaded&&Ve.onNodeLoad((0,b.F)(R))},[oe,Ve.loadData,Ve.onNodeLoad,te,ct,R]);var Le=p.useMemo(function(){var nt;return(nt=Ve.draggable)!==null&&nt!==void 0&&nt.icon?p.createElement("span",{className:"".concat(Ve.prefixCls,"-draggable-icon")},Ve.draggable.icon):null},[Ve.draggable]),tt=function(vt){var yt=R.switcherIcon||Ve.switcherIcon;return typeof yt=="function"?yt((0,Se.Z)((0,Se.Z)({},R),{},{isLeaf:vt})):yt},Pt=function(){if(ct){var vt=tt(!0);return vt!==!1?p.createElement("span",{className:ce()("".concat(Ve.prefixCls,"-switcher"),"".concat(Ve.prefixCls,"-switcher-noop"))},vt):null}var yt=tt(!1);return yt!==!1?p.createElement("span",{onClick:Fe,className:ce()("".concat(Ve.prefixCls,"-switcher"),"".concat(Ve.prefixCls,"-switcher_").concat(te?N:j))},yt):null},xt=p.useMemo(function(){if(!ne)return null;var nt=typeof ne!="boolean"?ne:null;return p.createElement("span",{className:ce()("".concat(Ve.prefixCls,"-checkbox"),(0,fe.Z)((0,fe.Z)((0,fe.Z)({},"".concat(Ve.prefixCls,"-checkbox-checked"),v),"".concat(Ve.prefixCls,"-checkbox-indeterminate"),!v&&z),"".concat(Ve.prefixCls,"-checkbox-disabled"),De||R.disableCheckbox)),onClick:ke,role:"checkbox","aria-checked":z?"mixed":v,"aria-disabled":De||R.disableCheckbox,"aria-label":"Select ".concat(typeof R.title=="string"?R.title:"tree node")},nt)},[ne,v,z,De,R.disableCheckbox,R.title]),Ft=p.useMemo(function(){return ct?null:te?N:j},[ct,te]),Gt=p.useMemo(function(){return p.createElement("span",{className:ce()("".concat(Ve.prefixCls,"-iconEle"),"".concat(Ve.prefixCls,"-icon__").concat(Ft||"docu"),(0,fe.Z)({},"".concat(Ve.prefixCls,"-icon_loading"),oe))})},[Ve.prefixCls,Ft,oe]),ri=p.useMemo(function(){var nt=!!Ve.draggable,vt=!R.disabled&&nt&&Ve.dragOverNodeKey===_e;return vt?Ve.dropIndicatorRender({dropPosition:Ve.dropPosition,dropLevelOffset:Ve.dropLevelOffset,indent:Ve.indent,prefixCls:Ve.prefixCls,direction:Ve.direction}):null},[Ve.dropPosition,Ve.dropLevelOffset,Ve.indent,Ve.prefixCls,Ve.direction,Ve.draggable,Ve.dragOverNodeKey,Ve.dropIndicatorRender]),qt=p.useMemo(function(){var nt=R.title,vt=nt===void 0?G:nt,yt="".concat(Ve.prefixCls,"-node-content-wrapper"),vi;if(Ve.showIcon){var Vt=R.icon||Ve.icon;vi=Vt?p.createElement("span",{className:ce()("".concat(Ve.prefixCls,"-iconEle"),"".concat(Ve.prefixCls,"-icon__customize"))},typeof Vt=="function"?Vt(R):Vt):Gt}else Ve.loadData&&oe&&(vi=Gt);var ai;return typeof vt=="function"?ai=vt(ze):Ve.titleRender?ai=Ve.titleRender(ze):ai=vt,p.createElement("span",{ref:Kt,title:typeof vt=="string"?vt:"",className:ce()(yt,"".concat(yt,"-").concat(Ft||"normal"),(0,fe.Z)({},"".concat(Ve.prefixCls,"-node-selected"),!De&&(S||He))),onMouseEnter:Q,onMouseLeave:U,onContextMenu:M,onClick:Y,onDoubleClick:k},vi,p.createElement("span",{className:"".concat(Ve.prefixCls,"-title")},ai),ri)},[Ve.prefixCls,Ve.showIcon,R,Ve.icon,Gt,Ve.titleRender,ze,Ft,Q,U,M,Y,k]),ei=(0,l.Z)(ni,{aria:!0,data:!0}),Jt=(0,_.Z)(Ve.keyEntities,_e)||{},Tt=Jt.level,ot=le[le.length-1],dt=!De&&W,Ot=Ve.draggingNodeKey===_e,Bt=Nt!==void 0?{"aria-selected":!!Nt}:void 0;return p.createElement("div",(0,B.Z)({ref:Ae,role:"treeitem","aria-expanded":F?void 0:te,className:ce()(Ie,"".concat(Ve.prefixCls,"-treenode"),(ie={},(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)(ie,"".concat(Ve.prefixCls,"-treenode-disabled"),De),"".concat(Ve.prefixCls,"-treenode-switcher-").concat(te?"open":"close"),!F),"".concat(Ve.prefixCls,"-treenode-checkbox-checked"),v),"".concat(Ve.prefixCls,"-treenode-checkbox-indeterminate"),z),"".concat(Ve.prefixCls,"-treenode-selected"),S),"".concat(Ve.prefixCls,"-treenode-loading"),oe),"".concat(Ve.prefixCls,"-treenode-active"),Be),"".concat(Ve.prefixCls,"-treenode-leaf-last"),ot),"".concat(Ve.prefixCls,"-treenode-draggable"),W),"dragging",Ot),(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)(ie,"drop-target",Ve.dropTargetKey===_e),"drop-container",Ve.dropContainerKey===_e),"drag-over",!De&&Ke),"drag-over-gap-top",!De&&J),"drag-over-gap-bottom",!De&&D),"filter-node",(se=Ve.filterTreeNode)===null||se===void 0?void 0:se.call(Ve,(0,b.F)(R))),"".concat(Ve.prefixCls,"-treenode-leaf"),ct))),style:Te,draggable:dt,onDragStart:dt?ae:void 0,onDragEnter:W?ue:void 0,onDragOver:W?ye:void 0,onDragLeave:W?Ce:void 0,onDrop:W?qe:void 0,onDragEnd:W?xe:void 0,onMouseMove:St},Bt,ei),p.createElement(g,{prefixCls:Ve.prefixCls,level:Tt,isStart:O,isEnd:le}),Le,Pt(),xt,qt)};L.isTreeNode=1;var I=L},30699:function(Yt,st,K){"use strict";K.d(st,{k:function(){return fe},y:function(){return Se}});var B=K(59301),fe=B.createContext(null),Se=B.createContext({})},29530:function(Yt,st,K){"use strict";K.d(st,{OF:function(){return _e.Z},y6:function(){return j.y},ZP:function(){return De}});var B=K(14809),fe=K(93664),Se=K(20439),he=K(95190),V=K(99153),p=K(84851),me=K(13028),ce=K(19257),l=K(93046),X=K(4635),P=K(92310),g=K.n(P),_=K(10228),b=K(26112),A=K(48736),N=K(59301),j=K(30699),G=function(Re){var ke=Re.dropPosition,ee=Re.dropLevelOffset,Y=Re.indent,k={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(ke){case-1:k.top=0,k.left=-ee*Y;break;case 1:k.bottom=0,k.left=-ee*Y;break;case 0:k.bottom=0,k.left=Y;break}return N.createElement("div",{style:k})},L=G;function I(ne){if(ne==null)throw new TypeError("Cannot destructure "+ne)}var w=K(50298),R=K(62646),q=K(34280),se=K(65283),ie=K(77900),_e=K(639);function Ie(ne,Re){var ke=N.useState(!1),ee=(0,w.Z)(ke,2),Y=ee[0],k=ee[1];(0,q.Z)(function(){if(Y)return ne(),function(){Re()}},[Y]),(0,q.Z)(function(){return k(!0),function(){k(!1)}},[])}var Te=Ie,Ke=K(34061),J=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],D=N.forwardRef(function(ne,Re){var ke=ne.className,ee=ne.style,Y=ne.motion,k=ne.motionNodes,Q=ne.motionType,U=ne.onMotionStart,M=ne.onMotionEnd,W=ne.active,ae=ne.treeNodeRequiredProps,ue=(0,R.Z)(ne,J),ye=N.useState(!0),Ce=(0,w.Z)(ye,2),xe=Ce[0],qe=Ce[1],Fe=N.useContext(j.k),$e=Fe.prefixCls,ct=k&&Q!=="hide";(0,q.Z)(function(){k&&ct!==xe&&qe(ct)},[k]);var Le=function(){k&&U()},tt=N.useRef(!1),Pt=function(){k&&!tt.current&&(tt.current=!0,M())};Te(Le,Pt);var xt=function(Gt){ct===Gt&&Pt()};return k?N.createElement(ie.default,(0,B.Z)({ref:Re,visible:xe},Y,{motionAppear:Q==="show",onVisibleChanged:xt}),function(Ft,Gt){var ri=Ft.className,qt=Ft.style;return N.createElement("div",{ref:Gt,className:g()("".concat($e,"-treenode-motion"),ri),style:qt},k.map(function(ei){var Jt=Object.assign({},(I(ei.data),ei.data)),Tt=ei.title,ot=ei.key,dt=ei.isStart,Ot=ei.isEnd;delete Jt.children;var Bt=(0,Ke.H8)(ot,ae);return N.createElement(_e.Z,(0,B.Z)({},Jt,Bt,{title:Tt,active:W,data:ei.data,key:ot,isStart:dt,isEnd:Ot}))}))}):N.createElement(_e.Z,(0,B.Z)({domRef:Re,className:ke,style:ee},ue,{active:W}))}),F=D;function O(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ke=ne.length,ee=Re.length;if(Math.abs(ke-ee)!==1)return{add:!1,key:null};function Y(k,Q){var U=new Map;k.forEach(function(W){U.set(W,!0)});var M=Q.filter(function(W){return!U.has(W)});return M.length===1?M[0]:null}return ke<ee?{add:!0,key:Y(ne,Re)}:{add:!1,key:Y(Re,ne)}}function le(ne,Re,ke){var ee=ne.findIndex(function(U){return U.key===ke}),Y=ne[ee+1],k=Re.findIndex(function(U){return U.key===ke});if(Y){var Q=Re.findIndex(function(U){return U.key===Y.key});return Re.slice(k+1,Q)}return Re.slice(k+1)}var te=["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()),oe={key:z},Ae={key:z,level:0,index:0,pos:"0",node:oe,nodes:[oe]},Be={parent:null,children:[],pos:Ae.pos,data:oe,title:null,key:z,isStart:[],isEnd:[]};function ze(ne,Re,ke,ee){return Re===!1||!ke?ne:ne.slice(0,Math.ceil(ke/ee)+1)}function St(ne){var Re=ne.key,ke=ne.pos;return(0,Ke.km)(Re,ke)}function Nt(ne){for(var Re=String(ne.data.key),ke=ne;ke.parent;)ke=ke.parent,Re="".concat(ke.data.key," > ").concat(Re);return Re}var ni=N.forwardRef(function(ne,Re){var ke=ne.prefixCls,ee=ne.data,Y=ne.selectable,k=ne.checkable,Q=ne.expandedKeys,U=ne.selectedKeys,M=ne.checkedKeys,W=ne.loadedKeys,ae=ne.loadingKeys,ue=ne.halfCheckedKeys,ye=ne.keyEntities,Ce=ne.disabled,xe=ne.dragging,qe=ne.dragOverNodeKey,Fe=ne.dropPosition,$e=ne.motion,ct=ne.height,Le=ne.itemHeight,tt=ne.virtual,Pt=ne.scrollWidth,xt=ne.focusable,Ft=ne.activeItem,Gt=ne.focused,ri=ne.tabIndex,qt=ne.onKeyDown,ei=ne.onFocus,Jt=ne.onBlur,Tt=ne.onActiveChange,ot=ne.onListChangeStart,dt=ne.onListChangeEnd,Ot=(0,R.Z)(ne,te),Bt=N.useRef(null),nt=N.useRef(null);N.useImperativeHandle(Re,function(){return{scrollTo:function(je){Bt.current.scrollTo(je)},getIndentWidth:function(){return nt.current.offsetWidth}}});var vt=N.useState(Q),yt=(0,w.Z)(vt,2),vi=yt[0],Vt=yt[1],ai=N.useState(ee),wt=(0,w.Z)(ai,2),We=wt[0],h=wt[1],m=N.useState(ee),y=(0,w.Z)(m,2),C=y[0],Z=y[1],pe=N.useState([]),be=(0,w.Z)(pe,2),at=be[0],rt=be[1],_t=N.useState(null),$t=(0,w.Z)(_t,2),Ut=$t[0],At=$t[1],Zt=N.useRef(ee);Zt.current=ee;function Lt(){var Ze=Zt.current;h(Ze),Z(Ze),rt([]),At(null),dt()}(0,q.Z)(function(){Vt(Q);var Ze=O(vi,Q);if(Ze.key!==null)if(Ze.add){var je=We.findIndex(function(zt){var ve=zt.key;return ve===Ze.key}),pt=ze(le(We,ee,Ze.key),tt,ct,Le),ti=We.slice();ti.splice(je+1,0,Be),Z(ti),rt(pt),At("show")}else{var Qt=ee.findIndex(function(zt){var ve=zt.key;return ve===Ze.key}),Mt=ze(le(ee,We,Ze.key),tt,ct,Le),It=ee.slice();It.splice(Qt+1,0,Be),Z(It),rt(Mt),At("hide")}else We!==ee&&(h(ee),Z(ee))},[Q,ee]),N.useEffect(function(){xe||Lt()},[xe]);var ft=$e?C:ee,ht={expandedKeys:Q,selectedKeys:U,loadedKeys:W,loadingKeys:ae,checkedKeys:M,halfCheckedKeys:ue,dragOverNodeKey:qe,dropPosition:Fe,keyEntities:ye};return N.createElement(N.Fragment,null,Gt&&Ft&&N.createElement("span",{style:S,"aria-live":"assertive"},Nt(Ft)),N.createElement("div",null,N.createElement("input",{style:S,disabled:xt===!1||Ce,tabIndex:xt!==!1?ri:null,onKeyDown:qt,onFocus:ei,onBlur:Jt,value:"",onChange:v,"aria-label":"for screen reader"})),N.createElement("div",{className:"".concat(ke,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},N.createElement("div",{className:"".concat(ke,"-indent")},N.createElement("div",{ref:nt,className:"".concat(ke,"-indent-unit")}))),N.createElement(se.Z,(0,B.Z)({},Ot,{data:ft,itemKey:St,height:ct,fullHeight:!1,virtual:tt,itemHeight:Le,scrollWidth:Pt,prefixCls:"".concat(ke,"-list"),ref:Bt,role:"tree",onVisibleChange:function(je){je.every(function(pt){return St(pt)!==z})&&Lt()}}),function(Ze){var je=Ze.pos,pt=Object.assign({},(I(Ze.data),Ze.data)),ti=Ze.title,Qt=Ze.key,Mt=Ze.isStart,It=Ze.isEnd,zt=(0,Ke.km)(Qt,je);delete pt.key,delete pt.children;var ve=(0,Ke.H8)(zt,ht);return N.createElement(F,(0,B.Z)({},pt,ve,{title:ti,active:!!Ft&&Qt===Ft.key,pos:je,data:Ze.data,isStart:Mt,isEnd:It,motion:$e,motionNodes:Qt===z?at:null,motionType:Ut,onMotionStart:ot,onMotionEnd:Lt,treeNodeRequiredProps:ht,onMouseMove:function(){Tt(null)}}))}))}),Ve=ni,gt=K(82661),Kt=K(34643),ut=K(65065),hi=10,He=function(ne){(0,ce.Z)(ke,ne);var Re=(0,l.Z)(ke);function ke(){var ee;(0,V.Z)(this,ke);for(var Y=arguments.length,k=new Array(Y),Q=0;Q<Y;Q++)k[Q]=arguments[Q];return ee=Re.call.apply(Re,[this].concat(k)),(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,Ke.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",N.createRef()),(0,X.Z)((0,me.Z)(ee),"onNodeDragStart",function(U,M){var W=ee.state,ae=W.expandedKeys,ue=W.keyEntities,ye=ee.props.onDragStart,Ce=M.eventKey;ee.dragNodeProps=M,ee.dragStartMousePosition={x:U.clientX,y:U.clientY};var xe=(0,gt._5)(ae,Ce);ee.setState({draggingNodeKey:Ce,dragChildrenKeys:(0,gt.wA)(Ce,ue),indent:ee.listRef.current.getIndentWidth()}),ee.setExpandedKeys(xe),window.addEventListener("dragend",ee.onWindowDragEnd),ye==null||ye({event:U,node:(0,Ke.F)(M)})}),(0,X.Z)((0,me.Z)(ee),"onNodeDragEnter",function(U,M){var W=ee.state,ae=W.expandedKeys,ue=W.keyEntities,ye=W.dragChildrenKeys,Ce=W.flattenNodes,xe=W.indent,qe=ee.props,Fe=qe.onDragEnter,$e=qe.onExpand,ct=qe.allowDrop,Le=qe.direction,tt=M.pos,Pt=M.eventKey;if(ee.currentMouseOverDroppableNodeKey!==Pt&&(ee.currentMouseOverDroppableNodeKey=Pt),!ee.dragNodeProps){ee.resetDragState();return}var xt=(0,gt.OM)(U,ee.dragNodeProps,M,xe,ee.dragStartMousePosition,ct,Ce,ue,ae,Le),Ft=xt.dropPosition,Gt=xt.dropLevelOffset,ri=xt.dropTargetKey,qt=xt.dropContainerKey,ei=xt.dropTargetPos,Jt=xt.dropAllowed,Tt=xt.dragOverNodeKey;if(ye.includes(ri)||!Jt){ee.resetDragState();return}if(ee.delayedDragEnterLogic||(ee.delayedDragEnterLogic={}),Object.keys(ee.delayedDragEnterLogic).forEach(function(ot){clearTimeout(ee.delayedDragEnterLogic[ot])}),ee.dragNodeProps.eventKey!==M.eventKey&&(U.persist(),ee.delayedDragEnterLogic[tt]=window.setTimeout(function(){if(ee.state.draggingNodeKey!==null){var ot=(0,he.Z)(ae),dt=(0,ut.Z)(ue,M.eventKey);dt&&(dt.children||[]).length&&(ot=(0,gt.L0)(ae,M.eventKey)),ee.props.hasOwnProperty("expandedKeys")||ee.setExpandedKeys(ot),$e==null||$e(ot,{node:(0,Ke.F)(M),expanded:!0,nativeEvent:U.nativeEvent})}},800)),ee.dragNodeProps.eventKey===ri&&Gt===0){ee.resetDragState();return}ee.setState({dragOverNodeKey:Tt,dropPosition:Ft,dropLevelOffset:Gt,dropTargetKey:ri,dropContainerKey:qt,dropTargetPos:ei,dropAllowed:Jt}),Fe==null||Fe({event:U,node:(0,Ke.F)(M),expandedKeys:ae})}),(0,X.Z)((0,me.Z)(ee),"onNodeDragOver",function(U,M){var W=ee.state,ae=W.dragChildrenKeys,ue=W.flattenNodes,ye=W.keyEntities,Ce=W.expandedKeys,xe=W.indent,qe=ee.props,Fe=qe.onDragOver,$e=qe.allowDrop,ct=qe.direction;if(ee.dragNodeProps){var Le=(0,gt.OM)(U,ee.dragNodeProps,M,xe,ee.dragStartMousePosition,$e,ue,ye,Ce,ct),tt=Le.dropPosition,Pt=Le.dropLevelOffset,xt=Le.dropTargetKey,Ft=Le.dropContainerKey,Gt=Le.dropTargetPos,ri=Le.dropAllowed,qt=Le.dragOverNodeKey;ae.includes(xt)||!ri||(ee.dragNodeProps.eventKey===xt&&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&&xt===ee.state.dropTargetKey&&Ft===ee.state.dropContainerKey&&Gt===ee.state.dropTargetPos&&ri===ee.state.dropAllowed&&qt===ee.state.dragOverNodeKey||ee.setState({dropPosition:tt,dropLevelOffset:Pt,dropTargetKey:xt,dropContainerKey:Ft,dropTargetPos:Gt,dropAllowed:ri,dragOverNodeKey:qt}),Fe==null||Fe({event:U,node:(0,Ke.F)(M)}))}}),(0,X.Z)((0,me.Z)(ee),"onNodeDragLeave",function(U,M){ee.currentMouseOverDroppableNodeKey===M.eventKey&&!U.currentTarget.contains(U.relatedTarget)&&(ee.resetDragState(),ee.currentMouseOverDroppableNodeKey=null);var W=ee.props.onDragLeave;W==null||W({event:U,node:(0,Ke.F)(M)})}),(0,X.Z)((0,me.Z)(ee),"onWindowDragEnd",function(U){ee.onNodeDragEnd(U,null,!0),window.removeEventListener("dragend",ee.onWindowDragEnd)}),(0,X.Z)((0,me.Z)(ee),"onNodeDragEnd",function(U,M){var W=ee.props.onDragEnd;ee.setState({dragOverNodeKey:null}),ee.cleanDragState(),W==null||W({event:U,node:(0,Ke.F)(M)}),ee.dragNodeProps=null,window.removeEventListener("dragend",ee.onWindowDragEnd)}),(0,X.Z)((0,me.Z)(ee),"onNodeDrop",function(U,M){var W,ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,ue=ee.state,ye=ue.dragChildrenKeys,Ce=ue.dropPosition,xe=ue.dropTargetKey,qe=ue.dropTargetPos,Fe=ue.dropAllowed;if(Fe){var $e=ee.props.onDrop;if(ee.setState({dragOverNodeKey:null}),ee.cleanDragState(),xe!==null){var ct=(0,Se.Z)((0,Se.Z)({},(0,Ke.H8)(xe,ee.getTreeNodeRequiredProps())),{},{active:((W=ee.getActiveItem())===null||W===void 0?void 0:W.key)===xe,data:(0,ut.Z)(ee.state.keyEntities,xe).node}),Le=ye.includes(xe);(0,A.ZP)(!Le,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var tt=(0,gt.yx)(qe),Pt={event:U,node:(0,Ke.F)(ct),dragNode:ee.dragNodeProps?(0,Ke.F)(ee.dragNodeProps):null,dragNodesKeys:[ee.dragNodeProps.eventKey].concat(ye),dropToGap:Ce!==0,dropPosition:Ce+Number(tt[tt.length-1])};ae||$e==null||$e(Pt),ee.dragNodeProps=null}}}),(0,X.Z)((0,me.Z)(ee),"cleanDragState",function(){var U=ee.state.draggingNodeKey;U!==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(U,M){var W=ee.state,ae=W.expandedKeys,ue=W.flattenNodes,ye=M.expanded,Ce=M.key,xe=M.isLeaf;if(!(xe||U.shiftKey||U.metaKey||U.ctrlKey)){var qe=ue.filter(function($e){return $e.key===Ce})[0],Fe=(0,Ke.F)((0,Se.Z)((0,Se.Z)({},(0,Ke.H8)(Ce,ee.getTreeNodeRequiredProps())),{},{data:qe.data}));ee.setExpandedKeys(ye?(0,gt._5)(ae,Ce):(0,gt.L0)(ae,Ce)),ee.onNodeExpand(U,Fe)}}),(0,X.Z)((0,me.Z)(ee),"onNodeClick",function(U,M){var W=ee.props,ae=W.onClick,ue=W.expandAction;ue==="click"&&ee.triggerExpandActionExpand(U,M),ae==null||ae(U,M)}),(0,X.Z)((0,me.Z)(ee),"onNodeDoubleClick",function(U,M){var W=ee.props,ae=W.onDoubleClick,ue=W.expandAction;ue==="doubleClick"&&ee.triggerExpandActionExpand(U,M),ae==null||ae(U,M)}),(0,X.Z)((0,me.Z)(ee),"onNodeSelect",function(U,M){var W=ee.state.selectedKeys,ae=ee.state,ue=ae.keyEntities,ye=ae.fieldNames,Ce=ee.props,xe=Ce.onSelect,qe=Ce.multiple,Fe=M.selected,$e=M[ye.key],ct=!Fe;ct?qe?W=(0,gt.L0)(W,$e):W=[$e]:W=(0,gt._5)(W,$e);var Le=W.map(function(tt){var Pt=(0,ut.Z)(ue,tt);return Pt?Pt.node:null}).filter(Boolean);ee.setUncontrolledState({selectedKeys:W}),xe==null||xe(W,{event:"select",selected:ct,node:M,selectedNodes:Le,nativeEvent:U.nativeEvent})}),(0,X.Z)((0,me.Z)(ee),"onNodeCheck",function(U,M,W){var ae=ee.state,ue=ae.keyEntities,ye=ae.checkedKeys,Ce=ae.halfCheckedKeys,xe=ee.props,qe=xe.checkStrictly,Fe=xe.onCheck,$e=M.key,ct,Le={event:"check",node:M,checked:W,nativeEvent:U.nativeEvent};if(qe){var tt=W?(0,gt.L0)(ye,$e):(0,gt._5)(ye,$e),Pt=(0,gt._5)(Ce,$e);ct={checked:tt,halfChecked:Pt},Le.checkedNodes=tt.map(function(ei){return(0,ut.Z)(ue,ei)}).filter(Boolean).map(function(ei){return ei.node}),ee.setUncontrolledState({checkedKeys:tt})}else{var xt=(0,Kt.S)([].concat((0,he.Z)(ye),[$e]),!0,ue),Ft=xt.checkedKeys,Gt=xt.halfCheckedKeys;if(!W){var ri=new Set(Ft);ri.delete($e);var qt=(0,Kt.S)(Array.from(ri),{checked:!1,halfCheckedKeys:Gt},ue);Ft=qt.checkedKeys,Gt=qt.halfCheckedKeys}ct=Ft,Le.checkedNodes=[],Le.checkedNodesPositions=[],Le.halfCheckedKeys=Gt,Ft.forEach(function(ei){var Jt=(0,ut.Z)(ue,ei);if(Jt){var Tt=Jt.node,ot=Jt.pos;Le.checkedNodes.push(Tt),Le.checkedNodesPositions.push({node:Tt,pos:ot})}}),ee.setUncontrolledState({checkedKeys:Ft},!1,{halfCheckedKeys:Gt})}Fe==null||Fe(ct,Le)}),(0,X.Z)((0,me.Z)(ee),"onNodeLoad",function(U){var M,W=U.key,ae=ee.state.keyEntities,ue=(0,ut.Z)(ae,W);if(!(ue!=null&&(M=ue.children)!==null&&M!==void 0&&M.length)){var ye=new Promise(function(Ce,xe){ee.setState(function(qe){var Fe=qe.loadedKeys,$e=Fe===void 0?[]:Fe,ct=qe.loadingKeys,Le=ct===void 0?[]:ct,tt=ee.props,Pt=tt.loadData,xt=tt.onLoad;if(!Pt||$e.includes(W)||Le.includes(W))return null;var Ft=Pt(U);return Ft.then(function(){var Gt=ee.state.loadedKeys,ri=(0,gt.L0)(Gt,W);xt==null||xt(ri,{event:"load",node:U}),ee.setUncontrolledState({loadedKeys:ri}),ee.setState(function(qt){return{loadingKeys:(0,gt._5)(qt.loadingKeys,W)}}),Ce()}).catch(function(Gt){if(ee.setState(function(qt){return{loadingKeys:(0,gt._5)(qt.loadingKeys,W)}}),ee.loadingRetryTimes[W]=(ee.loadingRetryTimes[W]||0)+1,ee.loadingRetryTimes[W]>=hi){var ri=ee.state.loadedKeys;(0,A.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),ee.setUncontrolledState({loadedKeys:(0,gt.L0)(ri,W)}),Ce()}xe(Gt)}),{loadingKeys:(0,gt.L0)(Le,W)}})});return ye.catch(function(){}),ye}}),(0,X.Z)((0,me.Z)(ee),"onNodeMouseEnter",function(U,M){var W=ee.props.onMouseEnter;W==null||W({event:U,node:M})}),(0,X.Z)((0,me.Z)(ee),"onNodeMouseLeave",function(U,M){var W=ee.props.onMouseLeave;W==null||W({event:U,node:M})}),(0,X.Z)((0,me.Z)(ee),"onNodeContextMenu",function(U,M){var W=ee.props.onRightClick;W&&(U.preventDefault(),W({event:U,node:M}))}),(0,X.Z)((0,me.Z)(ee),"onFocus",function(){var U=ee.props.onFocus;ee.setState({focused:!0});for(var M=arguments.length,W=new Array(M),ae=0;ae<M;ae++)W[ae]=arguments[ae];U==null||U.apply(void 0,W)}),(0,X.Z)((0,me.Z)(ee),"onBlur",function(){var U=ee.props.onBlur;ee.setState({focused:!1}),ee.onActiveChange(null);for(var M=arguments.length,W=new Array(M),ae=0;ae<M;ae++)W[ae]=arguments[ae];U==null||U.apply(void 0,W)}),(0,X.Z)((0,me.Z)(ee),"getTreeNodeRequiredProps",function(){var U=ee.state,M=U.expandedKeys,W=U.selectedKeys,ae=U.loadedKeys,ue=U.loadingKeys,ye=U.checkedKeys,Ce=U.halfCheckedKeys,xe=U.dragOverNodeKey,qe=U.dropPosition,Fe=U.keyEntities;return{expandedKeys:M||[],selectedKeys:W||[],loadedKeys:ae||[],loadingKeys:ue||[],checkedKeys:ye||[],halfCheckedKeys:Ce||[],dragOverNodeKey:xe,dropPosition:qe,keyEntities:Fe}}),(0,X.Z)((0,me.Z)(ee),"setExpandedKeys",function(U){var M=ee.state,W=M.treeData,ae=M.fieldNames,ue=(0,Ke.oH)(W,U,ae);ee.setUncontrolledState({expandedKeys:U,flattenNodes:ue},!0)}),(0,X.Z)((0,me.Z)(ee),"onNodeExpand",function(U,M){var W=ee.state.expandedKeys,ae=ee.state,ue=ae.listChanging,ye=ae.fieldNames,Ce=ee.props,xe=Ce.onExpand,qe=Ce.loadData,Fe=M.expanded,$e=M[ye.key];if(!ue){var ct=W.includes($e),Le=!Fe;if((0,A.ZP)(Fe&&ct||!Fe&&!ct,"Expand state not sync with index check"),W=Le?(0,gt.L0)(W,$e):(0,gt._5)(W,$e),ee.setExpandedKeys(W),xe==null||xe(W,{node:M,expanded:Le,nativeEvent:U.nativeEvent}),Le&&qe){var tt=ee.onNodeLoad(M);tt&&tt.then(function(){var Pt=(0,Ke.oH)(ee.state.treeData,W,ye);ee.setUncontrolledState({flattenNodes:Pt})}).catch(function(){var Pt=ee.state.expandedKeys,xt=(0,gt._5)(Pt,$e);ee.setExpandedKeys(xt)})}}}),(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(U){var M=ee.state.activeKey,W=ee.props,ae=W.onActiveChange,ue=W.itemScrollOffset,ye=ue===void 0?0:ue;M!==U&&(ee.setState({activeKey:U}),U!==null&&ee.scrollTo({key:U,offset:ye}),ae==null||ae(U))}),(0,X.Z)((0,me.Z)(ee),"getActiveItem",function(){var U=ee.state,M=U.activeKey,W=U.flattenNodes;return M===null?null:W.find(function(ae){var ue=ae.key;return ue===M})||null}),(0,X.Z)((0,me.Z)(ee),"offsetActiveKey",function(U){var M=ee.state,W=M.flattenNodes,ae=M.activeKey,ue=W.findIndex(function(xe){var qe=xe.key;return qe===ae});ue===-1&&U<0&&(ue=W.length),ue=(ue+U+W.length)%W.length;var ye=W[ue];if(ye){var Ce=ye.key;ee.onActiveChange(Ce)}else ee.onActiveChange(null)}),(0,X.Z)((0,me.Z)(ee),"onKeyDown",function(U){var M=ee.state,W=M.activeKey,ae=M.expandedKeys,ue=M.checkedKeys,ye=M.fieldNames,Ce=ee.props,xe=Ce.onKeyDown,qe=Ce.checkable,Fe=Ce.selectable;switch(U.which){case _.Z.UP:{ee.offsetActiveKey(-1),U.preventDefault();break}case _.Z.DOWN:{ee.offsetActiveKey(1),U.preventDefault();break}}var $e=ee.getActiveItem();if($e&&$e.data){var ct=ee.getTreeNodeRequiredProps(),Le=$e.data.isLeaf===!1||!!($e.data[ye.children]||[]).length,tt=(0,Ke.F)((0,Se.Z)((0,Se.Z)({},(0,Ke.H8)(W,ct)),{},{data:$e.data,active:!0}));switch(U.which){case _.Z.LEFT:{Le&&ae.includes(W)?ee.onNodeExpand({},tt):$e.parent&&ee.onActiveChange($e.parent.key),U.preventDefault();break}case _.Z.RIGHT:{Le&&!ae.includes(W)?ee.onNodeExpand({},tt):$e.children&&$e.children.length&&ee.onActiveChange($e.children[0].key),U.preventDefault();break}case _.Z.ENTER:case _.Z.SPACE:{qe&&!tt.disabled&&tt.checkable!==!1&&!tt.disableCheckbox?ee.onNodeCheck({},tt,!ue.includes(W)):!qe&&Fe&&!tt.disabled&&tt.selectable!==!1&&ee.onNodeSelect({},tt);break}}}xe==null||xe(U)}),(0,X.Z)((0,me.Z)(ee),"setUncontrolledState",function(U){var M=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 ae=!1,ue=!0,ye={};Object.keys(U).forEach(function(Ce){if(ee.props.hasOwnProperty(Ce)){ue=!1;return}ae=!0,ye[Ce]=U[Ce]}),ae&&(!M||ue)&&ee.setState((0,Se.Z)((0,Se.Z)({},ye),W))}}),(0,X.Z)((0,me.Z)(ee),"scrollTo",function(U){ee.listRef.current.scrollTo(U)}),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,k=Y.activeKey,Q=Y.itemScrollOffset,U=Q===void 0?0:Q;k!==void 0&&k!==this.state.activeKey&&(this.setState({activeKey:k}),k!==null&&this.scrollTo({key:k,offset:U}))}},{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,k=Y.focused,Q=Y.flattenNodes,U=Y.keyEntities,M=Y.draggingNodeKey,W=Y.activeKey,ae=Y.dropLevelOffset,ue=Y.dropContainerKey,ye=Y.dropTargetKey,Ce=Y.dropPosition,xe=Y.dragOverNodeKey,qe=Y.indent,Fe=this.props,$e=Fe.prefixCls,ct=Fe.className,Le=Fe.style,tt=Fe.showLine,Pt=Fe.focusable,xt=Fe.tabIndex,Ft=xt===void 0?0:xt,Gt=Fe.selectable,ri=Fe.showIcon,qt=Fe.icon,ei=Fe.switcherIcon,Jt=Fe.draggable,Tt=Fe.checkable,ot=Fe.checkStrictly,dt=Fe.disabled,Ot=Fe.motion,Bt=Fe.loadData,nt=Fe.filterTreeNode,vt=Fe.height,yt=Fe.itemHeight,vi=Fe.scrollWidth,Vt=Fe.virtual,ai=Fe.titleRender,wt=Fe.dropIndicatorRender,We=Fe.onContextMenu,h=Fe.onScroll,m=Fe.direction,y=Fe.rootClassName,C=Fe.rootStyle,Z=(0,b.Z)(this.props,{aria:!0,data:!0}),pe;Jt&&((0,fe.Z)(Jt)==="object"?pe=Jt:typeof Jt=="function"?pe={nodeDraggable:Jt}:pe={});var be={prefixCls:$e,selectable:Gt,showIcon:ri,icon:qt,switcherIcon:ei,draggable:pe,draggingNodeKey:M,checkable:Tt,checkStrictly:ot,disabled:dt,keyEntities:U,dropLevelOffset:ae,dropContainerKey:ue,dropTargetKey:ye,dropPosition:Ce,dragOverNodeKey:xe,indent:qe,direction:m,dropIndicatorRender:wt,loadData:Bt,filterTreeNode:nt,titleRender:ai,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 N.createElement(j.k.Provider,{value:be},N.createElement("div",{className:g()($e,ct,y,(0,X.Z)((0,X.Z)((0,X.Z)({},"".concat($e,"-show-line"),tt),"".concat($e,"-focused"),k),"".concat($e,"-active-focused"),W!==null)),style:C},N.createElement(Ve,(0,B.Z)({ref:this.listRef,prefixCls:$e,style:Le,data:Q,disabled:dt,selectable:Gt,checkable:!!Tt,motion:Ot,dragging:M!==null,height:vt,itemHeight:yt,virtual:Vt,focusable:Pt,focused:k,tabIndex:Ft,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:We,onScroll:h,scrollWidth:vi},this.getTreeNodeRequiredProps(),Z))))}}],[{key:"getDerivedStateFromProps",value:function(Y,k){var Q=k.prevProps,U={prevProps:Y};function M(Ft){return!Q&&Y.hasOwnProperty(Ft)||Q&&Q[Ft]!==Y[Ft]}var W,ae=k.fieldNames;if(M("fieldNames")&&(ae=(0,Ke.w$)(Y.fieldNames),U.fieldNames=ae),M("treeData")?W=Y.treeData:M("children")&&((0,A.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),W=(0,Ke.zn)(Y.children)),W){U.treeData=W;var ue=(0,Ke.I8)(W,{fieldNames:ae});U.keyEntities=(0,Se.Z)((0,X.Z)({},z,Ae),ue.keyEntities)}var ye=U.keyEntities||k.keyEntities;if(M("expandedKeys")||Q&&M("autoExpandParent"))U.expandedKeys=Y.autoExpandParent||!Q&&Y.defaultExpandParent?(0,gt.r7)(Y.expandedKeys,ye):Y.expandedKeys;else if(!Q&&Y.defaultExpandAll){var Ce=(0,Se.Z)({},ye);delete Ce[z];var xe=[];Object.keys(Ce).forEach(function(Ft){var Gt=Ce[Ft];Gt.children&&Gt.children.length&&xe.push(Gt.key)}),U.expandedKeys=xe}else!Q&&Y.defaultExpandedKeys&&(U.expandedKeys=Y.autoExpandParent||Y.defaultExpandParent?(0,gt.r7)(Y.defaultExpandedKeys,ye):Y.defaultExpandedKeys);if(U.expandedKeys||delete U.expandedKeys,W||U.expandedKeys){var qe=(0,Ke.oH)(W||k.treeData,U.expandedKeys||k.expandedKeys,ae);U.flattenNodes=qe}if(Y.selectable&&(M("selectedKeys")?U.selectedKeys=(0,gt.BT)(Y.selectedKeys,Y):!Q&&Y.defaultSelectedKeys&&(U.selectedKeys=(0,gt.BT)(Y.defaultSelectedKeys,Y))),Y.checkable){var Fe;if(M("checkedKeys")?Fe=(0,gt.E6)(Y.checkedKeys)||{}:!Q&&Y.defaultCheckedKeys?Fe=(0,gt.E6)(Y.defaultCheckedKeys)||{}:W&&(Fe=(0,gt.E6)(Y.checkedKeys)||{checkedKeys:k.checkedKeys,halfCheckedKeys:k.halfCheckedKeys}),Fe){var $e=Fe,ct=$e.checkedKeys,Le=ct===void 0?[]:ct,tt=$e.halfCheckedKeys,Pt=tt===void 0?[]:tt;if(!Y.checkStrictly){var xt=(0,Kt.S)(Le,!0,ye);Le=xt.checkedKeys,Pt=xt.halfCheckedKeys}U.checkedKeys=Le,U.halfCheckedKeys=Pt}}return M("loadedKeys")&&(U.loadedKeys=Y.loadedKeys),U}}]),ke}(N.Component);(0,X.Z)(He,"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)(He,"TreeNode",_e.Z);var Ee=He,De=Ee},82661:function(Yt,st,K){"use strict";K.d(st,{BT:function(){return N},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(95190),fe=K(93664),Se=K(48736),he=K(59301),V=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 ie(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];_e.forEach(function(Ie){var Te=Ie.key,Ke=Ie.children;q.push(Te),ie(Ke)})}return ie(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 b(w){var R=P(w.pos);return Number(R[R.length-1])===0}function A(w,R,q,se,ie,_e,Ie,Te,Ke,J){var D,F=w.clientX,O=w.clientY,le=w.target.getBoundingClientRect(),te=le.top,S=le.height,v=(J==="rtl"?-1:1)*(((ie==null?void 0:ie.x)||0)-F),z=(v-12)/se,oe=Ke.filter(function(De){var ne;return(ne=Te[De])===null||ne===void 0||(ne=ne.children)===null||ne===void 0?void 0:ne.length}),Ae=(0,p.Z)(Te,q.eventKey);if(O<te+S/2){var Be=Ie.findIndex(function(De){return De.key===Ae.key}),ze=Be<=0?0:Be-1,St=Ie[ze].key;Ae=(0,p.Z)(Te,St)}var Nt=Ae.key,ni=Ae,Ve=Ae.key,gt=0,Kt=0;if(!oe.includes(Nt))for(var ut=0;ut<z&&_(Ae);ut+=1)Ae=Ae.parent,Kt+=1;var hi=R.data,He=Ae.node,Ee=!0;return b(Ae)&&Ae.level===0&&O<te+S/2&&_e({dragNode:hi,dropNode:He,dropPosition:-1})&&Ae.key===q.eventKey?gt=-1:(ni.children||[]).length&&oe.includes(Ve)?_e({dragNode:hi,dropNode:He,dropPosition:0})?gt=0:Ee=!1:Kt===0?z>-1.5?_e({dragNode:hi,dropNode:He,dropPosition:1})?gt=1:Ee=!1:_e({dragNode:hi,dropNode:He,dropPosition:0})?gt=0:_e({dragNode:hi,dropNode:He,dropPosition:1})?gt=1:Ee=!1:_e({dragNode:hi,dropNode:He,dropPosition:1})?gt=1:Ee=!1,{dropPosition:gt,dropLevelOffset:Kt,dropTargetKey:Ae.key,dropTargetPos:Ae.pos,dragOverNodeKey:Ve,dropContainerKey:gt===0?null:((D=Ae.parent)===null||D===void 0?void 0:D.key)||null,dropAllowed:Ee}}function N(w,R){if(w){var q=R.multiple;return q?w.slice():w.length?[w[0]]:w}}var j=function(R){return R};function G(w,R){if(!w)return[];var q=R||{},se=q.processProps,ie=se===void 0?j:se,_e=Array.isArray(w)?w:[w];return _e.map(function(Ie){var Te=Ie.children,Ke=_objectWithoutProperties(Ie,ce),J=G(Te,R);return React.createElement(TreeNode,_extends({key:Ke.key},ie(Ke)),J)})}function L(w){if(!w)return null;var R;if(Array.isArray(w))R={checkedKeys:w,halfCheckedKeys:void 0};else if((0,fe.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(ie){if(!q.has(ie)){var _e=(0,p.Z)(R,ie);if(_e){q.add(ie);var Ie=_e.parent,Te=_e.node;Te.disabled||Ie&&se(Ie.key)}}}return(w||[]).forEach(function(ie){se(ie)}),(0,B.Z)(q)}},34643:function(Yt,st,K){"use strict";K.d(st,{S:function(){return me}});var B=K(48736),fe=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 V(ce,l,X,P){for(var g=new Set(ce),_=new Set,b=0;b<=X;b+=1){var A=l.get(b)||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 N=new Set,j=X;j>=0;j-=1){var G=l.get(j)||new Set;G.forEach(function(L){var I=L.parent,w=L.node;if(!(P(w)||!L.parent||N.has(L.parent.key))){if(P(L.parent.node)){N.add(I.key);return}var R=!0,q=!1;(I.children||[]).filter(function(se){return!P(se.node)}).forEach(function(se){var ie=se.key,_e=g.has(ie);R&&!_e&&(R=!1),!q&&(_e||_.has(ie))&&(q=!0)}),R&&g.add(I.key),q&&_.add(I.key),N.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),b=new Set(l),A=0;A<=P;A+=1){var N=X.get(A)||new Set;N.forEach(function(I){var w=I.key,R=I.node,q=I.children,se=q===void 0?[]:q;!_.has(w)&&!b.has(w)&&!g(R)&&se.filter(function(ie){return!g(ie.node)}).forEach(function(ie){_.delete(ie.key)})})}b=new Set;for(var j=new Set,G=P;G>=0;G-=1){var L=X.get(G)||new Set;L.forEach(function(I){var w=I.parent,R=I.node;if(!(g(R)||!I.parent||j.has(I.parent.key))){if(g(I.parent.node)){j.add(w.key);return}var q=!0,se=!1;(w.children||[]).filter(function(ie){return!g(ie.node)}).forEach(function(ie){var _e=ie.key,Ie=_.has(_e);q&&!Ie&&(q=!1),!se&&(Ie||b.has(_e))&&(se=!0)}),q||_.delete(w.key),se&&b.add(w.key),j.add(w.key)}})}return{checkedKeys:Array.from(_),halfCheckedKeys:Array.from(Se(b,_))}}function me(ce,l,X,P){var g=[],_;P?_=P:_=he;var b=new Set(ce.filter(function(G){var L=!!(0,fe.Z)(X,G);return L||g.push(G),L})),A=new Map,N=0;Object.keys(X).forEach(function(G){var L=X[G],I=L.level,w=A.get(I);w||(w=new Set,A.set(I,w)),w.add(L),N=Math.max(N,I)}),(0,B.ZP)(!g.length,"Tree missing follow keys: ".concat(g.slice(0,100).map(function(G){return"'".concat(G,"'")}).join(", ")));var j;return l===!0?j=V(b,A,N,_):j=p(b,l.halfCheckedKeys,A,N,_),j}},65065:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return B}});function B(fe,Se){return fe[Se]}},34061:function(Yt,st,K){"use strict";K.d(st,{F:function(){return I},H8:function(){return L},I8:function(){return G},km:function(){return g},oH:function(){return N},w$:function(){return _},zn:function(){return A}});var B=K(93664),fe=K(95190),Se=K(20439),he=K(62646),V=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,ie=R.key,_e=R.children,Ie=q||"title";return{title:Ie,_title:se||[Ie],key:ie||"key",children:_e||"children"}}function b(w,R){var q=new Map;function se(ie){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(ie||[]).forEach(function(Ie){var Te=Ie[R.key],Ke=Ie[R.children];warning(Te!=null,"Tree node must have a certain key: [".concat(_e).concat(Te,"]"));var J=String(Te);warning(!q.has(J)||Te===null||Te===void 0,"Same 'key' exist in the Tree: ".concat(J)),q.set(J,!0),se(Ke,"".concat(_e).concat(J," > "))})}se(w)}function A(w){function R(q){var se=(0,V.Z)(q);return se.map(function(ie){if(!P(ie))return(0,me.ZP)(!ie,"Tree/TreeNode can only accept TreeNode as children."),null;var _e=ie.key,Ie=ie.props,Te=Ie.children,Ke=(0,he.Z)(Ie,l),J=(0,Se.Z)({key:_e},Ke),D=R(Te);return D.length&&(J.children=D),J}).filter(function(ie){return ie})}return R(w)}function N(w,R,q){var se=_(q),ie=se._title,_e=se.key,Ie=se.children,Te=new Set(R===!0?[]:R),Ke=[];function J(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return D.map(function(O,le){for(var te=X(F?F.pos:"0",le),S=g(O[_e],te),v,z=0;z<ie.length;z+=1){var oe=ie[z];if(O[oe]!==void 0){v=O[oe];break}}var Ae=Object.assign((0,p.Z)(O,[].concat((0,fe.Z)(ie),[_e,Ie])),{title:v,key:S,parent:F,pos:te,children:null,data:O,isStart:[].concat((0,fe.Z)(F?F.isStart:[]),[le===0]),isEnd:[].concat((0,fe.Z)(F?F.isEnd:[]),[le===D.length-1])});return Ke.push(Ae),R===!0||Te.has(S)?Ae.children=J(O[Ie]||[],Ae):Ae.children=[],Ae})}return J(w),Ke}function j(w,R,q){var se={};(0,B.Z)(q)==="object"?se=q:se={externalGetKey:q},se=se||{};var ie=se,_e=ie.childrenPropName,Ie=ie.externalGetKey,Te=ie.fieldNames,Ke=_(Te),J=Ke.key,D=Ke.children,F=_e||D,O;Ie?typeof Ie=="string"?O=function(S){return S[Ie]}:typeof Ie=="function"&&(O=function(S){return Ie(S)}):O=function(S,v){return g(S[J],v)};function le(te,S,v,z){var oe=te?te[F]:w,Ae=te?X(v.pos,S):"0",Be=te?[].concat((0,fe.Z)(z),[te]):[];if(te){var ze=O(te,Ae),St={node:te,index:S,pos:Ae,key:ze,parentPos:v.node?v.pos:null,level:v.level+1,nodes:Be};R(St)}oe&&oe.forEach(function(Nt,ni){le(Nt,ni,{node:te,pos:Ae,level:v?v.level+1:-1},Be)})}le(null)}function G(w){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=R.initWrapper,se=R.processEntity,ie=R.onProcessFinished,_e=R.externalGetKey,Ie=R.childrenPropName,Te=R.fieldNames,Ke=arguments.length>2?arguments[2]:void 0,J=_e||Ke,D={},F={},O={posEntities:D,keyEntities:F};return q&&(O=q(O)||O),j(w,function(le){var te=le.node,S=le.index,v=le.pos,z=le.key,oe=le.parentPos,Ae=le.level,Be=le.nodes,ze={node:te,nodes:Be,index:S,key:z,pos:v,level:Ae},St=g(z,v);D[v]=ze,F[St]=ze,ze.parent=D[oe],ze.parent&&(ze.parent.children=ze.parent.children||[],ze.parent.children.push(ze)),se&&se(ze,O)},{externalGetKey:J,childrenPropName:Ie,fieldNames:Te}),ie&&ie(O),O}function L(w,R){var q=R.expandedKeys,se=R.selectedKeys,ie=R.loadedKeys,_e=R.loadingKeys,Ie=R.checkedKeys,Te=R.halfCheckedKeys,Ke=R.dragOverNodeKey,J=R.dropPosition,D=R.keyEntities,F=(0,ce.Z)(D,w),O={eventKey:w,expanded:q.indexOf(w)!==-1,selected:se.indexOf(w)!==-1,loaded:ie.indexOf(w)!==-1,loading:_e.indexOf(w)!==-1,checked:Ie.indexOf(w)!==-1,halfChecked:Te.indexOf(w)!==-1,pos:String(F?F.pos:""),dragOver:Ke===w&&J===0,dragOverGapTop:Ke===w&&J===-1,dragOverGapBottom:Ke===w&&J===1};return O}function I(w){var R=w.data,q=w.expanded,se=w.selected,ie=w.checked,_e=w.loaded,Ie=w.loading,Te=w.halfChecked,Ke=w.dragOver,J=w.dragOverGapTop,D=w.dragOverGapBottom,F=w.pos,O=w.active,le=w.eventKey,te=(0,Se.Z)((0,Se.Z)({},R),{},{expanded:q,selected:se,checked:ie,loaded:_e,loading:Ie,halfChecked:Te,dragOver:Ke,dragOverGapTop:J,dragOverGapBottom:D,pos:F,active:O,key:le});return"props"in te||Object.defineProperty(te,"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}}),te}},49658:function(Yt,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(Yt,st,K){"use strict";K.d(st,{Z:function(){return hi}});var B=K(14809),fe=K(93664),Se=K(20439),he=K(4635),V=K(50298),p=K(62646),me=K(92310),ce=K.n(me),l=K(29301),X=K(70425),P=K(34280),g=K(59301),_=K(4676),b=g.forwardRef(function(He,Ee){var De=He.height,ne=He.offsetY,Re=He.offsetX,ke=He.children,ee=He.prefixCls,Y=He.onInnerResize,k=He.innerProps,Q=He.rtl,U=He.extra,M={},W={display:"flex",flexDirection:"column"};return ne!==void 0&&(M={height:De,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",-Re),"position","absolute"),"left",0),"right",0),"top",0))),g.createElement("div",{style:M},g.createElement(l.Z,{onResize:function(ue){var ye=ue.offsetHeight;ye&&Y&&Y()}},g.createElement("div",(0,B.Z)({style:W,className:ce()((0,he.Z)({},"".concat(ee,"-holder-inner"),ee)),ref:Ee},k),ke,U)))});b.displayName="Filler";var A=b;function N(He){var Ee=He.children,De=He.setRef,ne=g.useCallback(function(Re){De(Re)},[]);return g.cloneElement(Ee,{ref:ne})}function j(He,Ee,De,ne,Re,ke,ee,Y){var k=Y.getKey;return He.slice(Ee,De+1).map(function(Q,U){var M=Ee+U,W=ee(Q,M,{style:{width:ne},offsetX:Re}),ae=k(Q);return g.createElement(N,{key:ae,setRef:function(ye){return ke(Q,ye)}},W)})}function G(He,Ee,De,ne){var Re=De-He,ke=Ee-De,ee=Math.min(Re,ke)*2;if(ne<=ee){var Y=Math.floor(ne/2);return ne%2?De+Y+1:De-Y}return Re>ke?De-(ne-ke):De+(ne-Re)}function L(He,Ee,De){var ne=He.length,Re=Ee.length,ke,ee;if(ne===0&&Re===0)return null;ne<Re?(ke=He,ee=Ee):(ke=Ee,ee=He);var Y={__EMPTY_ITEM__:!0};function k(ue){return ue!==void 0?De(ue):Y}for(var Q=null,U=Math.abs(ne-Re)!==1,M=0;M<ee.length;M+=1){var W=k(ke[M]),ae=k(ee[M]);if(W!==ae){Q=M,U=U||W!==k(ee[M+1]);break}}return Q===null?null:{index:Q,multiple:U}}function I(He,Ee,De){var ne=g.useState(He),Re=(0,V.Z)(ne,2),ke=Re[0],ee=Re[1],Y=g.useState(null),k=(0,V.Z)(Y,2),Q=k[0],U=k[1];return g.useEffect(function(){var M=L(ke||[],He||[],Ee);(M==null?void 0:M.index)!==void 0&&(De==null||De(M.index),U(He[M.index])),ee(He)},[He]),[Q]}var w=K(16089),R=(typeof navigator=="undefined"?"undefined":(0,fe.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),q=R,se=function(He,Ee,De,ne){var Re=(0,g.useRef)(!1),ke=(0,g.useRef)(null);function ee(){clearTimeout(ke.current),Re.current=!0,ke.current=setTimeout(function(){Re.current=!1},50)}var Y=(0,g.useRef)({top:He,bottom:Ee,left:De,right:ne});return Y.current.top=He,Y.current.bottom=Ee,Y.current.left=De,Y.current.right=ne,function(k,Q){var U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,M=k?Q<0&&Y.current.left||Q>0&&Y.current.right:Q<0&&Y.current.top||Q>0&&Y.current.bottom;return U&&M?(clearTimeout(ke.current),Re.current=!1):(!M||Re.current)&&ee(),!Re.current&&M}};function ie(He,Ee,De,ne,Re,ke,ee){var Y=(0,g.useRef)(0),k=(0,g.useRef)(null),Q=(0,g.useRef)(null),U=(0,g.useRef)(!1),M=se(Ee,De,ne,Re);function W(qe,Fe){if(w.Z.cancel(k.current),!M(!1,Fe)){var $e=qe;if(!$e._virtualHandled)$e._virtualHandled=!0;else return;Y.current+=Fe,Q.current=Fe,q||$e.preventDefault(),k.current=(0,w.Z)(function(){var ct=U.current?10:1;ee(Y.current*ct,!1),Y.current=0})}}function ae(qe,Fe){ee(Fe,!0),q||qe.preventDefault()}var ue=(0,g.useRef)(null),ye=(0,g.useRef)(null);function Ce(qe){if(He){w.Z.cancel(ye.current),ye.current=(0,w.Z)(function(){ue.current=null},2);var Fe=qe.deltaX,$e=qe.deltaY,ct=qe.shiftKey,Le=Fe,tt=$e;(ue.current==="sx"||!ue.current&&ct&&$e&&!Fe)&&(Le=$e,tt=0,ue.current="sx");var Pt=Math.abs(Le),xt=Math.abs(tt);ue.current===null&&(ue.current=ke&&Pt>xt?"x":"y"),ue.current==="y"?W(qe,tt):ae(qe,Le)}}function xe(qe){He&&(U.current=qe.detail===Q.current)}return[Ce,xe]}function _e(He,Ee,De,ne){var Re=g.useMemo(function(){return[new Map,[]]},[He,De.id,ne]),ke=(0,V.Z)(Re,2),ee=ke[0],Y=ke[1],k=function(U){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:U,W=ee.get(U),ae=ee.get(M);if(W===void 0||ae===void 0)for(var ue=He.length,ye=Y.length;ye<ue;ye+=1){var Ce,xe=He[ye],qe=Ee(xe);ee.set(qe,ye);var Fe=(Ce=De.get(qe))!==null&&Ce!==void 0?Ce:ne;if(Y[ye]=(Y[ye-1]||0)+Fe,qe===U&&(W=ye),qe===M&&(ae=ye),W!==void 0&&ae!==void 0)break}return{top:Y[W-1]||0,bottom:Y[ae]}};return k}var Ie=K(99153),Te=K(84851),Ke=function(){function He(){(0,Ie.Z)(this,He),(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,Te.Z)(He,[{key:"set",value:function(De,ne){this.diffRecords.set(De,this.maps[De]),this.maps[De]=ne,this.id+=1}},{key:"get",value:function(De){return this.maps[De]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),He}(),J=Ke;function D(He){var Ee=parseFloat(He);return isNaN(Ee)?0:Ee}function F(He,Ee,De){var ne=g.useState(0),Re=(0,V.Z)(ne,2),ke=Re[0],ee=Re[1],Y=(0,g.useRef)(new Map),k=(0,g.useRef)(new J),Q=(0,g.useRef)(0);function U(){Q.current+=1}function M(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;U();var ue=function(){var xe=!1;Y.current.forEach(function(qe,Fe){if(qe&&qe.offsetParent){var $e=qe.offsetHeight,ct=getComputedStyle(qe),Le=ct.marginTop,tt=ct.marginBottom,Pt=D(Le),xt=D(tt),Ft=$e+Pt+xt;k.current.get(Fe)!==Ft&&(k.current.set(Fe,Ft),xe=!0)}}),xe&&ee(function(qe){return qe+1})};if(ae)ue();else{Q.current+=1;var ye=Q.current;Promise.resolve().then(function(){ye===Q.current&&ue()})}}function W(ae,ue){var ye=He(ae),Ce=Y.current.get(ye);ue?(Y.current.set(ye,ue),M()):Y.current.delete(ye),!Ce!=!ue&&(ue?Ee==null||Ee(ae):De==null||De(ae))}return(0,g.useEffect)(function(){return U},[]),[W,M,k.current,ke]}var O=14/15;function le(He,Ee,De){var ne=(0,g.useRef)(!1),Re=(0,g.useRef)(0),ke=(0,g.useRef)(0),ee=(0,g.useRef)(null),Y=(0,g.useRef)(null),k,Q=function(ae){if(ne.current){var ue=Math.ceil(ae.touches[0].pageX),ye=Math.ceil(ae.touches[0].pageY),Ce=Re.current-ue,xe=ke.current-ye,qe=Math.abs(Ce)>Math.abs(xe);qe?Re.current=ue:ke.current=ye;var Fe=De(qe,qe?Ce:xe,!1,ae);Fe&&ae.preventDefault(),clearInterval(Y.current),Fe&&(Y.current=setInterval(function(){qe?Ce*=O:xe*=O;var $e=Math.floor(qe?Ce:xe);(!De(qe,$e,!0)||Math.abs($e)<=.1)&&clearInterval(Y.current)},16))}},U=function(){ne.current=!1,k()},M=function(ae){k(),ae.touches.length===1&&!ne.current&&(ne.current=!0,Re.current=Math.ceil(ae.touches[0].pageX),ke.current=Math.ceil(ae.touches[0].pageY),ee.current=ae.target,ee.current.addEventListener("touchmove",Q,{passive:!1}),ee.current.addEventListener("touchend",U,{passive:!0}))};k=function(){ee.current&&(ee.current.removeEventListener("touchmove",Q),ee.current.removeEventListener("touchend",U))},(0,P.Z)(function(){return He&&Ee.current.addEventListener("touchstart",M,{passive:!0}),function(){var W;(W=Ee.current)===null||W===void 0||W.removeEventListener("touchstart",M),k(),clearInterval(Y.current)}},[He])}function te(He){return Math.floor(Math.pow(He,.5))}function S(He,Ee){var De="touches"in He?He.touches[0]:He;return De[Ee?"pageX":"pageY"]-window[Ee?"scrollX":"scrollY"]}function v(He,Ee,De){g.useEffect(function(){var ne=Ee.current;if(He&&ne){var Re=!1,ke,ee,Y=function(){w.Z.cancel(ke)},k=function W(){Y(),ke=(0,w.Z)(function(){De(ee),W()})},Q=function(ae){if(!(ae.target.draggable||ae.button!==0)){var ue=ae;ue._virtualHandled||(ue._virtualHandled=!0,Re=!0)}},U=function(){Re=!1,Y()},M=function(ae){if(Re){var ue=S(ae,!1),ye=ne.getBoundingClientRect(),Ce=ye.top,xe=ye.bottom;if(ue<=Ce){var qe=Ce-ue;ee=-te(qe),k()}else if(ue>=xe){var Fe=ue-xe;ee=te(Fe),k()}else Y()}};return ne.addEventListener("mousedown",Q),ne.ownerDocument.addEventListener("mouseup",U),ne.ownerDocument.addEventListener("mousemove",M),function(){ne.removeEventListener("mousedown",Q),ne.ownerDocument.removeEventListener("mouseup",U),ne.ownerDocument.removeEventListener("mousemove",M),Y()}}},[He])}var z=10;function oe(He,Ee,De,ne,Re,ke,ee,Y){var k=g.useRef(),Q=g.useState(null),U=(0,V.Z)(Q,2),M=U[0],W=U[1];return(0,P.Z)(function(){if(M&&M.times<z){if(!He.current){W(function(Ot){return(0,Se.Z)({},Ot)});return}ke();var ae=M.targetAlign,ue=M.originAlign,ye=M.index,Ce=M.offset,xe=He.current.clientHeight,qe=!1,Fe=ae,$e=null;if(xe){for(var ct=ae||ue,Le=0,tt=0,Pt=0,xt=Math.min(Ee.length-1,ye),Ft=0;Ft<=xt;Ft+=1){var Gt=Re(Ee[Ft]);tt=Le;var ri=De.get(Gt);Pt=tt+(ri===void 0?ne:ri),Le=Pt}for(var qt=ct==="top"?Ce:xe-Ce,ei=xt;ei>=0;ei-=1){var Jt=Re(Ee[ei]),Tt=De.get(Jt);if(Tt===void 0){qe=!0;break}if(qt-=Tt,qt<=0)break}switch(ct){case"top":$e=tt-Ce;break;case"bottom":$e=Pt-xe+Ce;break;default:{var ot=He.current.scrollTop,dt=ot+xe;tt<ot?Fe="top":Pt>dt&&(Fe="bottom")}}$e!==null&&ee($e),$e!==M.lastTop&&(qe=!0)}qe&&W((0,Se.Z)((0,Se.Z)({},M),{},{times:M.times+1,targetAlign:Fe,lastTop:$e}))}},[M,He.current]),function(ae){if(ae==null){Y();return}if(w.Z.cancel(k.current),typeof ae=="number")ee(ae);else if(ae&&(0,fe.Z)(ae)==="object"){var ue,ye=ae.align;"index"in ae?ue=ae.index:ue=Ee.findIndex(function(qe){return Re(qe)===ae.key});var Ce=ae.offset,xe=Ce===void 0?0:Ce;W({times:0,index:ue,offset:xe,originAlign:ye})}}}var Ae=g.forwardRef(function(He,Ee){var De=He.prefixCls,ne=He.rtl,Re=He.scrollOffset,ke=He.scrollRange,ee=He.onStartMove,Y=He.onStopMove,k=He.onScroll,Q=He.horizontal,U=He.spinSize,M=He.containerSize,W=He.style,ae=He.thumbStyle,ue=He.showScrollBar,ye=g.useState(!1),Ce=(0,V.Z)(ye,2),xe=Ce[0],qe=Ce[1],Fe=g.useState(null),$e=(0,V.Z)(Fe,2),ct=$e[0],Le=$e[1],tt=g.useState(null),Pt=(0,V.Z)(tt,2),xt=Pt[0],Ft=Pt[1],Gt=!ne,ri=g.useRef(),qt=g.useRef(),ei=g.useState(ue),Jt=(0,V.Z)(ei,2),Tt=Jt[0],ot=Jt[1],dt=g.useRef(),Ot=function(){ue===!0||ue===!1||(clearTimeout(dt.current),ot(!0),dt.current=setTimeout(function(){ot(!1)},3e3))},Bt=ke-M||0,nt=M-U||0,vt=g.useMemo(function(){if(Re===0||Bt===0)return 0;var y=Re/Bt;return y*nt},[Re,Bt,nt]),yt=function(C){C.stopPropagation(),C.preventDefault()},vi=g.useRef({top:vt,dragging:xe,pageY:ct,startTop:xt});vi.current={top:vt,dragging:xe,pageY:ct,startTop:xt};var Vt=function(C){qe(!0),Le(S(C,Q)),Ft(vi.current.top),ee(),C.stopPropagation(),C.preventDefault()};g.useEffect(function(){var y=function(be){be.preventDefault()},C=ri.current,Z=qt.current;return C.addEventListener("touchstart",y,{passive:!1}),Z.addEventListener("touchstart",Vt,{passive:!1}),function(){C.removeEventListener("touchstart",y),Z.removeEventListener("touchstart",Vt)}},[]);var ai=g.useRef();ai.current=Bt;var wt=g.useRef();wt.current=nt,g.useEffect(function(){if(xe){var y,C=function(be){var at=vi.current,rt=at.dragging,_t=at.pageY,$t=at.startTop;w.Z.cancel(y);var Ut=ri.current.getBoundingClientRect(),At=M/(Q?Ut.width:Ut.height);if(rt){var Zt=(S(be,Q)-_t)*At,Lt=$t;!Gt&&Q?Lt-=Zt:Lt+=Zt;var ft=ai.current,ht=wt.current,Ze=ht?Lt/ht:0,je=Math.ceil(Ze*ft);je=Math.max(je,0),je=Math.min(je,ft),y=(0,w.Z)(function(){k(je,Q)})}},Z=function(){qe(!1),Y()};return window.addEventListener("mousemove",C,{passive:!0}),window.addEventListener("touchmove",C,{passive:!0}),window.addEventListener("mouseup",Z,{passive:!0}),window.addEventListener("touchend",Z,{passive:!0}),function(){window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",Z),window.removeEventListener("touchend",Z),w.Z.cancel(y)}}},[xe]),g.useEffect(function(){return Ot(),function(){clearTimeout(dt.current)}},[Re]),g.useImperativeHandle(Ee,function(){return{delayHidden:Ot}});var We="".concat(De,"-scrollbar"),h={position:"absolute",visibility:Tt?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=U,Gt?m.left=vt:m.right=vt):(h.width=8,h.top=0,h.bottom=0,Gt?h.right=0:h.left=0,m.width="100%",m.height=U,m.top=vt),g.createElement("div",{ref:ri,className:ce()(We,(0,he.Z)((0,he.Z)((0,he.Z)({},"".concat(We,"-horizontal"),Q),"".concat(We,"-vertical"),!Q),"".concat(We,"-visible"),Tt)),style:(0,Se.Z)((0,Se.Z)({},h),W),onMouseDown:yt,onMouseMove:Ot},g.createElement("div",{ref:qt,className:ce()("".concat(We,"-thumb"),(0,he.Z)({},"".concat(We,"-thumb-moving"),xe)),style:(0,Se.Z)((0,Se.Z)({},m),ae),onMouseDown:Vt}))}),Be=Ae,ze=20;function St(){var He=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,De=He/Ee*He;return isNaN(De)&&(De=0),De=Math.max(De,ze),Math.floor(De)}var Nt=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],ni=[],Ve={overflowY:"auto",overflowAnchor:"none"};function gt(He,Ee){var De=He.prefixCls,ne=De===void 0?"rc-virtual-list":De,Re=He.className,ke=He.height,ee=He.itemHeight,Y=He.fullHeight,k=Y===void 0?!0:Y,Q=He.style,U=He.data,M=He.children,W=He.itemKey,ae=He.virtual,ue=He.direction,ye=He.scrollWidth,Ce=He.component,xe=Ce===void 0?"div":Ce,qe=He.onScroll,Fe=He.onVirtualScroll,$e=He.onVisibleChange,ct=He.innerProps,Le=He.extraRender,tt=He.styles,Pt=He.showScrollBar,xt=Pt===void 0?"optional":Pt,Ft=(0,p.Z)(He,Nt),Gt=g.useCallback(function(ii){return typeof W=="function"?W(ii):ii==null?void 0:ii[W]},[W]),ri=F(Gt,null,null),qt=(0,V.Z)(ri,4),ei=qt[0],Jt=qt[1],Tt=qt[2],ot=qt[3],dt=!!(ae!==!1&&ke&&ee),Ot=g.useMemo(function(){return Object.values(Tt.maps).reduce(function(ii,Ct){return ii+Ct},0)},[Tt.id,Tt.maps]),Bt=dt&&U&&(Math.max(ee*U.length,Ot)>ke||!!ye),nt=ue==="rtl",vt=ce()(ne,(0,he.Z)({},"".concat(ne,"-rtl"),nt),Re),yt=U||ni,vi=(0,g.useRef)(),Vt=(0,g.useRef)(),ai=(0,g.useRef)(),wt=(0,g.useState)(0),We=(0,V.Z)(wt,2),h=We[0],m=We[1],y=(0,g.useState)(0),C=(0,V.Z)(y,2),Z=C[0],pe=C[1],be=(0,g.useState)(!1),at=(0,V.Z)(be,2),rt=at[0],_t=at[1],$t=function(){_t(!0)},Ut=function(){_t(!1)},At={getKey:Gt};function Zt(ii){m(function(Ct){var gi;typeof ii=="function"?gi=ii(Ct):gi=ii;var Pi=ui(gi);return vi.current.scrollTop=Pi,Pi})}var Lt=(0,g.useRef)({start:0,end:yt.length}),ft=(0,g.useRef)(),ht=I(yt,Gt),Ze=(0,V.Z)(ht,1),je=Ze[0];ft.current=je;var pt=g.useMemo(function(){if(!dt)return{scrollHeight:void 0,start:0,end:yt.length-1,offset:void 0};if(!Bt){var ii;return{scrollHeight:((ii=Vt.current)===null||ii===void 0?void 0:ii.offsetHeight)||0,start:0,end:yt.length-1,offset:void 0}}for(var Ct=0,gi,Pi,Fi,ln=yt.length,cn=0;cn<ln;cn+=1){var sn=yt[cn],hn=Gt(sn),En=Tt.get(hn),Zi=Ct+(En===void 0?ee:En);Zi>=h&&gi===void 0&&(gi=cn,Pi=Ct),Zi>h+ke&&Fi===void 0&&(Fi=cn),Ct=Zi}return gi===void 0&&(gi=0,Pi=0,Fi=Math.ceil(ke/ee)),Fi===void 0&&(Fi=yt.length-1),Fi=Math.min(Fi+1,yt.length-1),{scrollHeight:Ct,start:gi,end:Fi,offset:Pi}},[Bt,dt,h,yt,ot,ke]),ti=pt.scrollHeight,Qt=pt.start,Mt=pt.end,It=pt.offset;Lt.current.start=Qt,Lt.current.end=Mt,g.useLayoutEffect(function(){var ii=Tt.getRecord();if(ii.size===1){var Ct=Array.from(ii.keys())[0],gi=ii.get(Ct),Pi=yt[Qt];if(Pi&&gi===void 0){var Fi=Gt(Pi);if(Fi===Ct){var ln=Tt.get(Ct),cn=ln-ee;Zt(function(sn){return sn+cn})}}}Tt.resetRecord()},[ti]);var zt=g.useState({width:0,height:ke}),ve=(0,V.Z)(zt,2),Oe=ve[0],Qe=ve[1],Ye=function(Ct){Qe({width:Ct.offsetWidth,height:Ct.offsetHeight})},it=(0,g.useRef)(),mt=(0,g.useRef)(),lt=g.useMemo(function(){return St(Oe.width,ye)},[Oe.width,ye]),Et=g.useMemo(function(){return St(Oe.height,ti)},[Oe.height,ti]),Xt=ti-ke,Dt=(0,g.useRef)(Xt);Dt.current=Xt;function ui(ii){var Ct=ii;return Number.isNaN(Dt.current)||(Ct=Math.min(Ct,Dt.current)),Ct=Math.max(Ct,0),Ct}var jt=h<=0,pi=h>=Xt,xi=Z<=0,ki=Z>=ye,Ii=se(jt,pi,xi,ki),di=function(){return{x:nt?-Z:Z,y:h}},yi=(0,g.useRef)(di()),Di=(0,X.zX)(function(ii){if(Fe){var Ct=(0,Se.Z)((0,Se.Z)({},di()),ii);(yi.current.x!==Ct.x||yi.current.y!==Ct.y)&&(Fe(Ct),yi.current=Ct)}});function wi(ii,Ct){var gi=ii;Ct?((0,_.flushSync)(function(){pe(gi)}),Di()):Zt(gi)}function Ti(ii){var Ct=ii.currentTarget.scrollTop;Ct!==h&&Zt(Ct),qe==null||qe(ii),Di()}var Ni=function(Ct){var gi=Ct,Pi=ye?ye-Oe.width:0;return gi=Math.max(gi,0),gi=Math.min(gi,Pi),gi},mi=(0,X.zX)(function(ii,Ct){Ct?((0,_.flushSync)(function(){pe(function(gi){var Pi=gi+(nt?-ii:ii);return Ni(Pi)})}),Di()):Zt(function(gi){var Pi=gi+ii;return Pi})}),Li=ie(dt,jt,pi,xi,ki,!!ye,mi),Qi=(0,V.Z)(Li,2),Mi=Qi[0],Ci=Qi[1];le(dt,vi,function(ii,Ct,gi,Pi){var Fi=Pi;return Ii(ii,Ct,gi)?!1:!Fi||!Fi._virtualHandled?(Fi&&(Fi._virtualHandled=!0),Mi({preventDefault:function(){},deltaX:ii?Ct:0,deltaY:ii?0:Ct}),!0):!1}),v(Bt,vi,function(ii){Zt(function(Ct){return Ct+ii})}),(0,P.Z)(function(){function ii(gi){var Pi=jt&&gi.detail<0,Fi=pi&&gi.detail>0;dt&&!Pi&&!Fi&&gi.preventDefault()}var Ct=vi.current;return Ct.addEventListener("wheel",Mi,{passive:!1}),Ct.addEventListener("DOMMouseScroll",Ci,{passive:!0}),Ct.addEventListener("MozMousePixelScroll",ii,{passive:!1}),function(){Ct.removeEventListener("wheel",Mi),Ct.removeEventListener("DOMMouseScroll",Ci),Ct.removeEventListener("MozMousePixelScroll",ii)}},[dt,jt,pi]),(0,P.Z)(function(){if(ye){var ii=Ni(Z);pe(ii),Di({x:ii})}},[Oe.width,ye]);var zi=function(){var Ct,gi;(Ct=it.current)===null||Ct===void 0||Ct.delayHidden(),(gi=mt.current)===null||gi===void 0||gi.delayHidden()},ji=oe(vi,yt,Tt,ee,Gt,function(){return Jt(!0)},Zt,zi);g.useImperativeHandle(Ee,function(){return{nativeElement:ai.current,getScrollInfo:di,scrollTo:function(Ct){function gi(Pi){return Pi&&(0,fe.Z)(Pi)==="object"&&("left"in Pi||"top"in Pi)}gi(Ct)?(Ct.left!==void 0&&pe(Ni(Ct.left)),ji(Ct.top)):ji(Ct)}}}),(0,P.Z)(function(){if($e){var ii=yt.slice(Qt,Mt+1);$e(ii,yt)}},[Qt,Mt,yt]);var Ji=_e(yt,Gt,Tt,ee),tn=Le==null?void 0:Le({start:Qt,end:Mt,virtual:Bt,offsetX:Z,offsetY:It,rtl:nt,getSize:Ji}),Gi=j(yt,Qt,Mt,ye,Z,ei,M,At),nn=null;ke&&(nn=(0,Se.Z)((0,he.Z)({},k?"height":"maxHeight",ke),Ve),dt&&(nn.overflowY="hidden",ye&&(nn.overflowX="hidden"),rt&&(nn.pointerEvents="none")));var Yi={};return nt&&(Yi.dir="rtl"),g.createElement("div",(0,B.Z)({ref:ai,style:(0,Se.Z)((0,Se.Z)({},Q),{},{position:"relative"}),className:vt},Yi,Ft),g.createElement(l.Z,{onResize:Ye},g.createElement(xe,{className:"".concat(ne,"-holder"),style:nn,ref:vi,onScroll:Ti,onMouseEnter:zi},g.createElement(A,{prefixCls:ne,height:ti,offsetX:Z,offsetY:It,scrollWidth:ye,onInnerResize:Jt,ref:Vt,innerProps:ct,rtl:nt,extra:tn},Gi))),Bt&&ti>ke&&g.createElement(Be,{ref:it,prefixCls:ne,scrollOffset:h,scrollRange:ti,rtl:nt,onScroll:wi,onStartMove:$t,onStopMove:Ut,spinSize:Et,containerSize:Oe.height,style:tt==null?void 0:tt.verticalScrollBar,thumbStyle:tt==null?void 0:tt.verticalScrollBarThumb,showScrollBar:xt}),Bt&&ye>Oe.width&&g.createElement(Be,{ref:mt,prefixCls:ne,scrollOffset:Z,scrollRange:ye,rtl:nt,onScroll:wi,onStartMove:$t,onStopMove:Ut,spinSize:lt,containerSize:Oe.width,horizontal:!0,style:tt==null?void 0:tt.horizontalScrollBar,thumbStyle:tt==null?void 0:tt.horizontalScrollBarThumb,showScrollBar:xt}))}var Kt=g.forwardRef(gt);Kt.displayName="List";var ut=Kt,hi=ut},83145:function(Yt,st,K){"use strict";Object.defineProperty(st,"__esModule",{value:!0}),st.CopyToClipboard=void 0;var B=Se(K(59301)),fe=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 V(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?V(w,!0).forEach(function(R){j(L,R,w[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(L,Object.getOwnPropertyDescriptors(w)):V(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:b(L)}function _(L){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},_(L)}function b(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&&N(L,I)}function N(L,I){return N=Object.setPrototypeOf||function(R,q){return R.__proto__=q,R},N(L,I)}function j(L,I,w){return I in L?Object.defineProperty(L,I,{value:w,enumerable:!0,configurable:!0,writable:!0}):L[I]=w,L}var G=function(L){A(I,L);function I(){var w,R;l(this,I);for(var q=arguments.length,se=new Array(q),ie=0;ie<q;ie++)se[ie]=arguments[ie];return R=g(this,(w=_(I)).call.apply(w,[this].concat(se))),j(b(R),"onClick",function(_e){var Ie=R.props,Te=Ie.text,Ke=Ie.onCopy,J=Ie.children,D=Ie.options,F=B.default.Children.only(J),O=(0,fe.default)(Te,D);Ke&&Ke(Te,O),F&&F.props&&typeof F.props.onClick=="function"&&F.props.onClick(_e)}),R}return P(I,[{key:"render",value:function(){var R=this.props,q=R.text,se=R.onCopy,ie=R.options,_e=R.children,Ie=me(R,["text","onCopy","options","children"]),Te=B.default.Children.only(_e);return B.default.cloneElement(Te,p({},Ie,{onClick:this.onClick}))}}]),I}(B.default.PureComponent);st.CopyToClipboard=G,j(G,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Yt,st,K){"use strict";var B=K(83145),fe=B.CopyToClipboard;fe.CopyToClipboard=fe,Yt.exports=fe},76374:function(Yt,st,K){"use strict";var B=function(){if(typeof Map!="undefined")return Map;function J(D,F){var O=-1;return D.some(function(le,te){return le[0]===F?(O=te,!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(F){var O=J(this.__entries__,F),le=this.__entries__[O];return le&&le[1]},D.prototype.set=function(F,O){var le=J(this.__entries__,F);~le?this.__entries__[le][1]=O:this.__entries__.push([F,O])},D.prototype.delete=function(F){var O=this.__entries__,le=J(O,F);~le&&O.splice(le,1)},D.prototype.has=function(F){return!!~J(this.__entries__,F)},D.prototype.clear=function(){this.__entries__.splice(0)},D.prototype.forEach=function(F,O){O===void 0&&(O=null);for(var le=0,te=this.__entries__;le<te.length;le++){var S=te[le];F.call(O,S[1],S[0])}},D}()}(),fe=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)}}(),V=2;function p(J,D){var F=!1,O=!1,le=0;function te(){F&&(F=!1,J()),O&&v()}function S(){he(te)}function v(){var z=Date.now();if(F){if(z-le<V)return;O=!0}else F=!0,O=!1,setTimeout(S,D);le=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 F=this.observers_,O=F.indexOf(D);~O&&F.splice(O,1),!F.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(F){return F.gatherActive(),F.hasActive()});return D.forEach(function(F){return F.broadcastActive()}),D.length>0},J.prototype.connect_=function(){!fe||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(){!fe||!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 F=D.propertyName,O=F===void 0?"":F,le=ce.some(function(te){return!!~O.indexOf(te)});le&&this.refresh()},J.getInstance=function(){return this.instance_||(this.instance_=new J),this.instance_},J.instance_=null,J}(),P=function(J,D){for(var F=0,O=Object.keys(D);F<O.length;F++){var le=O[F];Object.defineProperty(J,le,{value:D[le],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 b(J){return parseFloat(J)||0}function A(J){for(var D=[],F=1;F<arguments.length;F++)D[F-1]=arguments[F];return D.reduce(function(O,le){var te=J["border-"+le+"-width"];return O+b(te)},0)}function N(J){for(var D=["top","right","bottom","left"],F={},O=0,le=D;O<le.length;O++){var te=le[O],S=J["padding-"+te];F[te]=b(S)}return F}function j(J){var D=J.getBBox();return q(0,0,D.width,D.height)}function G(J){var D=J.clientWidth,F=J.clientHeight;if(!D&&!F)return _;var O=g(J).getComputedStyle(J),le=N(O),te=le.left+le.right,S=le.top+le.bottom,v=b(O.width),z=b(O.height);if(O.boxSizing==="border-box"&&(Math.round(v+te)!==D&&(v-=A(O,"left","right")+te),Math.round(z+S)!==F&&(z-=A(O,"top","bottom")+S)),!I(J)){var oe=Math.round(v+te)-D,Ae=Math.round(z+S)-F;Math.abs(oe)!==1&&(v-=oe),Math.abs(Ae)!==1&&(z-=Ae)}return q(le.left,le.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 fe?L(J)?j(J):G(J):_}function R(J){var D=J.x,F=J.y,O=J.width,le=J.height,te=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,S=Object.create(te.prototype);return P(S,{x:D,y:F,width:O,height:le,top:F,right:D+O,bottom:le+F,left:D}),S}function q(J,D,F,O){return{x:J,y:D,width:F,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}(),ie=function(){function J(D,F){var O=R(F);P(this,{target:D,contentRect:O})}return J}(),_e=function(){function J(D,F,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_=F,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 F=this.observations_;F.has(D)||(F.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 F=this.observations_;F.has(D)&&(F.delete(D),F.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(F){F.isActive()&&D.activeObservations_.push(F)})},J.prototype.broadcastActive=function(){if(this.hasActive()){var D=this.callbackCtx_,F=this.activeObservations_.map(function(O){return new ie(O.target,O.broadcastRect())});this.callback_.call(D,F,D),this.clearActive()}},J.prototype.clearActive=function(){this.activeObservations_.splice(0)},J.prototype.hasActive=function(){return this.activeObservations_.length>0},J}(),Ie=typeof WeakMap!="undefined"?new WeakMap:new B,Te=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 F=X.getInstance(),O=new _e(D,F,this);Ie.set(this,O)}return J}();["observe","unobserve","disconnect"].forEach(function(J){Te.prototype[J]=function(){var D;return(D=Ie.get(this))[J].apply(D,arguments)}});var Ke=function(){return typeof Se.ResizeObserver!="undefined"?Se.ResizeObserver:Te}();st.Z=Ke},98040:function(Yt){Yt.exports=function(){var st=document.getSelection();if(!st.rangeCount)return function(){};for(var K=document.activeElement,B=[],fe=0;fe<st.rangeCount;fe++)B.push(st.getRangeAt(fe));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(Yt){var st=arguments[3],K=arguments[4],B=arguments[5],fe=JSON.stringify;Yt.exports=function(Se,he){for(var V,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){V=l;break}}if(!V){V=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[V]=["function(require,module,exports){"+Se+"(self); }",P]}var g=Math.floor(Math.pow(16,8)*Math.random()).toString(16),_={};_[V]=V,K[g]=["function(require,module,exports){var f = require("+fe(V)+");(f.default ? f.default : f)(self);}",_];var b={};A(g);function A(w){b[w]=!0;for(var R in K[w][1]){var q=K[w][1][R];b[q]||A(q)}}var N="("+st+")({"+Object.keys(b).map(function(w){return fe(w)+":["+K[w][0]+","+fe(K[w][1])+"]"}).join(",")+"},{},["+fe(g)+"])",j=window.URL||window.webkitURL||window.mozURL||window.msURL,G=new Blob([N],{type:"text/javascript"});if(he&&he.bare)return G;var L=j.createObjectURL(G),I=new Worker(L);return I.objectURL=L,I}},93314:function(Yt){"use strict";Yt.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=="},15360:function(Yt,st,K){"use strict";K.d(st,{ZP:function(){return ys}});const B=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},fe=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}({}),V=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=N(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 b(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 N(a){var e=A(a,"string");return typeof e=="symbol"?e:e+""}class j{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=G,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 G=function(){},L={trace:G,debug:G,log:G,warn:G,info:G,error:G};function I(){return g({},L)}function w(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):G}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.5`)}catch(s){return I()}n.forEach(s=>{q[s]=R(s,a)})}else g(q,i);return i}const ie=q;function _e(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ie(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function Te(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 Ke(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 F={exports:{}},O;function le(){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 E=o.parseURL(u);if(!E)throw new Error("Error trying to parse relative URL.");if(E.scheme)return d.alwaysNormalize?(E.path=o.normalizePath(E.path),o.buildURLFromParts(E)):u;var T=o.parseURL(c);if(!T)throw new Error("Error trying to parse base URL.");if(!T.netLoc&&T.path&&T.path[0]!=="/"){var x=n.exec(T.path);T.netLoc=x[1],T.path=x[2]}T.netLoc&&!T.path&&(T.path="/");var H={scheme:T.scheme,netLoc:E.netLoc,path:null,params:E.params,query:E.query,fragment:E.fragment};if(!E.netLoc&&(H.netLoc=T.netLoc,E.path[0]!=="/"))if(!E.path)H.path=T.path,E.params||(H.params=T.params,E.query||(H.query=T.query));else{var $=T.path,re=$.substring(0,$.lastIndexOf("/")+1)+E.path;H.path=o.normalizePath(re)}return H.path===null&&(H.path=d.alwaysNormalize?o.normalizePath(E.path):E.path),o.buildURLFromParts(H)},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})()}(F)),F.exports}var te=le();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,St(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=te.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 oe(a){return a.sn!=="initSegment"}class Ae 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 oe(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 Be 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 ze(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||ze(t,e)}}function St(a,e){const t=ze(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const Nt=Math.pow(2,32)-1,ni=[].push,Ve={video:1,audio:2,id3:3,text:4};function gt(a){return String.fromCharCode.apply(null,a)}function Kt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function ut(a,e){const t=He(a,e);return t<0?4294967296+t:t}function hi(a,e){let t=ut(a,e);return t*=Math.pow(2,32),t+=ut(a,e+4),t}function He(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 De(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=gt(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&&ni.apply(t,c)}n=o}return t}function Re(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=hi(a,i),r=hi(a,i+8),i+=16),i+=2;let o=a.length+r;const c=Kt(a,i);i+=2;for(let u=0;u<c;u++){let d=i;const f=ut(a,d);d+=4;const E=f&2147483647;if((f&2147483648)>>>31===1)return ie.warn("SIDX has hierarchical references (not supported)"),null;const x=ut(a,d);d+=4,e.push({referenceSize:E,subsegmentDuration:x,info:{duration:x/n,start:o,end:o+E-1}}),o+=E,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 E=gt(f.subarray(8,12)),T={soun:v.AUDIO,vide:v.VIDEO}[E],x=ne(s,["mdia","minf","stbl","stsd"])[0],H=ee(x);T?(e[c]={timescale:d,type:T,stsd:H},e[T]=b({timescale:d,id:c},H)):e[c]={timescale:d,type:E,stsd:H}}}}}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=gt(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 E=ne(f,["schm"])[0];if(E){const T=gt(E.subarray(4,8));if(T==="cbcs"||T==="cenc"){const x=ne(f,["frma"])[0];x&&(n=gt(x))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=ne(t,["avcC"])[0];c&&c.length>3&&(n+="."+U(c[1])+U(c[2])+U(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=Q(u,d),d+=2;const f=u[d++];if(f&128&&(d+=2),f&64&&(d+=u[d++]),u[d++]!==4)break;d=Q(u,d);const E=u[d++];if(E===64)n+="."+U(E);else break;if(d+=12,u[d++]!==5)break;d=Q(u,d);const T=u[d++];let x=(T&248)>>3;x===31&&(x+=1+((T&7)<<3)+((u[d]&224)>>5)),n+="."+x}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,E=ut(c,2),T=(u&32)>>5?"H":"L",x=c[12],H=c.subarray(6,12);n+="."+d+f,n+="."+k(E).toString(16).toUpperCase(),n+="."+T+x;let $="";for(let re=H.length;re--;){const ge=H[re];(ge||$)&&($="."+ge.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+="."+M(u)+"."+M(d)+"."+M(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",E=(c[2]&64)>>6,T=(c[2]&32)>>5,x=u===2&&E?T?12:10:E?10:8,H=(c[2]&16)>>4,$=(c[2]&8)>>3,re=(c[2]&4)>>2,ge=c[2]&3;n+="."+u+"."+M(d)+f+"."+M(x)+"."+H+"."+$+re+ge+"."+M(1)+"."+M(1)+"."+M(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+"."+M(n)+"."+M(s)}}function k(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function Q(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function U(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function M(a){return(a<10?"0":"")+a}function W(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(E=>{const T=ae(E);if(T){const x=T.subarray(8,24);x.some(H=>H!==0)||(ie.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${J.hexDump(x)} -> ${J.hexDump(t)}`),T.set(t,8))}})})}),a}function ae(a){const e=ne(a,["schm"])[0];if(e){const t=gt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ne(a,["schi","tenc"])[0]}return null}function ue(a,e,t){const i={},n=ne(a,["moof","traf"]);for(let s=0;s<n.length;s++){const r=n[s],o=ne(r,["tfhd"])[0],c=ut(o,4),u=e[c];if(!u)continue;const d=i[c]||(i[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type}),f=ne(r,["tfdt"])[0];if(f){const de=f[0];let we=ut(f,4);de===1&&(we===Nt?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(we*=Nt+1,we+=ut(f,8))),B(we)&&(!B(d.start)||we<d.start)&&(d.start=we)}const E=u.default,T=ut(o,0)|(E==null?void 0:E.flags);let x=(E==null?void 0:E.duration)||0;T&8&&(T&2?x=ut(o,12):x=ut(o,8));const H=ne(r,["trun"]);let $=d.start||0,re=0,ge=x;for(let de=0;de<H.length;de++){const we=H[de],Pe=ut(we,4),et=d.sampleCount;d.sampleCount+=Pe;const Me=we[3]&1,Ge=we[3]&4,Je=we[2]&1,Ne=we[2]&2,bt=we[2]&4,Wt=we[2]&8;let Ei=8,oi=Pe;for(Me&&(Ei+=4),Ge&&Pe&&(!(we[Ei+1]&1)&&d.keyFrameIndex===void 0&&(d.keyFrameIndex=et),Ei+=4,Je?(ge=ut(we,Ei),Ei+=4):ge=x,Ne&&(Ei+=4),Wt&&(Ei+=4),$+=ge,re+=ge,oi--);oi--;)Je?(ge=ut(we,Ei),Ei+=4):ge=x,Ne&&(Ei+=4),bt&&(we[Ei+1]&1||d.keyFrameIndex===void 0&&(d.keyFrameIndex=d.sampleCount-(oi+1),d.keyFrameStart=$),Ei+=4),Wt&&(Ei+=4),$+=ge,re+=ge;!re&&x&&(re+=x*Pe)}d.duration+=re}if(!Object.keys(i).some(s=>i[s].duration)){let s=1/0,r=0;const o=ne(a,["sidx"]);for(let c=0;c<o.length;c++){const u=Re(o[c]);if(u!=null&&u.references){s=Math.min(s,u.earliestPresentationTime/u.timescale);const d=u.references.reduce((f,E)=>f+E.info.duration||0,0);r=Math.max(r,d+u.earliestPresentationTime/u.timescale)}}r&&B(r)&&Object.keys(i).forEach(c=>{i[c].duration||(i[c].duration=r*i[c].timescale-i[c].start)})}return i}function ye(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 E=Math.floor(f/(Nt+1)),T=Math.floor(f%(Nt+1));Ee(c,4,E),Ee(c,8,T)}}})})})}function Ce(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 xe(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function qe(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 E=ne(f,["tfdt"]).map(T=>{const x=T[0];let H=ut(T,4);return x===1&&(H*=Math.pow(2,32),H+=ut(T,8)),H/n})[0];return E!==void 0&&(a=E),ne(f,["tfhd"]).map(T=>{const x=ut(T,4),H=ut(T,0)&16777215,$=(H&1)!==0,re=(H&2)!==0,ge=(H&8)!==0;let de=0;const we=(H&16)!==0;let Pe=0;const et=(H&32)!==0;let Me=8;x===s&&($&&(Me+=8),re&&(Me+=4),ge&&(de=ut(T,Me),Me+=4),we&&(Pe=ut(T,Me),Me+=4),et&&(Me+=4),e.type==="video"&&(r=Fe(e.codec)),ne(f,["trun"]).map(Ge=>{const Je=Ge[0],Ne=ut(Ge,0)&16777215,bt=(Ne&1)!==0;let Wt=0;const Ei=(Ne&4)!==0,oi=(Ne&256)!==0;let li=0;const Ht=(Ne&512)!==0;let ci=0;const fi=(Ne&1024)!==0,Rt=(Ne&2048)!==0;let kt=0;const Ri=ut(Ge,4);let Ai=8;bt&&(Wt=ut(Ge,Ai),Ai+=4),Ei&&(Ai+=4);let Oi=Wt+u;for(let Ki=0;Ki<Ri;Ki++){if(oi?(li=ut(Ge,Ai),Ai+=4):li=de,Ht?(ci=ut(Ge,Ai),Ai+=4):ci=Pe,fi&&(Ai+=4),Rt&&(Je===0?kt=ut(Ge,Ai):kt=He(Ge,Ai),Ai+=4),e.type===v.VIDEO){let Hi=0;for(;Hi<ci;){const en=ut(i,Oi);if(Oi+=4,$e(r,i[Oi])){const Rn=i.subarray(Oi,Oi+en);ct(Rn,r?2:1,a+kt/n,t)}Oi+=en,Hi+=en+4}}a+=li/n}}))})})}),t}function Fe(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function $e(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function ct(a,e,t,i){const n=Le(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){ie.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[d++]===181){const E=Kt(n,d);if(d+=2,E===49){const T=ut(n,d);if(d+=4,T===1195456820){const x=n[d++];if(x===3){const H=n[d++],$=31&H,re=64&H,ge=re?2+$*3:0,de=new Uint8Array(ge);if(re){de[0]=H;for(let we=1;we<ge;we++)de[we]=n[d++]}i.push({type:x,payloadType:r,pts:t,bytes:de})}}}}}else if(r===5&&o>16){const f=[];for(let x=0;x<16;x++){const H=n[d++].toString(16);f.push(H.length==1?"0"+H:H),(x===3||x===5||x===7||x===9)&&f.push("-")}const E=o-16,T=new Uint8Array(E);for(let x=0;x<E;x++)T[x]=n[d++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:Ke(T),userDataBytes:T})}}}function Le(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 tt(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;gt(a.subarray(u,u+1))!=="\0";)t+=gt(a.subarray(u,u+1)),u+=1;for(t+=gt(a.subarray(u,u+1)),u+=1;gt(a.subarray(u,u+1))!=="\0";)i+=gt(a.subarray(u,u+1)),u+=1;i+=gt(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 E=ut(a,u);for(u+=4,r=Xo(2,32)*f+E,fe(r)||(r=Number.MAX_SAFE_INTEGER,ie.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;gt(a.subarray(u,u+1))!=="\0";)t+=gt(a.subarray(u,u+1)),u+=1;for(t+=gt(a.subarray(u,u+1)),u+=1;gt(a.subarray(u,u+1))!=="\0";)i+=gt(a.subarray(u,u+1)),u+=1;i+=gt(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 Pt(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 xt(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),Pt([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t||new Uint8Array)}function Ft(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=Gt(n);e.push(s),i+=s.size}}return e}function Gt(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 ri=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),qt={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 ei(a,e){const t=qt[e];return!!t&&!!t[a.slice(0,4)]}function Jt(a,e,t=!0){return!a.split(",").some(i=>!Tt(i,e,t))}function Tt(a,e,t=!0){var i;const n=_e(t);return(i=n==null?void 0:n.isTypeSupported(ot(a,e)))!=null?i:!1}function ot(a,e){return`${e}/mp4;codecs=${a}`}function dt(a){if(a){const e=a.substring(0,4);return qt.video[e]}return 2}function Ot(a){const e=ri();return a.split(",").reduce((t,i)=>{const s=e&&Fe(i)?9:qt.video[i];return s?(s*2+t)/(t?3:2):(qt.audio[i]+t)/(t?2:1)},0)}const Bt={};function nt(a,e=!0){if(Bt[a])return Bt[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(Tt(t[n],"audio",e))return Bt[a]=t[n],t[n];if(t[n]==="mp3"&&(i=_e(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const vt=/flac|opus|mp4a\.40\.34/i;function yt(a,e=!0){return a.replace(vt,t=>nt(t.toLowerCase(),e))}function vi(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)ei(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function Vt(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 ai(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function wt(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 We(a){const e=_e(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 h(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const m={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function y(a,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const C={};function Z(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,E)=>{if(E){const T=e.groups[E];if(!T)throw new Error(`Audio track group ${E} not found`);Object.keys(T.channels).forEach(x=>{f[x]=(f[x]||0)+T.channels[x]})}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 pe(a,e,t){const i=a.videoCodec,n=a.audioCodec;if(!i&&!n||!t)return Promise.resolve(m);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=>Fe(d))&&ri())return Promise.resolve(y(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:b(b({},r),{},{contentType:ot(wt(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:ot(f,"audio"),channels:""+d}})))}}))}),Promise.all(s.map(r=>{const o=be(r);return C[o]||(C[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 be(a){const{audio:e,video:t}=a,i=t||e;if(i){const n=h(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 rt(a){return at.indexOf(a)>-1}const _t=["SDR","PQ","HLG"];function $t(a){return!!a&&_t.indexOf(a)>-1}var Ut={No:"",Yes:"YES",v2:"v2"};function At(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?Ut.v2:Ut.Yes:Ut.No}class Zt{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 Lt{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 ft(this._audioGroups,e)}hasSubtitleGroup(e){return ft(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 ft(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function ht(){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||_t.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&ht(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const je=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}},pt=(a,e)=>JSON.stringify(a,je(e));function ti(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,E=1/0,T=1/0,x=1/0,H=1/0,$=0,re=[];const{preferHDR:ge,allowedVideoRanges:de}=Ze(e,n);for(let Ge=s.length;Ge--;){const Je=a[s[Ge]];d||(d=Je.channels[2]>0),E=Math.min(E,Je.minHeight),T=Math.min(T,Je.minFramerate),x=Math.min(x,Je.minBitrate),de.filter(bt=>Je.videoRanges[bt]>0).length>0&&(f=!0)}E=B(E)?E:0,T=B(T)?T:0;const we=Math.max(1080,E),Pe=Math.max(30,T);x=B(x)?x:t,t=Math.max(x,t),f||(e=void 0);const et=s.length>1;return{codecSet:s.reduce((Ge,Je)=>{const Ne=a[Je];if(Je===Ge)return Ge;if(re=f?de.filter(bt=>Ne.videoRanges[bt]>0):[],et){if(Ne.minBitrate>t)return Qt(Je,`min bitrate of ${Ne.minBitrate} > current estimate of ${t}`),Ge;if(!Ne.hasDefaultAudio)return Qt(Je,"no renditions with default or auto-select sound found"),Ge;if(o&&Je.indexOf(o.substring(0,4))%5!==0)return Qt(Je,`audio codec preference "${o}" not found`),Ge;if(r&&!u){if(!Ne.channels[r])return Qt(Je,`no renditions with ${r} channel sound found (channels options: ${Object.keys(Ne.channels)})`),Ge}else if((!o||u)&&d&&Ne.channels[2]===0)return Qt(Je,"no renditions with stereo sound found"),Ge;if(Ne.minHeight>we)return Qt(Je,`min resolution of ${Ne.minHeight} > maximum of ${we}`),Ge;if(Ne.minFramerate>Pe)return Qt(Je,`min framerate of ${Ne.minFramerate} > maximum of ${Pe}`),Ge;if(!re.some(bt=>Ne.videoRanges[bt]>0))return Qt(Je,`no variants with VIDEO-RANGE of ${pt(re)} found`),Ge;if(c&&Je.indexOf(c.substring(0,4))%5!==0)return Qt(Je,`video codec preference "${c}" not found`),Ge;if(Ne.maxScore<$)return Qt(Je,`max score of ${Ne.maxScore} < selected max of ${$}`),Ge}return Ge&&(Ot(Je)>=Ot(Ge)||Ne.fragmentError>a[Ge].fragmentError)?Ge:(H=Ne.minIndex,$=Ne.maxScore,Je)},void 0),videoRanges:re,preferHDR:ge,minFramerate:T,minBitrate:x,minIndex:H}}function Qt(a,e){ie.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Mt(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 It(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(E=>{c.channels[E]=(c.channels[E]||0)+f.channels[E]}))}),n},{})}function zt(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 ve(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(Oe(a,n,t))return i}return-1}function Oe(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)||Ye(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 Ye(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function it(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 mt(a,e,t,i,n){const s=e[i],o=e.reduce((E,T,x)=>{const H=T.uri;return(E[H]||(E[H]=[])).push(x),E},{})[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=lt(e,i,E=>{if(E.videoRange!==c||E.frameRate!==u||E.codecSet.substring(0,4)!==d)return!1;const T=E.audioGroups,x=t.filter(H=>!T||T.indexOf(H.groupId)!==-1);return ve(a,x,n)>-1});return f>-1?f:lt(e,i,E=>{const T=E.audioGroups,x=t.filter(H=>!T||T.indexOf(H.groupId)!==-1);return ve(a,x,n)>-1})}function lt(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 Et(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Xt extends j{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,E=u-d.loading.start,T=r.minAutoLevel,x=n.level,H=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||x<=T){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const $=H>-1&&H!==x,re=!!t||$;if(!re&&(c.paused||!c.playbackRate||!c.readyState))return;const ge=r.mainForwardBufferInfo;if(!re&&ge===null)return;const de=this.bwEstimator.getEstimateTTFB(),we=Math.abs(c.playbackRate);if(E<=Math.max(de,1e3*(f/(we*2))))return;const Pe=ge?ge.len/we:0,et=d.loading.first?d.loading.first-d.loading.start:-1,Me=d.loaded&&et>-1,Ge=this.getBwEstimate(),Je=r.levels,Ne=Je[x],bt=Math.max(d.loaded,Math.round(f*(n.bitrate||Ne.averageBitrate)/8));let Wt=Me?E-et:E;Wt<1&&Me&&(Wt=Math.min(E,d.loaded*8/Ge));const Ei=Me?d.loaded*1e3/Wt:0,oi=de/1e3,li=Ei?(bt-d.loaded)/Ei:bt*8/Ge+oi;if(li<=Pe)return;const Ht=Ei?Ei*8:Ge,ci=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,fi=this.hls.config.abrBandWidthUpFactor;let Rt=Number.POSITIVE_INFINITY,kt;for(kt=x-1;kt>T;kt--){const Ki=Je[kt].maxBitrate,Hi=!Je[kt].details||ci;if(Rt=this.getTimeToLoadFrag(oi,Ht,f*Ki,Hi),Rt<Math.min(Pe,f+oi))break}if(Rt>=li||Rt>f*10)return;Me?this.bwEstimator.sample(E-Math.min(de,et),d.loaded):this.bwEstimator.sampleTTFB(E);const Ri=Je[kt].maxBitrate;this.getBwEstimate()*fi>Ri&&this.resetEstimator(Ri);const Ai=this.findBestLevel(Ri,T,kt,0,Pe,1,1);Ai>-1&&(kt=Ai),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${x} is loading too slowly;
Fragment duration: ${n.duration.toFixed(3)}
Time to underbuffer: ${Pe.toFixed(3)} s
Estimated load time for current fragment: ${li.toFixed(3)} s
Estimated load time for down switch fragment: ${Rt.toFixed(3)} s
TTFB estimate: ${et|0} ms
Current BW estimate: ${B(Ge)?Ge|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${kt} @ ${Ri|0} bps`),r.nextLoadLevel=r.nextAutoLevel=kt,this.clearTimer();const Oi=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===kt&&kt>0){const Ki=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${kt>0?"and switching down":""}
Fragment duration: ${n.duration.toFixed(3)} s
Time to underbuffer: ${Ki.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,kt>T){let Hi=this.findBestLevel(this.hls.levels[T].bitrate,T,kt,0,Ki,1,1);Hi===-1&&(Hi=T),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Hi,this.resetEstimator(this.hls.levels[Hi].bitrate)}}};$||li>Rt*2?Oi():this.timer=self.setInterval(Oi,Rt*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 V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case V.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 E=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const $=this.bitrateTestDelay;$&&(E=(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*E)} ms`),d=f=1)}const T=this.findBestLevel(c,r,n,u,E,d,f);if(this.rebufferNotice!==T&&(this.rebufferNotice=T,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${T}`)),T>-1)return T;const x=i.levels[r],H=i.loadLevelObj;return H&&(x==null?void 0:x.bitrate)<H.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:E,partCurrent:T}=this,{levels:x,allAudioTracks:H,loadLevel:$,config:re}=this.hls;if(x.length===1)return 0;const ge=x[f],de=!!((c=this.hls.latestLevelDetails)!=null&&c.live),we=$===-1||d===-1;let Pe,et="SDR",Me=(ge==null?void 0:ge.frameRate)||0;const{audioPreference:Ge,videoPreference:Je}=re,Ne=this.audioTracksByGroup||(this.audioTracksByGroup=Mt(H));let bt=-1;if(we){if(this.firstSelection!==-1)return this.firstSelection;const Ht=this.codecTiers||(this.codecTiers=It(x,Ne,t,i)),ci=ti(Ht,et,e,Ge,Je),{codecSet:fi,videoRanges:Rt,minFramerate:kt,minBitrate:Ri,minIndex:Ai,preferHDR:Oi}=ci;bt=Ai,Pe=fi,et=Oi?Rt[Rt.length-1]:Rt[0],Me=kt,e=Math.max(e,Ri),this.log(`picked start tier ${pt(ci)}`)}else Pe=ge==null?void 0:ge.codecSet,et=ge==null?void 0:ge.videoRange;const Wt=T?T.duration:E?E.duration:0,Ei=this.bwEstimator.getEstimateTTFB()/1e3,oi=[];for(let Ht=i;Ht>=t;Ht--){var li;const ci=x[Ht],fi=Ht>f;if(!ci)continue;if(re.useMediaCapabilities&&!ci.supportedResult&&!ci.supportedPromise){const Hi=navigator.mediaCapabilities;typeof(Hi==null?void 0:Hi.decodingInfo)=="function"&&(Z(ci,Ne,et,Me,e,Ge)||Fe(ci.videoCodec))?(ci.supportedPromise=pe(ci,Ne,Hi),ci.supportedPromise.then(en=>{if(!this.hls)return;ci.supportedResult=en;const Rn=this.hls.levels,Pn=Rn.indexOf(ci);en.error?this.warn(`MediaCapabilities decodingInfo error: "${en.error}" for level ${Pn} ${pt(en)}`):en.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Pn} ${pt(en)}`),Pn>-1&&Rn.length>1&&(this.log(`Removing unsupported level ${Pn}`),this.hls.removeLevel(Pn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):ci.supportedResult=m}if((Pe&&ci.codecSet!==Pe||et&&ci.videoRange!==et||fi&&Me>ci.frameRate||!fi&&Me>0&&Me<ci.frameRate||ci.supportedResult&&!((li=ci.supportedResult.decodingInfoResults)!=null&&li[0].smooth))&&(!we||Ht!==bt)){oi.push(Ht);continue}const Rt=ci.details,kt=(T?Rt==null?void 0:Rt.partTarget:Rt==null?void 0:Rt.averagetargetduration)||Wt;let Ri;fi?Ri=o*e:Ri=r*e;const Ai=Wt&&n>=Wt*2&&s===0?ci.averageBitrate:ci.maxBitrate,Oi=this.getTimeToLoadFrag(Ei,Ri,Ai*kt,Rt===void 0);if(Ri>=Ai&&(Ht===d||ci.loadError===0&&ci.fragmentError===0)&&(Oi<=Ei||!B(Oi)||de&&!this.bitrateTestDelay||Oi<u)){const Hi=this.forcedAutoLevel;return Ht!==$&&(Hi===-1||Hi!==$)&&(oi.length&&this.trace(`Skipped level(s) ${oi.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${x[oi[0]].codecs}" ${x[oi[0]].videoRange}; not compatible with "${Pe}" ${et}`),this.info(`switch candidate:${f}->${Ht} adjustedbw(${Math.round(Ri)})-bitrate=${Math.round(Ri-Ai)} ttfb:${Ei.toFixed(1)} avgDuration:${kt.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${Oi.toFixed(1)} firstSelection:${we} codecSet:${ci.codecSet} videoRange:${ci.videoRange} hls.loadLevel:${$}`)),we&&(this.firstSelection=Ht),Ht}}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 Dt={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 ui(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;for(let s=0;s<a.length;++s){const r=a[s];if(ki(e,t,r))return r}return null}function jt(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)&&xi(t,i,s)===0||pi(s,a,Math.min(n,i))))return s;const r=Dt.search(e,xi.bind(null,t,i));return r&&(r!==a||!s)?r:s}function pi(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 xi(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 ki(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function Ii(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let i=a.fragments;const{fragmentHint:n}=a;n&&(i=i.concat(n));let s;return Dt.search(i,r=>r.cc<e?1:r.cc>e?-1:(s=r,r.end<=t?1:r.start>t?-1:0)),s||null}return null}function di(a){switch(a.details){case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_TIMEOUT:case V.LEVEL_LOAD_TIMEOUT:case V.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function yi(a,e){const t=di(e);return a.default[`${t?"timeout":"error"}Retry`]}function Di(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function wi(a){return b(b({},a),{errorRetry:null,timeoutRetry:null})}function Ti(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(Ni(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function Ni(a){return a===0&&navigator.onLine===!1||!!a&&(a<400||a>499)}var mi={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Li={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Qi extends j{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 V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case V.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Mi();return}case V.FRAG_GAP:case V.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=mi.SendAlternateToPenaltyBox;return}case V.LEVEL_EMPTY_ERROR:case V.LEVEL_PARSING_ERROR:{var r,o;const u=t.parent===ce.MAIN?t.level:n.loadLevel;t.details===V.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 V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.SUBTITLE_LOAD_ERROR:case V.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=mi.SendAlternateToPenaltyBox,t.errorAction.flags=Li.MoveAllAlternatesMatchingHost;return}}return;case V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.loadLevelObj,d=u==null?void 0:u.attrs["HDCP-LEVEL"];d?t.errorAction={action:mi.SendAlternateToPenaltyBox,flags:Li.MoveAllAlternatesMatchingHDCP,hdcpLevel:d}:this.keySystemError(t)}return;case V.BUFFER_ADD_CODEC_ERROR:case V.REMUX_ALLOC_ERROR:case V.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case V.INTERNAL_EXCEPTION:case V.BUFFER_APPENDING_ERROR:case V.BUFFER_FULL_ERROR:case V.LEVEL_SWITCH_ERROR:case V.BUFFER_STALLED_ERROR:case V.BUFFER_SEEK_OVER_HOLE:case V.BUFFER_NUDGE_ON_STALL:t.errorAction=Mi();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=yi(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Ti(n,s,di(e),e.response))return{action:mi.RetryRequest,flags:Li.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=yi(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((d,f)=>d+f.fragmentError,0);if(n&&(e.details!==V.FRAG_GAP&&n.fragmentError++,Ti(o,c,di(e),e.response)))return{action:mi.RetryRequest,flags:Li.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===V.BUFFER_APPEND_ERROR&&n.fragmentError++;let d=-1;const{levels:f,loadLevel:E,minAutoLevel:T,maxAutoLevel:x}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const H=(s=e.frag)==null?void 0:s.type,re=(H===ce.AUDIO&&u===V.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===V.BUFFER_ADD_CODEC_ERROR||u===V.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:et})=>n.audioCodec!==et),de=e.sourceBufferName==="video"&&(u===V.BUFFER_ADD_CODEC_ERROR||u===V.BUFFER_APPEND_ERROR)&&f.some(({codecSet:et,audioCodec:Me})=>n.codecSet!==et&&n.audioCodec===Me),{type:we,groupId:Pe}=(r=e.context)!=null?r:{};for(let et=f.length;et--;){const Me=(et+E)%f.length;if(Me!==E&&Me>=T&&Me<=x&&f[Me].loadError===0){var o,c;const Ge=f[Me];if(u===V.FRAG_GAP&&H===ce.MAIN&&e.frag){const Je=f[Me].details;if(Je){const Ne=jt(e.frag,Je.fragments,e.frag.start);if(Ne!=null&&Ne.gap)continue}}else{if(we===me.AUDIO_TRACK&&Ge.hasAudioGroup(Pe)||we===me.SUBTITLE_TRACK&&Ge.hasSubtitleGroup(Pe))continue;if(H===ce.AUDIO&&(o=n.audioGroups)!=null&&o.some(Je=>Ge.hasAudioGroup(Je))||H===ce.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(Je=>Ge.hasSubtitleGroup(Je))||re&&n.audioCodec===Ge.audioCodec||!re&&n.audioCodec!==Ge.audioCodec||de&&n.codecSet===Ge.codecSet)continue}d=Me;break}}if(d>-1&&i.loadLevel!==d)return e.levelRetry=!0,this.playlistError=0,{action:mi.SendAlternateToPenaltyBox,flags:Li.None,nextAutoLevel:d}}return{action:mi.SendAlternateToPenaltyBox,flags:Li.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case mi.DoNothing:break;case mi.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==V.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 mi.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 Li.None:this.switchLevel(e,r);break;case Li.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===V.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=h(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function Mi(a){const e={action:mi.DoNothing,flags:Li.None};return a&&(e.resolved=!0),e}var Ci={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class zi{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=Ji(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),ji(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=tn(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=Ji(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,E=n.end(d)+this.bufferPadding;if(u>=f&&c<=E){s.time.push({startPTS:Math.max(r,n.start(d)),endPTS:Math.min(o,n.end(d))});break}else if(r<E&&o>f){const T=Math.max(r,n.start(d)),x=Math.min(o,n.end(d));x>T&&(s.partial=!0,s.time.push({startPTS:T,endPTS:x}))}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&&ji(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||ji(t))}getState(e){const t=Ji(e),i=this.fragments[t];return i?i.buffered?ji(i)?Ci.PARTIAL:Ci.OK:Ci.APPENDING:Ci.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=Ji(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=Ji(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=Ji(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=tn(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 ji(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 Ji(a){return`${a.type}_${a.level}_${a.sn}`}function tn(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Gi={cbc:0,ctr:1};class nn{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 Gi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Gi.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 Yi(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class ii{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],E=c[3],T=new Uint32Array(256);let x=0,H=0,$=0;for($=0;$<256;$++)$<128?T[$]=$<<1:T[$]=$<<1^283;for($=0;$<256;$++){let re=H^H<<1^H<<2^H<<3^H<<4;re=re>>>8^re&255^99,e[x]=re,t[re]=x;const ge=T[x],de=T[ge],we=T[de];let Pe=T[re]*257^re*16843008;n[x]=Pe<<24|Pe>>>8,s[x]=Pe<<16|Pe>>>16,r[x]=Pe<<8|Pe>>>24,o[x]=Pe,Pe=we*16843009^de*65537^ge*257^x*16843008,u[re]=Pe<<24|Pe>>>8,d[re]=Pe<<16|Pe>>>16,f[re]=Pe<<8|Pe>>>24,E[re]=Pe,x?(x=ge^T[T[T[we^ge]]],H^=T[T[H]]):x=H=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,E=this.rcon,T=this.invSubMix,x=T[0],H=T[1],$=T[2],re=T[3];let ge,de;for(o=0;o<r;o++){if(o<s){ge=u[o]=t[o];continue}de=ge,o%s===0?(de=de<<8|de>>>24,de=f[de>>>24]<<24|f[de>>>16&255]<<16|f[de>>>8&255]<<8|f[de&255],de^=E[o/s|0]<<24):s>6&&o%s===4&&(de=f[de>>>24]<<24|f[de>>>16&255]<<16|f[de>>>8&255]<<8|f[de&255]),u[o]=ge=(u[o-s]^de)>>>0}for(c=0;c<r;c++)o=r-c,c&3?de=u[o]:de=u[o-4],c<4||o<=4?d[c]=de:d[c]=x[f[de>>>24]]^H[f[de>>>16&255]]^$[f[de>>>8&255]]^re[f[de&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],E=this.uint8ArrayToUint32Array_(i);let T=E[0],x=E[1],H=E[2],$=E[3];const re=new Int32Array(e),ge=new Int32Array(re.length);let de,we,Pe,et,Me,Ge,Je,Ne,bt,Wt,Ei,oi,li,Ht;const ci=this.networkToHostOrderSwap;for(;t<re.length;){for(bt=ci(re[t]),Wt=ci(re[t+1]),Ei=ci(re[t+2]),oi=ci(re[t+3]),Me=bt^s[0],Ge=oi^s[1],Je=Ei^s[2],Ne=Wt^s[3],li=4,Ht=1;Ht<n;Ht++)de=c[Me>>>24]^u[Ge>>16&255]^d[Je>>8&255]^f[Ne&255]^s[li],we=c[Ge>>>24]^u[Je>>16&255]^d[Ne>>8&255]^f[Me&255]^s[li+1],Pe=c[Je>>>24]^u[Ne>>16&255]^d[Me>>8&255]^f[Ge&255]^s[li+2],et=c[Ne>>>24]^u[Me>>16&255]^d[Ge>>8&255]^f[Je&255]^s[li+3],Me=de,Ge=we,Je=Pe,Ne=et,li=li+4;de=r[Me>>>24]<<24^r[Ge>>16&255]<<16^r[Je>>8&255]<<8^r[Ne&255]^s[li],we=r[Ge>>>24]<<24^r[Je>>16&255]<<16^r[Ne>>8&255]<<8^r[Me&255]^s[li+1],Pe=r[Je>>>24]<<24^r[Ne>>16&255]<<16^r[Me>>8&255]<<8^r[Ge&255]^s[li+2],et=r[Ne>>>24]<<24^r[Me>>16&255]<<16^r[Ge>>8&255]<<8^r[Je&255]^s[li+3],ge[t]=ci(de^T),ge[t+1]=ci(et^x),ge[t+2]=ci(Pe^H),ge[t+3]=ci(we^$),T=bt,x=Wt,H=Ei,$=oi,t=t+4}return ge.buffer}}class Ct{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=gi(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function gi(a){switch(a){case Gi.cbc:return"AES-CBC";case Gi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const Pi=16;class Fi{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?Yi(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!==Gi.cbc||t.byteLength!==16)return ie.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=xe(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 ii),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 Ct(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new nn(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(ie.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%Pi;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(ie.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const ln=Math.pow(2,17);class cn{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 Zi({type:he.NETWORK_ERROR,details:V.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(x=>x[0]==="GAP")){c(hn(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),d=sn(e);e.loader=u;const f=wi(n.fragLoadPolicy.default),E={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:ln};e.stats=u.stats;const T={onSuccess:(x,H,$,re)=>{this.resetLoader(e,u);let ge=x.data;$.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ge.slice(0,16)),ge=ge.slice(16)),o({frag:e,part:null,payload:ge,networkDetails:re})},onError:(x,H,$,re)=>{this.resetLoader(e,u),c(new Zi({type:he.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:b({url:i,data:void 0},x),error:new Error(`HTTP Error ${x.code} ${x.text}`),networkDetails:$,stats:re}))},onAbort:(x,H,$)=>{this.resetLoader(e,u),c(new Zi({type:he.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:$,stats:x}))},onTimeout:(x,H,$)=>{this.resetLoader(e,u),c(new Zi({type:he.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${E.timeout}ms`),networkDetails:$,stats:x}))}};t&&(T.onProgress=(x,H,$,re)=>t({frag:e,part:null,payload:$,networkDetails:re})),u.load(d,E,T)})}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(hn(e,t));return}const u=this.loader=s?new s(n):new r(n),d=sn(e,t);e.loader=u;const f=wi(n.fragLoadPolicy.default),E={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ln};t.stats=u.stats,u.load(d,E,{onSuccess:(T,x,H,$)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const re={frag:e,part:t,payload:T.data,networkDetails:$};i(re),o(re)},onError:(T,x,H,$)=>{this.resetLoader(e,u),c(new Zi({type:he.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:b({url:d.url,data:void 0},T),error:new Error(`HTTP Error ${T.code} ${T.text}`),networkDetails:H,stats:$}))},onAbort:(T,x,H)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Zi({type:he.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:H,stats:T}))},onTimeout:(T,x,H)=>{this.resetLoader(e,u),c(new Zi({type:he.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${E.timeout}ms`),networkDetails:H,stats:T}))}})})}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 sn(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"&&En((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 hn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:he.MEDIA_ERROR,details:V.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new Zi(i)}function En(a){return a==="AES-128"||a==="AES-256"}class Zi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class mn extends j{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 rn{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=un(),this.buffering={audio:un(),video:un(),audiovideo:un()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function un(){return{start:0,executeStart:0,executeEnd:0,end:0}}const gn={length:0,start:()=>0,end:()=>0};class _i{static isBuffered(e,t){if(e){const i=_i.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=_i.getBuffered(e);return _i.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=_i.bufferedRanges(e);if(n.length)return _i.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 E=s[f-1].end;e[d].start-E<i?e[d].end>E&&(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,E=s[d].end;if(n===-1&&t>=f&&t<=E&&(n=d),t+i>=f&&t<E)c=f,u=E,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||gn}catch(t){return ie.log("failed to get media.buffered",t),gn}}}const dn=/\{\$([a-zA-Z0-9-_]+)\}/g;function pn(a){return dn.test(a)}function bn(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(dn,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 Ln(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 Wn(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 Hn=/^(\d+)x(\d+)$/,Fn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Bi{constructor(e,t){typeof e=="string"&&(e=Bi.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=Hn.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(Fn.lastIndex=0;(i=Fn.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=bn(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":ie.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const ts="com.apple.hls.interstitial";function as(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Zn(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class yn{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]){ie.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=g(new Bi({}),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?(ie.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===ts}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 os=10;class ls{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||os}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 Sn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Bn(a){switch(a){case"AES-128":case"AES-256":return Gi.cbc;case"AES-256-CTR":return Gi.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function On(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function In(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function fn(a){const e=In(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function wn(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 zn(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=On(r)):t=fn(r)}}return t}const an=typeof self!="undefined"?self:void 0;var bi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ui={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function _n(a){switch(a){case Ui.FAIRPLAY:return bi.FAIRPLAY;case Ui.PLAYREADY:return bi.PLAYREADY;case Ui.WIDEVINE:return bi.WIDEVINE;case Ui.CLEARKEY:return bi.CLEARKEY}}var Dn={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Yn(a){if(a===Dn.WIDEVINE)return bi.WIDEVINE;if(a===Dn.PLAYREADY)return bi.PLAYREADY;if(a===Dn.CENC||a===Dn.CLEARKEY)return bi.CLEARKEY}function Xn(a){switch(a){case bi.FAIRPLAY:return Ui.FAIRPLAY;case bi.PLAYREADY:return Ui.PLAYREADY;case bi.WIDEVINE:return Ui.WIDEVINE;case bi.CLEARKEY:return Ui.CLEARKEY}}function qn(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[bi.FAIRPLAY,bi.WIDEVINE,bi.PLAYREADY,bi.CLEARKEY].filter(n=>!!e[n]):[];return!i[bi.WIDEVINE]&&t&&i.push(bi.WIDEVINE),i}const is=function(a){return an!=null&&(a=an.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function si(a,e,t,i){let n;switch(a){case bi.FAIRPLAY:n=["cenc","sinf"];break;case bi.WIDEVINE:case bi.PLAYREADY:n=["cenc"];break;case bi.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Si(n,e,t,i)}function Si(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 Vi(a){var e;return a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function Xi(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=On(o).subarray(0,16);return wn(c),c}}return null}let Wi={};class Un{static clearKeyUriToKeyIdMap(){Wi={}}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&&!Sn(e)}isSupported(){if(this.method){if(Sn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Ui.FAIRPLAY:case Ui.WIDEVINE:case Ui.PLAYREADY:case Ui.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(Sn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(ie.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=ps(e);return new Un(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=zn(this.uri);if(t)switch(this.keyFormat){case Ui.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Ui.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=xt(i,null,t),this.keyId=Xi(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=Wi[this.uri];if(!i){const n=Object.keys(Wi).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),Wi[this.uri]=i}this.keyId=i}return this}}function ps(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const Cn=/#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,us=/#EXT-X-MEDIA:(.*)/g,Br=/^#EXT(?:INF|-X-TARGETDURATION):/m,Is=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Ur=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 Kn{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 te.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Br.test(e)}static parseMasterPlaylist(e,t){const i=pn(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];Cn.lastIndex=0;let r;for(;(r=Cn.exec(e))!=null;)if(r[1]){var o;const u=new Bi(r[1],n),d=bn(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Kn.resolve(d,t)},E=u.decimalResolution("RESOLUTION");E&&(f.width=E.width,f.height=E.height),Ds(u.CODECS,f);const T=u["SUPPLEMENTAL-CODECS"];T&&(f.supplemental={},Ds(T,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 Bi(d,n),E=f["DATA-ID"];E&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[E]=f);break}case"SESSION-KEY":{const f=bs(d,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):ie.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const f=new Bi(d,n);Ln(n,f,t)}break}case"CONTENT-STEERING":{const f=new Bi(d,n);n.contentSteering={uri:Kn.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=rr(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(us.lastIndex=0;(n=us.exec(e))!==null;){const u=new Bi(n[1],i),d=u.TYPE;if(d){const f=o[d],E=s[d]||[];s[d]=E;const T=u.LANGUAGE,x=u["ASSOC-LANGUAGE"],H=u.CHANNELS,$=u.CHARACTERISTICS,re=u["INSTREAM-ID"],ge={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||T||"",type:d,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:T,url:u.URI?Kn.resolve(u.URI,t):""};if(x&&(ge.assocLang=x),H&&(ge.channels=H),$&&(ge.characteristics=$),re&&(ge.instreamId=re),f!=null&&f.length){const de=Kn.findGroup(f,ge.groupId)||f[0];ns(ge,de,"audioCodec"),ns(ge,de,"textCodec")}E.push(ge)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new ls(t),d=u.fragments,f=[];let E=null,T=0,x=0,H=0,$=0,re=0,ge=null,de=new Ae(n,c),we,Pe,et,Me=-1,Ge=!1,Je=null,Ne;if(Is.lastIndex=0,u.m3u8=e,u.hasVariableRefs=pn(e),((o=Is.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(we=Is.exec(e))!==null;){Ge&&(Ge=!1,de=new Ae(n,c),de.playlistOffset=H,de.start=H,de.sn=T,de.cc=$,re&&(de.bitrate=re),de.level=i,E&&(de.initSegment=E,E.rawProgramDateTime&&(de.rawProgramDateTime=E.rawProgramDateTime,E.rawProgramDateTime=null),Je&&(de.setByteRange(Je),Je=null)));const oi=we[1];if(oi){de.duration=parseFloat(oi);const li=(" "+we[2]).slice(1);de.title=li||null,de.tagList.push(li?["INF",oi,li]:["INF",oi])}else if(we[3]){if(B(de.duration)){de.playlistOffset=H,de.start=H,et&&Vs(de,et,u),de.sn=T,de.level=i,de.cc=$,d.push(de);const li=(" "+we[3]).slice(1);de.relurl=bn(u,li),Cs(de,ge,f),ge=de,H+=de.duration,T++,x=0,Ge=!0}}else{if(we=we[0].match(Ur),!we){ie.warn("No matches on slow regex match for level playlist!");continue}for(Pe=1;Pe<we.length&&we[Pe]===void 0;Pe++);const li=(" "+we[Pe]).slice(1),Ht=(" "+we[Pe+1]).slice(1),ci=we[Pe+2]?(" "+we[Pe+2]).slice(1):null;switch(li){case"BYTERANGE":ge?de.setByteRange(Ht,ge):de.setByteRange(Ht);break;case"PROGRAM-DATE-TIME":de.rawProgramDateTime=Ht,de.tagList.push(["PROGRAM-DATE-TIME",Ht]),Me===-1&&(Me=d.length);break;case"PLAYLIST-TYPE":u.type&&Qn(u,li,we),u.type=Ht.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Qn(u,li,we):d.length>0&&js(u,li,we),T=u.startSN=parseInt(Ht);break;case"SKIP":{u.skippedSegments&&Qn(u,li,we);const fi=new Bi(Ht,u),Rt=fi.decimalInteger("SKIPPED-SEGMENTS");if(B(Rt)){u.skippedSegments+=Rt;for(let Ri=Rt;Ri--;)d.push(null);T+=Rt}const kt=fi.enumeratedString("RECENTLY-REMOVED-DATERANGES");kt&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(kt.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Qn(u,li,we),u.targetduration=Math.max(parseInt(Ht),1);break;case"VERSION":u.version!==null&&Qn(u,li,we),u.version=parseInt(Ht);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Qn(u,li,we),u.live=!1;break;case"#":(Ht||ci)&&de.tagList.push(ci?[Ht,ci]:[Ht]);break;case"DISCONTINUITY":$++,de.tagList.push(["DIS"]);break;case"GAP":de.gap=!0,de.tagList.push([li]);break;case"BITRATE":de.tagList.push([li,Ht]),re=parseInt(Ht)*1e3,B(re)?de.bitrate=re:re=0;break;case"DATERANGE":{const fi=new Bi(Ht,u),Rt=new yn(fi,u.dateRanges[fi.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Rt.isValid||u.skippedSegments?u.dateRanges[Rt.id]=Rt:ie.warn(`Ignoring invalid DATERANGE tag: "${Ht}"`),de.tagList.push(["EXT-X-DATERANGE",Ht]);break}case"DEFINE":{{const fi=new Bi(Ht,u);"IMPORT"in fi?Wn(u,fi,r):Ln(u,fi,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?Qn(u,li,we):d.length>0&&js(u,li,we),u.startCC=$=parseInt(Ht);break;case"KEY":{const fi=bs(Ht,t,u);if(fi.isSupported()){if(fi.method==="NONE"){et=void 0;break}et||(et={}),et[fi.keyFormat]&&(et=g({},et)),et[fi.keyFormat]=fi}else ie.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${Ht}"`);break}case"START":u.startTimeOffset=rr(Ht);break;case"MAP":{const fi=new Bi(Ht,u);if(de.duration){const Rt=new Ae(n,c);or(Rt,fi,i,et),E=Rt,de.initSegment=E,E.rawProgramDateTime&&!de.rawProgramDateTime&&(de.rawProgramDateTime=E.rawProgramDateTime)}else{const Rt=de.byteRangeEndOffset;if(Rt){const kt=de.byteRangeStartOffset;Je=`${Rt-kt}@${kt}`}else Je=null;or(de,fi,i,et),E=de,Ge=!0}E.cc=$;break}case"SERVER-CONTROL":{Ne&&Qn(u,li,we),Ne=new Bi(Ht),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&&Qn(u,li,we);const fi=new Bi(Ht);u.partTarget=fi.decimalFloatingPoint("PART-TARGET");break}case"PART":{let fi=u.partList;fi||(fi=u.partList=[]);const Rt=x>0?fi[fi.length-1]:void 0,kt=x++,Ri=new Bi(Ht,u),Ai=new Be(Ri,de,c,kt,Rt);fi.push(Ai),de.duration+=Ai.duration;break}case"PRELOAD-HINT":{const fi=new Bi(Ht,u);u.preloadHint=fi;break}case"RENDITION-REPORT":{const fi=new Bi(Ht,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(fi);break}default:ie.warn(`line parsed but not handled: ${we}`);break}}}ge&&!ge.relurl?(d.pop(),H-=ge.duration,u.partList&&(u.fragmentHint=ge)):u.partList&&(Cs(de,ge,f),de.cc=$,u.fragmentHint=de,et&&Vs(de,et,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const bt=d.length,Wt=d[0],Ei=d[bt-1];if(H+=u.skippedSegments*u.targetduration,H>0&&bt&&Ei){u.averagetargetduration=H/bt;const oi=Ei.sn;u.endSN=oi!=="initSegment"?oi:0,u.live||(Ei.endList=!0),Wt&&u.startCC===void 0&&(u.startCC=Wt.cc),Me>0&&(ar(d,Me),Wt&&f.unshift(Wt))}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(H+=u.fragmentHint.duration),u.totalduration=H,f.length&&u.dateRangeTagCount&&Wt&&nr(f,u),u.endCC=$,u}}function nr(a,e){const t=a.length;if(!t)return;const 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=sr(e,c,a,u,n);if(d!==-1){o.tagAnchor=e.fragments[d].ref;break}}}}function sr(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 E=(t[i+1]||d[d.length-1]).sn-a.startSN;for(let T=E;T>u;T--){const x=d[T].programDateTime;if(e>=x&&e<x+d[T].duration*1e3)return T}}return u}}}return-1}function bs(a,e,t){var i,n;const s=new Bi(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&&ie.error(`Invalid IV: ${s.IV}`);const f=o?Kn.resolve(o,e):"",E=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Un(r,f,d,E,c)}function rr(a){const t=new Bi(a).decimalFloatingPoint("TIME-OFFSET");return B(t)?t:null}function Ds(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>ei(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 ns(a,e,t){const i=e[t];i&&(a[t]=i)}function ar(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 Cs(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function or(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 Vs(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 Qn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function js(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 lr(a,e,t,i,n,s){i-t<=0&&(ie.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 E=e.sn;if(!a||E<a.startSN||E>a.endSN)return 0;let T;const x=E-a.startSN,H=a.fragments;for(H[x]=e,T=x;T>0;T--)Ws(H[T],H[T-1]);for(T=x;T<H.length-1;T++)Ws(H[T],H[T+1]);return a.fragmentHint&&Ws(H[H.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,f}function Kr(a,e){if(a===e)return;let t=null;const i=a.fragments;for(let u=i.length-1;u>=0;u--){const d=i[u].initSegment;if(d){t=d;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let n;Ss(a,e,(u,d,f,E)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==u.cc){const T=u.cc-d.cc;for(let x=f;x<E.length;x++)E[x].cc+=T;e.endCC=E[E.length-1].cc}B(u.startPTS)&&B(u.endPTS)&&(d.setStart(d.startPTS=u.startPTS),d.startDTS=u.startDTS,d.maxStartPTS=u.maxStartPTS,d.endPTS=u.endPTS,d.endDTS=u.endDTS,d.minEndPTS=u.minEndPTS,d.setDuration(u.endPTS-u.startPTS),d.duration&&(n=d),e.PTSKnown=e.alignedSliding=!0),u.hasStreams&&(d.elementaryStreams=u.elementaryStreams),d.loader=u.loader,u.hasStats&&(d.stats=u.stats),u.initSegment&&(d.initSegment=u.initSegment,t=u.initSegment)});const s=e.fragments,r=e.fragmentHint?s.concat(e.fragmentHint):s;if(t&&r.forEach(u=>{var d;u&&(!u.initSegment||u.initSegment.relurl===((d=t)==null?void 0:d.relurl))&&(u.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=s.some(u=>!u),e.deltaUpdateFailed){ie.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)s.shift();e.startSN=s[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=$r(a.dateRanges,e));const u=a.fragments.filter(d=>d.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<r.length;d++)r[d].programDateTime===null&&Cs(r[d],r[d-1],u);nr(u,e)}e.endCC=s[s.length-1].cc}if(!e.startCC){var o;const u=Zs(a,e.startSN-1);e.startCC=(o=u==null?void 0:u.cc)!=null?o:s[0].cc}ur(a.partList,e.partList,(u,d)=>{d.elementaryStreams=u.elementaryStreams,d.stats=u.stats}),n?lr(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):cr(a,e),s.length&&(e.totalduration=e.edge-s[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const u=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=u),e.driftEndTime=c,e.driftEnd=u}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function $r(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 yn(t[o].attr,c);u.isValid?(n[o]=u,c||(u.tagOrder+=r)):ie.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${pt(t[o].attr)}"`)}),n}function ur(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 Ss(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=ks(`media sequence mismatch ${f.sn}:`,a,e,d,f);return}else if(d.cc!==f.cc){e.playlistParsingError=ks(`discontinuity sequence mismatch (${d.cc}!=${f.cc})`,a,e,d,f);return}}}}function ks(a,e,t,i,n){return new Error(`${a} ${n.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function cr(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;Hs(e,r)}function Hs(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 hr(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 Zs(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 xs(a,e,t){return a?dr(a.partList,e,t):null}function dr(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 fr(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 Ts(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 pr(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function mr(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function gr(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)mr(t[i],a);e.fragmentHint&&mr(e.fragmentHint,a),e.alignedSliding=!0}function Gr(a,e){a&&(_r(e,a),!e.alignedSliding&&a&&Ps(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&cr(a,e,!1))}function _r(a,e){if(!pr(e,a))return;const t=Math.min(e.endCC,a.endCC),i=Ts(e.fragments,t),n=Ts(a.fragments,t);if(!i||!n)return;ie.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;gr(s,a)}function Ps(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=Ts(i,r),s=Ts(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=Ts(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);gr(u,a)}const on={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}},Xe={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 qi extends mn{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=Xe.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,E=_i.bufferInfo(u||c,f,r.maxBufferHole);if(this.log(`media seeking to ${B(f)?f.toFixed(3):f}, state: ${d}`),this.state===Xe.ENDED)this.resetLoadingState();else if(o){const T=r.maxFragLookUpTolerance,x=o.start-T,H=o.start+o.duration+T;if(!E.len||H<E.start||x>E.end){const $=f>H;(f<x||$)&&($&&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 T=this.lastCurrentTime;if(f>T&&(this.lastCurrentTime=f),!this.loadingParts){const x=Math.max(E.end,f),H=this.shouldLoadParts(this.getLevelDetails(),x);H&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${x.toFixed(2)}`),this.loadingParts=H)}}!this.hls.hasEnoughToStart&&!E.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 cn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Fi(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===Xe.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=Xe.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.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=_i.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>n&&r<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const d=c[c.length-1];return _i.isBuffered(this.media,d.start+d.duration/2)}const u=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)}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===Xe.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=Xe.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===Xe.FRAG_LOADING||!this.fragCurrent&&r===Xe.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=Xe.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===Xe.STOPPED||this.state===Xe.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)===Ci.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)===Ci.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&&Sn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,Bn(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:V.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===Xe.STOPPED||this.state===Xe.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!==Xe.STOPPED&&(this.state=Xe.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?on.toString(_i.getBuffered(i)):"(detached)"})`),oe(e)){var n;if(e.type!==ce.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=Xe.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=Xe.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 rn(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=Xe.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===Xe.KEY_LOADING&&(this.state=Xe.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||(o=this.keyLoader.loadClear(e,r.encryptedFragments),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(oe(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&&oe(e)){const f=r.partList;if(f&&n){i>e.end&&r.fragmentHint&&(e=r.fragmentHint);const E=this.getNextPart(f,e,i);if(E>-1){const T=f[E];e=this.fragCurrent=T.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${T.index} (${E}/${f.length-1}) of ${this.fragInfo(e,!1,T)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=T.start+T.duration,this.state=Xe.FRAG_LOADING;let x;return o?x=o.then(H=>!H||this.fragContextChanged(H.frag)?null:this.doFragPartsLoad(e,T,t,n)).catch(H=>this.handleFragLoadError(H)):x=this.doFragPartsLoad(e,T,t,n).catch(H=>this.handleFragLoadError(H)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:T,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):x}else if(!e.url||this.loadedEndOfParts(f,i))return Promise.resolve(null)}}if(oe(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=Xe.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(E=>{c[f.index]=E;const T=E.part;this.hls.trigger(p.FRAG_LOADED,E);const x=xs(i.details,e.sn,f.index+1)||dr(u,e.sn,f.index+1);if(x)d(x);else return s({frag:e,part:T,partsLoaded:c})}).catch(r)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===V.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:V.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Xe.PARSING){!this.fragCurrent&&this.state!==Xe.STOPPED&&this.state!==Xe.ERROR&&(this.state=Xe.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?xs(c,s,r):null,d=u?u.fragment:Zs(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!==Xe.PARSING)return;const{data1:o,data2:c}=e;let u=o;if(o&&c&&(u=xe(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(!_i.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=_i.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=_i.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 _i.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);const E=this.hls.startPosition,T=this.hls.liveSyncPosition,x=c?(E!==-1&&E>=r?E:T)||c.start:e;this.log(`Setting startPosition to ${x} to match start frag at live edge. mainStart: ${E} liveSyncPosition: ${T} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=x}}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===Ci.OK||i===Ci.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(xn(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(xn(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){const t=e.fragments,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=ui(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=Ii(e,i.cc,i.end),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 E;if(e<t){var T;const H=e<this.lastCurrentTime||e>t-u||(T=this.media)!=null&&T.paused||!this.startFragRequested?0:u;E=jt(s,r,e,H)}else E=r[r.length-1];if(E){const x=E.sn-i.startSN,H=this.fragmentTracker.getState(E);if((H===Ci.OK||H===Ci.PARTIAL&&E.gap)&&(s=E),s&&E.sn===s.sn&&(!f||d[0].fragment.sn>E.sn||!i.live&&!f)&&s&&E.level===s.level){const re=r[x+1];E.sn<o&&this.fragmentTracker.getState(re)!==Ci.OK?E=re:E=null}}return E}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){Gr(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&&oe(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!==Xe.FRAG_LOADING_WAITING_RETRY)&&(this.state=Xe.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const x=this.getCurrentContext(t.chunkMeta);x&&(t.frag=x.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===V.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,E=f&&o===mi.RetryRequest,T=f&&!r.resolved&&c===Li.MoveAllAlternatesMatchingHost;if(!E&&T&&oe(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),r.resolved=!0;else if((E||T)&&u<d.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const x=Di(d,u);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${d.maxNumRetry} in ${x}ms`),r.resolved=!0,this.retryDate=self.performance.now()+x,this.state=Xe.FRAG_LOADING_WAITING_RETRY}else if(d&&r)if(this.resetFragmentErrors(e),u<d.maxNumRetry)!s&&o!==mi.RemoveAlternatePermanently&&(r.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else o===mi.SendAlternateToPenaltyBox?this.state=Xe.WAITING_LEVEL:this.state=Xe.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===Xe.PARSING||this.state===Xe.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!==Xe.STOPPED&&(this.state=Xe.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=_i.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===Xe.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Xe.STOPPED&&(this.state=Xe.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 E=n?0:lr(s,e,d.startPTS,d.endPTS,d.startDTS,d.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:i,drift:E,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:V.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=Xe.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 xn(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Tn{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=Os(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Os(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 As={exports:{}},vr;function yr(){return vr||(vr=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,E){if(typeof d!="function")throw new TypeError("The listener must be a function");var T=new n(d,f||c,E),x=t?t+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],T]:c._events[x].push(T):(c._events[x]=T,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 E=0,T=f.length,x=new Array(T);E<T;E++)x[E]=f[E].fn;return x},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,E,T,x){var H=t?t+u:u;if(!this._events[H])return!1;var $=this._events[H],re=arguments.length,ge,de;if($.fn){switch($.once&&this.removeListener(u,$.fn,void 0,!0),re){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,E),!0;case 5:return $.fn.call($.context,d,f,E,T),!0;case 6:return $.fn.call($.context,d,f,E,T,x),!0}for(de=1,ge=new Array(re-1);de<re;de++)ge[de-1]=arguments[de];$.fn.apply($.context,ge)}else{var we=$.length,Pe;for(de=0;de<we;de++)switch($[de].once&&this.removeListener(u,$[de].fn,void 0,!0),re){case 1:$[de].fn.call($[de].context);break;case 2:$[de].fn.call($[de].context,d);break;case 3:$[de].fn.call($[de].context,d,f);break;case 4:$[de].fn.call($[de].context,d,f,E);break;default:if(!ge)for(Pe=1,ge=new Array(re-1);Pe<re;Pe++)ge[Pe-1]=arguments[Pe];$[de].fn.apply($[de].context,ge)}}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,E){var T=t?t+u:u;if(!this._events[T])return this;if(!d)return r(this,T),this;var x=this._events[T];if(x.fn)x.fn===d&&(!E||x.once)&&(!f||x.context===f)&&r(this,T);else{for(var H=0,$=[],re=x.length;H<re;H++)(x[H].fn!==d||E&&!x[H].once||f&&x[H].context!==f)&&$.push(x[H]);$.length?this._events[T]=$.length===1?$[0]:$:r(this,T)}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}(As)),As.exports}var Er=yr(),cs=D(Er);const hs="1.6.5",ms={};function Jo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function el(){const a=ms[hs];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 ms[hs]=n,n}function tl(a){const e=ms[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 ms[a]=n,n}function il(a){const e=ms[a||hs];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete ms[a||hs],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 br(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 zs(a,e){const t=e;let i=0;for(;Vr(a,e);){i+=10;const n=br(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 T=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!0,error:T,reason:T.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 E=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return ie.log(`manifest codec:${i}, parsed codec:${u}, channels:${c}, rate:${d} (ADTS object type:${o} sampling index:${r})`),{config:E,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 Sr(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(Sr(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||Sr(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:E}=o,T=E+f,x=Math.max(0,t+T-e.length);x?(c=new Uint8Array(T-E),c.set(e.subarray(t+E,e.length),0)):c=e.subarray(t+E,t+T);const H={unit:c,pts:r};return x||a.samples.push(H),{sample:H,length:T,missing:x}}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)&&br(a,e+6)+10<=a.length-e}function ul(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 cl(a,e,t,Uint8Array)}function cl(a,e,t,i){const n=hl(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=dl(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 hl(a){return a instanceof ArrayBuffer?a:a.buffer}function dl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function fl(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=Ke(Wr(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=Ke(Wr(a.data,3+i,r));let c;return n==="-->"?c=Ke(Wr(a.data,4+i+r)):c=ul(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function pl(a){if(a.size<2)return;const e=Ke(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function ml(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=Ke(a.data.subarray(t),!0);t+=i.length+1;const n=Ke(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Ke(a.data.subarray(1));return{key:a.type,info:"",data:e}}function gl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=Ke(a.data.subarray(t),!0);t+=i.length+1;const n=Ke(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Ke(a.data);return{key:a.type,info:"",data:e}}function _l(a){return a.type==="PRIV"?pl(a):a.type[0]==="W"?gl(a):a.type==="APIC"?fl(a):ml(a)}function vl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=br(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const xr=10,yl=10;function Ca(a){let e=0;const t=[];for(;Vr(a,e);){const i=br(a,e+6);a[e+5]>>6&1&&(e+=xr),e+=xr;const n=e+i;for(;e+yl<n;){const s=vl(a.subarray(e)),r=_l(s);r&&t.push(r),e+=s.size+xr}Aa(a,e)&&(e+=xr)}return t}function ka(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function El(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=Ca(a);for(let t=0;t<e.length;t++){const i=e[t];if(ka(i))return El(i)}}let Mn=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 ss(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=xe(this.cachedData,e),this.cachedData=null);let i=zs(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=bl(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:Mn.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=zs(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Mn.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=xe(this.cachedData,d):this.cachedData=d}}return{audioTrack:r,videoTrack:ss(),id3Track:o,textTrack:ss()}}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:ss(),id3Track:this._id3Track,textTrack:ss()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const bl=(a,e,t)=>{if(B(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Tr=null;const Sl=[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],xl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Tl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Al=[0,1,1,4];function Pa(a,e,t,i,n){if(t+24>e.length)return;const s=Oa(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 Oa(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=Sl[c*14+n-1]*1e3,f=xl[(t===3?0:t===2?1:2)*3+s],E=o===3?1:2,T=Tl[t][i],x=Al[i],H=T*8*x,$=Math.floor(T*u/f+r)*x;if(Tr===null){const de=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Tr=de?parseInt(de[1]):0}return!!Tr&&Tr<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:E,frameLength:$,samplesPerFrame:H}}}function zr(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Ma(a,e){return e+1<a.length&&zr(a,e)}function wl(a,e){return zr(a,e)&&4<=a.length-e}function Na(a,e){if(e+1<a.length&&zr(a,e)){const i=Oa(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||Ma(a,s)}return!1}class Rl 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=zs(e,0);let n=(i==null?void 0:i.length)||0;if(Na(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 Fa=(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 Ll 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=Ba(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=zs(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Fa(e,i)<16}}function Ba(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 E=0;f===2?E+=2:(f&1&&f!==1&&(E+=2),f&4&&(E+=2));const T=(e[t+6]<<8|e[t+7])>>12-E&1,H=[2,1,2,3,3,4,4,5][f]+T,$=e[t+5]>>3,re=e[t+5]&7,ge=new Uint8Array([s<<6|$<<1|re>>2,(re&3)<<6|f<<3|T<<2|c>>4,c<<4&224]),de=1536/o*9e4,we=i+n*de,Pe=e.subarray(t,t+d);return a.config=ge,a.channelCount=H,a.samplerate=o,a.samples.push({unit:Pe,pts:we}),d}class Il 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=zs(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Fa(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(Na(e,i))return ie.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return wl(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Pa(e,t,i,this.basePTS,this.frameIndex)}}const Dl=/\/emsg[-/]ID3/i;class Cl{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=ss("video",1),r=this.audioTrack=ss("audio",1),o=this.txtTrack=ss("text",1);if(this.id3Track=ss("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:E}=c.video;s.id=u,s.timescale=o.timescale=d,s.codec=f,s.supplemental=E}if(c.audio){const{id:u,timescale:d,codec:f}=c.audio;r.id=u,r.timescale=d,r.codec=f}o.id=Ve.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return De(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=xe(this.remainderData,e));const o=Ce(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=qe(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=qe(e,t),{videoTrack:t,audioTrack:ss(),id3Track:n,textTrack:ss()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=ne(e.samples,["emsg"]);n&&n.forEach(s=>{const r=tt(s);if(Dl.test(r.schemeIdUri)){const o=Ua(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:Mn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Ua(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Mn.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 Ua(a,e){return B(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class kl{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Fi(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Gi.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=Le(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 Ka{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,E=-1,T=0;for(s===-1&&(E=0,T=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,E>=0){const x={data:t.subarray(E,d),type:T};o.push(x)}else{const x=this.getLastNalUnit(e.samples);x&&(r&&c<=4-r&&x.state&&(x.data=x.data.subarray(0,x.data.byteLength-r)),d>0&&(x.data=xe(x.data,t.subarray(0,d)),x.state=0))}c<n?(f=this.getNALuType(t,c),E=c,T=f,s=0):s=-1}else s=0}if(E>=0&&s>=0){const x={data:t.subarray(E,n),type:T,state:s};o.push(x)}if(o.length===0){const x=this.getLastNalUnit(e.samples);x&&(x.data=xe(x.data,t))}return e.naluState=s,o}}class Ys{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&&ie.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 $a extends Ka{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 H=!1;o=!0;const $=u.data;if(c&&$.length>4){const re=this.readSliceType($);(re===2||re===4||re===7||re===9)&&(H=!0)}if(H){var E;(E=r)!=null&&E.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=H;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,ct(u.data,1,i.pts,t.samples);break}case 7:{var T,x;o=!0,c=!0;const H=u.data,$=this.readSPS(H);if(!e.sps||e.width!==$.width||e.height!==$.height||((T=e.pixelRatio)==null?void 0:T[0])!==$.pixelRatio[0]||((x=e.pixelRatio)==null?void 0:x[1])!==$.pixelRatio[1]){e.width=$.width,e.height=$.height,e.pixelRatio=$.pixelRatio,e.sps=[H];const re=H.subarray(1,4);let ge="avc1.";for(let de=0;de<3;de++){let we=re[de].toString(16);we.length<2&&(we="0"+we),ge+=we}e.codec=ge}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 Ys(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 Ys(e);let i=0,n=0,s=0,r=0,o,c,u;const d=t.readUByte.bind(t),f=t.readBits.bind(t),E=t.readUEG.bind(t),T=t.readBoolean.bind(t),x=t.skipBits.bind(t),H=t.skipEG.bind(t),$=t.skipUEG.bind(t),re=this.skipScalingList.bind(this);d();const ge=d();if(f(5),x(3),d(),$(),ge===100||ge===110||ge===122||ge===244||ge===44||ge===83||ge===86||ge===118||ge===128){const Ge=E();if(Ge===3&&x(1),$(),$(),x(1),T())for(c=Ge!==3?8:12,u=0;u<c;u++)T()&&(u<6?re(16,t):re(64,t))}$();const de=E();if(de===0)E();else if(de===1)for(x(1),H(),H(),o=E(),u=0;u<o;u++)H();$(),x(1);const we=E(),Pe=E(),et=f(1);et===0&&x(1),x(1),T()&&(i=E(),n=E(),s=E(),r=E());let Me=[1,1];if(T()&&T())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((we+1)*16-i*2-n*2),height:(2-et)*(Pe+1)*16-(et?2:4)*(s+r),pixelRatio:Me}}}class Ga extends Ka{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 E;(E=r)!=null&&E.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,ct(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 T=this.readSPS(u.data);e.width=T.width,e.height=T.height,e.pixelRatio=T.pixelRatio,e.codec=T.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const x in T.params)e.params[x]=T.params[x]}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 T=this.readPPS(u.data);for(const x in T)e.params[x]=T[x]}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 Ys(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 Ys(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(),E=t.readUByte(),T=t.readUByte(),x=t.readUByte(),H=t.readUByte(),$=t.readUByte(),re=t.readUByte(),ge=[],de=[];for(let $i=0;$i<i;$i++)ge.push(t.readBoolean()),de.push(t.readBoolean());if(i>0)for(let $i=i;$i<8;$i++)t.readBits(2);for(let $i=0;$i<i;$i++)ge[$i]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),de[$i]&&t.readUByte();t.readUEG();const we=t.readUEG();we==3&&t.skipBits(1);const Pe=t.readUEG(),et=t.readUEG(),Me=t.readBoolean();let Ge=0,Je=0,Ne=0,bt=0;Me&&(Ge+=t.readUEG(),Je+=t.readUEG(),Ne+=t.readUEG(),bt+=t.readUEG());const Wt=t.readUEG(),Ei=t.readUEG(),oi=t.readUEG(),li=t.readBoolean();for(let $i=li?0:i;$i<=i;$i++)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 An=0;An<4;An++)for(let jn=0;jn<(An===3?2:6);jn++)if(!t.readBoolean())t.readUEG();else{const es=Math.min(64,1<<4+(An<<1));An>1&&t.readEG();for(let Gs=0;Gs<es;Gs++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const fi=t.readUEG();let Rt=0;for(let $i=0;$i<fi;$i++){let An=!1;if($i!==0&&(An=t.readBoolean()),An){$i===fi&&t.readUEG(),t.readBoolean(),t.readUEG();let jn=0;for(let Rs=0;Rs<=Rt;Rs++){const es=t.readBoolean();let Gs=!1;es||(Gs=t.readBoolean()),(es||Gs)&&jn++}Rt=jn}else{const jn=t.readUEG(),Rs=t.readUEG();Rt=jn+Rs;for(let es=0;es<jn;es++)t.readUEG(),t.readBoolean();for(let es=0;es<Rs;es++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const $i=t.readUEG();for(let An=0;An<$i;An++){for(let jn=0;jn<oi+4;jn++)t.readBits(1);t.readBits(1)}}let Ri=0,Ai=1,Oi=1,Ki=!0,Hi=1,en=0;t.readBoolean(),t.readBoolean();let Rn=!1;if(t.readBoolean()){if(t.readBoolean()){const Ls=t.readUByte(),Wo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Fr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Ls>0&&Ls<16?(Ai=Wo[Ls-1],Oi=Fr[Ls-1]):Ls===255&&(Ai=t.readBits(16),Oi=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(),Rn=t.readBoolean(),Rn&&(Ge+=t.readUEG(),Je+=t.readUEG(),Ne+=t.readUEG(),bt+=t.readUEG()),t.readBoolean()&&(Hi=t.readBits(32),en=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Fr=t.readBoolean(),Ho=t.readBoolean();let tr=!1;(Fr||Ho)&&(tr=t.readBoolean(),tr&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),tr&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Zo=0;Zo<=i;Zo++){Ki=t.readBoolean();const ih=Ki||t.readBoolean();let zo=!1;ih?t.readEG():zo=t.readBoolean();const Yo=zo?1:t.readUEG()+1;if(Fr)for(let ir=0;ir<Yo;ir++)t.readUEG(),t.readUEG(),tr&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Ho)for(let ir=0;ir<Yo;ir++)t.readUEG(),t.readUEG(),tr&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Ri=t.readUEG())}let Es=Pe,jo=et;if(Me||Rn){let $i=1,An=1;we===1?$i=An=2:we==2&&($i=2),Es=Pe-$i*Je-$i*Ge,jo=et-An*bt-An*Ne}const eh=n?["A","B","C"][n]:"",th=o<<24|c<<16|u<<8|d;let xa=0;for(let $i=0;$i<32;$i++)xa=(xa|(th>>$i&1)<<31-$i)>>>0;let Ta=xa.toString(16);return r===1&&Ta==="2"&&(Ta="6"),{codecString:`hvc1.${eh}${r}.${Ta}.${s?"H":"L"}${re}.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,E,T,x,H,$],general_level_idc:re,bit_depth:Wt+8,bit_depth_luma_minus8:Wt,bit_depth_chroma_minus8:Ei,min_spatial_segmentation_idc:Ri,chroma_format_idc:we,frame_rate:{fixed:Ki,fps:en/Hi}},width:Es,height:jo,pixelRatio:[Ai,Oi]}}readPPS(e){const t=new Ys(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 vn=188;class gs{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=gs.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(vn*5,t-vn)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=vn)if(e[c]===71&&(t-c===vn||e[c+vn]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+vn*99,e.length-vn)+1)),s||(s=Yr(e,c)===0),s&&o>1&&(r===0&&o>2||c+vn>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:Ve[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=gs.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=gs.createTrack("audio",n),this._id3Track=gs.createTrack("id3"),this._txtTrack=gs.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,E=o.pid,T=c.pid,x=o.pesData,H=c.pesData,$=null,re=this.pmtParsed,ge=this._pmtId,de=e.length;if(this.remainderData&&(e=xe(this.remainderData,e),de=e.length,this.remainderData=null),de<vn&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const we=Math.max(0,gs.syncOffset(e));de-=(de-we)%vn,de<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,de,e.buffer.byteLength-de));let Pe=0;for(let Me=we;Me<de;Me+=vn)if(e[Me]===71){const Ge=!!(e[Me+1]&64),Je=Yr(e,Me),Ne=(e[Me+3]&48)>>4;let bt;if(Ne>1){if(bt=Me+5+e[Me+4],bt===Me+vn)continue}else bt=Me+4;switch(Je){case d:if(Ge){if(f&&(s=Ms(f,this.logger))){if(this.videoParser===null)switch(r.segmentCodec){case"avc":this.videoParser=new $a;break;case"hevc":this.videoParser=new Ga;break}this.videoParser!==null&&this.videoParser.parsePES(r,u,s,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray(bt,Me+vn)),f.size+=Me+vn-bt);break;case E:if(Ge){if(x&&(s=Ms(x,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}x={data:[],size:0}}x&&(x.data.push(e.subarray(bt,Me+vn)),x.size+=Me+vn-bt);break;case T:Ge&&(H&&(s=Ms(H,this.logger))&&this.parseID3PES(c,s),H={data:[],size:0}),H&&(H.data.push(e.subarray(bt,Me+vn)),H.size+=Me+vn-bt);break;case 0:Ge&&(bt+=e[bt]+1),ge=this._pmtId=Pl(e,bt);break;case ge:{Ge&&(bt+=e[bt]+1);const Wt=Ol(e,bt,this.typeSupported,i,this.observer,this.logger);d=Wt.videoPid,d>0&&(r.pid=d,r.segmentCodec=Wt.segmentVideoCodec),E=Wt.audioPid,E>0&&(o.pid=E,o.segmentCodec=Wt.segmentAudioCodec),T=Wt.id3Pid,T>0&&(c.pid=T),$!==null&&!re&&(this.logger.warn(`MPEG-TS PMT found at ${Me} after unknown PID '${$}'. Backtracking to sync byte @${we} to parse all TS packets.`),$=null,Me=we-188),re=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=Je;break}}else Pe++;Pe>0&&Xr(this.observer,new Error(`Found ${Pe} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=x,c.pesData=H;const et={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(et),et}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=Ms(r,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new $a;break;case"hevc":this.videoParser=new Ga;break}this.videoParser!==null&&(this.videoParser.parsePES(i,s,u,!0),i.pesData=null)}else i.pesData=r;if(o&&(u=Ms(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=Ms(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 kl(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,E=n.sample.unit.byteLength;if(f===-1)s=xe(n.sample.unit,s);else{const T=E-f;n.sample.unit.set(s.subarray(0,f),T),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!Sr(s,r);r++);if(r!==i){let f;const E=r<o-1;if(E?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),E,this.logger),!E)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&&!Sr(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(Ma(i,r)){const c=Pa(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=Ba(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?Mn.emsg:Mn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Yr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function Pl(a,e){return(a[e+10]&31)<<8|a[e+11]}function Ol(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 E=e+5,T=f;for(;T>2;){switch(a[E]){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 H=a[E+1]+2;E+=H,T-=H}}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:V.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 Ms(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]=xe(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 E=new Uint8Array(a.size);for(let T=0,x=c.length;T<x;T++){i=c[T];let H=i.byteLength;if(f)if(f>H){f-=H;continue}else i=i.subarray(f),H-=f,f=0;E.set(i,t),t+=H}return n&&(n-=s+3),{data:E,pts:r,dts:o,len:n}}return null}class Ml{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 _s=Math.pow(2,32)-1;class Ue{static init(){Ue.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 Ue.types)Ue.types.hasOwnProperty(e)&&(Ue.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]);Ue.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]);Ue.STTS=Ue.STSC=Ue.STCO=s,Ue.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ue.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Ue.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Ue.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]);Ue.FTYP=Ue.box(Ue.types.ftyp,r,c,r,o),Ue.DINF=Ue.box(Ue.types.dinf,Ue.box(Ue.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 Ue.box(Ue.types.hdlr,Ue.HDLR_TYPES[e])}static mdat(e){return Ue.box(Ue.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(_s+1)),n=Math.floor(t%(_s+1));return Ue.box(Ue.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 Ue.box(Ue.types.mdia,Ue.mdhd(e.timescale||0,e.duration||0),Ue.hdlr(e.type),Ue.minf(e))}static mfhd(e){return Ue.box(Ue.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"?Ue.box(Ue.types.minf,Ue.box(Ue.types.smhd,Ue.SMHD),Ue.DINF,Ue.stbl(e)):Ue.box(Ue.types.minf,Ue.box(Ue.types.vmhd,Ue.VMHD),Ue.DINF,Ue.stbl(e))}static moof(e,t,i){return Ue.box(Ue.types.moof,Ue.mfhd(e),Ue.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Ue.trak(e[t]);return Ue.box.apply(null,[Ue.types.moov,Ue.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Ue.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Ue.trex(e[t]);return Ue.box.apply(null,[Ue.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(_s+1)),n=Math.floor(t%(_s+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 Ue.box(Ue.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 Ue.box(Ue.types.sdtp,i)}static stbl(e){return Ue.box(Ue.types.stbl,Ue.stsd(e),Ue.box(Ue.types.stts,Ue.STTS),Ue.box(Ue.types.stsc,Ue.STSC),Ue.box(Ue.types.stsz,Ue.STSZ),Ue.box(Ue.types.stco,Ue.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=Ue.box(Ue.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 Ue.box(Ue.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,Ue.box(Ue.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ue.box(Ue.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 Ue.box(Ue.types.mp4a,Ue.audioStsd(e),Ue.box(Ue.types.esds,Ue.esds(e)))}static mp3(e){return Ue.box(Ue.types[".mp3"],Ue.audioStsd(e))}static ac3(e){return Ue.box(Ue.types["ac-3"],Ue.audioStsd(e),Ue.box(Ue.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Ue.box(Ue.types.stsd,Ue.STSD,Ue.mp4a(e));if(t==="ac3"&&e.config)return Ue.box(Ue.types.stsd,Ue.STSD,Ue.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Ue.box(Ue.types.stsd,Ue.STSD,Ue.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Ue.box(Ue.types.stsd,Ue.STSD,Ue.avc1(e));if(t==="hevc"&&e.vps)return Ue.box(Ue.types.stsd,Ue.STSD,Ue.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/(_s+1)),o=Math.floor(i%(_s+1));return Ue.box(Ue.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=Ue.sdtp(e),n=e.id,s=Math.floor(t/(_s+1)),r=Math.floor(t%(_s+1));return Ue.box(Ue.types.traf,Ue.box(Ue.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),Ue.box(Ue.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])),Ue.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Ue.box(Ue.types.trak,Ue.tkhd(e),Ue.mdia(e))}static trex(e){const t=e.id;return Ue.box(Ue.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,E;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,E=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,E>>>24&255,E>>>16&255,E>>>8&255,E&255],12+16*o);return Ue.box(Ue.types.trun,r)}static initSegment(e){Ue.types||Ue.init();const t=Ue.moov(e);return xe(Ue.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 x=0;x<i.length;x+=1){r+=3;for(let H=0;H<i[x].length;H+=1)r+=2+i[x][H].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let x=0;x<i.length;x+=1){o.set(new Uint8Array([32+x|(x===c?128:0),0,i[x].length]),r),r+=3;for(let H=0;H<i[x].length;H+=1)o.set(new Uint8Array([i[x][H].length>>8,i[x][H].length&255]),r),r+=2,o.set(i[x][H],r),r+=i[x][H].length}const u=Ue.box(Ue.types.hvcC,o),d=e.width,f=e.height,E=e.pixelRatio[0],T=e.pixelRatio[1];return Ue.box(Ue.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,Ue.box(Ue.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ue.box(Ue.types.pasp,new Uint8Array([E>>24,E>>16&255,E>>8&255,E&255,T>>24,T>>16&255,T>>8&255,T&255])))}}Ue.types=void 0,Ue.HDLR_TYPES=void 0,Ue.STTS=void 0,Ue.STSC=void 0,Ue.STCO=void 0,Ue.STSZ=void 0,Ue.VMHD=void 0,Ue.SMHD=void 0,Ue.STSD=void 0,Ue.FTYP=void 0,Ue.DINF=void 0;const Va=9e4;function Qr(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function Nl(a,e,t=1,i=!1){return Qr(a,e,1/t,i)}function Xs(a,e=!1){return Qr(a,1e3,1/Va,e)}function Fl(a,e=1){return Qr(a,Va,1/e)}const Bl=10*1e3,Ul=1024,Kl=1152,$l=1536;let Ns=null,Jr=null;function ja(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 Ar{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,Ns===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ns=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=$n(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,E,T,x,H=s,$=s;const re=e.pid>-1,ge=t.pid>-1,de=t.samples.length,we=e.samples.length>0,Pe=o&&de>0||de>1;if((!re||we)&&(!ge||Pe)||this.ISGenerated||o){if(this.ISGenerated){var Me,Ge,Je,Ne;const oi=this.videoTrackConfig;(oi&&(t.width!==oi.width||t.height!==oi.height||((Me=t.pixelRatio)==null?void 0:Me[0])!==((Ge=oi.pixelRatio)==null?void 0:Ge[0])||((Je=t.pixelRatio)==null?void 0:Je[1])!==((Ne=oi.pixelRatio)==null?void 0:Ne[1]))||!oi&&Pe||this.nextAudioPts===null&&we)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const bt=this.isVideoContiguous;let Wt=-1,Ei;if(Pe&&(Wt=Gl(t.samples),!bt&&this.config.forceKeyFrameOnDiscontinuity))if(x=!0,Wt>0){this.logger.warn(`[mp4-remuxer]: Dropped ${Wt} out of ${de} video samples due to a missing keyframe`);const oi=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Wt),t.dropped+=Wt,$+=(t.samples[0].pts-oi)/t.inputTimeScale,Ei=$}else Wt===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${de} video samples`),x=!1);if(this.ISGenerated){if(we&&Pe){const oi=this.getVideoStartPts(t.samples),Ht=($n(e.samples[0].pts,oi)-oi)/t.inputTimeScale;H+=Math.max(0,Ht),$+=Math.max(0,-Ht)}if(we){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),d=this.remuxAudio(e,H,this.isAudioContiguous,r,ge||Pe||c===ce.AUDIO?$:void 0),Pe){const oi=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,$,bt,oi)}}else Pe&&(u=this.remuxVideo(t,$,bt,0));u&&(u.firstKeyFrame=Wt,u.independent=Wt!==-1,u.firstKeyFramePTS=Ei)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(T=Wa(i,s,this._initPTS,this._initDTS)),n.samples.length&&(E=Ha(n,s,this._initPTS))),{audio:d,video:u,initSegment:f,independent:x,text:E,id3:T}}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",E,T,x,H;if(d&&(E=T=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):Ue.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(H=e.id,x=e.inputTimeScale,!u||x!==u.timescale?E=T=s[0].pts-Math.round(x*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:Ue.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(H=t.id,x=t.inputTimeScale,!u||x!==u.timescale){const $=this.getVideoStartPts(r),re=Math.round(x*i);T=Math.min(T,$n(r[0].dts,$)-re),E=Math.min(E,$-re)}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:E,timescale:x},this._initDTS={baseTime:T,timescale:x}):E=x=void 0,{tracks:c,initPTS:E,timescale:x,trackId:H}}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,E=this.videoSampleDuration,T,x,H=Number.POSITIVE_INFINITY,$=Number.NEGATIVE_INFINITY,re=!1;if(!i||d===null){const Rt=t*s,kt=r[0].pts-$n(r[0].dts,r[0].pts);Ns&&d!==null&&Math.abs(Rt-kt-d)<15e3?i=!0:d=Rt-kt}const ge=u.baseTime*s/u.timescale;for(let Rt=0;Rt<c;Rt++){const kt=r[Rt];kt.pts=$n(kt.pts-ge,d),kt.dts=$n(kt.dts-ge,d),kt.dts<r[Rt>0?Rt-1:Rt].dts&&(re=!0)}re&&r.sort(function(Rt,kt){const Ri=Rt.dts-kt.dts,Ai=Rt.pts-kt.pts;return Ri||Ai}),T=r[0].dts,x=r[r.length-1].dts;const de=x-T,we=de?Math.round(de/(c-1)):E||e.inputTimeScale/30;if(i){const Rt=T-d,kt=Rt>we,Ri=Rt<-1;if((kt||Ri)&&(kt?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Xs(Rt,!0)} ms (${Rt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Xs(-Rt,!0)} ms (${Rt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ri||d>=r[0].pts||Ns)){T=d;const Ai=r[0].pts-Rt;if(kt)r[0].dts=T,r[0].pts=Ai;else{let Oi=!0;for(let Ki=0;Ki<r.length&&!(r[Ki].dts>Ai&&Oi);Ki++){const Hi=r[Ki].pts;if(r[Ki].dts-=Rt,r[Ki].pts-=Rt,Ki<r.length-1){const en=r[Ki+1].pts,Rn=r[Ki].pts,Pn=en<=Rn,Es=en<=Hi;Oi=Pn==Es}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${Xs(Ai,!0)}/${Xs(T,!0)}, delta: ${Xs(Rt,!0)} ms`)}}T=Math.max(0,T);let Pe=0,et=0,Me=T;for(let Rt=0;Rt<c;Rt++){const kt=r[Rt],Ri=kt.units,Ai=Ri.length;let Oi=0;for(let Ki=0;Ki<Ai;Ki++)Oi+=Ri[Ki].data.length;et+=Oi,Pe+=Ai,kt.length=Oi,kt.dts<Me?(kt.dts=Me,Me+=we/4|0||1):Me=kt.dts,H=Math.min(kt.pts,H),$=Math.max(kt.pts,$)}x=r[c-1].dts;const Ge=et+4*Pe+8;let Je;try{Je=new Uint8Array(Ge)}catch(Rt){this.observer.emit(p.ERROR,p.ERROR,{type:he.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:Rt,bytes:Ge,reason:`fail allocating video mdat ${Ge}`});return}const Ne=new DataView(Je.buffer);Ne.setUint32(0,Ge),Je.set(Ue.types.mdat,4);let bt=!1,Wt=Number.POSITIVE_INFINITY,Ei=Number.POSITIVE_INFINITY,oi=Number.NEGATIVE_INFINITY,li=Number.NEGATIVE_INFINITY;for(let Rt=0;Rt<c;Rt++){const kt=r[Rt],Ri=kt.units;let Ai=0;for(let Hi=0,en=Ri.length;Hi<en;Hi++){const Rn=Ri[Hi],Pn=Rn.data,Es=Rn.data.byteLength;Ne.setUint32(f,Es),f+=4,Je.set(Pn,f),f+=Es,Ai+=4+Es}let Oi;if(Rt<c-1)E=r[Rt+1].dts-kt.dts,Oi=r[Rt+1].pts-kt.pts;else{const Hi=this.config,en=Rt>0?kt.dts-r[Rt-1].dts:we;if(Oi=Rt>0?kt.pts-r[Rt-1].pts:we,Hi.stretchShortVideoTrack&&this.nextAudioPts!==null){const Rn=Math.floor(Hi.maxBufferHole*s),Pn=(n?H+n*s:this.nextAudioPts)-kt.pts;Pn>Rn?(E=Pn-en,E<0?E=en:bt=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${Pn/90} ms to the next segment; using duration ${E/90} ms for the last video frame.`)):E=en}else E=en}const Ki=Math.round(kt.pts-kt.dts);Wt=Math.min(Wt,E),oi=Math.max(oi,E),Ei=Math.min(Ei,Oi),li=Math.max(li,Oi),o.push(ja(kt.key,E,Ai,Ki))}if(o.length){if(Ns){if(Ns<70){const Rt=o[0].flags;Rt.dependsOn=2,Rt.isNonSync=0}}else if(Jr&&li-Ei<oi-Wt&&we/oi<.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 Rt=T;for(let kt=0,Ri=o.length;kt<Ri;kt++){const Ai=Rt+o[kt].duration,Oi=Rt+o[kt].cts;if(kt<Ri-1){const Ki=Ai+o[kt+1].cts;o[kt].duration=Ki-Oi}else o[kt].duration=kt?o[kt-1].duration:we;o[kt].cts=0,Rt=Ai}}}E=bt||!E?we:E,this.nextAvcDts=d=x+E,this.videoSampleDuration=E,this.isVideoContiguous=!0;const fi={data1:Ue.moof(e.sequenceNumber++,T,g(e,{samples:o})),data2:Je,startPTS:H/s,endPTS:($+E)/s,startDTS:T/s,endDTS:d/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,fi}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Kl;case"ac3":return $l;default:return Ul}}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,E=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,T=[],x=s!==void 0;let H=e.samples,$=E?0:8,re=this.nextAudioPts||-1;const ge=t*r,de=f.baseTime*r/f.timescale;if(this.isAudioContiguous=i=i||H.length&&re>0&&(n&&Math.abs(ge-re)<9e3||Math.abs($n(H[0].pts-de,ge)-re)<20*d),H.forEach(function(Ht){Ht.pts=$n(Ht.pts-de,ge)}),!i||re<0){if(H=H.filter(Ht=>Ht.pts>=0),!H.length)return;s===0?re=0:n&&!x?re=Math.max(0,ge):re=H[0].pts}if(e.segmentCodec==="aac"){const Ht=this.config.maxAudioFramesDrift;for(let ci=0,fi=re;ci<H.length;ci++){const Rt=H[ci],kt=Rt.pts,Ri=kt-fi,Ai=Math.abs(1e3*Ri/r);if(Ri<=-Ht*d&&x)ci===0&&(this.logger.warn(`Audio frame @ ${(kt/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Ri/r)} ms.`),this.nextAudioPts=re=fi=kt);else if(Ri>=Ht*d&&Ai<Bl&&x){let Oi=Math.round(Ri/d);fi=kt-Oi*d,fi<0&&(Oi--,fi+=d),ci===0&&(this.nextAudioPts=re=fi),this.logger.warn(`[mp4-remuxer]: Injecting ${Oi} audio frame @ ${(fi/r).toFixed(3)}s due to ${Math.round(1e3*Ri/r)} ms gap.`);for(let Ki=0;Ki<Oi;Ki++){const Hi=Math.max(fi,0);let en=Ml.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);en||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),en=Rt.unit.subarray()),H.splice(ci,0,{unit:en,pts:Hi}),fi+=d,ci++}}Rt.pts=fi,fi+=d}}let we=null,Pe=null,et,Me=0,Ge=H.length;for(;Ge--;)Me+=H[Ge].unit.byteLength;for(let Ht=0,ci=H.length;Ht<ci;Ht++){const fi=H[Ht],Rt=fi.unit;let kt=fi.pts;if(Pe!==null){const Ai=T[Ht-1];Ai.duration=Math.round((kt-Pe)/c)}else if(i&&e.segmentCodec==="aac"&&(kt=re),we=kt,Me>0){Me+=$;try{et=new Uint8Array(Me)}catch(Ai){this.observer.emit(p.ERROR,p.ERROR,{type:he.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:Ai,bytes:Me,reason:`fail allocating audio mdat ${Me}`});return}E||(new DataView(et.buffer).setUint32(0,Me),et.set(Ue.types.mdat,4))}else return;et.set(Rt,$);const Ri=Rt.byteLength;$+=Ri,T.push(ja(!0,u,Ri,0)),Pe=kt}const Je=T.length;if(!Je)return;const Ne=T[T.length-1];this.nextAudioPts=re=Pe+c*Ne.duration;const bt=E?new Uint8Array(0):Ue.moof(e.sequenceNumber++,we/c,g({},e,{samples:T}));e.samples=[];const Wt=we/r,Ei=re/r,li={data1:bt,data2:et,startPTS:Wt,endPTS:Ei,startDTS:Wt,endDTS:Ei,type:"audio",hasAudio:!0,hasVideo:!1,nb:Je};return this.isAudioContiguous=!0,li}}function $n(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 Gl(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function Wa(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=$n(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=$n(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function Ha(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=$n(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 Vl{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.isVideoContiguous=!1,this.logger=n}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(W(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,this.logger)),n.video&&(i=Za(n.video,v.VIDEO,this.logger));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 E=t.samples;if(!(E!=null&&E.length))return f;const T={initPTS:void 0,timescale:void 0,trackId:void 0};let x=this.initData;if((o=x)!=null&&o.length||(this.generateInitSegment(E),x=this.initData),!((c=x)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1);const H=ue(E,x,this.logger),$=x.audio?H[x.audio.id]:null,re=x.video?H[x.video.id]:null,ge=wr(re,1/0),de=wr($,1/0),we=wr(re,0,!0),Pe=wr($,0,!0);let et,Me=s,Ge=0;if($&&(!re||!u&&de<ge||u&&u.trackId===x.audio.id)?(T.trackId=x.audio.id,et=$,Ge=Pe-de):re&&(T.trackId=x.video.id,et=re,Ge=we-ge),et){const Ht=et.timescale;Me=et.start/Ht,T.timescale=Ht,u||(T.initPTS=et.start-s*Ht,this.initPTS=u={baseTime:T.initPTS,timescale:Ht,trackId:T.trackId})}(r||!u)&&(jl(u,Me,s,Ge)||T.timescale!==u.timescale)&&(T.initPTS=Me-s,u&&u.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${u.baseTime/u.timescale} to ${T.initPTS}`),this.initPTS=u={baseTime:T.initPTS,timescale:1});const Je=e?Me-u.baseTime/u.timescale:d;ye(x,E,u.baseTime/u.timescale);const Ne=Je+Ge;Ge>0?this.lastEndTime=Ne:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const bt=!!x.audio,Wt=!!x.video;let Ei="";bt&&(Ei+="audio"),Wt&&(Ei+="video");const oi={data1:E,startPTS:Je,startDTS:Je,endPTS:Ne,endDTS:Ne,type:Ei,hasAudio:bt,hasVideo:Wt,nb:1,dropped:0};f.audio=bt&&!Wt?oi:void 0,f.video=Wt?oi:void 0;const li=re==null?void 0:re.sampleCount;if(li){const Ht=re.keyFrameIndex,ci=Ht!==-1;oi.nb=li,oi.dropped=Ht===0||this.isVideoContiguous?0:ci?Ht:li,oi.independent=ci,oi.firstKeyFrame=Ht,ci&&re.keyFrameStart&&(oi.firstKeyFramePTS=re.keyFrameStart-u.baseTime/u.timescale),this.isVideoContiguous||(f.independent=ci),this.isVideoContiguous||(this.isVideoContiguous=ci),oi.dropped&&this.logger.warn(`fmp4 does not start with IDR: firstIDR ${Ht}/${li} dropped: ${oi.dropped} pts: ${oi.firstKeyFramePTS||"NA"}`)}return f.initSegment=T,f.id3=Wa(i,s,u,u),n.samples.length&&(f.text=Ha(n,s,u)),f}}function wr(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function jl(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,t){const i=a==null?void 0:a.codec;return i&&i.length>4?i:e===v.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?yt(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let ds;try{ds=self.performance.now.bind(self.performance)}catch(a){ds=Date.now}const Rr=[{demux:Cl,remux:Vl},{demux:gs,remux:Ar},{demux:Rl,remux:Ar},{demux:Il,remux:Ar}];Rr.splice(2,0,{demux:Ll,remux:Ar});class za{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=ds();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:u,discontinuity:d,trackSwitch:f,accurateTimeOffset:E,timeOffset:T,initSegmentChange:x}=n||o,{audioCodec:H,videoCodec:$,defaultInitPts:re,duration:ge,initSegmentData:de}=c,we=Wl(r,t);if(we&&Sn(we.method)){const Ge=this.getDecrypter(),Je=Bn(we.method);if(Ge.isSync()){let Ne=Ge.softwareDecrypt(r,we.key.buffer,we.iv.buffer,Je);if(i.part>-1){const Wt=Ge.flush();Ne=Wt&&Wt.buffer}if(!Ne)return s.executeEnd=ds(),ea(i);r=new Uint8Array(Ne)}else return this.asyncResult=!0,this.decryptionPromise=Ge.webCryptoDecrypt(r,we.key.buffer,we.iv.buffer,Je).then(Ne=>{const bt=this.push(Ne,null,i);return this.decryptionPromise=null,bt}),this.decryptionPromise}const Pe=this.needsProbing(d,f);if(Pe){const Ge=this.configureTransmuxer(r);if(Ge)return this.logger.warn(`[transmuxer] ${Ge.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:Ge,reason:Ge.message}),s.executeEnd=ds(),ea(i)}(d||f||x||Pe)&&this.resetInitSegment(de,H,$,ge,t),(d||x||Pe)&&this.resetInitialTimestamp(re),u||this.resetContiguity();const et=this.transmux(r,we,T,E,i);this.asyncResult=qs(et);const Me=this.currentTransmuxState;return Me.contiguous=!0,Me.discontinuity=!1,Me.trackSwitch=!1,s.executeEnd=ds(),et}flush(e){const t=e.transmuxing;t.executeStart=ds();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=ds();const f=[ea(e)];return this.asyncResult?Promise.resolve(f):f}const d=c.flush(o);return qs(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=ds()}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,E=Rr.length;f<E;f++){var r;if((r=Rr[f].demux)!=null&&r.probe(e,this.logger)){s=Rr[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 Fi(this.config)),e}}function Wl(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 qs(a){return"then"in a&&a.then instanceof Function}class Hl{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 Zl{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 Ya=0;class Xa{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Ya++,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 E=(f=this.workerContext)==null?void 0:f.objectURL;E&&self.URL.revokeObjectURL(E);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:V.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 cs,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=We(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:pt(s)})}catch(d){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,d),this.terminateWorker(),this.error=null,this.transmuxer=new za(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new za(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Ya++;const t=this.hls.config,i=We(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:pt(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,E;u.transmuxing.start=self.performance.now();const{instanceNo:T,transmuxer:x}=this,H=r?r.start:s.start,$=s.decryptdata,re=this.frag,ge=!(re&&s.cc===re.cc),de=!(re&&u.level===re.level),we=re?u.sn-re.sn:-1,Pe=this.part?u.part-this.part.index:-1,et=we===0&&u.id>1&&u.id===(re==null?void 0:re.stats.chunkCount),Me=!de&&(we===1||we===0&&(Pe===1||et&&Pe<=0)),Ge=self.performance.now();(de||we||s.stats.parsing.start===0)&&(s.stats.parsing.start=Ge),r&&(Pe||!Me)&&(r.stats.parsing.start=Ge);const Je=!(re&&((f=s.initSegment)==null?void 0:f.url)===((E=re.initSegment)==null?void 0:E.url)),Ne=new Zl(ge,Me,c,de,H,Je);if(!Me||ge||Je){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: ${ge}
trackSwitch: ${de}
contiguous: ${Me}
accurateTimeOffset: ${c}
timeOffset: ${H}
initSegmentChange: ${Je}`);const bt=new Hl(i,n,t,o,d);this.configureTransmuxer(bt)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:T,cmd:"demux",data:e,decryptdata:$,chunkMeta:u,state:Ne},e instanceof ArrayBuffer?[e]:[]);else if(x){const bt=x.push(e,$,u,Ne);qs(bt)?bt.then(Wt=>{this.handleTransmuxComplete(Wt)}).catch(Wt=>{this.transmuxerError(Wt,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(bt)}}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);qs(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:V.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 zl extends qi{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===Xe.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==r)&&this.syncWithAnchor(t,c==null?void 0:c.frag)}else!this.hls.hasEnoughToStart&&o&&o.cc!==r?(o.abortRequests(),this.syncWithAnchor(t,o)):this.state===Xe.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&(n==null?void 0:n.cc)===t.cc)return;const s=(n||e).cc,r=this.getLevelDetails(),o=this.getLoadPosition(),c=Ii(r,s,o);c&&(this.log(`Waiting fragment cc (${t==null?void 0:t.cc}) cancelled because video is at cc ${e.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===Xe.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Xe.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=Xe.IDLE):this.state=Xe.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Xe.IDLE:this.doTickIdle();break;case Xe.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=Xe.WAITING_INIT_PTS}break}case Xe.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=Xe.IDLE}break}case Xe.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=Xe.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.syncWithAnchor(o,t.frag)}else this.state=Xe.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),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=Xe.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=Xe.ENDED;return}const f=d.len,E=t.maxBufferLength,T=c.fragments,x=T[0].start,H=this.getLoadPosition(),$=this.flushing?H:d.end;if(this.switchingTrack&&n){const de=H;c.PTSKnown&&de<x&&(d.end>x||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=x+.05)}if(f>=E&&!this.switchingTrack&&$<T[T.length-1].start)return;let re=this.getNextFragment($,c);if(re&&this.isLoopLoading(re,$)&&(re=this.getNextFragmentLoopLoading(re,c,d,ce.MAIN,E)),!re){this.bufferFlushed=!0;return}let ge=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ge&&oe(re)&&!re.endList&&(!c.live||!this.loadingParts&&$<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ge)===Ci.OK&&(this.mainFragLoading=ge=null),ge&&oe(ge))){if(re.start>ge.end){const we=this.fragmentTracker.getFragAtPos($,ce.MAIN);we&&we.end>ge.end&&(ge=we,this.mainFragLoading={frag:we,targetBufferTime:null})}if(re.start>ge.end)return}this.loadFragment(re,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 Lt(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!==Xe.STOPPED&&(this.setInterval(qa),this.state=Xe.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!==Xe.STOPPED&&(this.state=Xe.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 E;f=this.alignPlaylists(s,d.details,(E=this.levelLastLoaded)==null?void 0:E.details)}s.alignedSliding||(_r(s,u),s.alignedSliding||Ps(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===Xe.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=Xe.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 E=this.transmuxer;E||(E=this.transmuxer=new Xa(this.hls,ce.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const T=this.initPTS[i.cc],x=(t=i.initSegment)==null?void 0:t.data;if(T!==void 0){const $=n?n.index:-1,re=$!==-1,ge=new rn(i.level,i.sn,i.stats.chunkCount,s.byteLength,$,re);E.push(s,x,f,"",i,n,d.totalduration,!1,ge,T)}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:H}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Tn,complete:!1};H.push(new Uint8Array(s)),this.state!==Xe.STOPPED&&(this.state=Xe.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&&oe(t.frag)&&(this.mainFragLoading=t,this.state===Xe.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(oe(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,b({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=Xe.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.AUDIO,t);break;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Xe.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===me.AUDIO_TRACK&&(this.state=Xe.IDLE);break;case V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case V.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case V.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===Xe.ENDED&&(this.state=Xe.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:E,text:T,id3:x,initSegment:H}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=Xe.PARSING,this.switchingTrack&&E&&this.completeAudioSwitch(this.switchingTrack),H!=null&&H.tracks){const $=c.initSegment||c;this._bufferInitSegment(d,H.tracks,$,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:$,id:i,tracks:H.tracks})}if(E){const{startPTS:$,endPTS:re,startDTS:ge,endDTS:de}=E;u&&(u.elementaryStreams[v.AUDIO]={startPTS:$,endPTS:re,startDTS:ge,endDTS:de}),c.setElementaryStreamInfo(v.AUDIO,$,re,ge,de),this.bufferFragmentData(E,c,u,r)}if(x!=null&&(t=x.samples)!=null&&t.length){const $=g({id:i,frag:c,details:f},x);n.trigger(p.FRAG_PARSING_METADATA,$)}if(T){const $=g({id:i,frag:c,details:f},T);n.trigger(p.FRAG_PARSING_USERDATA,$)}}_bufferInitSegment(e,t,i,n){if(this.state!==Xe.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===Ci.NOT_LOADED||n===Ci.PARTIAL){var s;if(!oe(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=Xe.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&Ps(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;Oe({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,it)||(Et(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,b({},e))}}class ta extends j{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&&At(i);return new Zt(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){Kr(i,n);const ge=n.playlistParsingError;if(ge){this.warn(ge);const de=this.hls;if(!de.config.ignorePlaylistParsingErrors){var u;const{networkDetails:we}=t;de.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:V.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:ge,reason:ge.message,level:t.level||void 0,parent:(u=n.fragments[0])==null?void 0:u.type,networkDetails:we,stats:s});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,E=f?f.end-f.len:0,T=(n.edge-E)*1e3,x=hr(n,T);if(n.requestScheduled+x<r?n.requestScheduled=r:n.requestScheduled+=x,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let H,$,re;if(n.canBlockReload&&n.endSN&&n.advanced){const ge=this.hls.config.lowLatencyMode,de=n.lastPartSn,we=n.endSN,Pe=n.lastPartIndex,et=Pe!==-1,Me=de===we;et?Me?($=we+1,re=ge?0:Pe):($=de,re=ge?Pe+1:n.maxPartIndex):$=we+1;const Ge=n.age,Je=Ge+n.ageHeader;let Ne=Math.min(Je-n.partTarget,n.targetduration*1.5);if(Ne>0){if(Je>n.targetduration*3)this.log(`Playlist last advanced ${Ge.toFixed(2)}s ago. Omitting segment and part directives.`),$=void 0,re=void 0;else if(i!=null&&i.tuneInGoal&&Je-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 bt=Math.floor(Ne/n.targetduration);if($+=bt,re!==void 0){const Wt=Math.round(Ne%n.targetduration/n.partTarget);re+=Wt}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${Ge.toFixed(2)}s goal: ${Ne} skip sn ${bt} to part ${re}`)}n.tuneInGoal=Ne}if(H=this.getDeliveryDirectives(n,t.deliveryDirectives,$,re),ge||!Me){n.requestScheduled=r,this.loadingPlaylist(d,H);return}}else(n.canBlockReload||n.canSkipUntil)&&(H=this.getDeliveryDirectives(n,t.deliveryDirectives,$,re));H&&$!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(x-o*2,x/2)),this.scheduleLoading(d,H,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=At(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=Ut.No),new Zt(i,n,s)}checkRetry(e){const t=e.details,i=di(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===mi.RetryRequest||!n.resolved&&s===mi.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=Di(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 Qa(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!Qs(a[t].attrs,e[t].attrs))return!1;return!0}function Qs(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 Yl 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(E=>!i||i.indexOf(E.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(E=>E.default)&&(this.selectDefaultTrack=!1),o.forEach((E,T)=>{E.id=T});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const E=ve(c,o,it);if(E>-1)s=o[E];else{const T=ve(c,this.tracks);s=this.tracks[T]}}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 E=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(E.message),this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:V.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:E})}}}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&&Oe(e,n,it))return n;const s=ve(e,this.tracksInGroup,it);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=mt(e,t.levels,i,r,it);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=ve(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,b({},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||Oe(e,n,it)))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(Oe({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},d,it))return u}for(let u=0;u<t.length;u++){const d=t[u];if(Qs(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const d=t[u];if(Qs(e.attrs,d.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Et(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 Xl{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 Ja=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,eo="HlsJsTrackRemovedError";class ql extends Error{constructor(e){super(e),this.name=eo}}class Ql extends j{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=Ie(_e(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=_e(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,to(i),Jl(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: ${pt(i,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${pt(n,(c,u)=>c==="initSegment"?void 0:u)}}`),!Te(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 E=this.fragmentTracker,T=d.id;if(E.hasFragments(T)||E.hasParts(T)){const $=_i.getBuffered(f);E.detectEvictedFragments(u,$,T,null,!0)}const x=na(u),H=[u,f];this.sourceBuffers[x]=H,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&&to(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 Xl(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:E,codec:T,levelCodec:x,container:H,metadata:$,supplemental:re}=f;let ge=i[o];const de=(c=this.transferData)==null||(u=c.tracks)==null?void 0:u[o],we=de!=null&&de.buffer?de:ge,Pe=(we==null?void 0:we.pendingCodec)||(we==null?void 0:we.codec),et=we==null?void 0:we.levelCodec;ge||(ge=i[o]={buffer:void 0,listeners:[],codec:T,supplemental:re,container:H,levelCodec:x,metadata:$,id:E});const Me=Vt(Pe,et),Ge=Me==null?void 0:Me.replace(Ja,"$1");let Je=Vt(T,x);const Ne=(d=Je)==null?void 0:d.replace(Ja,"$1");Je&&Me&&Ge!==Ne&&(o.slice(0,5)==="audio"&&(Je=yt(Je,this.appendSource)),this.log(`switching codec ${Pe} to ${Je}`),Je!==(ge.pendingCodec||ge.codec)&&(ge.pendingCodec=Je),ge.container=H,this.appendChangeType(o,H,Je))}),(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&&_i.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,E=self.performance.now();d.start=E;const T=o.stats.buffering,x=c?c.stats.buffering:null;T.start===0&&(T.start=E),x&&x.start===0&&(x.start=E);const H=i.audio;let $=!1;s==="audio"&&(H==null?void 0:H.container)==="audio/mpeg"&&($=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const re=this.tracks.video,ge=re==null?void 0:re.buffer;if(ge&&f!=="initSegment"){const Pe=c||o,et=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend){const Ge=Pe.start+Pe.duration*.05,Je=ge.buffered,Ne=this.currentOp("video");!Je.length&&!Ne?this.blockAudio(Pe):!Ne&&!_i.isBuffered(ge,Ge)&&this.lastVideoAppendEnd<Ge&&this.blockAudio(Pe)}else if(s==="video"){const Me=Pe.end;if(et){const Ge=et.frag.start;(Me>Ge||Me<this.lastVideoAppendEnd||_i.isBuffered(ge,Ge))&&this.unblockAudio()}this.lastVideoAppendEnd=Me}}const de=(c||o).start,we={label:`append-${s}`,execute:()=>{if(d.executeStart=self.performance.now(),$){const Pe=this.tracks[s];if(Pe){const et=Pe.buffer;if(et){const Me=de-et.timestampOffset;Math.abs(Me)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${de} (delta: ${Me}) sn: ${f})`),et.timestampOffset=de)}}}this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const Pe=self.performance.now();d.executeEnd=d.end=Pe,T.first===0&&(T.first=Pe),x&&x.first===0&&(x.first=Pe);const et={};this.sourceBuffers.forEach(([Me,Ge])=>{Me&&(et[Me]=_i.getBuffered(Ge))}),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:et})},onError:Pe=>{var et;const Me={type:he.MEDIA_ERROR,parent:o.type,details:V.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:Pe,err:Pe,fatal:!1},Ge=(et=this.media)==null?void 0:et.error;if(Pe.code===DOMException.QUOTA_EXCEEDED_ERR)Me.details=V.BUFFER_FULL_ERROR;else if(Pe.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Ge)Me.errorAction=Mi(!0);else if(Pe.name===eo&&this.sourceBufferCount===0)Me.errorAction=Mi(!0);else{const Je=++this.appendErrors[s];this.warn(`Failed ${Je}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Ge||"no media error"})`),(Je>=this.hls.config.appendErrorMaxRetry||Ge)&&(Me.fatal=!0)}this.hls.trigger(p.ERROR,Me)}};this.append(we,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===V.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=_i.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=_i.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}) ${pt(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:V.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":""} ${pt(o)}`);try{const d=i.addSourceBuffer(u),f=na(r),E=[r,d];t[f]=E,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:V.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")&&Jt(i,"video")&&(n=vi(n,i));const s=Vt(n,e.levelCodec);return s?t.slice(0,5)==="audio"?yt(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:V.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 ql(`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 to(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function Jl(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 kn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},eu={HLS:"h"},Js={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},tu={[Js.OBJECT]:["br","d","ot","tb"],[Js.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Js.SESSION]:["cid","pr","sf","sid","st","v"],[Js.STATUS]:["bs","rtp"]};class Fs{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Fs?i:new Fs(i))),this.value=e,this.params=t}}const iu="Dict";function nu(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 su(a,e,t,i){return new Error(`failed to ${a} "${nu(e)}" as ${t}`,{cause:i})}function rs(a,e,t){return su("serialize",a,e,t)}class io{constructor(e){this.description=e}}const no="Bare Item",ru="Boolean";function au(a){if(typeof a!="boolean")throw rs(a,ru);return a?"?1":"?0"}function ou(a){return btoa(String.fromCharCode(...a))}const lu="Byte Sequence";function uu(a){if(ArrayBuffer.isView(a)===!1)throw rs(a,lu);return`:${ou(a)}:`}const cu="Integer";function hu(a){return a<-999999999999999||999999999999999<a}function so(a){if(hu(a))throw rs(a,cu);return a.toString()}function du(a){return`@${so(a.getTime()/1e3)}`}function ro(a,e){if(a<0)return-ro(-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}const fu="Decimal";function pu(a){const e=ro(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw rs(a,fu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const mu="String",gu=/[\x00-\x1f\x7f]+/;function _u(a){if(gu.test(a))throw rs(a,mu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function vu(a){return a.description||a.toString().slice(7,-1)}const yu="Token";function ao(a){const e=vu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw rs(e,yu);return e}function ra(a){switch(typeof a){case"number":if(!B(a))throw rs(a,no);return Number.isInteger(a)?so(a):pu(a);case"string":return _u(a);case"symbol":return ao(a);case"boolean":return au(a);case"object":if(a instanceof Date)return du(a);if(a instanceof Uint8Array)return uu(a);if(a instanceof io)return ao(a);default:throw rs(a,no)}}const Eu="Key";function aa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw rs(a,Eu);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 Fs?`${ra(a.value)}${oa(a.params)}`:ra(a)}function bu(a){return`(${a.value.map(oo).join(" ")})${oa(a.params)}`}function Su(a,e={whitespace:!0}){if(typeof a!="object")throw rs(a,iu);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof Fs||(s=new Fs(s));let r=aa(n);return s.value===!0?r+=oa(s.params):(r+="=",Array.isArray(s.value)?r+=bu(s):r+=oo(s)),r}).join(`,${i}`)}function xu(a,e){return Su(a,e)}function Tu(a){return a==="ot"||a==="sf"||a==="st"}function Au(a){return typeof a=="number"?B(a):a!=null&&a!==""&&a!==!1}function wu(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("/")}const Lr=a=>Math.round(a),Ru=(a,e)=>(e!=null&&e.baseUrl&&(a=wu(a,e.baseUrl)),encodeURIComponent(a)),Ir=a=>Lr(a/100)*100,Lu={br:Lr,d:Lr,bl:Ir,dl:Ir,mtp:Ir,nor:Ru,rtp:Ir,tb:Lr};function Iu(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=g({},Lu,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||Au(o)&&(Tu(r)&&typeof o=="string"&&(o=new io(o)),t[r]=o))}),t}function lo(a,e={}){return a?xu(Iu(a,e),g({whitespace:!1},e)):""}function Du(a,e={}){const t={};if(!a)return t;const i=Object.entries(a),n=Object.entries(tu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((r,o)=>{var c,u;const[d,f]=o,E=((c=n.find(T=>T[1].includes(d)))===null||c===void 0?void 0:c[0])||Js.REQUEST;return(u=r[E])!==null&&u!==void 0||(r[E]={}),r[E][d]=f,r},{});return Object.entries(s).reduce((r,[o,c])=>(r[o]=lo(c,e),r),t)}function Cu(a,e,t){return g(a,Du(e,t))}const ku="CMCD";function Pu(a,e={}){if(!a)return"";const t=lo(a,e);return`${ku}=${encodeURIComponent(t)}`}const uo=/CMCD=[^&#]+/;function Ou(a,e,t){const i=Pu(e,t);if(!i)return a;if(uo.test(a))return a.replace(uo,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Mu{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:kn.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===kn.VIDEO||c===kn.AUDIO||c==kn.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:eu.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===kn.INIT||t.ot===kn.VIDEO||t.ot===kn.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={}),Cu(e.headers,t,s)):e.url=Ou(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 kn.TIMED_TEXT;if(e.sn==="initSegment")return kn.INIT;if(t==="audio")return kn.AUDIO;if(t==="main")return this.hls.audioTracks.length?kn.VIDEO:kn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===kn.AUDIO)i=n.audioTracks;else{const s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;i=n.levels.slice(0,r)}return i.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===kn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:_i.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 Nu=3e5;class Fu extends j{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)===mi.SendAlternateToPenaltyBox&&i.flags===Li.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: ${pt(s)} penalized: ${pt(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]>Nu&&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,fr(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 Bi(d.attrs);f["PATHWAY-ID"]=r;const E=f.AUDIO&&`${f.AUDIO}_clone_${r}`,T=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;E&&(i[f.AUDIO]=E,f.AUDIO=E),T&&(n[f.SUBTITLES]=T,f.SUBTITLES=T);const x=ho(d.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),H=new Lt({attrs:f,audioCodec:d.audioCodec,bitrate:d.bitrate,height:d.height,name:d.name,url:x,videoCodec:d.videoCodec,width:d.width});if(d.audioGroups)for(let $=1;$<d.audioGroups.length;$++)H.addGroupId("audio",`${d.audioGroups[$]}_clone_${r}`);if(d.subtitleGroups)for(let $=1;$<d.subtitleGroups.length;$++)H.addGroupId("text",`${d.subtitleGroups[$]}_clone_${r}`);return H});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,E,T)=>{this.log(`Loaded steering manifest: "${n}"`);const x=d.data;if((x==null?void 0:x.VERSION)!==1){this.log(`Steering VERSION ${x.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=x.TTL;const{"RELOAD-URI":H,"PATHWAY-CLONES":$,"PATHWAY-PRIORITY":re}=x;if(H)try{this.uri=new self.URL(H,n).href}catch(de){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${H}`);return}this.scheduleRefresh(this.uri||E.url),$&&this.clonePathways($);const ge={steeringManifest:x,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,ge),re&&this.updatePathwayPriority(re)},onError:(d,f,E,T)=>{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 x=this.timeToLoad*1e3;if(d.code===429){const H=this.loader;if(typeof(H==null?void 0:H.getResponseHeader)=="function"){const $=H.getResponseHeader("Retry-After");$&&(x=parseFloat($)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,x)},onTimeout:(d,f,E)=>{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 Bi(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}function Nn(a,e,t){Gn(a,e,t),a.addEventListener(e,t)}function Gn(a,e,t){a.removeEventListener(e,t)}class Bs extends j{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.mediaKeys=null,this.setMediaKeysQueue=Bs.CDMCleanupPromise?[Bs.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=qn(this.config));const o=r.map(Xn).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=_n(r);let c,u;if(i==="sinf"){if(o!==bi.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const x=gt(new Uint8Array(n));try{const H=On(JSON.parse(x).sinf),$=ae(H);if(!$)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array($.subarray(8,24)),u=bi.FAIRPLAY}catch(H){this.warn(`${s} Failed to parse sinf: ${H}`);return}}else{if(o!==bi.WIDEVINE&&o!==bi.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const x=Ft(n),H=x.filter(re=>!!re.systemId&&Yn(re.systemId)===o);H.length>1&&this.warn(`${s} Using first of ${H.length} pssh found for selected key-system ${o}`);const $=H[0];if(!$){x.length===0||x.some(re=>!re.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${x.map(re=>Yn(re.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(u=Yn($.systemId),$.version===0&&$.data)if(u===bi.WIDEVINE){const re=$.data.length-22;c=new Uint8Array($.data.subarray(re,re+16))}else u===bi.PLAYREADY&&(c=Xi($.data))}if(!u||!c)return;const d=J.hexDump(c),{keyIdToKeySessionPromise:f,mediaKeySessions:E}=this;let T=f[d];for(let x=0;x<E.length;x++){const H=E[x],$=H.decryptdata;if(!$.keyId)continue;const re=J.hexDump($.keyId);if(d===re||$.uri.replace(/-/g,"").indexOf(d)!==-1){if(T=f[re],$.pssh)break;delete f[re],$.pssh=new Uint8Array(n),$.keyId=c,T=f[d]=T.then(()=>this.generateRequestWithPreferredKeySession(H,i,n,"encrypted-event-key-match")),T.catch(ge=>this.handleError(ge));break}}if(!T){if(u!==o){this.log(`Ignoring "${t.type}" event with ${u} init data for selected key-system ${o}`);return}T=f[d]=this.getKeySystemSelectionPromise([u]).then(({keySystem:x,mediaKeys:H})=>{var $;this.throwIfDestroyed();const re=new Un("ISO-23001-7",d,($=Xn(x))!=null?$:"");return re.pssh=new Uint8Array(n),re.keyId=c,this.attemptSetMediaKeys(x,H).then(()=>{this.throwIfDestroyed();const ge=this.createMediaKeySessionContext({decryptdata:re,keySystem:x,mediaKeys:H});return this.generateRequestWithPreferredKeySession(ge,i,n,"encrypted-event-no-match")})}),T.catch(x=>this.handleError(x))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.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),this.hls.on(p.DESTROYING,this.onDestroying,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),this.hls.off(p.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===bi.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 Vn?o(f):o(new Vn({type:he.KEY_SYSTEM_ERROR,details:V.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 is===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=si(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: ${pt(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}"`),o.hasMediaKeys=!0,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)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Xn(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const s=Xn(n);s?t(s):i(new Error(`Unable to find format for key-system "${n}"`))}).catch(i))}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){const t=qn(this.config),i=e.map(_n).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(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 Vn?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:he.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=_n(e.keyFormat),s=n?[n]:qn(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=qn(this.config)),e.length===0)throw new Vn({type:he.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${pt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,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 x=o.call(this.hls,t,i,e);if(!x)throw new Error("Invalid response from configured generateRequest filter");t=x.initDataType,i=x.initData?x.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(x){var c;if(this.warn(x.message),(c=this.hls)!=null&&c.config.debug)throw x}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 cs,f=e._onmessage=x=>{const H=e.mediaKeysSession;if(!H){d.emit("error",new Error("invalid state"));return}const{messageType:$,message:re}=x;this.log(`"${$}" message event for session "${H.sessionId}" message size: ${re.byteLength}`),$==="license-request"||$==="license-renewal"?this.renewLicense(e,re).catch(ge=>{d.eventNames().length?d.emit("error",ge):this.handleError(ge)}):$==="license-release"?e.keySystem===bi.FAIRPLAY&&(this.updateKeySession(e,In("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${$}"`)},E=e._onkeystatuseschange=x=>{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))};Nn(e.mediaKeysSession,"message",f),Nn(e.mediaKeysSession,"keystatuseschange",E);const T=new Promise((x,H)=>{d.on("error",H),d.on("keyStatus",$=>{$.startsWith("usable")?x():$==="output-restricted"?H(new Vn({type:he.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):$==="internal-error"?H(new Vn({type:he.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${$}"`)):$==="expired"?H(new Error("key expired while generating request")):this.warn(`unhandled key status change "${$}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var x;this.log(`Request generated for key-session "${(x=e.mediaKeysSession)==null?void 0:x.sessionId}" keyId: ${u}`)}).catch(x=>{throw new Vn({type:he.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_SESSION,error:x,fatal:!1},`Error generating key-session request: ${x}`)}).then(()=>T).catch(x=>{throw d.removeAllListeners(),this.removeSession(e),x}).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:(E,T,x,H)=>{r(E.data)},onError:(E,T,x,H)=>{o(new Vn({type:he.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:x,response:b({url:c.url,data:void 0},E)},`"${e}" certificate request failed (${s}). Status: ${E.code} (${E.text})`))},onTimeout:(E,T,x)=>{o(new Vn({type:he.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:x,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(E,T,x)=>{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 Vn({type:he.KEY_SYSTEM_ERROR,details:V.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 Vn({type:he.KEY_SYSTEM_ERROR,details:V.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,E=s.length;f<E;f++){var r,o;d=s[f];const T=(r=d.querySelector("name"))==null?void 0:r.textContent,x=(o=d.querySelector("value"))==null?void 0:o.textContent;T&&x&&e.setRequestHeader(T,x)}}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 Vn({type:he.KEY_SYSTEM_ERROR,details:V.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==bi.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Nn(i,"encrypted",this.onMediaEncrypted),Nn(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Gn(e,"encrypted",this.onMediaEncrypted),Gn(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Un.clearKeyUriToKeyIdMap();const n=i.length;Bs.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.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:V.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).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:V.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}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(Vi(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:V.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:V.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}}}Bs.CDMCleanupPromise=void 0;class Vn 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 Bu{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){ie.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){ie.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function Us(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=Ku(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 Uu(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 Ku(a,e,t){const i=[],n=Uu(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 Dr(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 $u 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=Dr(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;Dr(i.textTracks).forEach(r=>{Us(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=ve(o,r);if(d>-1)s=r[d];else{const f=ve(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||Oe(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(Qs(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(Qs(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&&Oe(e,i))return i;const n=ve(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=ve(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=Dr(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 Gu(){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 er(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Ks=.025;let Cr=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Vu(a,e,t){return`${a.identifier}-${t+1}-${er(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){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}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)<Ks))}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"?Cr.Range:Cr.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))<Ks)?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 ca(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function Wu(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function $s(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=()=>{this.reachedPlayout(this.currentTime)&&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,t.primarySessionId).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),this.appendInPlace&&s.on(p.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,s.trigger(p.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return((e=this.interstitial)==null?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,n=_i.bufferInfo(e,i,0);return this.getAssetTime(n.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}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=_i.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()}resetDetails(){const e=this.hls;if(this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}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;return`HlsAssetPlayer: ${$s(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const go=.033;class Zu extends j{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,E=u.cue.post,T=d.cue.pre,x=d.cue.post;if(f&&!T)return-1;if(T&&!f||E&&!x)return 1;if(x&&!E)return-1;if(!f&&!T&&!E&&!x){const H=u.startTime,$=d.startTime;if(H!==$)return H-$}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 E=d.cue.pre,T=d.cue.post,x=e[f-1]||null,H=d.appendInPlace,$=T?s:d.startOffset,re=d.duration,ge=d.timelineOccupancy===Cr.Range?re:0,de=d.resumptionOffset,we=(x==null?void 0:x.startTime)===$,Pe=$+d.cumulativeDuration;let et=H?Pe+re:$+de;if(E||!T&&$<=0){const Ge=u;u+=ge,d.timelineStart=Pe;const Je=r;r+=re,i.push({event:d,start:Pe,end:et,playout:{start:Je,end:r},integrated:{start:Ge,end:u}})}else if($<=s){if(!we){const Ne=$-c;if(Ne>go){const bt=c,Wt=u;u+=Ne;const Ei=r;r+=Ne;const oi={previousEvent:e[f-1]||null,nextEvent:d,start:bt,end:bt+Ne,playout:{start:Ei,end:r},integrated:{start:Wt,end:u}};i.push(oi)}else Ne>0&&x&&(x.cumulativeDuration+=Ne,i[i.length-1].end=$)}T&&(et=Pe),d.timelineStart=Pe;const Ge=u;u+=ge;const Je=r;r+=re,i.push({event:d,start:Pe,end:et,playout:{start:Je,end:r},integrated:{start:Ge,end:u}})}else return;const Me=d.resumeTime;T||Me>s?c=s:c=Me}),c<s){var o;const d=c,f=u,E=s-c;u+=E;const T=r;r+=E,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:d+E,playout:{start:T,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=jt(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 T=B(o.resumeOffset)?o.resumeOffset:o.duration;s+=T})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>Ks?(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=jt(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)<Ks+d||Math.abs(u.end-i)<Ks+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 vs(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(E){const T=this.assignAssetListError(e,V.ASSET_LIST_LOAD_ERROR,E,i);this.hls.trigger(p.ERROR,T);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:(E,T,x,H)=>{const $=E.data,re=$==null?void 0:$.ASSETS;if(!Array.isArray(re)){const ge=this.assignAssetListError(e,V.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),x.url,T,H);this.hls.trigger(p.ERROR,ge);return}e.assetListResponse=$,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:$,networkDetails:H})},onError:(E,T,x,H)=>{const $=this.assignAssetListError(e,V.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${E.code} ${E.text} (${T.url})`),T.url,H,x);this.hls.trigger(p.ERROR,$)},onTimeout:(E,T,x)=>{const H=this.assignAssetListError(e,V.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${T.url})`),T.url,E,x);this.hls.trigger(p.ERROR,H)}};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 _o(a){a==null||a.play().catch(()=>{})}class Yu extends j{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 E=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r){const T=this.findItemIndex(o);if(E>T){const x=this.schedule.findJumpRestrictedIndex(T+1,E);if(x>T){this.setSchedulePosition(x);return}}}this.setSchedulePosition(E);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const E=o.event.assetList[0];E&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,E))}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);(f||n)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(x=>vs(x))} pos: ${this.timelinePos}`),d.length&&this.log(`Removed events ${d}`),this.playerQueue.forEach(x=>{if(x.interstitial.appendInPlace){const H=x.assetItem.timelineStart,$=x.timelineOffset-H;if($)try{x.timelineOffset=H}catch(re){Math.abs($)>Ks&&this.warn(`${re} ("${x.assetId}" ${x.timelineOffset}->${H})`)}}});let E=null;if(r){const x=this.updateItem(r,this.timelinePos);this.itemsMatch(r,x)&&(this.playingItem=x,this.waitingItem=this.endedItem=null,E=()=>this.trimInPlace(x,r))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const T=this.bufferingItem;if(T){const x=this.updateItem(T,this.bufferedPos);this.itemsMatch(T,x)?(this.bufferingItem=x,E||(E=()=>this.trimInPlace(x,T))):T.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(T.event,null))}if(i.forEach(x=>{x.assetList.forEach(H=>{this.clearAssetPlayer(H.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}E&&E(),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){Gn(e,"play",this.onPlay),Gn(e,"pause",this.onPause),Gn(e,"seeking",this.onSeeking),Gn(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Nn(i,"seeking",this.onSeeking),Nn(i,"timeupdate",this.onTimeupdate),Nn(i,"play",this.onPlay),Nn(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,E,T,x,H)=>{if(f){let $=f[E].start;const re=f.event;if(re){if(E==="playout"||re.timelineOccupancy!==Cr.Point){const ge=i(T);(ge==null?void 0:ge.interstitial)===re&&($+=ge.assetItem.startOffset+ge[H])}}else{const ge=x==="bufferedPos"?r():e[x];$+=ge-f.start}return $}return 0},s=(f,E)=>{if(f!==0&&E!=="primary"&&e.schedule.length){var T;const x=e.schedule.findItemIndexAtTime(f),H=(T=e.schedule.items)==null?void 0:T[x];if(H){const $=H[E].start-H.start;return f+$}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var E;return(E=e.primaryDetails)!=null&&E.live?e.primaryDetails.edge:e.schedule.durations[f]},c=(f,E)=>{var T,x;const H=e.effectivePlayingItem;if(H!=null&&(T=H.event)!=null&&T.restrictions.skip)return;e.log(`seek to ${f} "${E}"`);const $=e.effectivePlayingItem,re=e.schedule.findItemIndexAtTime(f,E),ge=(x=e.schedule.items)==null?void 0:x[re],de=e.getBufferingPlayer(),we=de==null?void 0:de.interstitial,Pe=we==null?void 0:we.appendInPlace,et=$&&e.itemsMatch($,ge);if($&&(Pe||et)){const Ge=i(e.playingAsset),Je=(Ge==null?void 0:Ge.media)||e.primaryMedia;if(Je){const Ne=E==="primary"?Je.currentTime:n($,E,e.playingAsset,"timelinePos","currentTime"),bt=f-Ne,Wt=(Pe?Ne:Je.currentTime)+bt;if(Wt>=0&&(!Ge||Pe||Wt<=Ge.duration)){Je.currentTime=Wt;return}}}if(ge){let Ge=f;if(E!=="primary"){const Ne=ge[E].start,bt=f-Ne;Ge=ge.start+bt}const Je=!e.isInterstitial(ge);if((!e.isInterstitial($)||$.event.appendInPlace)&&(Je||ge.event.appendInPlace)){const Ne=e.media||(Pe?de==null?void 0:de.media:null);Ne&&(Ne.currentTime=Ge)}else if($){const Ne=e.findItemIndex($);if(re>Ne){const Wt=e.schedule.findJumpRestrictedIndex(Ne+1,re);if(Wt>Ne){e.setSchedulePosition(Wt);return}}let bt=0;if(Je)e.timelinePos=Ge,e.checkBuffer();else{var Me;const Wt=ge==null||(Me=ge.event)==null?void 0:Me.assetList;if(Wt){const Ei=f-(ge[E]||ge).start;for(let oi=Wt.length;oi--;){const li=Wt[oi];if(li.duration&&Ei>=li.startOffset&&Ei<li.startOffset+li.duration){bt=oi;break}}}}e.setSchedulePosition(re,bt)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const E=t();return e.isInterstitial(E)?E:null},d={get currentTime(){const f=u(),E=e.effectivePlayingItem;return E&&E===f?n(E,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-E.playout.start:0},set currentTime(f){const E=u(),T=e.effectivePlayingItem;T&&T===E&&c(f+T.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const E=(f=u())==null?void 0:f.event.assetList;return E?E.map(T=>e.getAssetPlayer(T.identifier)):[]},get playingIndex(){var f;const E=(f=u())==null?void 0:f.event;return E&&e.effectivePlayingAsset?E.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};this.manager={get events(){var f,E;return((f=e.schedule)==null||(E=f.events)==null?void 0:E.slice(0))||[]},get schedule(){var f,E;return((f=e.schedule)==null||(E=f.items)==null?void 0:E.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,E=f==null?void 0:f.event;if(E&&!E.restrictions.skip){const T=e.findItemIndex(f);if(E.appendInPlace){const x=f.playout.start+f.event.duration;c(x+.001,"playout")}else e.advanceAfterAssetEnded(E,T,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} ${pt(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 T=this.getBufferingPlayer();T?(s=T.transferMedia(),d=`${T}`):d="detached MediaSource"}else d="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${pt(s)}`);else if(!this.detachedData||r.media===t){const T=this.playerQueue;T.length>1&&T.forEach(x=>{if(o&&x.interstitial.appendInPlace!==c){const H=x.interstitial;this.clearInterstitial(x.interstitial,null),H.appendInPlace=!1,H.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${H}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((n=s.mediaSource)==null?void 0:n.readyState)!=="closed",E=f&&s?s:t;if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${d}`),E===s){const T=o&&e.assetId===this.schedule.assetIdAtEnd;E.overrides={duration:this.schedule.duration,endOfStream:!o||T,cueRemoval:!o}}e.attachMedia(E)}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=ca(e,i);if(!e.isAssetPastPlayoutLimit(n))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.advanceAfterAssetEnded(s,r,o-1)}}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,E=f?this.getAssetPlayer(f):null;if(E&&f&&(!this.eventItemsMatch(s,n)||t!==void 0&&f!==((o=u.assetList)==null?void 0:o[t].identifier))){var c;const T=u.findAssetIndex(d);this.log(`INTERSTITIAL_ASSET_ENDED ${T+1}/${u.assetList.length} ${$s(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:T,event:u,schedule:i.slice(0),scheduleIndex:e,player:E}),this.retreiveMediaSource(f,n),E.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&E.detachMedia()}if(!this.eventItemsMatch(s,n)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${vs(s)}`),u.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){this.updateSchedule();const T=this.schedule.items;if(n&&T){const x=this.schedule.findItemIndex(n);this.advanceSchedule(x,T,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;if(i===void 0){i=this.schedule.findAssetIndex(u,this.timelinePos);const T=ca(u,i-1);if(u.isAssetPastPlayoutLimit(T)){this.advanceAfterAssetEnded(u,e,i);return}i=T}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 ${vs(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 E=u.assetList[i];if(!E){const T=t[e+1],x=this.media;T&&x&&!this.isInterstitial(T)&&x.currentTime<T.start&&(x.currentTime=this.timelinePos=T.start),this.advanceAfterAssetEnded(u,e,i||0);return}if(f||(f=this.getAssetPlayer(E.identifier)),f===null||f.destroyed){const T=u.assetList.length;this.warn(`asset ${i+1}/${T} player destroyed ${u}`),f=this.createAssetPlayer(u,E,i)}if(!this.eventItemsMatch(r,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(E))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 ${vs(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(`INTERSTITIALS_PRIMARY_RESUMED ${vs(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:_i.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=b(b({},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=b(b({},this.altSelection),{},{audio:i});return}const s=b(b({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=b(b({},this.altSelection),{},{subtitles:i});return}const s=b(b({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=zt(t);this.playerQueue.forEach(n=>n.hls.setAudioOption(t)||n.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=zt(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}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,r)=>{e.event.isAssetPastPlayoutLimit(r)&&this.clearAssetPlayer(s.identifier,null)});const i=e.end+.25,n=_i.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.attachPrimary(i,null),this.flushFrontBuffer(i))}}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=_i.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),E=Math.min(f+1,t.length-1),T=t[E];if((c===-1&&s&&e>=s.end||(u=T.event)!=null&&u.appendInPlace&&e+.01>=T.start)&&(c=E),E-o>1&&(s==null||(d=s.event)==null?void 0:d.appendInPlace)===!1)return;if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(T);else{const x=this.primaryDetails;this.primaryLive&&x&&e>x.edge-x.targetduration&&T.start<x.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(T)&&this.preloadAssets(T.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();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=o?o.remaining:t?t.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${vs(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),this.playbackDisabled||(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 E=this.playingItem;!this.isInterstitial(E)&&(E==null||(o=E.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 E=d-c;E>0&&(u=Math.round(E*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){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 de=this.timelinePos-t.timelineStart;if(de>1){const we=t.duration;we&&de<we&&(d=de)}}const f=t.identifier,E=b(b({},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&&(E.timelineOffset=t.timelineStart));const T=E.cmcd;T!=null&&T.sessionId&&T.contentId&&(E.cmcd=g({},T,{contentId:er(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const x=new Hu(this.HlsPlayerClass,E,e,t);this.playerQueue.push(x),e.assetList[i]=t;const H=de=>{if(de.live){const et=new Error(`Interstitials MUST be VOD assets ${e}`),Me={fatal:!0,type:he.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:et};this.handleAssetItemError(Me,e,this.schedule.findEventIndex(e.identifier),i,et.message);return}const we=de.edge-de.fragmentStart,Pe=t.duration;(Pe===null||we>Pe)&&(this.log(`Interstitial asset "${f}" duration change ${Pe} > ${we}`),t.duration=we,this.updateSchedule())};x.on(p.LEVEL_UPDATED,(de,{details:we})=>H(we)),x.on(p.LEVEL_PTS_UPDATED,(de,{details:we})=>H(we));const $=(de,we)=>{const Pe=this.getAssetPlayer(f);if(Pe&&we.tracks){Pe.off(p.BUFFER_CODECS,$),Pe.tracks=we.tracks;const et=this.primaryMedia;this.bufferingAsset===Pe.assetItem&&et&&!Pe.media&&this.bufferAssetPlayer(Pe,et)}};x.on(p.BUFFER_CODECS,$);const re=()=>{var de;const we=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${we}`),!we)return;const Pe=this.schedule.findEventIndex(e.identifier),et=(de=this.schedule.items)==null?void 0:de[Pe];if(this.isInterstitial(et)){const Ge=e.findAssetIndex(t),Je=ca(e,Ge);if(!e.isAssetPastPlayoutLimit(Je))this.bufferedToItem(et,Je);else{var Me;const Ne=(Me=this.schedule.items)==null?void 0:Me[Pe+1];Ne&&this.bufferedToItem(Ne)}}};x.on(p.BUFFERED_TO_END,re);const ge=de=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const Pe=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Pe,de)};return x.once(p.MEDIA_ENDED,ge(i)),x.once(p.PLAYOUT_LIMIT_REACHED,ge(1/0)),x.on(p.ERROR,(de,we)=>{const Pe=this.getAssetPlayer(f);if(we.details===V.BUFFER_STALLED_ERROR){if(Pe!=null&&Pe.media){const et=Pe.currentTime,Me=Pe.duration-et;et&&e.appendInPlace&&Me/Pe.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${Pe.media.currentTime}`),re()):(this.warn(`Stalled at ${et} of ${et+Me} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(we,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${we.error} ${e}`)}),x.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const we=new Error(`Asset player destroyed unexpectedly ${f}`),Pe={fatal:!0,type:he.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:we};this.handleAssetItemError(Pe,e,this.schedule.findEventIndex(e.identifier),i,we.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${$s(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:x}),x}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){this.log(`clear asset player "${e}" toSegment: ${t&&vs(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} ${$s(o)}`),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}=e,o=this.schedule.findEventIndex(s.identifier),c=(i=this.schedule.items)==null?void 0:i[o];if(!c)return;this.setBufferingItem(c),this.bufferingAsset=r;const u=this.getBufferingPlayer();if(u===e)return;const d=s.appendInPlace;if(d&&(u==null?void 0:u.interstitial.appendInPlace)===!1)return;const f=(u==null?void 0:u.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(d&&r!==this.playingAsset){if(!e.tracks)return;if(f&&!Te(f,e.tracks)){const E=new Error(`Asset ${$s(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),T={fatal:!0,type:he.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:E},x=s.findAssetIndex(r);this.handleAssetItemError(T,s,o,x,E.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,n,s){if(e.details===V.BUFFER_STALLED_ERROR)return;const r=t.assetList[n];this.warn(`INTERSTITIAL_ASSET_ERROR ${r&&$s(r)} ${e.error}`);const o=r==null?void 0:r.identifier,c=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[c]||null,d=this.schedule.items,f=g({},e,{fatal:!1,errorAction:Mi(!0),asset:r,assetListIndex:n,event:t,schedule:d,scheduleIndex:i,player:u});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const E=this.playingAsset,T=new Error(s);if(r&&(this.clearAssetPlayer(o,null),r.error=T),!t.assetList.some(x=>!x.error))t.error=T;else if(t.appendInPlace){for(let x=n;x<t.assetList.length;x++)this.resetAssetPlayer(t.assetList[x].identifier);this.updateSchedule()}t.error?this.primaryFallback(t):E&&E.identifier===o&&this.advanceAfterAssetEnded(t,i,n)}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?vs(i):"<none>"} error: ${e.error}`);let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const s=this.updateItem(i,n);this.itemsMatch(i,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));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((x,H)=>{const $=parseFloat(x.DURATION);this.createAsset(n,H,u,o+u,$,x.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 E=(i=this.bufferingItem)==null?void 0:i.event;if(f){var T;const x=this.schedule.findEventIndex(s),H=(T=this.schedule.items)==null?void 0:T[x];if(H){if(!this.playingItem&&this.timelinePos>H.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==x){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(H)}this.setSchedulePosition(x)}else if((E==null?void 0:E.identifier)===s&&E.appendInPlace){const x=n.assetList[0],H=this.getAssetPlayer(x.identifier),$=this.primaryMedia;x&&H&&$&&this.bufferAssetPlayer(H,$)}}onError(e,t){switch(t.details){case V.ASSET_LIST_PARSING_ERROR:case V.ASSET_LIST_LOAD_ERROR:case V.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case V.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const vo=500;class Xu extends qi{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=Xe.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(oe(i)&&(this.fragPrevious=i),this.state=Xe.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===V.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Xe.STOPPED&&(this.state=Xe.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Qa(this.levels,t)){this.levels=t.map(i=>new Lt(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new Lt(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!==Xe.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 E=f.fragments[0];if(!c.details)r.hasProgramDateTime&&f.hasProgramDateTime?(Ps(r,f),u=r.fragmentStart):E&&(u=E.start,Hs(r,u));else{var d;u=this.alignPlaylists(r,c.details,(d=this.levelLastLoaded)==null?void 0:d.details),u===0&&E&&(u=E.start,Hs(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===Xe.IDLE&&(jt(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&&Sn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,Bn(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:V.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=Xe.IDLE})}}doTick(){if(!this.media){this.state=Xe.IDLE;return}if(this.state===Xe.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=_i.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,E=f.length,T=u.edge;let x=null;const H=this.fragPrevious;if(o<T){const ge=n.maxFragLookUpTolerance,de=o>T-ge?0:ge;x=jt(H,f,Math.max(f[0].start,o),de),!x&&H&&H.start<f[0].start&&(x=f[0])}else x=f[E-1];if(x=this.filterReplacedPrimary(x,i.details),!x)return;const $=x.sn-u.startSN,re=f[$-1];if(re&&re.cc===x.cc&&this.fragmentTracker.getState(re)===Ci.NOT_LOADED&&(x=re),this.fragmentTracker.getState(x)===Ci.NOT_LOADED){const ge=this.mapToInitFragWhenRequired(x);ge&&this.loadFragment(ge,i,o)}}}loadFragment(e,t,i){oe(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),Jn=15,fs=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;ie.log(`${this.time} [${e}] ${i}`)}}}const ws=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<fs;t++)this.chars.push(new rc);this.logger=e}equals(e){for(let t=0;t<fs;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<fs;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<fs;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>fs&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=fs)}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>=fs){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<fs;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<fs;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=Jn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Jn;t++)this.rows.push(new ac(e));this.logger=e}reset(){for(let e=0;e<Jn;e++)this.rows[e].clear();this.currRow=Jn-1}equals(e){let t=!0;for(let i=0;i<Jn;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Jn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Jn;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 = "+pt(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<Jn;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 = "+pt(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<Jn;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[Jn-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[Jn-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: "+pt(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,()=>"["+ws([t[i],t[i+1]])+"] -> ("+ws([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(oc(n,s,c)){kr(null,null,c),this.logger.log(3,()=>"Repeated command ("+ws([n,s])+") is dropped");continue}kr(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 kr(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 "+ws([n,s])+" orig: "+ws([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 ("+ws([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 = "+ws(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()}kr(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 kr(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(an!=null&&an.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 E="",T=!1,x=o,H=c,$=u,re=null,ge="",de=!0,we="auto",Pe="start",et=50,Me="middle",Ge=50,Je="middle";Object.defineProperty(d,"id",s({},f,{get:function(){return E},set:function(Ne){E=""+Ne}})),Object.defineProperty(d,"pauseOnExit",s({},f,{get:function(){return T},set:function(Ne){T=!!Ne}})),Object.defineProperty(d,"startTime",s({},f,{get:function(){return x},set:function(Ne){if(typeof Ne!="number")throw new TypeError("Start time must be set to a number.");x=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",s({},f,{get:function(){return H},set:function(Ne){if(typeof Ne!="number")throw new TypeError("End time must be set to a number.");H=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 re},set:function(Ne){re=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",s({},f,{get:function(){return ge},set:function(Ne){const bt=i(Ne);if(bt===!1)throw new SyntaxError("An invalid or illegal string was specified.");ge=bt,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",s({},f,{get:function(){return de},set:function(Ne){de=!!Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",s({},f,{get:function(){return we},set:function(Ne){if(typeof Ne!="number"&&Ne!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");we=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",s({},f,{get:function(){return Pe},set:function(Ne){const bt=n(Ne);if(!bt)throw new SyntaxError("An invalid or illegal string was specified.");Pe=bt,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",s({},f,{get:function(){return et},set:function(Ne){if(Ne<0||Ne>100)throw new Error("Position must be between 0 and 100.");et=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",s({},f,{get:function(){return Me},set:function(Ne){const bt=n(Ne);if(!bt)throw new SyntaxError("An invalid or illegal string was specified.");Me=bt,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",s({},f,{get:function(){return Ge},set:function(Ne){if(Ne<0||Ne>100)throw new Error("Size must be between 0 and 100.");Ge=Ne,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",s({},f,{get:function(){return Je},set:function(Ne){const bt=n(Ne);if(!bt)throw new SyntaxError("An invalid or illegal string was specified.");Je=bt,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,""),Pr=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(E,T){let x;switch(E){case"region":for(let H=t.length-1;H>=0;H--)if(t[H].id===T){u.set(E,t[H].region);break}break;case"vertical":u.alt(E,T,["rl","lr"]);break;case"line":x=T.split(","),u.integer(E,x[0]),u.percent(E,x[0])&&u.set("snapToLines",!1),u.alt(E,x[0],["auto"]),x.length===2&&u.alt("lineAlign",x[1],["start",Pr,"end"]);break;case"position":x=T.split(","),u.percent(E,x[0]),x.length===2&&u.alt("positionAlign",x[1],["start",Pr,"end","line-left","line-right","auto"]);break;case"size":u.percent(E,T);break;case"align":u.alt(E,T,["start",Pr,"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",Pr);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 er(a.toString())+er(e.toString())+er(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=Ke(new Uint8Array(a)).trim().replace(fc,`
`).split(`
`),u=[],d=e?Fl(e.baseTime,e.timescale):0;let f="00:00.000",E=0,T=0,x,H=!0;o.oncue=function($){const re=t[i];let ge=t.ccOffset;const de=(E-d)/9e4;if(re!=null&&re.new&&(T!==void 0?ge=t.ccOffset=re.start:mc(t,i,de)),de){if(!e){x=new Error("Missing initPTS for VTT MPEGTS");return}ge=de-t.presentationOffset}const we=$.endTime-$.startTime,Pe=$n(($.startTime+ge-T)*9e4,n*9e4)/9e4;$.startTime=Math.max(Pe,0),$.endTime=Math.max(Pe+we,0);const et=$.text.trim();$.text=decodeURIComponent(encodeURIComponent(et)),$.id||($.id=ma($.startTime,$.endTime,et)),$.endTime>0&&u.push($)},o.onparsingerror=function($){x=$},o.onflush=function(){if(x){r(x);return}s(u)},c.forEach($=>{if(H)if(pa($,"X-TIMESTAMP-MAP=")){H=!1,$.slice(16).split(",").forEach(re=>{pa(re,"LOCAL:")?f=re.slice(6):pa(re,"MPEGTS:")&&(E=parseInt(re.slice(7)))});try{T=pc(f)/1e3}catch(re){x=re}return}else $===""&&(H=!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=>Ke(o)),r=Nl(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,E)=>(f[E]=n.getAttribute(`ttp:${E}`)||s[E],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 E=Do(f,o);if(!E||!f.hasAttribute("begin"))return null;const T=ya(f.getAttribute("begin"),r),x=ya(f.getAttribute("dur"),r);let H=ya(f.getAttribute("end"),r);if(T===null)throw Co(f);if(H===null){if(x===null)throw Co(f);H=T+x}const $=new da(T-e,H-e,E);$.id=ma($.startTime,$.endTime,$.text);const re=u[f.getAttribute("region")],ge=c[f.getAttribute("style")],de=yc(re,ge,c),{textAlign:we}=de;if(we){const Pe=_c[we];Pe&&($.lineAlign=Pe),$.align=we}return g($,de),$}).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 Or{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 Or(this,"textTrack1"),t=new Or(this,"textTrack2"),i=new Or(this,"textTrack3"),n=new Or(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,Us(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=>{Us(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++)Us(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(Qa(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Dr(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let d;if(o){let f=null;for(let E=0;E<o.length;E++)if(o[E]&&Po(o[E],c)){f=o[E],o[E]=null;break}f&&(d=f)}if(d)Us(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?xe(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 E=0;E<i.rows.length;E++)if(s=i.rows[E],o=!0,c=0,u="",!s.isEmpty()){var f;for(let H=0;H<s.chars.length;H++)Tc.test(s.chars[H].uchar)&&o?c++:(u+=s.chars[H].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const T=Ao(u.trim()),x=ma(e,t,T);a!=null&&(f=a.cues)!=null&&f.getCueById(x)||(r=new d(e,t,T),r.id=x,r.line=E+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((E,T)=>E.line==="auto"||T.line==="auto"?0:E.line>8&&T.line>8?T.line-E.line:E.line-T.line),n.forEach(E=>po(a,E))),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),(qs(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var E;this.response=this.loader=f;const T=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-(T-n.loading.start)),!f.ok){const{status:H,statusText:$}=f;throw new kc($||"fetch, bad network response",H,f)}n.loading.first=T,n.total=Dc(f.headers)||n.total;const x=(E=this.callbacks)==null?void 0:E.onProgress;return x&&B(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,x):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var E,T;const x=this.response;if(!x)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const H=f[o];H&&(n.loaded=n.total=H);const $={url:x.url,data:f,code:x.status},re=(E=this.callbacks)==null?void 0:E.onProgress;re&&!B(t.highWaterMark)&&re(n,e,f,x),(T=this.callbacks)==null||T.onSuccess($,n,e,x)}).catch(f=>{var E;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const T=f&&f.code||0,x=f?f.message:null;(E=this.callbacks)==null||E.onError({code:T,text:x},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 Tn,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 x=d!=null?d:t.response;if(x!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const H=t.responseType==="arraybuffer"?x.byteLength:x.length;i.loaded=i.total=H,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const $=(r=this.callbacks)==null?void 0:r.onProgress;$&&$(i,e,x,t);const re={url:t.responseURL,data:x,code:u};(o=this.callbacks)==null||o.onSuccess(re,i,e,t);return}}const f=s.loadPolicy.errorRetry,E=i.retry,T={url:e.url,data:void 0,code:u};if(Ti(f,E,!1,T))this.retry(f);else{var c;ie.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(Ti(e,t,!0))this.retry(e);else{var i;ie.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=Di(e,i.retry),i.retry++,ie.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=b(b({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,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",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:Xt,bufferController:Ql,capLevelController:sa,errorController:Qi,fpsController:Bu,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:is,requireKeySystemAccessOnStart:!1,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,preserveManualLevelOnError:!1,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:$u,timelineController:Sc,audioStreamController:zl,audioTrackController:Yl,emeController:Bs,cmcdController:Mu,contentSteeringController:Fu,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}`,E=e[f];if(E!==void 0&&c){u.push(f);const T=i[o].default;switch(e[o]={default:T},d){case"TimeOut":T.maxLoadTimeMs=E,T.maxTimeToFirstByteMs=E;break;case"MaxRetry":T.errorRetry.maxNumRetry=E,T.timeoutRetry.maxNumRetry=E;break;case"RetryDelay":T.errorRetry.retryDelayMs=E,T.timeoutRetry.retryDelayMs=E;break;case"MaxRetryTimeout":T.errorRetry.maxRetryDelayMs=E,T.timeoutRetry.maxRetryDelayMs=E;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${pt(e[o])}`)}),b(b({},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 Mr=2,Uc=.1,Kc=.05,$c=100;class Gc extends mn{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;Nn(i,"playing",this.onMediaPlaying),Nn(i,"waiting",this.onMediaWaiting),Nn(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Gn(i,"playing",this.onMediaPlaying),Gn(i,"waiting",this.onMediaWaiting),Gn(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 r=this.media;if(!r)return;const{seeking:o}=r,c=this.seeking&&!o,u=!this.seeking&&o,d=r.paused&&!o||r.ended||r.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!d&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||c){c&&this.stallResolved(e);return}if(d){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(!_i.getBuffered(r).length){this.nudgeRetry=0;return}const f=_i.bufferInfo(r,e,0),E=f.nextStart||0,T=this.fragmentTracker;if(o&&T&&this.hls){const et=Fo(this.hls.inFlightFragments,e),Me=f.len>Mr,Ge=!E||et||E-e>Mr&&!T.getPartialFragment(e);if(Me||Ge)return;this.moved=!1}const x=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&T){if(!(f.len>0)&&!E)return;const Me=Math.max(E,f.start||0)-e,Je=!!(x!=null&&x.live)?x.targetduration*2:Mr,Ne=T.getPartialFragment(e);if(Me>0&&(Me<=Je||Ne)){r.paused||this._trySkipBufferHole(Ne);return}}const H=s.detectStallWithCurrentTimeMs,$=self.performance.now(),re=this.waiting;let ge=this.stalled;if(ge===null)if(re>0&&$-re<H)ge=this.stalled=re;else{this.stalled=$;return}const de=$-ge;if(!o&&(de>=H||re)&&this.hls){var we;if(((we=this.mediaSource)==null?void 0:we.readyState)==="ended"&&!(x!=null&&x.live)&&Math.abs(e-((x==null?void 0:x.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const Pe=_i.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(Pe,de,e)}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=_i.bufferedInfo(_i.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=_i.timeRangesToArray(n),o=_i.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=_i.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 E=this.fragmentTracker.getPartialFragment(e)||void 0,T=_i.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:E,buffer:T.len,bufferInfo:T})}}}}}_tryFixBufferStall(e,t,i){var n,s;const{fragmentTracker:r,media:o}=this,c=(n=this.hls)==null?void 0:n.config;if(!o||!r||!c)return;const u=(s=this.hls)==null?void 0:s.latestLevelDetails,d=r.getPartialFragment(i);if((d||u!=null&&u.live&&i<u.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;const f=e.buffered,E=this.adjacentTraversal(e,i);(f&&f.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-i<c.maxBufferHole||E))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,n=e.nextStart;if(i&&n){const s=i.getFragAtPos(t,ce.MAIN),r=i.getFragAtPos(n,ce.MAIN);if(s&&r)return r.sn-s.sn<2}return!1}_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 (${pt(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:V.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=_i.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,E=c-r;if(E>0&&(d||f)){if(E>s.maxBufferHole){let x=!1;if(r===0){const H=i.getAppendedFrag(0,ce.MAIN);H&&c<H.end&&(x=!0)}if(!x){const H=e||i.getAppendedFrag(r,ce.MAIN);if(H){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||Fo(this.hls.inFlightFragments,c))return 0;let re=!1,ge=H.end;for(;ge<c;){const de=i.getPartialFragment(ge);if(de)ge+=de.duration;else{re=!0;break}}if(re)return 0}}}const T=Math.max(c+Kc,r+Uc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${T}`),this.moved=!0,n.currentTime=T,!(e!=null&&e.gap)){const x=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${T}`);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:x,reason:x.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return T}}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:V.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:V.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 Xe.IDLE:case Xe.STOPPED:case Xe.ENDED:case Xe.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,pt(n?b({type:n},i):i))}return s}const Nr=(()=>{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&&Us(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===Mn.emsg&&!i||!n)continue;const u=Ca(s[o].data);if(u){const d=s[o].pts;let f=d+s[o].duration;f>Nr&&(f=Nr),f-d<=0&&(f=d+Vc);for(let T=0;T<u.length;T++){const x=u[T];if(!ka(x)){this.updateId3CueEnds(d,c);const H=Uo(r,d,f,x,c);H&&this.id3Track.addCue(H)}}}}}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===Nr&&(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===Mn.audioId3&&c:n==="video"?u=d=>d.type===Mn.emsg&&o:u=d=>d.type===Mn.audioId3&&c||d.type===Mn.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 E=d[f],T=r[E].cues;delete r[E],Object.keys(T).forEach(x=>{try{const H=T[x];H.removeEventListener("enter",this.onEventCueEnter),i.removeCue(H)}catch(H){}})}}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],E=n[f],T=E.startTime,x=r[f],H=(x==null?void 0:x.cues)||{};let $=(x==null?void 0:x.durationKnown)||!1,re=Nr;const{duration:ge,endDate:de}=E;if(de&&ge!==null)re=T+ge,$=!0;else if(E.endOnNext&&!$){const Pe=s.reduce((et,Me)=>{if(Me!==E.id){const Ge=n[Me];if(Ge.class===E.class&&Ge.startDate>E.startDate&&(!et||E.startDate<et.startDate))return Ge}return et},null);Pe&&(re=Pe.startTime,$=!0)}const we=Object.keys(E.attr);for(let Pe=0;Pe<we.length;Pe++){const et=we[Pe];if(!as(et))continue;const Me=H[et];if(Me)$&&!x.durationKnown?Me.endTime=re:Math.abs(Me.startTime-T)>.01&&(Me.startTime=T,Me.endTime=re);else if(u){let Ge=E.attr[et];Zn(et)&&(Ge=jc(Ge));const Ne=Uo(u,T,re,{key:et,data:Ge},Mn.dateRange);Ne&&(Ne.id=f,this.id3Track.addCue(Ne),H[et]=Ne,this.hls.config.interstitialsController&&(et==="X-ASSET-LIST"||et==="X-ASSET-URL")&&Ne.addEventListener("enter",this.onEventCueEnter))}}r[f]={cues:H,dateRange:E,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)),E=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,T=Math.min(f,Math.max(1,E));this.changeMediaPlaybackRate(t,T)}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===V.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=>{const f=d.attrs;let{audioCodec:E,videoCodec:T}=d;E&&(d.audioCodec=E=yt(E,i)||void 0),T&&(T=d.videoCodec=ai(T));const{width:x,height:H,unknownCodecs:$}=d;let re=$?$.length:0;if($)for(let Ne=re;Ne--;){const bt=$[Ne];this.isAudioSupported(bt)?(d.audioCodec=E=E?`${E},${bt}`:bt,re--,qt.audio[E.substring(0,4)]=2):this.isVideoSupported(bt)&&(d.videoCodec=T=T?`${T},${bt}`:bt,re--,qt.video[T.substring(0,4)]=2)}if(o||(o=!!(x&&H)),c||(c=!!T),u||(u=!!E),re||E&&!this.isAudioSupported(E)||T&&!this.isVideoSupported(T)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:ge,"FRAME-RATE":de,"HDCP-LEVEL":we,"PATHWAY-ID":Pe,RESOLUTION:et,"VIDEO-RANGE":Me}=f,Je=`${`${Pe||"."}-`}${d.bitrate}-${et}-${de}-${ge}-${Me}-${we}`;if(s[Je])if(s[Je].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const Ne=r[Je]+=1;d.attrs["PATHWAY-ID"]=new Array(Ne+1).join(".");const bt=this.createLevel(d);s[Je]=bt,n.push(bt)}else s[Je].addGroupId("audio",f.AUDIO),s[Je].addGroupId("text",f.SUBTITLES);else{const Ne=this.createLevel(d);s[Je]=Ne,r[Je]=1,n.push(Ne)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new Lt(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=y(n,[])}return t}isAudioSupported(e){return Jt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Jt(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:re,width:ge,height:de})=>(!!$||!!(ge&&de))&&$t(re))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let $="no level with compatible codecs found in manifest",re=$;t.levels.length&&(re=`one or more CODECS in variant not supported: ${pt(t.levels.map(de=>de.attrs.CODECS).filter((de,we,Pe)=>Pe.indexOf(de)===we))}`,this.warn(re),$+=` (${re})`);const ge=new Error($);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:V.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:ge,reason:re})}});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(($,re)=>{if($.attrs["HDCP-LEVEL"]!==re.attrs["HDCP-LEVEL"])return($.attrs["HDCP-LEVEL"]||"")>(re.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&$.height!==re.height)return $.height-re.height;if($.frameRate!==re.frameRate)return $.frameRate-re.frameRate;if($.videoRange!==re.videoRange)return _t.indexOf($.videoRange)-_t.indexOf(re.videoRange);if($.videoCodec!==re.videoCodec){const ge=dt($.videoCodec),de=dt(re.videoCodec);if(ge!==de)return de-ge}if($.uri===re.uri&&$.codecSet!==re.codecSet){const ge=Ot($.codecSet),de=Ot(re.codecSet);if(ge!==de)return de-ge}return $.averageBitrate!==re.averageBitrate?$.averageBitrate-re.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 re=d.bitrate,ge=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${re}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const de=Math.min(re,this.hls.config.abrEwmaDefaultEstimateMax);de>ge&&ge===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=de)}break}const E=s&&!n,T=this.hls.config,x=!!(T.audioStreamController&&T.audioTrackController),H={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:x&&!E&&r.some($=>!!$.url)};this.hls.trigger(p.MANIFEST_PARSED,H)}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:V.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));fr(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(!_e())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=_e();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(ot(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(ot(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 qi{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=Xe.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Xe.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Xe.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=Xe.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Xe.IDLE;break}break}case Xe.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=Xe.IDLE}}break}this.state===Xe.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 H={};this.altAudio===2&&(H.type="video"),this.hls.trigger(p.BUFFER_EOS,H),this.state=Xe.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===Xe.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=Xe.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 E=this.backtrackFragment?this.backtrackFragment.start:o.end;let T=this.getNextFragment(E,u);if(this.couldBacktrack&&!this.fragPrevious&&T&&oe(T)&&this.fragmentTracker.getState(T)!==Ci.OK){var x;const $=((x=this.backtrackFragment)!=null?x:T).sn-u.startSN,re=u.fragments[$-1];re&&T.cc===re.cc&&(T=re,this.fragmentTracker.removeFragment(re))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(T&&this.isLoopLoading(T,E)){if(!T.gap){const $=this.audioOnly&&!this.altAudio?v.AUDIO:v.VIDEO,re=($===v.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;re&&this.afterBufferFlushed(re,$,ce.MAIN)}T=this.getNextFragmentLoopLoading(T,u,o,ce.MAIN,f)}T&&(T.initSegment&&!T.initSegment.data&&!this.bitrateTest&&(T=T.initSegment),this.loadFragment(T,r,E))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Ci.NOT_LOADED||n===Ci.PARTIAL?oe(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 Xe.KEY_LOADING:case Xe.FRAG_LOADING:case Xe.FRAG_LOADING_WAITING_RETRY:case Xe.PARSING:case Xe.PARSED:this.state=Xe.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;Nn(i,"playing",this.onMediaPlaying),Nn(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Gn(i,"playing",this.onMediaPlaying),Gn(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!==Xe.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=Xe.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===Xe.FRAG_LOADING||this.state===Xe.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 E;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(E=this.levelLastLoaded)==null?void 0:E.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===Xe.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Xe.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 d=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&i.readyState<4||s<o-d)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const f=_i.bufferInfo(i,n,0);if(!(f!=null&&(u=f.buffered)!=null&&u.length)){i.currentTime=n;return}if(f.start<=s){i.currentTime=n;return}const{nextStart:T}=_i.bufferedInfo(f.buffered,s,0);T&&(i.currentTime=T)}else 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,E=this._getAudioCodec(o),T=this.transmuxer=this.transmuxer||new Xa(this.hls,ce.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),x=n?n.index:-1,H=x!==-1,$=new rn(i.level,i.sn,i.stats.chunkCount,s.byteLength,x,H),re=this.initPTS[i.cc];T.push(s,f,E,u,i,n,c.totalduration,d,$,re)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(Et(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=Et(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===Xe.PARSED&&(this.state=Xe.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),oe(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&_i.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=Xe.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.MAIN,t);break;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Xe.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===me.LEVEL&&(this.state=Xe.IDLE);break;case V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case V.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Xe.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=_i.getBuffered(e),o=r.length?r.start(0):0,c=o-i,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||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=Xe.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:E,id3:T,initSegment:x}=s,{details:H}=d,$=this.altAudio?void 0:s.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=Xe.PARSING,x){if(x!=null&&x.tracks){const de=c.initSegment||c;this._bufferInitSegment(d,x.tracks,de,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:de,id:i,tracks:x.tracks})}const re=x.initPTS,ge=x.timescale;B(re)&&(this.initPTS[c.cc]={baseTime:re,timescale:ge},n.trigger(p.INIT_PTS_FOUND,{frag:c,id:i,initPTS:re,timescale:ge}))}if(f&&H){$&&f.type==="audiovideo"&&this.logMuxedErr(c);const re=H.fragments[c.sn-1-H.startSN],ge=c.sn===H.startSN,de=!re||c.cc>re.cc;if(s.independent!==!1){const{startPTS:we,endPTS:Pe,startDTS:et,endDTS:Me}=f;if(u)u.elementaryStreams[f.type]={startPTS:we,endPTS:Pe,startDTS:et,endDTS:Me};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!de&&(this.couldBacktrack=!0),f.dropped&&f.independent){const Ge=this.getMainFwdBufferInfo(),Je=(Ge?Ge.end:this.getLoadPosition())+this.config.maxBufferHole,Ne=f.firstKeyFramePTS?f.firstKeyFramePTS:we;if(!ge&&Je<Ne-this.config.maxBufferHole&&!de){this.backtrack(c);return}else de&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,Pe,c.start,Me,!0)}else ge&&we-(H.appliedTimelineOffset||0)>Mr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,we,Pe,et,Me),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,u,r,ge||de)}else if(ge||de)c.gap=!0;else{this.backtrack(c);return}}if($){const{startPTS:re,endPTS:ge,startDTS:de,endDTS:we}=$;u&&(u.elementaryStreams[v.AUDIO]={startPTS:re,endPTS:ge,startDTS:de,endDTS:we}),c.setElementaryStreamInfo(v.AUDIO,re,ge,de,we),this.bufferFragmentData($,c,u,r)}if(H&&T!=null&&(t=T.samples)!=null&&t.length){const re={id:i,frag:c,details:H,samples:T.samples};n.trigger(p.FRAG_PARSING_METADATA,re)}if(H&&E){const re={id:i,frag:c,details:H,samples:E.samples};n.trigger(p.FRAG_PARSING_USERDATA,re)}}logMuxedErr(e){this.warn(`${oe(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==Xe.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=Vt(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=Xe.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(_i.isBuffered(e,i)?t=this.getAppendedFrag(i):_i.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?jt(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=V.KEY_LOAD_ERROR,i,n,s){return new Zi({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&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length){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))return this.emeController.selectKeySystemFormat(r).then(o=>{if(r.setKeyFormat(o),this.emeController&&this.config.requireKeySystemAccessOnStart){const c=_n(o);if(c)return this.emeController.getKeySystemAccess([c])}})}}else if(this.config.requireKeySystemAccessOnStart){const i=qn(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}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,V.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,V.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,V.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:(E,T,x,H)=>{const{frag:$,keyInfo:re,url:ge}=x;if(!$.decryptdata||re!==this.keyUriToKeyInfo[ge])return o(this.createKeyLoadError($,V.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),H));re.decryptdata.key=$.decryptdata.key=new Uint8Array(E.data),$.keyLoader=null,re.loader=null,r({frag:$,keyInfo:re})},onError:(E,T,x,H)=>{this.resetLoader(T),o(this.createKeyLoadError(t,V.KEY_LOAD_ERROR,new Error(`HTTP Error ${E.code} loading key ${E.text}`),x,b({url:c.url,data:void 0},E)))},onTimeout:(E,T,x)=>{this.resetLoader(T),o(this.createKeyLoadError(t,V.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),x))},onAbort:(E,T,x)=>{this.resetLoader(T),o(this.createKeyLoadError(t,V.INTERNAL_ABORTED,new Error("key loading aborted"),x))}};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 E=Math.max(d*3,f*.8)*1e3;s=g({},s,{maxTimeToFirstByteMs:Math.min(E,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(E,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,E)=>{const T=this.getInternalLoader(f);this.resetInternalLoader(f.type);const x=u.data;if(x.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),E||null,d);return}d.parsing.start=performance.now(),Kn.isMediaPlaylist(x)||f.type!==me.MANIFEST?this.handleTrackOrLevelPlaylist(u,d,f,E||null,T):this.handleMasterPlaylist(u,d,f,E)},onError:(u,d,f,E)=>{this.handleNetworkError(d,f,!1,u,E)},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=Kn.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:u,levels:d,sessionData:f,sessionKeys:E,startTimeOffset:T,variableList:x}=c;this.variableList=x;const{AUDIO:H=[],SUBTITLES:$,"CLOSED-CAPTIONS":re}=Kn.parseMasterPlaylistMedia(r,o,c);H.length&&!H.some(de=>!de.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"),H.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Bi({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:d,audioTracks:H,subtitles:$,captions:re,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:E,startTimeOffset:T,variableList:x})}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,E=Vo(i),T=Kn.parseLevelPlaylist(e.data,d,f,E,0,this.variableList);if(u===me.MANIFEST){const x={attrs:new Bi({}),bitrate:0,details:T,name:"",url:d};T.requestScheduled=t.loading.start+hr(T,0),r.trigger(p.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:d,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=T,this.handlePlaylistLoaded(T,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:V.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=V.UNKNOWN,u=!1;const d=this.getInternalLoader(e);switch(e.type){case me.MANIFEST:c=i?V.MANIFEST_LOAD_TIMEOUT:V.MANIFEST_LOAD_ERROR,u=!0;break;case me.LEVEL:c=i?V.LEVEL_LOAD_TIMEOUT:V.LEVEL_LOAD_ERROR,u=!1;break;case me.AUDIO_TRACK:c=i?V.AUDIO_TRACK_LOAD_TIMEOUT:V.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case me.SUBTITLE_TRACK:c=i?V.SUBTITLE_TRACK_LOAD_TIMEOUT:V.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 E=(t==null?void 0:t.url)||e.url;f.response=b({url:E,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:E}=n,T=Sa(t,n),x=Vo(n),H=typeof n.level=="number"&&x===ce.MAIN?u:void 0;if(!e.fragments.length){const re=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:V.LEVEL_EMPTY_ERROR,fatal:!1,url:T,error:re,reason:re.message,response:t,context:n,level:H,parent:x,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:V.LEVEL_PARSING_ERROR,fatal:!1,url:T,error:$,reason:$.message,response:t,context:n,level:H,parent:x,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:H||0,id:d||0,stats:i,networkDetails:s,deliveryDirectives:E,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:E});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:E});break}}}class ys{static get version(){return hs}static isMSESupported(){return Go()}static isSupported(){return zc()}static getMediaSource(){return _e()}static get Events(){return p}static get MetadataSchema(){return Mn}static get ErrorTypes(){return he}static get ErrorDetails(){return V}static get DefaultConfig(){return ys.defaultConfig?ys.defaultConfig:Mc}static set DefaultConfig(e){ys.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 cs,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(ys.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 zi(this),E=i.interstitialsController,T=E?this.interstitialsController=new E(this,ys):null,x=this.bufferController=new s(this,f),H=this.capLevelController=new r(this),$=new c(this),re=new Jc(this),ge=i.contentSteeringController,de=ge?new ge(this):null,we=this.levelController=new Zc(this,de),Pe=new Wc(this),et=new Qc(this.config),Me=this.streamController=new qc(this,f,et),Ge=this.gapController=new Gc(this,f);H.setStreamController(Me),$.setStreamController(Me);const Je=[re,we,Me];T&&Je.splice(1,0,T),de&&Je.splice(1,0,de),this.networkControllers=Je;const Ne=[d,x,Ge,H,$,Pe,f];this.audioTrackController=this.createController(i.audioTrackController,Je);const bt=i.audioStreamController;bt&&Je.push(this.audioStreamController=new bt(this,f,et)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Je);const Wt=i.subtitleStreamController;Wt&&Je.push(this.subtititleStreamController=new Wt(this,f,et)),this.createController(i.timelineController,Ne),et.emeController=this.emeController=this.createController(i.emeController,Ne),this.cmcdController=this.createController(i.cmcdController,Ne),this.latencyController=this.createController(Hc,Ne),this.coreComponents=Ne,Je.push(u);const Ei=u.onErrorOut;typeof Ei=="function"&&this.on(p.ERROR,Ei,u),this.on(p.MANIFEST_LOADED,re.onManifestLoaded,re)}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:V.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:V.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=te.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=Gu()),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){rt(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=Mt(t);return pe(e,i,navigator.mediaCapabilities)}}ys.defaultConfig=void 0}}]);
}());