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.bec3b9...

121 lines
1.1 MiB

!(function(){var Xo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[6444],{65352:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return Ge}});var U=K(77321),de=K(52487),Se=K(74416),he=K(43403),j=K(92310),p=K.n(j),me=K(29301),ce=K(76846),l=K(96452),X=K(6089),P=K(80402),g=K(34280),_=K(49658),E=K(59301),A=K(72308),B=K(77900),H=K(8654);function V(ve){var we=ve.prefixCls,se=ve.align,Re=ve.arrow,Oe=ve.arrowPos,ie=Re||{},C=ie.className,O=ie.content,Q=Oe.x,z=Q===void 0?0:Q,N=Oe.y,Z=N===void 0?0:N,re=E.useRef();if(!se||!se.points)return null;var le={position:"absolute"};if(se.autoArrow!==!1){var _e=se.points[0],Ae=se.points[1],We=_e[0],He=_e[1],Be=Ae[0],Ke=Ae[1];We===Be||!["t","b"].includes(We)?le.top=Z:We==="t"?le.top=0:le.bottom=0,He===Ke||!["l","r"].includes(He)?le.left=z:He==="l"?le.left=0:le.right=0}return E.createElement("div",{ref:re,className:p()("".concat(we,"-arrow"),C),style:le},O)}function L(ve){var we=ve.prefixCls,se=ve.open,Re=ve.zIndex,Oe=ve.mask,ie=ve.motion;return Oe?E.createElement(B.default,(0,A.Z)({},ie,{motionAppear:!0,visible:se,removeOnLeave:!0}),function(C){var O=C.className;return E.createElement("div",{style:{zIndex:Re},className:p()("".concat(we,"-mask"),O)})}):null}var I=E.memo(function(ve){var we=ve.children;return we},function(ve,we){return we.cache}),w=I,R=E.forwardRef(function(ve,we){var se=ve.popup,Re=ve.className,Oe=ve.prefixCls,ie=ve.style,C=ve.target,O=ve.onVisibleChanged,Q=ve.open,z=ve.keepDom,N=ve.fresh,Z=ve.onClick,re=ve.mask,le=ve.arrow,_e=ve.arrowPos,Ae=ve.align,We=ve.motion,He=ve.maskMotion,Be=ve.forceRender,Ke=ve.getPopupContainer,lt=ve.autoDestroy,Ie=ve.portal,et=ve.zIndex,Kt=ve.onMouseEnter,bt=ve.onMouseLeave,Mt=ve.onPointerEnter,Zt=ve.onPointerDownCapture,ii=ve.ready,ei=ve.offsetX,Ft=ve.offsetY,ri=ve.offsetR,St=ve.offsetB,ft=ve.onAlign,gt=ve.onPrepare,Ht=ve.stretch,pt=ve.targetWidth,dt=ve.targetHeight,vt=typeof se=="function"?se():se,Bt=Q||z,ai=(Ke==null?void 0:Ke.length)>0,xt=E.useState(!Ke||!ai),Xt=(0,de.Z)(xt,2),Lt=Xt[0],Ne=Xt[1];if((0,g.Z)(function(){!Lt&&ai&&C&&Ne(!0)},[Lt,ai,C]),!Lt)return null;var h="auto",m={left:"-1000vw",top:"-1000vh",right:h,bottom:h};if(ii||!Q){var y,k=Ae.points,W=Ae.dynamicInset||((y=Ae._experimental)===null||y===void 0?void 0:y.dynamicInset),pe=W&&k[0][1]==="r",be=W&&k[0][0]==="b";pe?(m.right=ri,m.left=h):(m.left=ei,m.right=h),be?(m.bottom=St,m.top=h):(m.top=Ft,m.bottom=h)}var rt={};return Ht&&(Ht.includes("height")&&dt?rt.height=dt:Ht.includes("minHeight")&&dt&&(rt.minHeight=dt),Ht.includes("width")&&pt?rt.width=pt:Ht.includes("minWidth")&&pt&&(rt.minWidth=pt)),Q||(rt.pointerEvents="none"),E.createElement(Ie,{open:Be||Bt,getContainer:Ke&&function(){return Ke(C)},autoDestroy:lt},E.createElement(L,{prefixCls:Oe,open:Q,zIndex:et,mask:re,motion:He}),E.createElement(me.Z,{onResize:ft,disabled:!Q},function(ut){return E.createElement(B.default,(0,A.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Be,leavedClassName:"".concat(Oe,"-hidden")},We,{onAppearPrepare:gt,onEnterPrepare:gt,visible:Q,onVisibleChanged:function(Ut){var zt;We==null||(zt=We.onVisibleChanged)===null||zt===void 0||zt.call(We,Ut),O(Ut)}}),function(_t,Ut){var zt=_t.className,Tt=_t.style,Gt=p()(Oe,zt,Re);return E.createElement("div",{ref:(0,H.sQ)(ut,we,Ut),className:Gt,style:(0,U.Z)((0,U.Z)((0,U.Z)((0,U.Z)({"--arrow-x":"".concat(_e.x||0,"px"),"--arrow-y":"".concat(_e.y||0,"px")},m),rt),Tt),{},{boxSizing:"border-box",zIndex:et},ie),onMouseEnter:Kt,onMouseLeave:bt,onPointerEnter:Mt,onClick:Z,onPointerDownCapture:Zt},le&&E.createElement(V,{prefixCls:Oe,arrow:le,arrowPos:_e,align:Ae}),E.createElement(w,{cache:!Q&&!N},vt))})}))}),q=R,ne=E.forwardRef(function(ve,we){var se=ve.children,Re=ve.getTriggerDOMNode,Oe=(0,H.Yr)(se),ie=E.useCallback(function(O){(0,H.mH)(we,Re?Re(O):O)},[Re]),C=(0,H.x1)(ie,(0,H.C4)(se));return Oe?E.cloneElement(se,{ref:C}):se}),ee=ne,ye=E.createContext(null),Le=ye;function Te(ve){return ve?Array.isArray(ve)?ve:[ve]:[]}function $e(ve,we,se,Re){return E.useMemo(function(){var Oe=Te(se!=null?se:we),ie=Te(Re!=null?Re:we),C=new Set(Oe),O=new Set(ie);return ve&&(C.has("hover")&&(C.delete("hover"),C.add("click")),O.has("hover")&&(O.delete("hover"),O.add("click"))),[C,O]},[ve,we,se,Re])}var J=K(29194);function D(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],se=arguments.length>2?arguments[2]:void 0;return se?ve[0]===we[0]:ve[0]===we[0]&&ve[1]===we[1]}function F(ve,we,se,Re){for(var Oe=se.points,ie=Object.keys(ve),C=0;C<ie.length;C+=1){var O,Q=ie[C];if(D((O=ve[Q])===null||O===void 0?void 0:O.points,Oe,Re))return"".concat(we,"-placement-").concat(Q)}return""}function M(ve,we,se,Re){return we||(se?{motionName:"".concat(ve,"-").concat(se)}:Re?{motionName:Re}:null)}function oe(ve){return ve.ownerDocument.defaultView}function te(ve){for(var we=[],se=ve==null?void 0:ve.parentElement,Re=["hidden","scroll","clip","auto"];se;){var Oe=oe(se).getComputedStyle(se),ie=Oe.overflowX,C=Oe.overflowY,O=Oe.overflow;[ie,C,O].some(function(Q){return Re.includes(Q)})&&we.push(se),se=se.parentElement}return we}function S(ve){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(ve)?we:ve}function v(ve){return S(parseFloat(ve),0)}function Y(ve,we){var se=(0,U.Z)({},ve);return(we||[]).forEach(function(Re){if(!(Re instanceof HTMLBodyElement||Re instanceof HTMLHtmlElement)){var Oe=oe(Re).getComputedStyle(Re),ie=Oe.overflow,C=Oe.overflowClipMargin,O=Oe.borderTopWidth,Q=Oe.borderBottomWidth,z=Oe.borderLeftWidth,N=Oe.borderRightWidth,Z=Re.getBoundingClientRect(),re=Re.offsetHeight,le=Re.clientHeight,_e=Re.offsetWidth,Ae=Re.clientWidth,We=v(O),He=v(Q),Be=v(z),Ke=v(N),lt=S(Math.round(Z.width/_e*1e3)/1e3),Ie=S(Math.round(Z.height/re*1e3)/1e3),et=(_e-Ae-Be-Ke)*lt,Kt=(re-le-We-He)*Ie,bt=We*Ie,Mt=He*Ie,Zt=Be*lt,ii=Ke*lt,ei=0,Ft=0;if(ie==="clip"){var ri=v(C);ei=ri*lt,Ft=ri*Ie}var St=Z.x+Zt-ei,ft=Z.y+bt-Ft,gt=St+Z.width+2*ei-Zt-ii-et,Ht=ft+Z.height+2*Ft-bt-Mt-Kt;se.left=Math.max(se.left,St),se.top=Math.max(se.top,ft),se.right=Math.min(se.right,gt),se.bottom=Math.min(se.bottom,Ht)}}),se}function ae(ve){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,se="".concat(we),Re=se.match(/^(.*)\%$/);return Re?ve*(parseFloat(Re[1])/100):parseFloat(se)}function xe(ve,we){var se=we||[],Re=(0,de.Z)(se,2),Oe=Re[0],ie=Re[1];return[ae(ve.width,Oe),ae(ve.height,ie)]}function Fe(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[ve[0],ve[1]]}function Xe(ve,we){var se=we[0],Re=we[1],Oe,ie;return se==="t"?ie=ve.y:se==="b"?ie=ve.y+ve.height:ie=ve.y+ve.height/2,Re==="l"?Oe=ve.x:Re==="r"?Oe=ve.x+ve.width:Oe=ve.x+ve.width/2,{x:Oe,y:ie}}function yt(ve,we){var se={t:"b",b:"t",l:"r",r:"l"};return ve.map(function(Re,Oe){return Oe===we?se[Re]||"c":Re}).join("")}function $t(ve,we,se,Re,Oe,ie,C){var O=E.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Oe[Re]||{}}),Q=(0,de.Z)(O,2),z=Q[0],N=Q[1],Z=E.useRef(0),re=E.useMemo(function(){return we?te(we):[]},[we]),le=E.useRef({}),_e=function(){le.current={}};ve||_e();var Ae=(0,X.Z)(function(){if(we&&se&&ve){let mn=function(Ji,en){var Di=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ze,cn=xt.x+Ji,Wn=xt.y+en,ts=cn+pe,os=Wn+W,Hn=Math.max(cn,Di.left),qt=Math.max(Wn,Di.top),vi=Math.min(ts,Di.right),Hi=Math.min(os,Di.bottom);return Math.max(0,(vi-Hn)*(Hi-qt))},Nn=function(){nn=xt.y+ui,Yi=nn+W,Zi=xt.x+gi,Qi=Zi+pe};var Be,Ke,lt,Ie,et=we,Kt=et.ownerDocument,bt=oe(et),Mt=bt.getComputedStyle(et),Zt=Mt.width,ii=Mt.height,ei=Mt.position,Ft=et.style.left,ri=et.style.top,St=et.style.right,ft=et.style.bottom,gt=et.style.overflow,Ht=(0,U.Z)((0,U.Z)({},Oe[Re]),ie),pt=Kt.createElement("div");(Be=et.parentElement)===null||Be===void 0||Be.appendChild(pt),pt.style.left="".concat(et.offsetLeft,"px"),pt.style.top="".concat(et.offsetTop,"px"),pt.style.position=ei,pt.style.height="".concat(et.offsetHeight,"px"),pt.style.width="".concat(et.offsetWidth,"px"),et.style.left="0",et.style.top="0",et.style.right="auto",et.style.bottom="auto",et.style.overflow="hidden";var dt;if(Array.isArray(se))dt={x:se[0],y:se[1],width:0,height:0};else{var vt,Bt,ai=se.getBoundingClientRect();ai.x=(vt=ai.x)!==null&&vt!==void 0?vt:ai.left,ai.y=(Bt=ai.y)!==null&&Bt!==void 0?Bt:ai.top,dt={x:ai.x,y:ai.y,width:ai.width,height:ai.height}}var xt=et.getBoundingClientRect();xt.x=(Ke=xt.x)!==null&&Ke!==void 0?Ke:xt.left,xt.y=(lt=xt.y)!==null&&lt!==void 0?lt:xt.top;var Xt=Kt.documentElement,Lt=Xt.clientWidth,Ne=Xt.clientHeight,h=Xt.scrollWidth,m=Xt.scrollHeight,y=Xt.scrollTop,k=Xt.scrollLeft,W=xt.height,pe=xt.width,be=dt.height,rt=dt.width,ut={left:0,top:0,right:Lt,bottom:Ne},_t={left:-k,top:-y,right:h-k,bottom:m-y},Ut=Ht.htmlRegion,zt="visible",Tt="visibleFirst";Ut!=="scroll"&&Ut!==Tt&&(Ut=zt);var Gt=Ut===Tt,Pt=Y(_t,re),tt=Y(ut,re),ze=Ut===zt?tt:Pt,Ve=Gt?tt:ze;et.style.left="auto",et.style.top="auto",et.style.right="0",et.style.bottom="0";var at=et.getBoundingClientRect();et.style.left=Ft,et.style.top=ri,et.style.right=St,et.style.bottom=ft,et.style.overflow=gt,(Ie=et.parentElement)===null||Ie===void 0||Ie.removeChild(pt);var Vt=S(Math.round(pe/parseFloat(Zt)*1e3)/1e3),Ct=S(Math.round(W/parseFloat(ii)*1e3)/1e3);if(Vt===0||Ct===0||(0,ce.Sh)(se)&&!(0,J.Z)(se))return;var pi=Ht.offset,Dt=Ht.targetOffset,Rt=xe(xt,pi),Nt=(0,de.Z)(Rt,2),Ee=Nt[0],De=Nt[1],qe=xe(dt,Dt),Ye=(0,de.Z)(qe,2),ot=Ye[0],Qe=Ye[1];dt.x-=ot,dt.y-=Qe;var ct=Ht.points||[],Et=(0,de.Z)(ct,2),ni=Et[0],Ot=Et[1],Qt=Fe(Ot),oi=Fe(ni),mi=Xe(dt,Qt),Ei=Xe(xt,oi),Ti=(0,U.Z)({},Ht),gi=mi.x-Ei.x+Ee,ui=mi.y-Ei.y+De,Li=mn(gi,ui),Pi=mn(gi,ui,tt),wi=Xe(dt,["t","l"]),bi=Xe(xt,["t","l"]),Mi=Xe(dt,["b","r"]),Ri=Xe(xt,["b","r"]),Ni=Ht.overflow||{},Ci=Ni.adjustX,Ii=Ni.adjustY,on=Ni.shiftX,Vi=Ni.shiftY,Ai=function(en){return typeof en=="boolean"?en:en>=0},nn,Yi,Zi,Qi;Nn();var Ki=Ai(Ii),Jt=oi[0]===Qt[0];if(Ki&&oi[0]==="t"&&(Yi>Ve.bottom||le.current.bt)){var It=ui;Jt?It-=W-be:It=wi.y-Ri.y-De;var _i=mn(gi,It),Fi=mn(gi,It,tt);_i>Li||_i===Li&&(!Gt||Fi>=Pi)?(le.current.bt=!0,ui=It,De=-De,Ti.points=[yt(oi,0),yt(Qt,0)]):le.current.bt=!1}if(Ki&&oi[0]==="b"&&(nn<Ve.top||le.current.tb)){var Bi=ui;Jt?Bi+=W-be:Bi=Mi.y-bi.y-De;var gn=mn(gi,Bi),ln=mn(gi,Bi,tt);gn>Li||gn===Li&&(!Gt||ln>=Pi)?(le.current.tb=!0,ui=Bi,De=-De,Ti.points=[yt(oi,0),yt(Qt,0)]):le.current.tb=!1}var sn=Ai(Ci),hn=oi[1]===Qt[1];if(sn&&oi[1]==="l"&&(Qi>Ve.right||le.current.rl)){var fn=gi;hn?fn-=pe-rt:fn=wi.x-Ri.x-Ee;var _n=mn(fn,ui),xn=mn(fn,ui,tt);_n>Li||_n===Li&&(!Gt||xn>=Pi)?(le.current.rl=!0,gi=fn,Ee=-Ee,Ti.points=[yt(oi,1),yt(Qt,1)]):le.current.rl=!1}if(sn&&oi[1]==="r"&&(Zi<Ve.left||le.current.lr)){var Ui=gi;hn?Ui+=pe-rt:Ui=Mi.x-bi.x-Ee;var vn=mn(Ui,ui),yn=mn(Ui,ui,tt);vn>Li||vn===Li&&(!Gt||yn>=Pi)?(le.current.lr=!0,gi=Ui,Ee=-Ee,Ti.points=[yt(oi,1),yt(Qt,1)]):le.current.lr=!1}Nn();var pn=on===!0?0:on;typeof pn=="number"&&(Zi<tt.left&&(gi-=Zi-tt.left-Ee,dt.x+rt<tt.left+pn&&(gi+=dt.x-tt.left+rt-pn)),Qi>tt.right&&(gi-=Qi-tt.right-Ee,dt.x>tt.right-pn&&(gi+=dt.x-tt.right+pn)));var dn=Vi===!0?0:Vi;typeof dn=="number"&&(nn<tt.top&&(ui-=nn-tt.top-De,dt.y+be<tt.top+dn&&(ui+=dt.y-tt.top+be-dn)),Yi>tt.bottom&&(ui-=Yi-tt.bottom-De,dt.y>tt.bottom-dn&&(ui+=dt.y-tt.bottom+dn)));var fi=xt.x+gi,Pn=fi+pe,Tn=xt.y+ui,Gn=Tn+W,On=dt.x,qn=On+rt,Mn=dt.y,Qn=Mn+be,Wi=Math.max(fi,On),Vn=Math.min(Pn,qn),An=(Wi+Vn)/2,as=An-fi,Jn=Math.max(Tn,Mn),jn=Math.min(Gn,Qn),es=(Jn+jn)/2,wn=es-Tn;C==null||C(we,Ti);var Rn=at.right-xt.x-(gi+xt.width),un=at.bottom-xt.y-(ui+xt.height);Vt===1&&(gi=Math.round(gi),Rn=Math.round(Rn)),Ct===1&&(ui=Math.round(ui),un=Math.round(un));var In={ready:!0,offsetX:gi/Vt,offsetY:ui/Ct,offsetR:Rn/Vt,offsetB:un/Ct,arrowX:as/Vt,arrowY:wn/Ct,scaleX:Vt,scaleY:Ct,align:Ti};N(In)}}),We=function(){Z.current+=1;var Ke=Z.current;Promise.resolve().then(function(){Z.current===Ke&&Ae()})},He=function(){N(function(Ke){return(0,U.Z)((0,U.Z)({},Ke),{},{ready:!1})})};return(0,g.Z)(He,[Re]),(0,g.Z)(function(){ve||He()},[ve]),[z.ready,z.offsetX,z.offsetY,z.offsetR,z.offsetB,z.arrowX,z.arrowY,z.scaleX,z.scaleY,z.align,We]}var ti=K(80702);function je(ve,we,se,Re,Oe){(0,g.Z)(function(){if(ve&&we&&se){let Z=function(){Re(),Oe()};var ie=we,C=se,O=te(ie),Q=te(C),z=oe(C),N=new Set([z].concat((0,ti.Z)(O),(0,ti.Z)(Q)));return N.forEach(function(re){re.addEventListener("scroll",Z,{passive:!0})}),z.addEventListener("resize",Z,{passive:!0}),Re(),function(){N.forEach(function(re){re.removeEventListener("scroll",Z),z.removeEventListener("resize",Z)})}}},[ve,we,se])}var mt=K(48736);function Wt(ve,we,se,Re,Oe,ie,C,O){var Q=E.useRef(ve);Q.current=ve;var z=E.useRef(!1);E.useEffect(function(){if(we&&Re&&(!Oe||ie)){var Z=function(){z.current=!1},re=function(lt){var Ie;Q.current&&!C(((Ie=lt.composedPath)===null||Ie===void 0||(Ie=Ie.call(lt))===null||Ie===void 0?void 0:Ie[0])||lt.target)&&!z.current&&O(!1)},le=oe(Re);le.addEventListener("pointerdown",Z,!0),le.addEventListener("mousedown",re,!0),le.addEventListener("contextmenu",re,!0);var _e=(0,l.A)(se);if(_e&&(_e.addEventListener("mousedown",re,!0),_e.addEventListener("contextmenu",re,!0)),0)var Ae,We,He,Be;return function(){le.removeEventListener("pointerdown",Z,!0),le.removeEventListener("mousedown",re,!0),le.removeEventListener("contextmenu",re,!0),_e&&(_e.removeEventListener("mousedown",re,!0),_e.removeEventListener("contextmenu",re,!0))}}},[we,se,Re,Oe,ie]);function N(){z.current=!0}return N}var ht=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function li(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:he.Z,we=E.forwardRef(function(se,Re){var Oe=se.prefixCls,ie=Oe===void 0?"rc-trigger-popup":Oe,C=se.children,O=se.action,Q=O===void 0?"hover":O,z=se.showAction,N=se.hideAction,Z=se.popupVisible,re=se.defaultPopupVisible,le=se.onPopupVisibleChange,_e=se.afterPopupVisibleChange,Ae=se.mouseEnterDelay,We=se.mouseLeaveDelay,He=We===void 0?.1:We,Be=se.focusDelay,Ke=se.blurDelay,lt=se.mask,Ie=se.maskClosable,et=Ie===void 0?!0:Ie,Kt=se.getPopupContainer,bt=se.forceRender,Mt=se.autoDestroy,Zt=se.destroyPopupOnHide,ii=se.popup,ei=se.popupClassName,Ft=se.popupStyle,ri=se.popupPlacement,St=se.builtinPlacements,ft=St===void 0?{}:St,gt=se.popupAlign,Ht=se.zIndex,pt=se.stretch,dt=se.getPopupClassNameFromAlign,vt=se.fresh,Bt=se.alignPoint,ai=se.onPopupClick,xt=se.onPopupAlign,Xt=se.arrow,Lt=se.popupMotion,Ne=se.maskMotion,h=se.popupTransitionName,m=se.popupAnimation,y=se.maskTransitionName,k=se.maskAnimation,W=se.className,pe=se.getTriggerDOMNode,be=(0,Se.Z)(se,ht),rt=Mt||Zt||!1,ut=E.useState(!1),_t=(0,de.Z)(ut,2),Ut=_t[0],zt=_t[1];(0,g.Z)(function(){zt((0,_.Z)())},[]);var Tt=E.useRef({}),Gt=E.useContext(Le),Pt=E.useMemo(function(){return{registerSubPopup:function(vi,Hi){Tt.current[vi]=Hi,Gt==null||Gt.registerSubPopup(vi,Hi)}}},[Gt]),tt=(0,P.Z)(),ze=E.useState(null),Ve=(0,de.Z)(ze,2),at=Ve[0],Vt=Ve[1],Ct=E.useRef(null),pi=(0,X.Z)(function(qt){Ct.current=qt,(0,ce.Sh)(qt)&&at!==qt&&Vt(qt),Gt==null||Gt.registerSubPopup(tt,qt)}),Dt=E.useState(null),Rt=(0,de.Z)(Dt,2),Nt=Rt[0],Ee=Rt[1],De=E.useRef(null),qe=(0,X.Z)(function(qt){(0,ce.Sh)(qt)&&Nt!==qt&&(Ee(qt),De.current=qt)}),Ye=E.Children.only(C),ot=(Ye==null?void 0:Ye.props)||{},Qe={},ct=(0,X.Z)(function(qt){var vi,Hi,rn=Nt;return(rn==null?void 0:rn.contains(qt))||((vi=(0,l.A)(rn))===null||vi===void 0?void 0:vi.host)===qt||qt===rn||(at==null?void 0:at.contains(qt))||((Hi=(0,l.A)(at))===null||Hi===void 0?void 0:Hi.host)===qt||qt===at||Object.values(Tt.current).some(function(Xi){return(Xi==null?void 0:Xi.contains(qt))||qt===Xi})}),Et=M(ie,Lt,m,h),ni=M(ie,Ne,k,y),Ot=E.useState(re||!1),Qt=(0,de.Z)(Ot,2),oi=Qt[0],mi=Qt[1],Ei=Z!=null?Z:oi,Ti=(0,X.Z)(function(qt){Z===void 0&&mi(qt)});(0,g.Z)(function(){mi(Z||!1)},[Z]);var gi=E.useRef(Ei);gi.current=Ei;var ui=E.useRef([]);ui.current=[];var Li=(0,X.Z)(function(qt){var vi;Ti(qt),((vi=ui.current[ui.current.length-1])!==null&&vi!==void 0?vi:Ei)!==qt&&(ui.current.push(qt),le==null||le(qt))}),Pi=E.useRef(),wi=function(){clearTimeout(Pi.current)},bi=function(vi){var Hi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;wi(),Hi===0?Li(vi):Pi.current=setTimeout(function(){Li(vi)},Hi*1e3)};E.useEffect(function(){return wi},[]);var Mi=E.useState(!1),Ri=(0,de.Z)(Mi,2),Ni=Ri[0],Ci=Ri[1];(0,g.Z)(function(qt){(!qt||Ei)&&Ci(!0)},[Ei]);var Ii=E.useState(null),on=(0,de.Z)(Ii,2),Vi=on[0],Ai=on[1],nn=E.useState(null),Yi=(0,de.Z)(nn,2),Zi=Yi[0],Qi=Yi[1],Ki=function(vi){Qi([vi.clientX,vi.clientY])},Jt=$t(Ei,at,Bt&&Zi!==null?Zi:Nt,ri,ft,gt,xt),It=(0,de.Z)(Jt,11),_i=It[0],Fi=It[1],Bi=It[2],gn=It[3],ln=It[4],sn=It[5],hn=It[6],fn=It[7],_n=It[8],xn=It[9],Ui=It[10],vn=$e(Ut,Q,z,N),yn=(0,de.Z)(vn,2),pn=yn[0],dn=yn[1],fi=pn.has("click"),Pn=dn.has("click")||dn.has("contextMenu"),Tn=(0,X.Z)(function(){Ni||Ui()}),Gn=function(){gi.current&&Bt&&Pn&&bi(!1)};je(Ei,Nt,at,Tn,Gn),(0,g.Z)(function(){Tn()},[Zi,ri]),(0,g.Z)(function(){Ei&&!(ft!=null&&ft[ri])&&Tn()},[JSON.stringify(gt)]);var On=E.useMemo(function(){var qt=F(ft,ie,xn,Bt);return p()(qt,dt==null?void 0:dt(xn))},[xn,dt,ft,ie,Bt]);E.useImperativeHandle(Re,function(){return{nativeElement:De.current,popupElement:Ct.current,forceAlign:Tn}});var qn=E.useState(0),Mn=(0,de.Z)(qn,2),Qn=Mn[0],Wi=Mn[1],Vn=E.useState(0),An=(0,de.Z)(Vn,2),as=An[0],Jn=An[1],jn=function(){if(pt&&Nt){var vi=Nt.getBoundingClientRect();Wi(vi.width),Jn(vi.height)}},es=function(){jn(),Tn()},wn=function(vi){Ci(!1),Ui(),_e==null||_e(vi)},Rn=function(){return new Promise(function(vi){jn(),Ai(function(){return vi})})};(0,g.Z)(function(){Vi&&(Ui(),Vi(),Ai(null))},[Vi]);function un(qt,vi,Hi,rn){Qe[qt]=function(Xi){var ls;rn==null||rn(Xi),bi(vi,Hi);for(var Zn=arguments.length,bn=new Array(Zn>1?Zn-1:0),ds=1;ds<Zn;ds++)bn[ds-1]=arguments[ds];(ls=ot[qt])===null||ls===void 0||ls.call.apply(ls,[ot,Xi].concat(bn))}}(fi||Pn)&&(Qe.onClick=function(qt){var vi;gi.current&&Pn?bi(!1):!gi.current&&fi&&(Ki(qt),bi(!0));for(var Hi=arguments.length,rn=new Array(Hi>1?Hi-1:0),Xi=1;Xi<Hi;Xi++)rn[Xi-1]=arguments[Xi];(vi=ot.onClick)===null||vi===void 0||vi.call.apply(vi,[ot,qt].concat(rn))});var In=Wt(Ei,Pn,Nt,at,lt,et,ct,bi),mn=pn.has("hover"),Nn=dn.has("hover"),Ji,en;mn&&(un("onMouseEnter",!0,Ae,function(qt){Ki(qt)}),un("onPointerEnter",!0,Ae,function(qt){Ki(qt)}),Ji=function(vi){(Ei||Ni)&&at!==null&&at!==void 0&&at.contains(vi.target)&&bi(!0,Ae)},Bt&&(Qe.onMouseMove=function(qt){var vi;(vi=ot.onMouseMove)===null||vi===void 0||vi.call(ot,qt)})),Nn&&(un("onMouseLeave",!1,He),un("onPointerLeave",!1,He),en=function(){bi(!1,He)}),pn.has("focus")&&un("onFocus",!0,Be),dn.has("focus")&&un("onBlur",!1,Ke),pn.has("contextMenu")&&(Qe.onContextMenu=function(qt){var vi;gi.current&&dn.has("contextMenu")?bi(!1):(Ki(qt),bi(!0)),qt.preventDefault();for(var Hi=arguments.length,rn=new Array(Hi>1?Hi-1:0),Xi=1;Xi<Hi;Xi++)rn[Xi-1]=arguments[Xi];(vi=ot.onContextMenu)===null||vi===void 0||vi.call.apply(vi,[ot,qt].concat(rn))}),W&&(Qe.className=p()(ot.className,W));var Di=(0,U.Z)((0,U.Z)({},ot),Qe),cn={},Wn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Wn.forEach(function(qt){be[qt]&&(cn[qt]=function(){for(var vi,Hi=arguments.length,rn=new Array(Hi),Xi=0;Xi<Hi;Xi++)rn[Xi]=arguments[Xi];(vi=Di[qt])===null||vi===void 0||vi.call.apply(vi,[Di].concat(rn)),be[qt].apply(be,rn)})});var ts=E.cloneElement(Ye,(0,U.Z)((0,U.Z)({},Di),cn)),os={x:sn,y:hn},Hn=Xt?(0,U.Z)({},Xt!==!0?Xt:{}):null;return E.createElement(E.Fragment,null,E.createElement(me.Z,{disabled:!Ei,ref:qe,onResize:es},E.createElement(ee,{getTriggerDOMNode:pe},ts)),E.createElement(Le.Provider,{value:Pt},E.createElement(q,{portal:ve,ref:pi,prefixCls:ie,popup:ii,className:p()(ei,On),style:Ft,target:Nt,onMouseEnter:Ji,onMouseLeave:en,onPointerEnter:Ji,zIndex:Ht,open:Ei,keepDom:Ni,fresh:vt,onClick:ai,onPointerDownCapture:In,mask:lt,motion:Et,maskMotion:ni,onVisibleChanged:wn,onPrepare:Rn,forceRender:bt,autoDestroy:rt,getPopupContainer:Kt,align:xn,arrow:Hn,arrowPos:os,ready:_i,offsetX:Fi,offsetY:Bi,offsetR:gn,offsetB:ln,onAlign:Tn,stretch:pt,targetWidth:Qn/fn,targetHeight:as/_n})))});return we}var Ge=li(he.Z)},12635:function(Yt,st,K){"use strict";var U=K(59301),de=K(93314),Se=K(99571),he=Object.defineProperty,j=Object.defineProperties,p=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,X=(E,A,B)=>A in E?he(E,A,{enumerable:!0,configurable:!0,writable:!0,value:B}):E[A]=B,P=(E,A)=>{for(var B in A||(A={}))ce.call(A,B)&&X(E,B,A[B]);if(me)for(var B of me(A))l.call(A,B)&&X(E,B,A[B]);return E},g=(E,A)=>j(E,p(A));const _=({img:E,buttonProps:A={},styles:B={},customText:H,ButtonText:V,ButtonClick:L,Buttonclass:I,ButtonTwo:w,imgStyles:R,loading:q=!1,className:ne=""})=>U.createElement("section",{className:`tc animated fadeIn ${ne}`,style:P({color:"#999",margin:"100px auto",visibility:q?"hidden":"visible"},B)},U.createElement("img",{src:E||de,style:g(P({},R),{pointerEvents:"none",userSelect:"none"})}),U.createElement("p",{className:"mt20 font14"},H||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),V&&U.createElement(Se.ZP,P({className:I,onClick:L},A),V),w&&w);st.Z=_},6311:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return I}});var U=K(59301),de={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},Se=K(99571),he=K(70557),j=K(89081),p=K(25399),me=K(59895),ce=K(76011),l=K(12635),X=K(12242),P=K(65789),g=K(59301),_=Object.defineProperty,E=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,H=(w,R,q)=>R in w?_(w,R,{enumerable:!0,configurable:!0,writable:!0,value:q}):w[R]=q,V=(w,R)=>{for(var q in R||(R={}))A.call(R,q)&&H(w,q,R[q]);if(E)for(var q of E(R))B.call(R,q)&&H(w,q,R[q]);return w},L=(w,R,q)=>new Promise((ne,ee)=>{var ye=$e=>{try{Te(q.next($e))}catch(J){ee(J)}},Le=$e=>{try{Te(q.throw($e))}catch(J){ee(J)}},Te=$e=>$e.done?ne($e.value):Promise.resolve($e.value).then(ye,Le);Te((q=q.apply(w,R)).next())}),I=({editOffice:w="view",data:R,theme:q,type:ne,filename:ee,monacoEditor:ye,className:Le,style:Te,close:$e,onClose:J,hasMask:D,disabledDownload:F,onImgDimensions:M,showNodata:oe,recordInfo:te})=>{const[S,v]=(0,U.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Y,ae]=(0,U.useState)(""),[xe,Fe]=(0,U.useState)(),Xe=window.ENV==="build"?"/react/build":"",yt=location.host.startsWith("localhost")?X.Z.PROXY_SERVER:X.Z.API_SERVER,ti=10*(1024*1024),je=(0,U.useRef)();R!=null&&R.startsWith("/api")&&ne!=="txt"&&(R=X.Z.API_SERVER+R);const mt=Ge=>Ge.substring(Ge.lastIndexOf("/")+1).split(".").pop();ee&&ye&&(ye.filename=ee),(0,U.useEffect)(()=>{var Ge,ve;const we=(ve=(Ge=document.cookie)==null?void 0:Ge.replace(/\s/g,""))==null?void 0:ve.split(";");we==null||we.map(se=>{let Re=se.split("=");Re[0]==="_educoder_session"&&ae(Re[1])})},[]),(0,U.useEffect)(()=>{ne==="office"&&(R.indexOf("bigfilescdn.")>-1||R.indexOf("bigfiles1")>-1?Fe({url:R,fileType:mt(R),model:R.indexOf("model=edit")?"edit":"view"}):Wt())},[ne,R]);const Wt=()=>L(void 0,null,function*(){console.log("data:",R);let Ge=R;R.startsWith("http")||(Ge=location.origin+Ge);let ve=new URL(Ge).pathname.split("/").pop();const we=yield(0,ce.gJ)({attachment_id:ve});we.url=yt+we.url,Fe(we)}),ht=()=>{if(R.startsWith("http")||R.startsWith("blob:")){li();return}(0,me.Sv)(ee||"educoder",R,ee)},li=()=>{te&&(0,P.fc)({id:te==null?void 0:te.id,watch_type:1,course_id:te==null?void 0:te.course_id}),(0,me.Nd)(ee||"educoder",decodeURIComponent(R))};return g.createElement("div",{style:V({},Te||{}),className:`${D&&de.bgBlack} ${ne?de.wrp:"hide"}`},$e&&g.createElement("div",{className:de.close,ref:je},!!M&&g.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>je.current},g.createElement("span",{onClick:()=>{J(),M()}},g.createElement("i",{className:"icon-yulanpizhu"}))),!F&&g.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>je.current},g.createElement("span",{onClick:li},g.createElement("i",{className:"icon-quxiaozhiding"}))),g.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>je.current},g.createElement("span",{className:"",onClick:J},g.createElement("i",{className:"icon-guanbi1"})))),g.createElement("div",{className:`${de[Le]} ${Le} ${de.monaco} ${ne==="txt"?"show":"hide"}`},ne==="txt"&&g.createElement(g.Fragment,null,g.createElement(j.ZP,V({},ye)))),ne==="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}),ne==="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})),ne==="office"&&xe&&g.createElement("iframe",{src:`${Xe}/office.html?key=${xe.key}&url=${btoa(xe.url)}&callbackUrl=${yt+(xe.callbackUrl||"")}&fileType=${xe.fileType}&title=${xe.title||""}&model=${w}&officeServer=${X.Z.ONLYOFFICE}&disabledDownload=${!!F}`}),ne==="html"&&g.createElement("iframe",{src:R+"&disposition=inline"}),ne==="pdf"&&g.createElement("iframe",{src:`${Xe}/js/pdfview/index.html?filename=${ee||"educoder.pdf"}&url=${encodeURIComponent(R)}&disabledDownload=${!!F}`}),ne==="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}`}),(ne==="other"||ne==="download")&&g.createElement(g.Fragment,null,oe?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:ht,disabled:F},"\u4E0B\u8F7D")}):g.createElement(Se.ZP,{type:"primary",size:"middle",onClick:ht,disabled:F},g.createElement(he.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},42159:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return A}});var U=K(59301),de=K(6767),Se=K(75727),he=K(92841),j=K(79710),p=K(69669),me=K(56102),ce=K(72890),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=(B,H,V)=>new Promise((L,I)=>{var w=ne=>{try{q(V.next(ne))}catch(ee){I(ee)}},R=ne=>{try{q(V.throw(ne))}catch(ee){I(ee)}},q=ne=>ne.done?L(ne.value):Promise.resolve(ne.value).then(w,R);q((V=V.apply(B,H)).next())});function P(B){if(isNaN(B))return{minutes:"00",seconds:"00"};const H=new Date(B*1e3).toISOString().substr(11,8);return{hour:H.substr(0,2),minutes:H.substr(3,2),seconds:H.substr(6,2)}}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2}});function g(B,H){return B-H}function _(B){B.sort(g);let H=0;for(let V=0;V<B.length-1;V++){let L=Math.abs(B[V+1]-B[V]);L<21&&(H+=L)}return H}const E=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var A=(0,U.forwardRef)(({allow_skip:B,src:H,toLog:V,videoId:L,logWatchHistory:I,courseId:w=null,startTime:R,handlePause:q=()=>{},handlePlay:ne=()=>{},handlePlayEnded:ee=()=>{},autoPlay:ye=!1,onPlayEnded:Le=()=>{},isShowWaterMark:Te=!0},$e)=>{var J;H=H==null?void 0:H.replace("http://","https://");const F=((J=H==null?void 0:H.split("."))==null?void 0:J.pop())==="flv",M=(0,U.useRef)(),oe=(0,U.useRef)(),te=(0,U.useRef)(),S=(0,U.useRef)(),v=(0,U.useRef)(),Y=(0,U.useRef)(),ae=(0,U.useRef)(),xe=(0,U.useRef)(),Fe=(0,U.useRef)(),Xe=(0,U.useRef)(),yt=(0,U.useRef)(),$t=(0,U.useRef)(),ti=(0,U.useRef)(),je=(0,U.useRef)(),mt=navigator.userAgent.toLowerCase().match(E),Wt=mt?mt[0]:"pc",ht=(0,U.useRef)(!1),li=(0,p.eY)();let Ge=0,ve=0,we=0,se=null,Re=!1,Oe=20,ie=1,C=!1,O=!1,Q=[];(0,U.useImperativeHandle)($e,()=>({getLastUpdatedTime:()=>M.current.currentTime,getDuration:()=>M.current.duration})),de.ZP.config({maxCount:1,getContainer:()=>te.current});const z=(0,U.useCallback)((We,He=!1)=>{let Be={point:M.current.currentTime};se?(Be.log_id=se,Be.watch_duration=_(Q),Be.total_duration=ve):(w?(Be.video_id=parseInt(L,10),Be.course_id=w):Be.video_id=L,Be.duration=Ge,Be.device=Wt),He&&(Be.ed="1");function Ke(){return X(this,null,function*(){C=!0,se=yield I==null?void 0:I(Be),C=!1,We&&We()})}Ke()},[L,w]);(0,U.useEffect)(()=>{M.current&&(S.current.style.display="none",v.current.style.display="block"),de.ZP.destroy();let We=null;return he.Z.isSupported&&F&&H&&(H==null?void 0:H.indexOf(".m3u8"))<0?(We=he.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:H,muted:!1}),M.current&&(We.attachMediaElement(M.current),We.load())):M.current.setAttribute("src",H),Z(),()=>{We&&(We.unload(),We.pause(),We.destroy(),We=null)}},[M,F,H]);function N(){M.current.paused?(S.current.style.display="none",v.current.style.display="block"):(S.current.style.display="block",v.current.style.display="none")}function Z(){yt.current.style.display="none",ti.current.style.display="none",$t.current.style.display="none",M.current.muted||M.current.volume===0?yt.current.style.display="block":M.current.volume>0&&M.current.volume<=.5?ti.current.style.display="block":$t.current.style.display="block"}(0,U.useEffect)(()=>{const We=document.getElementById("play"),He=document.querySelectorAll(".playback-icons use");function Be(){ne(),R&&!ht.current&&(M.current.currentTime=R),ht.current=!0,Q.push(M.current.currentTime),Re||(Re=!0,V&&z())}function Ke(){return X(this,null,function*(){N(),Q.push(M.current.currentTime),V&&z(()=>{se=null,we=0,Re=!1,C=!1,O=!1,Q=[],ve=0,ie=1},!0),Le()})}function lt(){Y.current.value=Math.round(M.current.currentTime),ae.current.value=Math.round(M.current.currentTime)}function Ie(){const ft=P(Math.round(M.current.currentTime));Fe.current.innerText=`${ft.hour>0?ft.hour+":":""}${ft.minutes}:${ft.seconds}`,Fe.current.setAttribute("datetime",`${ft.hour>0?" "+ft.hour+" ":""}${ft.minutes}m ${ft.seconds}s`)}function et(){var ft,gt,Ht,pt,dt,vt,Bt;const ai=Math.round((ft=M.current)==null?void 0:ft.duration);(Ht=(gt=Y.current)==null?void 0:gt.setAttribute)==null||Ht.call(gt,"max",ai),(dt=(pt=ae.current)==null?void 0:pt.setAttribute)==null||dt.call(pt,"max",ai);const xt=P(ai);xe.current&&(xe.current.innerText=`${xt.hour>0?xt.hour+":":""}${xt.minutes}:${xt.seconds}`,(Bt=(vt=xe.current).setAttribute)==null||Bt.call(vt,"datetime",`${xt.hour>0?" "+xt.hour+" ":""}${xt.minutes}m ${xt.seconds}s`))}function Kt(){try{const ft=Math.round(M.current.duration);Y.current.setAttribute("max",ft),ae.current.setAttribute("max",ft);const gt=P(ft);xe.current.innerText=`${gt.hour>0?gt.hour+":":""}${gt.minutes}:${gt.seconds}`,xe.current.setAttribute("datetime",`${gt.hour>0?" "+gt.hour+" ":""}${gt.minutes}m ${gt.seconds}s`),lt(),Ie();const{width:Ht,height:pt,x:dt,y:vt}=oe.current.getBoundingClientRect();if(dt<0||vt<0,!O){let Bt=M.current.currentTime,ai=Bt-we;Math.abs(ai)<10?(ve+=Math.abs(ai),we=Bt,C||ve-ie*Oe>=0&&(ie++,Q.push(we),V&&z())):(we=Bt,V&&z())}}catch(ft){console.log("videoplaying:",ft)}}function bt(){O=!0}function Mt(){M.current.playing&&Q.push(M.current.currentTime,we),we=M.current.currentTime,O=!1}function Zt(){Ge=M.current.duration,Ge<=20&&(Oe=Ge/3),M.current.addEventListener("play",Be)}function ii(ft){ft.preventDefault(),(0,ce.vp)()?(M.current.style.width="100%",M.current.style.height="100%"):M.current.style.cssText=""}function ei(){q()}function Ft(ft){if(!B){de.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const gt=ft.target.dataset.seek?ft.target.dataset.seek:ft.target.value;M.current.currentTime=gt,ae.current.value=gt,Y.current.value=gt}function ri(ft){const gt=Math.round(ft.offsetX/ft.target.clientWidth*parseInt(ft.target.getAttribute("max"),10));Y.current.setAttribute("data-seek",gt);const Ht=P(gt);Xe.current.textContent=`${Ht.hour>0?Ht.hour+":":""}${Ht.minutes}:${Ht.seconds}`;const pt=M.current.getBoundingClientRect();Xe.current.style.left=`${ft.pageX-pt.left}px`}function St(ft){switch(ft.code){case"Space":ft.preventDefault(),_e();break;case"ArrowRight":if(ft.preventDefault(),!B){de.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(M.current.currentTime>=M.current.duration)break;M.current.currentTime=parseInt(M.current.currentTime)+5,lt();break;case"ArrowLeft":if(ft.preventDefault(),!B){de.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(M.current.currentTime===0)break;M.current.currentTime=parseInt(M.current.currentTime)-5,lt();break;case"ArrowUp":ft.preventDefault(),M.current.volume<1&&(M.current.volume=(parseInt(M.current.volume*10)+1)/10);break;case"ArrowDown":ft.preventDefault(),M.current.volume>0&&(M.current.volume=(parseInt(M.current.volume*10)-1)/10);break}}return te.current.addEventListener((0,ce.gH)(),ii),M.current.addEventListener("canplay",Zt),M.current.addEventListener("ended",Ke),M.current.addEventListener("seeking",bt),M.current.addEventListener("seeked",Mt),M.current.addEventListener("loadedmetadata",et),Y.current.addEventListener("mousemove",ri),Y.current.addEventListener("input",Ft),M.current.addEventListener("timeupdate",Kt),M.current.addEventListener("pause",ei),M.current.addEventListener("volumechange",Z),document.addEventListener("keydown",St),()=>{var ft,gt,Ht,pt,dt,vt,Bt,ai,xt,Xt,Lt,Ne;(ft=M.current)==null||ft.removeEventListener("canplay",Zt),(gt=M.current)==null||gt.removeEventListener("play",Be),(Ht=M.current)==null||Ht.removeEventListener("ended",Ke),(pt=M.current)==null||pt.removeEventListener("seeking",bt),(dt=M.current)==null||dt.removeEventListener("seeked",Mt),(vt=Y.current)==null||vt.removeEventListener("mousemove",ri),(Bt=Y.current)==null||Bt.removeEventListener("input",Ft),(ai=M.current)==null||ai.removeEventListener("timeupdate",Kt),(xt=M.current)==null||xt.removeEventListener("pause",ei),(Xt=M.current)==null||Xt.removeEventListener("loadedmetadata",et),(Lt=M.current)==null||Lt.removeEventListener("volumechange",Z),document.removeEventListener("keydown",St),(Ne=M.current)!=null&&Ne.playing&&(Q.push(we,M.current.currentTime),V&&z())}},[M,H]),(0,U.useEffect)(()=>{if(M.current.onended=()=>{ee(M)},M.current.oncontextmenu=()=>!1,(H==null?void 0:H.indexOf(".m3u8"))>-1){if(M.current.canPlayType("application/vnd.apple.mpegurl"))M.current.src=H;else if(j.ZP.isSupported()){var We=new j.ZP;We.loadSource(H),We.attachMedia(M.current)}}},[H]);const[re,le]=(0,U.useState)(1),_e=()=>{M.current.paused||M.current.ended?M.current.play():M.current.pause(),N()};function Ae(){M.current.muted=!M.current.muted,M.current.muted?(je.current.setAttribute("data-volume",volume.value),je.current.value=0):je.current.value=je.current.dataset.volume}return U.createElement("div",{style:{position:"relative"},ref:te},U.createElement("div",{ref:oe,className:`${l.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${l.animate__loop}`},Te&&li?li.login:" "),U.createElement("div",{className:l.container},U.createElement("div",{className:l["video-container"],id:"video-container"},U.createElement("div",{className:l["playback-animation"],id:"playback-animation"},U.createElement("svg",{className:l["playback-icons"]},U.createElement("use",{className:"hidden",href:"#play-icon"}),U.createElement("use",{href:"#pause"}))),U.createElement("video",{className:l.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:M,autoPlay:ye}),U.createElement("div",{className:`${l["video-controls"]} `,id:"video-controls"},U.createElement("div",{className:l["bottom-controls"]},U.createElement("div",{className:l["left-controls"]},U.createElement("button",{"data-title":"\u64AD\u653E/\u6682\u505C",id:"play",onClick:_e},U.createElement("svg",{className:l["playback-icons"]},U.createElement("use",{ref:v,href:"#play-icon"}),U.createElement("use",{ref:S,style:{display:"none"},href:"#pause"}))),U.createElement("div",{className:l.time},U.createElement("time",{id:"time-elapsed",ref:Fe},"00:00"),U.createElement("span",null," / "),U.createElement("time",{id:"duration",ref:xe},"00:00"))),U.createElement("div",{className:l["right-controls"]},B&&U.createElement(Se.Z,{placement:"top",overlayClassName:l.rateOverlay,getPopupContainer:We=>We.parentNode,menu:{items:[{key:"1",label:U.createElement("span",{onClick:()=>{le(1),M.current.playbackRate=1}},"1.0x")},{key:"2",label:U.createElement("span",{onClick:()=>{le(1.5),M.current.playbackRate=1.5}},"1.5x")},{key:"3",label:U.createElement("span",{onClick:()=>{le(2),M.current.playbackRate=2}},"2.0x")}]}},U.createElement("div",{className:`${l.controlText} mr5`},"\u500D\u901F")),U.createElement(me.CopyToClipboard,{text:H,onCopy:()=>de.ZP.success("\u590D\u5236\u6210\u529F")},U.createElement("button",{"data-title":"\u590D\u5236\u94FE\u63A5"},U.createElement("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}}))),U.createElement("div",{className:l["volume-controls"]},U.createElement("button",{"data-title":"\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",className:l["volume-button"],id:"volume-button",onClick:Ae},U.createElement("i",{ref:yt,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),U.createElement("i",{ref:ti,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),U.createElement("i",{ref:$t,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})),U.createElement("input",{className:l.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:je,style:{display:"none"},onClick:Z})),U.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)}},U.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),U.createElement("div",{className:l["video-progress"]},U.createElement("progress",{ref:ae,value:"0",min:"0"}),U.createElement("input",{className:l.seek,ref:Y,value:"0",min:"0",type:"range",step:"1"}),U.createElement("div",{className:l["seek-tooltip"],ref:Xe,id:"seek-tooltip"},"00:00"))))),U.createElement("svg",{style:{display:"none"}},U.createElement("defs",null,U.createElement("symbol",{id:"pause",viewBox:"0 0 24 24"},U.createElement("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})),U.createElement("symbol",{id:"play-icon",viewBox:"0 0 24 24"},U.createElement("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})),U.createElement("symbol",{id:"volume-high",viewBox:"0 0 24 24"},U.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"})),U.createElement("symbol",{id:"volume-low",viewBox:"0 0 24 24"},U.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"})),U.createElement("symbol",{id:"volume-mute",viewBox:"0 0 24 24"},U.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"})),U.createElement("symbol",{id:"fullscreen",viewBox:"0 0 24 24"},U.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"})),U.createElement("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24"},U.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"})),U.createElement("symbol",{id:"pip",viewBox:"0 0 24 24"},U.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"})))))})},89081:function(Yt,st,K){"use strict";K.d(st,{SV:function(){return ie},ZP:function(){return Oe}});var U=K(59301),de=K(76374);const Se={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},he={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},j={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"if",content:["if () {"," $0","}"].join(`
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"include <vector>",content:["#include <vector>"].join(`
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
`)},{label:"include <map>",content:["#include <map>"].join(`
`)},{label:"include <string>",content:["#include <string>"].join(`
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
`)}]},p={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},me={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join(`
`)}]};var ce=K(53184),l=K.n(ce),X=Object.defineProperty,P=Object.defineProperties,g=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,B=(C,O,Q)=>O in C?X(C,O,{enumerable:!0,configurable:!0,writable:!0,value:Q}):C[O]=Q,H=(C,O)=>{for(var Q in O||(O={}))E.call(O,Q)&&B(C,Q,O[Q]);if(_)for(var Q of _(O))A.call(O,Q)&&B(C,Q,O[Q]);return C},V=(C,O)=>P(C,g(O)),L=(C,O,Q)=>new Promise((z,N)=>{var Z=_e=>{try{le(Q.next(_e))}catch(Ae){N(Ae)}},re=_e=>{try{le(Q.throw(_e))}catch(Ae){N(Ae)}},le=_e=>_e.done?z(_e.value):Promise.resolve(_e.value).then(Z,re);le((Q=Q.apply(C,O)).next())});const I={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},w=(C,O)=>O.map(Q=>({label:Q,kind:C.languages.CompletionItemKind.Keyword,insertText:Q})),R=C=>Object.keys(I.tables).map(O=>({label:O,kind:C.languages.CompletionItemKind.Variable,insertText:O})),q=(C,O)=>{const Q=I.tables[C];return Q?Q.map(z=>({label:z,kind:O.languages.CompletionItemKind.Field,insertText:z})):[]};function ne(C,O,Q,z,N){let Z=O.getWordUntilPosition(Q),re={startLineNumber:Q.lineNumber,endLineNumber:Q.lineNumber,startColumn:Z.startColumn,endColumn:Z.endColumn},le=z.map(_e=>({label:_e,kind:C.languages.CompletionItemKind.Keyword,insertText:_e,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}));return N.map(_e=>{le.push(V(H({},_e),{range:re}))}),le}var ee=C=>{I.languages.map(N=>(C.languages.registerDocumentFormattingEditProvider(N,{provideDocumentFormattingEdits(Z,re,le){return L(this,null,function*(){const _e=l()(Z.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:Z.getFullModelRange(),text:_e}]})}}),N));const O=j.quickKey.map(N=>({label:N.label,kind:C.languages.CompletionItemKind.Method,insertText:N.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet})),Q=p.quickKey.map(N=>({label:N.label,kind:C.languages.CompletionItemKind.Method,insertText:N.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet})),z=he.quickKey.map(N=>({label:N.label,kind:C.languages.CompletionItemKind.Method,insertText:N.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}));C.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(N,Z){var re=N.getWordUntilPosition(Z),le={startLineNumber:Z.lineNumber,endLineNumber:Z.lineNumber,startColumn:re.startColumn,endColumn:re.endColumn},_e=N.getLineContent(Z.lineNumber).substring(re.startColumn-2,re.endColumn);return{suggestions:[...j.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le})),...j.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:_e.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le}))]}}}),C.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(N,Z){var re=N.getWordUntilPosition(Z),le={startLineNumber:Z.lineNumber,endLineNumber:Z.lineNumber,startColumn:re.startColumn,endColumn:re.endColumn};return{suggestions:[...Se.keywords.map(_e=>({label:_e,kind:C.languages.CompletionItemKind.Function,documentation:_e,insertText:_e,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le}))]}}}),C.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(N,Z){var re=N.getWordUntilPosition(Z),le={startLineNumber:Z.lineNumber,endLineNumber:Z.lineNumber,startColumn:re.startColumn,endColumn:re.endColumn},_e=N.getLineContent(Z.lineNumber).substring(re.startColumn-2,re.endColumn);return{suggestions:[...he.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le})),...he.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:_e.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le}))]}}}),C.languages.registerCompletionItemProvider("scala",{provideCompletionItems:function(N,Z){var re=N.getWordUntilPosition(Z),le={startLineNumber:Z.lineNumber,endLineNumber:Z.lineNumber,startColumn:re.startColumn,endColumn:re.endColumn},_e=N.getLineContent(Z.lineNumber).substring(re.startColumn-2,re.endColumn);return{suggestions:[...me.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le})),...me.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:_e.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le}))]}}}),C.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(N,Z){var re=N.getWordUntilPosition(Z),le={startLineNumber:Z.lineNumber,endLineNumber:Z.lineNumber,startColumn:re.startColumn,endColumn:re.endColumn},_e=N.getLineContent(Z.lineNumber).substring(re.startColumn-2,re.endColumn);return{suggestions:[...p.keywords.map(Ae=>({label:Ae,kind:C.languages.CompletionItemKind.Function,documentation:Ae,insertText:Ae,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le})),...p.quickKey.map(Ae=>({label:Ae.label,kind:C.languages.CompletionItemKind.Function,documentation:Ae.content,insertText:_e.startsWith("#")?Ae.content.replace(/#/,""):Ae.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le}))]}}})};const ye="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var Le=Object.defineProperty,Te=(C,O,Q)=>O in C?Le(C,O,{enumerable:!0,configurable:!0,writable:!0,value:Q}):C[O]=Q,$e=(C,O,Q)=>Te(C,typeof O!="symbol"?O+"":O,Q);const J=class qo{constructor(O,Q,z){this.placeholder=O,this.editor=Q,this.monaco=z,Q.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return qo.ID}getDomNode(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}dispose(){this.editor.removeContentWidget(this)}};$e(J,"ID","editor.widget.placeholderHint");var F=J,M=K(96236),oe=K(6767),te=K(25399),S=K(89392),v=K(16448),Y=K(56102),ae=Object.defineProperty,xe=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,Xe=Object.getOwnPropertySymbols,yt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable,ti=(C,O,Q)=>O in C?ae(C,O,{enumerable:!0,configurable:!0,writable:!0,value:Q}):C[O]=Q,je=(C,O)=>{for(var Q in O||(O={}))yt.call(O,Q)&&ti(C,Q,O[Q]);if(Xe)for(var Q of Xe(O))$t.call(O,Q)&&ti(C,Q,O[Q]);return C},mt=(C,O)=>xe(C,Fe(O)),Wt=(C,O)=>{var Q={};for(var z in C)yt.call(C,z)&&O.indexOf(z)<0&&(Q[z]=C[z]);if(C!=null&&Xe)for(var z of Xe(C))O.indexOf(z)<0&&$t.call(C,z)&&(Q[z]=C[z]);return Q},ht=(C,O,Q)=>new Promise((z,N)=>{var Z=_e=>{try{le(Q.next(_e))}catch(Ae){N(Ae)}},re=_e=>{try{le(Q.throw(_e))}catch(Ae){N(Ae)}},le=_e=>_e.done?z(_e.value):Promise.resolve(_e.value).then(Z,re);le((Q=Q.apply(C,O)).next())});function li(C){return/^\d+$/.test(C)?`${C}px`:C}function Ge(){}let ve=!1;const we={"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 se(C=[]){let O=C;if(Array.isArray(C)){for(let Q=0;Q<C.length;Q++){let z=we[C[Q]];if(z)return z}return O[0]}return we[O]||O}let Re=null;var Oe=C=>{var O=C,{width:Q="100%",height:z="100%",value:N,language:Z="javascript",style:re={},options:le={},overrideServices:_e={},theme:Ae="vs-dark",onEditBlur:We,isCopy:He=!1,onSave:Be,autoHeight:Ke=!1,forbidCopy:lt=!1,onChange:Ie=Ge,editorDidMount:et=Ge,onFocus:Kt=Ge,onBreakPoint:bt=Ge,breakPointValue:Mt=[],filename:Zt="educoder.txt",errorLine:ii,errorContent:ei="",highlightLine:Ft,openBreakPoint:ri=!1,placeholder:St="",showMiniMap:ft=!0}=O,gt=Wt(O,["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 Ht=(0,U.useRef)(),pt=(0,U.useRef)({}),dt=(0,U.useRef)(),vt=(0,U.useRef)(),Bt=(0,U.useRef)([]),ai=(0,U.useRef)(!1),xt=(0,U.useRef)(),Xt=(0,U.useRef)(),Lt=(0,U.useRef)(!1),[Ne,h]=(0,U.useState)(!1);function m(){let ze;return Ht.current&&(ze=new de.Z(Ve=>{for(let at of Ve)(at.target.offsetHeight>0||at.target.offsetWidth>0)&&pt.current.instance.layout()}),ze.observe(Ht.current)),ze}function y(){oe.ZP.warning({content:decodeURIComponent(ye),key:"monaco-editor-tip"})}const k=()=>{let ze=pt.current.instance;if(N!=null&&ze&&Ne){const Ve=ze.getModel();Ve&&N!==Ve.getValue()&&(ve=!0,Ve.setValue(N),ze.layout(),ve=!1)}};(0,U.useEffect)(()=>{const ze=v.Z.subscribe("formatDocument",Ve=>{var at;let Vt=pt.current.instance;(at=Vt==null?void 0:Vt.getAction)==null||at.call(Vt,"editor.action.formatDocument").run()});return window.updateMonacoValue=Ve=>{Ie(Ve)},ze},[]),(0,U.useEffect)(()=>{var ze;let Ve=pt.current.instance;vt.current&&clearTimeout(vt.current),vt.current=setTimeout(()=>{k()},500),N&&(N!=null&&N.length)&&((ze=Ve==null?void 0:Ve.updateOptions)==null||ze.call(Ve,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(N.split(/\r\n|\r|\n/g).length))+3,5)}))},[N,Ne,pt.current]),(0,U.useEffect)(()=>{if(ii&&pt.current&&pt.current.instance){let Ve=pt.current.instance;Ve.changeViewZones(function(at){var Vt=document.createElement("div");Vt.style.padding="10px 20px",Vt.style.width="calc(100% - 20px)",Vt.className="my-error-line-wrp",Vt.innerHTML=ei,at.addZone({afterLineNumber:ii||11,heightInLines:3,domNode:Vt})});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}};Ve.addOverlayWidget(ze),Ve.revealPositionInCenter({lineNumber:20,column:1})}},[ii,pt.current,Ne]);const W=(ze="",Ve)=>{if(!ze||ze.trim()==="")return!0;const Vt=pt.current.instance.getModel().getLineTokens(Ve);let Ct=!1;for(let pi=0;pi<2;pi++)Vt.getStandardTokenType(pi)===1&&(Ct=!0);return Ct};(0,U.useEffect)(()=>{var ze;const Ve=(ze=pt.current)==null?void 0:ze.instance;if(Ve&&Ne&&lt){const at=Ve.onDidBlurEditorWidget(()=>{Lt.current=!1}),Vt=Ve.onDidFocusEditorText(()=>{Lt.current=!0});return()=>{at.dispose(),Vt.dispose()}}},[pt.current,Ne,lt]),(0,U.useEffect)(()=>{var ze;if((ze=pt.current)!=null&&ze.instance&&Ne&&ri){let Ve=pt.current.instance,at=Ve.getModel();if(!at)return;(()=>{var Qe;let ct=[],Et=[];const ni=at.getAllDecorations();for(let Qt of ni)Qt.options.className==="highlighted-line"&&(ct.push((Qe=Qt==null?void 0:Qt.range)==null?void 0:Qe.startLineNumber),Et.push(Qt==null?void 0:Qt.id));if(Ft===ct[0])return;at.deltaDecorations(Et,[]);const Ot=at.getLineCount();Ft&&Ft<=Ot&&(Ve.deltaDecorations([],[{range:new Re.Range(Ft,1,Ft,at.getLineMaxColumn(Ft)),options:{isWholeLine:!0,className:"highlighted-line"}}]),Ve.revealLineInCenter(Ft))})();const Ct=(Qe=!1)=>{var ct;let Et=[],ni=[];const Ot=at.getAllDecorations();for(let Qt of Ot)Qt.options.linesDecorationsClassName==="breakpoints-select"&&(Et.push((ct=Qt==null?void 0:Qt.range)==null?void 0:ct.startLineNumber),ni.push(Qt==null?void 0:Qt.id));if(Qe)return{lines:Et,ids:ni};bt(Et)},pi=Qe=>ht(void 0,null,function*(){let ct={range:new Re.Range(Qe,1,Qe,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield at.deltaDecorations([],[ct]),Ct()}),Dt=Qe=>ht(void 0,null,function*(){let ct=[];const Et=Ve.getLineDecorations(Qe);for(let ni of Et)ni.options.linesDecorationsClassName==="breakpoints-select"&&ct.push(ni.id);yield at.deltaDecorations(ct,[]),Ct()}),Rt=Qe=>{let ct=Ve.getLineDecorations(Qe);for(let Et of ct)if(Et.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,S.isEqual)(Mt,Ct(!0).lines)){at.deltaDecorations(Ct(!0).ids,[]);const Qe=Mt.map(ct=>({range:new Re.Range(ct,1,ct,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));at.deltaDecorations([],Qe)}const Nt=Ve.onDidChangeModelContent(Qe=>{let ct=Ve.getPosition();if(ct){let Et=ct.lineNumber;clearTimeout(Xt.current),Xt.current=setTimeout(()=>{W(at.getLineContent(Et),Et)?Dt(Et):Rt(Et)?(Dt(Et),pi(Et)):Ct()},100)}}),Ee=Ve.onMouseDown(Qe=>{var ct,Et,ni;if(Qe.target.detail&&((ni=(Et=(ct=Qe.target)==null?void 0:ct.element)==null?void 0:Et.className)!=null&&ni.includes("line-numbers"))){let Ot=Qe.target.position.lineNumber;if(W(at.getLineContent(Ot),Ot))return;Rt(Ot)?Dt(Ot):pi(Ot)}}),De=Qe=>{let ct={range:new Re.Range(Qe,1,Qe,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Bt.current=Ve.deltaDecorations(Bt.current,[ct])},qe=()=>{Bt.current=Ve.deltaDecorations(Bt.current,[])},Ye=Ve.onMouseMove(Qe=>{var ct,Et,ni;if(qe(),Qe.target.detail&&((ni=(Et=(ct=Qe.target)==null?void 0:ct.element)==null?void 0:Et.className)!=null&&ni.includes("line-numbers"))){let Ot=Qe.target.position.lineNumber;if(W(at.getLineContent(Ot),Ot))return;De(Ot)}}),ot=Ve.onMouseLeave(()=>{qe()});return()=>{Nt.dispose(),Ee.dispose(),Ye.dispose(),ot.dispose()}}},[pt.current,Ne,Mt,Ft,ri,Z]),(0,U.useEffect)(()=>{var ze;(ze=pt.current)!=null&&ze.instance&&ri&&pt.current.instance.setPosition({lineNumber:0,column:0})},[Ft]);function pe(){let ze=pt.current.instance;if(ze){const Ve=ze.getSelection(),at=pt.current.pastePos||{},Vt=new Re.Range(at.startLineNumber||Ve.endLineNumber,at.startColumn||Ve.endColumn,at.endLineNumber||Ve.endLineNumber,at.endColumn||Ve.endColumn);setTimeout(()=>{ze.executeEdits("",[{range:Vt,text:""}])},300)}}function be(ze){(window.navigator.platform.match("Mac")?ze.metaKey:ze.ctrlKey)&&ze.keyCode==83&&(ze.preventDefault(),Be())}const rt=()=>{if(Ke&&pt.current.instance){const ze=pt.current.instance.getContentHeight();Pt(ze<z?z:ze)}else Pt(z)};function ut(ze){var Ve=document.createEvent("MouseEvents");Ve.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ze.dispatchEvent(Ve)}const _t=ze=>{if(!Lt.current)return;const{keyCode:Ve,ctrlKey:at,metaKey:Vt,target:Ct,type:pi}=ze;return(pi==="paste"||(Ve===67||Ve===86)&&(Vt||at))&&Ct.nodeName==="TEXTAREA"&&(y(),ze.preventDefault()),!1};function Ut(ze,Ve){var at=window.URL||window.webkitURL||window,Vt=new Blob([Ve]),Ct=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ct.href=at.createObjectURL(Vt),Ct.download=ze,ut(Ct)}(0,U.useEffect)(()=>{rt()},[rt]),(0,U.useEffect)(()=>{Ht.current&&!Ne&&Promise.all([K.e(8909),K.e(7960)]).then(K.bind(K,71448)).then(ze=>{try{Re=ze,pt.current.instance=Re.editor.create(Ht.current,{value:N,language:se(Z),theme:Ae,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:ft||!1}},_e);const Ve=pt.current.instance;let Ct=[...M.BH._menuItems].find(Nt=>Nt[0]._debugName=="EditorContext")[1],pi=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],Dt=(Nt,Ee)=>{var De,qe;let Ye=Nt._first;do Ee.includes((qe=(De=Ye.element)==null?void 0:De.command)==null?void 0:qe.id)&&Nt._remove(Ye);while(Ye=Ye.next)};if(et(Ve,Re),setTimeout(()=>{rt(),pt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Ut(Zt||"educoder.txt",Ve.getValue())}})},500),pt.current.subscription=Ve.onDidChangeModelContent(Nt=>{ai.current?clearTimeout(xt.current):(rt(),Ie(Ve.getValue(),Nt)),xt.current=setTimeout(()=>{ai.current=!1},500)}),window.Monaco||ee(Re,se(Z)),lt&&(Dt(Ct,pi),Ht.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",_t),window.removeEventListener("paste",_t),window.addEventListener("keydown",_t),window.addEventListener("paste",_t)),window.Monaco=Re,We&&Ve.onDidBlurEditorWidget(()=>{We(Ve.getValue())}),Kt&&Ve.onDidFocusEditorText(()=>{Kt(Ve.getValue())}),lt)try{Ve.onDidPaste(Nt=>{const Ee=Ve.getSelection(),De=pt.current.pastePos||{},qe=new Re.Range(De.startLineNumber||Ee.endLineNumber,De.startColumn||Ee.endColumn,De.endLineNumber||Ee.endLineNumber,De.endColumn||Ee.endColumn);Ve.executeEdits("",[{range:Nt.range,text:""}])})}catch(Nt){}let Rt=m();return St&&typeof St=="string"&&new F(St,Ve,Re),h(!0),()=>{const Nt=pt.current.instance;Nt.dispose();const Ee=Nt.getModel();Ee&&Ee.dispose(),pt.current.subscription&&pt.current.subscription.dispose(),Rt.unobserve(Ht.current)}}catch(Ve){}})},[]),(0,U.useEffect)(()=>{if(pt.current.instance&&Ne)return document.addEventListener("keydown",be,!1),()=>{document.removeEventListener("keydown",be)}},[Be,Ne]),(0,U.useEffect)(()=>{let ze=pt.current.instance;if(ze&&Ne){let Ve=se(Z);Re.editor.setModelLanguage(ze.getModel(),Ve)}},[Z,Ne]),(0,U.useEffect)(()=>{pt.current.instance&&Ne&&Re.editor.setTheme(Ae)},[Ae,Ne]),(0,U.useEffect)(()=>{let ze=pt.current.instance;dt.current=le,ze&&Ne&&(ze.updateOptions(je({},le)),setTimeout(()=>{ze.getModel().updateOptions(je({},le))},200))},[JSON.stringify(le),Ne]),(0,U.useEffect)(()=>{let ze=pt.current.instance;ze&&Ne&&ze.layout()},[Q,z,Ne]);const[zt,Tt]=(0,U.useState)(li(Q)),[Gt,Pt]=(0,U.useState)(li(z)),tt=mt(je({},re),{width:zt,height:Gt,position:"relative"});return U.createElement("div",{className:"my-monaco-editor",ref:Ht,style:tt},He&&U.createElement(Y.CopyToClipboard,{text:N,onCopy:()=>oe.ZP.success("\u590D\u5236\u6210\u529F")},U.createElement(te.Z,{title:"\u590D\u5236\u4EE3\u7801"},U.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},U.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function ie({width:C="100%",height:O="100%",original:Q,modified:z,language:N,options:Z={}}){const re=(0,U.useRef)(),[le,_e]=(0,U.useState)(null);function Ae(Ke){let lt;return re.current&&(lt=new de.Z(Ie=>{for(let et of Ie)(et.target.offsetHeight>0||et.target.offsetWidth>0)&&Ke.layout()}),lt.observe(re.current)),lt}(0,U.useEffect)(()=>(re.current&&Promise.all([K.e(8909),K.e(9404)]).then(K.bind(K,2550)).then(Ke=>{Re=Ke;const lt=Re.editor.createDiffEditor(re.current,mt(je({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},Z),{wordWrap:!0}));_e(lt);let Ie=Ae(lt);return()=>{lt.dispose();const et=lt.getModel();et&&et.dispose(),Ie.unobserve(re.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,U.useEffect)(()=>{le&&le.setModel({original:Re.editor.createModel(Q,N),modified:Re.editor.createModel(z,N)})},[Q,z,N,le]);const We=li(C),He=li(O),Be={width:We,height:He};return U.createElement("div",{className:"my-diff-editor",ref:re,style:Be})}},23206:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return de}});var U=K(59301);function de(Se,he){const j=(0,U.useRef)();(0,U.useEffect)(()=>{j.current=Se}),(0,U.useEffect)(()=>{function p(){j.current()}if(he!==null){let me=setInterval(p,he);return()=>clearInterval(me)}},[he])}},11145:function(Yt,st,K){"use strict";K.r(st),K.d(st,{default:function(){return N},formatQuery:function(){return Q}});var U=K(59301),de=K(71570),Se=K(29787),he={bg:"bg___eq_Aq",container:"container___j770l",widthle:"widthle___ouh1T"},j=K(24334),p=K(42159),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(23206),_=K(14527),E=K(59895),A=K(59301),B=Object.defineProperty,H=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,I=(Z,re,le)=>re in Z?B(Z,re,{enumerable:!0,configurable:!0,writable:!0,value:le}):Z[re]=le,w=(Z,re)=>{for(var le in re||(re={}))V.call(re,le)&&I(Z,le,re[le]);if(H)for(var le of H(re))L.call(re,le)&&I(Z,le,re[le]);return Z},R=(Z,re)=>{var le={};for(var _e in Z)V.call(Z,_e)&&re.indexOf(_e)<0&&(le[_e]=Z[_e]);if(Z!=null&&H)for(var _e of H(Z))re.indexOf(_e)<0&&L.call(Z,_e)&&(le[_e]=Z[_e]);return le},q=(Z,re,le)=>new Promise((_e,Ae)=>{var We=Ke=>{try{Be(le.next(Ke))}catch(lt){Ae(lt)}},He=Ke=>{try{Be(le.throw(Ke))}catch(lt){Ae(lt)}},Be=Ke=>Ke.done?_e(Ke.value):Promise.resolve(Ke.value).then(We,He);Be((le=le.apply(Z,re)).next())});const ne=Z=>{var re=Z,{videoDetail:le,globalSetting:_e,loading:Ae,dispatch:We}=re,He=R(re,["videoDetail","globalSetting","loading","dispatch"]);const{queryParams:Be,selectParams:Ke,videoList:lt}=le,{subject_id:Ie,videoId:et}=Be,{checkBoxValue:Kt,radioValue:bt}=Ke,Mt={videoId:et},Zt={query:Be},ii=(0,U.useRef)(),ei=(0,U.useRef)(),Ft=(0,U.useRef)(),ri=(0,U.useRef)(5),{video_item:St}=le.detail||{};(0,g.Z)(()=>q(void 0,null,function*(){ei.current&&(console.log("videoRef lastUpdatedTime: ",ii.current.getLastUpdatedTime()),console.log(ii.current),yield ft())}),ri.current*1e3);const ft=(xt=!1)=>{const Xt=xt?{is_f:1}:{};return(0,_.DH)(w(w({},Xt),{id:Mt.videoId,point:ii.current.getLastUpdatedTime(),total:ii.current.getDuration()}))},gt=xt=>(xt.ed==="1"&&(ei.current=!1,ft(!0)),!ei.current&&!xt.ed&&(ei.current=!0,ri.current=ii.current.getDuration()<=5?1:5,ft()),We({type:"userDetail/logWatchHistory",payload:xt})),Ht=()=>{ei.current=!1},pt=()=>{ei.current=!0},dt=()=>{Ft.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:Ft.current,onChange:xt=>Ft.current=xt,className:P.modalRating})),onOk:()=>q(void 0,null,function*(){if((yield(0,_.jK)({id:Mt.videoId,star:Ft.current})).status===0){const{course_id:Xt}=(0,E.oP)();We({type:"videoDetail/getVideoDetail",payload:{id:Mt.videoId,videoId:Mt.videoId,course_id:Xt,subject_id:Ie}})}})})},vt=xt=>{const Xt=window.filterVideoSign,Lt=Xt.findIndex(W=>W.id===et);if(Lt===Xt.length-1)return;const h=Xt[Lt+1].id,m=Xt[Lt+1].can_view,y=Xt[Lt+1].link,k=Xt[Lt+1].is_public;if(window.checkBoxValue){if(y){window.open(y);return}if(!m){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:A.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")});return}if(!k){me.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:A.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}We({type:"videoDetail/handleListItemClick",payload:{videoId:h}}),window.videoTimer=setTimeout(()=>{xt.current.play()},2e3)}},Bt=(xt,Xt)=>{if(xt==="checkBox"){const Lt=Xt;window.checkBoxValue=Lt,We({type:"videoDetail/setSelectValue",payload:{radioValue:bt,checkBoxValue:Lt}});return}We({type:"videoDetail/setSelectValue",payload:{checkBoxValue:Kt,radioValue:Xt.target.value}})},ai=()=>lt.findIndex(Lt=>Lt.id===et)===lt.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:Lt=>{Bt("checkBox",Lt)},defaultChecked:Kt,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},St==null?void 0:St.name),!(St!=null&&St.can_edit)&&!(St!=null&&St.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:ii,startTime:St==null?void 0:St.last_point,src:St!=null&&St.is_link?St==null?void 0:St.link:(St==null?void 0:St.play_url)&&j.Base64.decode(St==null?void 0:St.play_url),videoId:St==null?void 0:St.video_id,logWatchHistory:gt,handlePause:Ht,handlePlay:pt,allow_skip:St==null?void 0:St.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:St==null?void 0:St.star,disabled:!0,className:P.rating,style:{color:"#FFA100",fontSize:12,marginLeft:10}}),A.createElement("div",{className:P.fenshu},(St==null?void 0:St.star)||0,"\u5206")),!(St!=null&&St.can_edit)&&!(St!=null&&St.is_public)?null:A.createElement("div",null,A.createElement("div",{className:P.checkBox},ai()))),A.createElement("div",{className:"mt10"},(St==null?void 0:St.description)&&A.createElement("span",{className:P.introName},"\u7B80\u4ECB\uFF1A",St.description))))};var ee=(0,de.connect)(({videoDetail:Z,loading:re,globalSetting:le})=>({videoDetail:Z,globalSetting:le,loading:re}))(ne),ye=K(6767),Le=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"},$e=K(76011),J=K(87527),D=K(12242),F=K(59301),M=Object.defineProperty,oe=Object.defineProperties,te=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,ae=(Z,re,le)=>re in Z?M(Z,re,{enumerable:!0,configurable:!0,writable:!0,value:le}):Z[re]=le,xe=(Z,re)=>{for(var le in re||(re={}))v.call(re,le)&&ae(Z,le,re[le]);if(S)for(var le of S(re))Y.call(re,le)&&ae(Z,le,re[le]);return Z},Fe=(Z,re)=>oe(Z,te(re)),Xe=(Z,re)=>{var le={};for(var _e in Z)v.call(Z,_e)&&re.indexOf(_e)<0&&(le[_e]=Z[_e]);if(Z!=null&&S)for(var _e of S(Z))re.indexOf(_e)<0&&Y.call(Z,_e)&&(le[_e]=Z[_e]);return le},yt=(Z,re,le)=>new Promise((_e,Ae)=>{var We=Ke=>{try{Be(le.next(Ke))}catch(lt){Ae(lt)}},He=Ke=>{try{Be(le.throw(Ke))}catch(lt){Ae(lt)}},Be=Ke=>Ke.done?_e(Ke.value):Promise.resolve(Ke.value).then(We,He);Be((le=le.apply(Z,re)).next())});const $t=[{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)}],ti=Z=>{var re=Z,{dispatch:le,pathsDetail:_e,videoDetail:Ae,user:We}=re,He=Xe(re,["dispatch","pathsDetail","videoDetail","user"]);const{queryParams:Be,stages:Ke,cust_seq:lt,active:Ie}=Ae,{subject_id:et,course_id:Kt}=Be,bt=(0,de.useParams)(),[Mt]=(0,de.useSearchParams)(),[Zt,ii]=(0,U.useState)([]),[ei,Ft]=(0,U.useState)([(Ie==null?void 0:Ie.id)||Number(bt.videoId)]),[ri,St]=(0,U.useState)("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"),ft=[".PDF",".DOC",".DOCX",".XLS",".XLSX",".PPT",".PPTX"];(0,U.useEffect)(()=>{le(et?{type:"videoDetail/getStageData",payload:{subject_id:et,page_type:"video"}}:{type:"videoDetail/getCourseStageData",payload:{coursesId:Kt}})},[]),(0,U.useEffect)(()=>{gt()},[Ae==null?void 0:Ae.stages]);const gt=()=>{let Lt=Zt;Ke.forEach((Ne,h)=>{Lt.push({title:F.createElement("div",{title:Ne.stage_name,className:Te.title},Ne.stage_name),value:Ne==null?void 0:Ne.stage_id,key:Ne==null?void 0:Ne.stage_id,icon:F.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Ht(Ne.items||[])})}),ii(Lt)},Ht=Lt=>{function Ne(h){var m;const y=h.children,k=Array.isArray(y)&&y.length>0,W=h==null?void 0:h.id,{name:pe,item_type:be,id:rt}=h,ut=(m=$t.find(zt=>zt.type===be))==null?void 0:m.bq,_t=Te.brght,Ut=Ie.id===rt?`${_t} ${Te.active}`:_t;return{title:F.createElement("div",{onClick:()=>Bt(h),className:_t,title:pe},ut,F.createElement("div",{className:Te.s3},pe)),value:W,key:W,icon:F.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:k?y==null?void 0:y.map(zt=>Ne(zt)):[]}}return Lt==null?void 0:Lt.map(h=>Ne(h))},pt=(Lt,Ne)=>yt(void 0,null,function*(){le({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF0C\u8BF7\u7A0D\u540E..."}});const h=Ne?yield(0,J.BK)({id:Lt}):yield(0,J.Ir)({id:Lt});if(le({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}}),h!=null&&h.game_identifier||h!=null&&h.identifier){(0,E.xg)(Ne?`/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&&dt(h==null?void 0:h.message)}),dt=Lt=>{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",Lt,"\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")})},vt=Lt=>{Lt=Lt!=null&&Lt.includes(".json")?Lt:`${Lt}.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:()=>yt(void 0,null,function*(){const Ne=yield(0,$e.L8)({url:Lt});if(!Ne)return;ye.ZP.success("\u91CD\u7F6E\u6210\u529F\uFF0C\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF01");const h=yield(0,J.Ir)({id:Ne.shixun_identifier});if(h!=null&&h.game_identifier){(0,E.xg)(`/tasks/${h.game_identifier}`);return}(h==null?void 0:h.status)===2?vt(h==null?void 0:h.message):(h==null?void 0:h.status)===3&&dt(h==null?void 0:h.message)})})},Bt=Lt=>{var Ne,h,m,y,k;if((Lt==null?void 0:Lt.item_type)==="StageCatalog")return;clearTimeout(window.videoTimer);const{id:W,item_type:pe,identifier:be,is_jupyter:rt,url:ut,link:_t}=Lt;if(pe==="VideoItem"&&!_t){if(!((Ne=We.userInfo)!=null&&Ne.admin)&&!((h=We.userInfo)!=null&&h.business)&&!Lt.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}le({type:"videoDetail/handleListItemClick",payload:{videoId:W}}),le({type:"videoDetail/getVideoDetail",payload:Fe(xe({id:W},Be),{videoId:W}),callback:Ut=>{if(Ut&&Ut.video_item&&!Ut.video_item.can_edit&&!Lt.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){Lt.link&&(0,_.DH)({is_f:1,id:Lt.id,point:0,total:0}),window.open(_t);return}if(pe==="Shixun"){pt(be,rt);return}if(pe==="Attachment"){if(_t){(0,E.xg)(_t);return}let Ut=(y=Lt==null?void 0:Lt.name)==null?void 0:y.substr((m=Lt==null?void 0:Lt.name)==null?void 0:m.lastIndexOf("."));if(ft.includes(Ut.toUpperCase())){le({type:"videoDetail/handleListItemClick",payload:{attachmentId:W}});return}else{if(!((k=_e.detail)!=null&&k.allow_download)){ye.ZP.info("\u6559\u5B66\u8BFE\u4EF6\u4E0D\u652F\u6301\u4E0B\u8F7D");return}(0,E.FH)(Lt.name,D.Z.API_SERVER+Lt.url);return}}window.open(D.Z.IMG_SERVER+ut)},ai=Lt=>{let Ne=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],h=["","\u5341","\u767E","\u5343","\u4E07"];Lt=parseInt(Lt);let m=W=>{let pe=W.toString().split("").reverse(),be="";for(var rt=0;rt<pe.length;rt++)be=(rt==0&&pe[rt]==0||rt>0&&pe[rt]==0&&pe[rt-1]==0?"":Ne[pe[rt]]+(pe[rt]==0?h[0]:h[rt]))+be;return be},y=Math.floor(Lt/1e4),k=Lt%1e4;return k.toString().length<4&&(k="0"+k),y?m(y)+"\u4E07"+m(k):m(Lt)},xt=(Lt,Ne,h,m)=>{var y;const{name:k,item_type:W,id:pe}=Lt,be=`${Ne+1}-${h+1}-${m+1}`,rt=(y=$t.find(Ut=>Ut.type===W))==null?void 0:y.icon,ut=Te.brght,_t=Ie.id===pe?`${ut} ${Te.active}`:ut;return F.createElement("div",{key:be,onClick:()=>Bt(Lt),className:_t,style:{paddingLeft:52}},F.createElement("span",{className:Te.s1},rt),!!lt&&F.createElement("span",{className:Te.s2},be),F.createElement("span",{className:Te.s3},"\u203B ",k))},Xt=(Lt,Ne,h)=>{var m;const{name:y,item_type:k,id:W,children:pe}=Lt,be=`${Ne+1}-${h+1}`,rt=(m=$t.find(Ut=>Ut.type===k))==null?void 0:m.icon,ut=Te.brght,_t=Ie.id===W?`${ut} ${Te.active}`:ut;return F.createElement(U.Fragment,{key:be},F.createElement("div",{onClick:()=>Bt(Lt),className:_t},F.createElement("span",{className:Te.s1},rt),!!lt&&F.createElement("span",{className:Te.s2},be),F.createElement("span",{className:Te.s3},"\u203B ",y)),!!pe.length&&pe.map((Ut,zt)=>xt(Ut,Ne,h,zt)))};return F.createElement("aside",{className:Te.list},F.createElement("div",{className:Te.tabs_style},F.createElement("div",{className:Te.tabs_item,onClick:()=>{St("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55")}},"\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55",ri=="\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"&&F.createElement("div",{className:Te.tabs_item_active}))),F.createElement("div",{className:Te.tree_style},(Zt==null?void 0:Zt.length)>0&&F.createElement(Le.default,{selectedKeys:ei,onSelect:(Lt,Ne)=>{Ft([...Lt])},blockNode:!0,treeData:Zt,defaultExpandAll:!0,className:Te.tree_line})))};var je=(0,de.connect)(({user:Z,videoDetail:re,loading:le,globalSetting:_e,pathsDetail:Ae})=>({user:Z,videoDetail:re,globalSetting:_e,loading:le,pathsDetail:Ae}))(ti),mt=K(6311),Wt=K(59301),ht=Object.defineProperty,li=Object.defineProperties,Ge=Object.getOwnPropertyDescriptors,ve=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,Re=(Z,re,le)=>re in Z?ht(Z,re,{enumerable:!0,configurable:!0,writable:!0,value:le}):Z[re]=le,Oe=(Z,re)=>{for(var le in re||(re={}))we.call(re,le)&&Re(Z,le,re[le]);if(ve)for(var le of ve(re))se.call(re,le)&&Re(Z,le,re[le]);return Z},ie=(Z,re)=>li(Z,Ge(re)),C=(Z,re)=>{var le={};for(var _e in Z)we.call(Z,_e)&&re.indexOf(_e)<0&&(le[_e]=Z[_e]);if(Z!=null&&ve)for(var _e of ve(Z))re.indexOf(_e)<0&&se.call(Z,_e)&&(le[_e]=Z[_e]);return le},O=(Z,re,le)=>new Promise((_e,Ae)=>{var We=Ke=>{try{Be(le.next(Ke))}catch(lt){Ae(lt)}},He=Ke=>{try{Be(le.throw(Ke))}catch(lt){Ae(lt)}},Be=Ke=>Ke.done?_e(Ke.value):Promise.resolve(Ke.value).then(We,He);Be((le=le.apply(Z,re)).next())});const Q=Z=>{const{subject_id:re}=Z;return{subject_id:re,course_id:re}},z=Z=>{var re=Z,{videoDetail:le,globalSetting:_e,loading:Ae,pathsDetail:We,dispatch:He}=re,Be=C(re,["videoDetail","globalSetting","loading","pathsDetail","dispatch"]),Ke,lt;const{queryParams:Ie,videoList:et,attachmentList:Kt,active:bt}=le,{subject_id:Mt,videoId:Zt}=Ie,ii={videoId:Zt};(0,U.useEffect)(()=>{if(bt){const{item_type:ri,id:St}=bt;ri==="VideoItem"&&He({type:"videoDetail/getVideoDetail",payload:ie(Oe({},Ie),{id:St})})}},[bt.id]),console.log("---",bt),(0,U.useEffect)(()=>{Mt&&ei()},[]);function ei(){return O(this,null,function*(){const ri=yield He({type:"pathsDetail/getPathsDetail",payload:{id:Mt}})})}(0,U.useEffect)(()=>{var ri,St;(0,E.Dk)((St=(ri=le.detail)==null?void 0:ri.video_item)==null?void 0:St.name)},[le]);let Ft={width:1200};return bt&&bt.item_type==="Attachment"&&bt.content_type==="application/pdf"&&(Ft={width:1250,marginLeft:(document.body.clientWidth-1200)/2}),Wt.createElement(Se.Z,{spinning:!1},Wt.createElement("section",{className:he.bg},Wt.createElement("div",{className:he.container,style:Ft},Wt.createElement(je,null),bt&&bt.item_type==="VideoItem"&&Wt.createElement(ee,null),bt&&bt.item_type==="Attachment"&&bt.content_type==="application/pdf"&&bt.url&&Wt.createElement("div",{className:he.widthle},Wt.createElement(mt.Z,{disabledDownload:!((Ke=We.detail)!=null&&Ke.allow_download),type:"pdf",filename:bt.name,data:D.Z.API_SERVER+bt.url,style:{position:"absolute",zIndex:1}})),bt&&bt.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(bt.content_type)&&bt.url&&Wt.createElement("div",{className:he.widthle},Wt.createElement(mt.Z,{disabledDownload:!((lt=We.detail)!=null&&lt.allow_download),type:"office",data:D.Z.API_SERVER+bt.url,style:{position:"absolute",zIndex:1}})))))};var N=(0,de.connect)(({videoDetail:Z,loading:re,globalSetting:le,pathsDetail:_e})=>({videoDetail:Z,globalSetting:le,loading:re,pathsDetail:_e}))(z)},72890:function(Yt,st,K){"use strict";K.d(st,{BU:function(){return de},Dj:function(){return U},gH:function(){return Se},vp:function(){return he}});function U(j){try{j.mozRequestFullScreen?j.mozRequestFullScreen():j.webkitRequestFullScreen&&j.webkitRequestFullScreen()}catch(p){console.log(p,":e")}}function de(){window.top.document.webkitExitFullscreen?window.top.document.webkitExitFullscreen():document.exitFullscreen?window.top.document.exitFullscreen():document.msExitFullscreen?window.top.document.msExitFullscreen():document.mozCancelFullScreen&&window.top.document.mozCancelFullScreen()}const Se=()=>{if(document.webkitExitFullscreen)return"webkitfullscreenchange";if(document.exitFullscreen)return"fullscreenchange";if(document.msExitFullscreen)return"msfullscreenchange";if(document.mozCancelFullScreen)return"mozfullscreenchange"};function he(){var j=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement,p=document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",j),window.isFullScreen?window.isFullScreen:j!=null}},92841:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return Lt}});class U{static install(){Object.setPrototypeOf=Object.setPrototypeOf||function(h,m){return h.__proto__=m,h},Object.assign=Object.assign||function(h){if(h==null)throw new TypeError("Cannot convert undefined or null to object");let m=Object(h);for(let y=1;y<arguments.length;y++){let k=arguments[y];if(k!=null)for(let W in k)k.hasOwnProperty(W)&&(m[W]=k[W])}return m},typeof self.Promise!="function"&&K(3867).polyfill()}}U.install();var de=U,Se=K(86204),he=K.n(Se);class j{static e(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","error",y),j.ENABLE_ERROR&&(console.error?console.error(y):console.warn?console.warn(y):console.log(y))}static i(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","info",y),j.ENABLE_INFO&&(console.info?console.info(y):console.log(y))}static w(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","warn",y),j.ENABLE_WARN&&(console.warn?console.warn(y):console.log(y))}static d(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","debug",y),j.ENABLE_DEBUG&&(console.debug?console.debug(y):console.log(y))}static v(h,m){(!h||j.FORCE_GLOBAL_TAG)&&(h=j.GLOBAL_TAG);let y=`[${h}] > ${m}`;j.ENABLE_CALLBACK&&j.emitter.emit("log","verbose",y),j.ENABLE_VERBOSE&&console.log(y)}}j.GLOBAL_TAG="flv.js",j.FORCE_GLOBAL_TAG=!1,j.ENABLE_ERROR=!0,j.ENABLE_INFO=!0,j.ENABLE_WARN=!0,j.ENABLE_DEBUG=!0,j.ENABLE_VERBOSE=!0,j.ENABLE_CALLBACK=!1,j.emitter=new(he());var p=j;class me{constructor(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(h){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=h,this._totalBytes+=h):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=h,this._totalBytes+=h):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=h,this._totalBytes+=h,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let h=(this._now()-this._lastCheckpoint)/1e3;return h==0&&(h=1),this._intervalBytes/h/1024}get lastSecondKBps(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}get averageKBps(){let h=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/h/1024}}var ce=me;class l{constructor(h){this._message=h}get name(){return"RuntimeException"}get message(){return this._message}toString(){return this.name+": "+this.message}}class X extends l{constructor(h){super(h)}get name(){return"IllegalStateException"}}class P extends l{constructor(h){super(h)}get name(){return"InvalidArgumentException"}}class g extends l{constructor(h){super(h)}get name(){return"NotImplementedException"}}const _={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},E={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};class A{constructor(h){this._type=h||"undefined",this._status=_.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}destroy(){this._status=_.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}isWorking(){return this._status===_.kConnecting||this._status===_.kBuffering}get type(){return this._type}get status(){return this._status}get needStashBuffer(){return this._needStash}get onContentLengthKnown(){return this._onContentLengthKnown}set onContentLengthKnown(h){this._onContentLengthKnown=h}get onURLRedirect(){return this._onURLRedirect}set onURLRedirect(h){this._onURLRedirect=h}get onDataArrival(){return this._onDataArrival}set onDataArrival(h){this._onDataArrival=h}get onError(){return this._onError}set onError(h){this._onError=h}get onComplete(){return this._onComplete}set onComplete(h){this._onComplete=h}open(h,m){throw new g("Unimplemented abstract function!")}abort(){throw new g("Unimplemented abstract function!")}}let B={};function H(){let Ne=self.navigator.userAgent.toLowerCase(),h=/(edge)\/([\w.]+)/.exec(Ne)||/(opr)[\/]([\w.]+)/.exec(Ne)||/(chrome)[ \/]([\w.]+)/.exec(Ne)||/(iemobile)[\/]([\w.]+)/.exec(Ne)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Ne)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Ne)||/(webkit)[ \/]([\w.]+)/.exec(Ne)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(Ne)||/(msie) ([\w.]+)/.exec(Ne)||Ne.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(Ne)||Ne.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(Ne)||[],m=/(ipad)/.exec(Ne)||/(ipod)/.exec(Ne)||/(windows phone)/.exec(Ne)||/(iphone)/.exec(Ne)||/(kindle)/.exec(Ne)||/(android)/.exec(Ne)||/(windows)/.exec(Ne)||/(mac)/.exec(Ne)||/(linux)/.exec(Ne)||/(cros)/.exec(Ne)||[],y={browser:h[5]||h[3]||h[1]||"",version:h[2]||h[4]||"0",majorVersion:h[4]||h[2]||"0",platform:m[0]||""},k={};if(y.browser){k[y.browser]=!0;let W=y.majorVersion.split(".");k.version={major:parseInt(y.majorVersion,10),string:y.version},W.length>1&&(k.version.minor=parseInt(W[1],10)),W.length>2&&(k.version.build=parseInt(W[2],10))}if(y.platform&&(k[y.platform]=!0),(k.chrome||k.opr||k.safari)&&(k.webkit=!0),k.rv||k.iemobile){k.rv&&delete k.rv;let W="msie";y.browser=W,k[W]=!0}if(k.edge){delete k.edge;let W="msedge";y.browser=W,k[W]=!0}if(k.opr){let W="opera";y.browser=W,k[W]=!0}if(k.safari&&k.android){let W="android";y.browser=W,k[W]=!0}k.name=y.browser,k.platform=y.platform;for(let W in B)B.hasOwnProperty(W)&&delete B[W];Object.assign(B,k)}H();var V=B;class L extends A{static isSupported(){try{let h=V.msedge&&V.version.minor>=15048,m=V.msedge?h:!0;return self.fetch&&self.ReadableStream&&m}catch(h){return!1}}constructor(h,m){super("fetch-stream-loader"),this.TAG="FetchStreamLoader",this._seekHandler=h,this._config=m,this._needStash=!0,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),super.destroy()}open(h,m){this._dataSource=h,this._range=m;let y=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(y=h.redirectedURL);let k=this._seekHandler.getConfig(y,m),W=new self.Headers;if(typeof k.headers=="object"){let be=k.headers;for(let rt in be)be.hasOwnProperty(rt)&&W.append(rt,be[rt])}let pe={method:"GET",headers:W,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(let be in this._config.headers)W.append(be,this._config.headers[be]);h.cors===!1&&(pe.mode="same-origin"),h.withCredentials&&(pe.credentials="include"),h.referrerPolicy&&(pe.referrerPolicy=h.referrerPolicy),this._status=_.kConnecting,self.fetch(k.url,pe).then(be=>{if(this._requestAbort){this._requestAbort=!1,this._status=_.kIdle;return}if(be.ok&&be.status>=200&&be.status<=299){if(be.url!==k.url&&this._onURLRedirect){let ut=this._seekHandler.removeURLParameters(be.url);this._onURLRedirect(ut)}let rt=be.headers.get("Content-Length");return rt!=null&&(this._contentLength=parseInt(rt),this._contentLength!==0&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,be.body.getReader())}else if(this._status=_.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:be.status,msg:be.statusText});else throw new l("FetchStreamLoader: Http code invalid, "+be.status+" "+be.statusText)}).catch(be=>{if(this._status=_.kError,this._onError)this._onError(E.EXCEPTION,{code:-1,msg:be.message});else throw be})}abort(){this._requestAbort=!0}_pump(h){return h.read().then(m=>{if(m.done)if(this._contentLength!==null&&this._receivedLength<this._contentLength){this._status=_.kError;let y=E.EARLY_EOF,k={code:-1,msg:"Fetch stream meet Early-EOF"};if(this._onError)this._onError(y,k);else throw new l(k.msg)}else this._status=_.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1);else{if(this._requestAbort===!0)return this._requestAbort=!1,this._status=_.kComplete,h.cancel();this._status=_.kBuffering;let y=m.value.buffer,k=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength,this._onDataArrival&&this._onDataArrival(y,k,this._receivedLength),this._pump(h)}}).catch(m=>{if(m.code===11&&V.msedge)return;this._status=_.kError;let y=0,k=null;if((m.code===19||m.message==="network error")&&(this._contentLength===null||this._contentLength!==null&&this._receivedLength<this._contentLength)?(y=E.EARLY_EOF,k={code:m.code,msg:"Fetch stream meet Early-EOF"}):(y=E.EXCEPTION,k={code:m.code,msg:m.message}),this._onError)this._onError(y,k);else throw new l(k.msg)})}}var I=L;class w extends A{static isSupported(){try{let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="moz-chunked-arraybuffer",h.responseType==="moz-chunked-arraybuffer"}catch(h){return p.w("MozChunkedLoader",h.message),!1}}constructor(h,m){super("xhr-moz-chunked-loader"),this.TAG="MozChunkedLoader",this._seekHandler=h,this._config=m,this._needStash=!0,this._xhr=null,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),super.destroy()}open(h,m){this._dataSource=h,this._range=m;let y=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(y=h.redirectedURL);let k=this._seekHandler.getConfig(y,m);this._requestURL=k.url;let W=this._xhr=new XMLHttpRequest;if(W.open("GET",k.url,!0),W.responseType="moz-chunked-arraybuffer",W.onreadystatechange=this._onReadyStateChange.bind(this),W.onprogress=this._onProgress.bind(this),W.onloadend=this._onLoadEnd.bind(this),W.onerror=this._onXhrError.bind(this),h.withCredentials&&(W.withCredentials=!0),typeof k.headers=="object"){let pe=k.headers;for(let be in pe)pe.hasOwnProperty(be)&&W.setRequestHeader(be,pe[be])}if(typeof this._config.headers=="object"){let pe=this._config.headers;for(let be in pe)pe.hasOwnProperty(be)&&W.setRequestHeader(be,pe[be])}this._status=_.kConnecting,W.send()}abort(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=_.kComplete}_onReadyStateChange(h){let m=h.target;if(m.readyState===2){if(m.responseURL!=null&&m.responseURL!==this._requestURL&&this._onURLRedirect){let y=this._seekHandler.removeURLParameters(m.responseURL);this._onURLRedirect(y)}if(m.status!==0&&(m.status<200||m.status>299))if(this._status=_.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new l("MozChunkedLoader: Http code invalid, "+m.status+" "+m.statusText);else this._status=_.kBuffering}}_onProgress(h){if(this._status===_.kError)return;this._contentLength===null&&h.total!==null&&h.total!==0&&(this._contentLength=h.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));let m=h.target.response,y=this._range.from+this._receivedLength;this._receivedLength+=m.byteLength,this._onDataArrival&&this._onDataArrival(m,y,this._receivedLength)}_onLoadEnd(h){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===_.kError)return;this._status=_.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)}_onXhrError(h){this._status=_.kError;let m=0,y=null;if(this._contentLength&&h.loaded<this._contentLength?(m=E.EARLY_EOF,y={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(m=E.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new l(y.msg)}}var R=w;class q extends null{static isSupported(){try{if(typeof self.MSStream=="undefined"||typeof self.MSStreamReader=="undefined")return!1;let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="ms-stream",h.responseType==="ms-stream"}catch(h){return Log.w("MSStreamLoader",h.message),!1}}constructor(h,m){super("xhr-msstream-loader"),this.TAG="MSStreamLoader",this._seekHandler=h,this._config=m,this._needStash=!0,this._xhr=null,this._reader=null,this._totalRange=null,this._currentRange=null,this._currentRequestURL=null,this._currentRedirectedURL=null,this._contentLength=null,this._receivedLength=0,this._bufferLimit=16*1024*1024,this._lastTimeBufferSize=0,this._isReconnecting=!1}destroy(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),super.destroy()}open(h,m){this._internalOpen(h,m,!1)}_internalOpen(h,m,y){this._dataSource=h,y?this._currentRange=m:this._totalRange=m;let k=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?k=this._currentRedirectedURL:h.redirectedURL!=null&&(k=h.redirectedURL));let W=this._seekHandler.getConfig(k,m);this._currentRequestURL=W.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",W.url,!0),be.responseType="ms-stream",be.onreadystatechange=this._xhrOnReadyStateChange.bind(this),be.onerror=this._xhrOnError.bind(this),h.withCredentials&&(be.withCredentials=!0),typeof W.headers=="object"){let rt=W.headers;for(let ut in rt)rt.hasOwnProperty(ut)&&be.setRequestHeader(ut,rt[ut])}if(typeof this._config.headers=="object"){let rt=this._config.headers;for(let ut in rt)rt.hasOwnProperty(ut)&&be.setRequestHeader(ut,rt[ut])}this._isReconnecting?this._isReconnecting=!1:this._status=LoaderStatus.kConnecting,be.send()}abort(){this._internalAbort(),this._status=LoaderStatus.kComplete}_internalAbort(){this._reader&&(this._reader.readyState===1&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)}_xhrOnReadyStateChange(h){let m=h.target;if(m.readyState===2)if(m.status>=200&&m.status<=299){if(this._status=LoaderStatus.kBuffering,m.responseURL!=null){let k=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&k!==this._currentRedirectedURL&&(this._currentRedirectedURL=k,this._onURLRedirect&&this._onURLRedirect(k))}let y=m.getResponseHeader("Content-Length");if(y!=null&&this._contentLength==null){let k=parseInt(y);k>0&&(this._contentLength=k,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else if(this._status=LoaderStatus.kError,this._onError)this._onError(LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new RuntimeException("MSStreamLoader: Http code invalid, "+m.status+" "+m.statusText);else if(m.readyState===3&&m.status>=200&&m.status<=299){this._status=LoaderStatus.kBuffering;let y=m.response;this._reader.readAsArrayBuffer(y)}}_xhrOnError(h){this._status=LoaderStatus.kError;let m=LoaderErrors.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type};if(this._onError)this._onError(m,y);else throw new RuntimeException(y.msg)}_msrOnProgress(h){let y=h.target.result;if(y==null){this._doReconnectIfNeeded();return}let k=y.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=y.byteLength;let W=this._totalRange.from+this._receivedLength;this._receivedLength+=k.byteLength,this._onDataArrival&&this._onDataArrival(k,W,this._receivedLength),y.byteLength>=this._bufferLimit&&(Log.v(this.TAG,`MSStream buffer exceeded max size near ${W+k.byteLength}, reconnecting...`),this._doReconnectIfNeeded())}_doReconnectIfNeeded(){if(this._contentLength==null||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();let h={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,h,!0)}}_msrOnLoad(h){this._status=LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}_msrOnError(h){this._status=LoaderStatus.kError;let m=0,y=null;if(this._contentLength&&this._receivedLength<this._contentLength?(m=LoaderErrors.EARLY_EOF,y={code:-1,msg:"MSStream meet Early-Eof"}):(m=LoaderErrors.EARLY_EOF,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new RuntimeException(y.msg)}}var ne=null;class ee extends A{static isSupported(){try{let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="arraybuffer",h.responseType==="arraybuffer"}catch(h){return p.w("RangeLoader",h.message),!1}}constructor(h,m){super("xhr-range-loader"),this.TAG="RangeLoader",this._seekHandler=h,this._config=m,this._needStash=!1,this._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],this._currentChunkSizeKB=384,this._currentSpeedNormalized=0,this._zeroSpeedChunkCount=0,this._xhr=null,this._speedSampler=new ce,this._requestAbort=!1,this._waitForTotalLength=!1,this._totalLengthReceived=!1,this._currentRequestURL=null,this._currentRedirectedURL=null,this._currentRequestRange=null,this._totalLength=null,this._contentLength=null,this._receivedLength=0,this._lastTimeLoaded=0}destroy(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),super.destroy()}get currentSpeed(){return this._speedSampler.lastSecondKBps}open(h,m){this._dataSource=h,this._range=m,this._status=_.kConnecting;let y=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(y=!0,this._totalLength=this._dataSource.filesize),!this._totalLengthReceived&&!y?(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1})):this._openSubRange()}_openSubRange(){let h=this._currentChunkSizeKB*1024,m=this._range.from+this._receivedLength,y=m+h;this._contentLength!=null&&y-this._range.from>=this._contentLength&&(y=this._range.from+this._contentLength-1),this._currentRequestRange={from:m,to:y},this._internalOpen(this._dataSource,this._currentRequestRange)}_internalOpen(h,m){this._lastTimeLoaded=0;let y=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?y=this._currentRedirectedURL:h.redirectedURL!=null&&(y=h.redirectedURL));let k=this._seekHandler.getConfig(y,m);this._currentRequestURL=k.url;let W=this._xhr=new XMLHttpRequest;if(W.open("GET",k.url,!0),W.responseType="arraybuffer",W.onreadystatechange=this._onReadyStateChange.bind(this),W.onprogress=this._onProgress.bind(this),W.onload=this._onLoad.bind(this),W.onerror=this._onXhrError.bind(this),h.withCredentials&&(W.withCredentials=!0),typeof k.headers=="object"){let pe=k.headers;for(let be in pe)pe.hasOwnProperty(be)&&W.setRequestHeader(be,pe[be])}if(typeof this._config.headers=="object"){let pe=this._config.headers;for(let be in pe)pe.hasOwnProperty(be)&&W.setRequestHeader(be,pe[be])}W.send()}abort(){this._requestAbort=!0,this._internalAbort(),this._status=_.kComplete}_internalAbort(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}_onReadyStateChange(h){let m=h.target;if(m.readyState===2){if(m.responseURL!=null){let y=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&y!==this._currentRedirectedURL&&(this._currentRedirectedURL=y,this._onURLRedirect&&this._onURLRedirect(y))}if(m.status>=200&&m.status<=299){if(this._waitForTotalLength)return;this._status=_.kBuffering}else if(this._status=_.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new l("RangeLoader: Http code invalid, "+m.status+" "+m.statusText)}}_onProgress(h){if(this._status===_.kError)return;if(this._contentLength===null){let y=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,y=!0;let k=h.total;this._internalAbort(),k!=null&k!==0&&(this._totalLength=k)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,y){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}let m=h.loaded-this._lastTimeLoaded;this._lastTimeLoaded=h.loaded,this._speedSampler.addBytes(m)}_normalizeSpeed(h){let m=this._chunkSizeKBList,y=m.length-1,k=0,W=0,pe=y;if(h<m[0])return m[0];for(;W<=pe;){if(k=W+Math.floor((pe-W)/2),k===y||h>=m[k]&&h<m[k+1])return m[k];m[k]<h?W=k+1:pe=k-1}}_onLoad(h){if(this._status===_.kError)return;if(this._waitForTotalLength){this._waitForTotalLength=!1;return}this._lastTimeLoaded=0;let m=this._speedSampler.lastSecondKBps;if(m===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(m=this._speedSampler.currentKBps)),m!==0){let pe=this._normalizeSpeed(m);this._currentSpeedNormalized!==pe&&(this._currentSpeedNormalized=pe,this._currentChunkSizeKB=pe)}let y=h.target.response,k=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength;let W=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():W=!0,this._onDataArrival&&this._onDataArrival(y,k,this._receivedLength),W&&(this._status=_.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}_onXhrError(h){this._status=_.kError;let m=0,y=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(m=E.EARLY_EOF,y={code:-1,msg:"RangeLoader meet Early-Eof"}):(m=E.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new l(y.msg)}}var ye=ee;class Le extends A{static isSupported(){try{return typeof self.WebSocket!="undefined"}catch(h){return!1}}constructor(){super("websocket-loader"),this.TAG="WebSocketLoader",this._needStash=!0,this._ws=null,this._requestAbort=!1,this._receivedLength=0}destroy(){this._ws&&this.abort(),super.destroy()}open(h){try{let m=this._ws=new self.WebSocket(h.url);m.binaryType="arraybuffer",m.onopen=this._onWebSocketOpen.bind(this),m.onclose=this._onWebSocketClose.bind(this),m.onmessage=this._onWebSocketMessage.bind(this),m.onerror=this._onWebSocketError.bind(this),this._status=_.kConnecting}catch(m){this._status=_.kError;let y={code:m.code,msg:m.message};if(this._onError)this._onError(E.EXCEPTION,y);else throw new l(y.msg)}}abort(){let h=this._ws;h&&(h.readyState===0||h.readyState===1)&&(this._requestAbort=!0,h.close()),this._ws=null,this._status=_.kComplete}_onWebSocketOpen(h){this._status=_.kBuffering}_onWebSocketClose(h){if(this._requestAbort===!0){this._requestAbort=!1;return}this._status=_.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)}_onWebSocketMessage(h){if(h.data instanceof ArrayBuffer)this._dispatchArrayBuffer(h.data);else if(h.data instanceof Blob){let m=new FileReader;m.onload=()=>{this._dispatchArrayBuffer(m.result)},m.readAsArrayBuffer(h.data)}else{this._status=_.kError;let m={code:-1,msg:"Unsupported WebSocket message type: "+h.data.constructor.name};if(this._onError)this._onError(E.EXCEPTION,m);else throw new l(m.msg)}}_dispatchArrayBuffer(h){let m=h,y=this._receivedLength;this._receivedLength+=m.byteLength,this._onDataArrival&&this._onDataArrival(m,y,this._receivedLength)}_onWebSocketError(h){this._status=_.kError;let m={code:h.code,msg:h.message};if(this._onError)this._onError(E.EXCEPTION,m);else throw new l(m.msg)}}var Te=Le;class $e{constructor(h){this._zeroStart=h||!1}getConfig(h,m){let y={};if(m.from!==0||m.to!==-1){let k;m.to!==-1?k=`bytes=${m.from.toString()}-${m.to.toString()}`:k=`bytes=${m.from.toString()}-`,y.Range=k}else this._zeroStart&&(y.Range="bytes=0-");return{url:h,headers:y}}removeURLParameters(h){return h}}var J=$e;class D{constructor(h,m){this._startName=h,this._endName=m}getConfig(h,m){let y=h;if(m.from!==0||m.to!==-1){let k=!0;y.indexOf("?")===-1&&(y+="?",k=!1),k&&(y+="&"),y+=`${this._startName}=${m.from.toString()}`,m.to!==-1&&(y+=`&${this._endName}=${m.to.toString()}`)}return{url:y,headers:{}}}removeURLParameters(h){let m=h.split("?")[0],y,k=h.indexOf("?");k!==-1&&(y=h.substring(k+1));let W="";if(y!=null&&y.length>0){let pe=y.split("&");for(let be=0;be<pe.length;be++){let rt=pe[be].split("="),ut=be>0;rt[0]!==this._startName&&rt[0]!==this._endName&&(ut&&(W+="&"),W+=pe[be])}}return W.length===0?m:m+"?"+W}}var F=D;class M{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===ye?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(ye.isSupported())this._loaderClass=ye;else throw new l("Your browser doesn't support xhr with arraybuffer responseType!")}_createLoader(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}open(h){this._currentRange={from:0,to:-1},h&&(this._currentRange.from=h),this._speedSampler.reset(),h||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}abort(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}pause(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}resume(){if(this._paused){this._paused=!1;let h=this._resumeFrom;this._resumeFrom=0,this._internalSeek(h,!0)}}seek(h){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(h,!0)}_internalSeek(h,m){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(m),this._loader.destroy(),this._loader=null;let y={from:h,to:-1};this._currentRange={from:y.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,y),this._onSeeked&&this._onSeeked()}updateUrl(h){if(!h||typeof h!="string"||h.length===0)throw new P("Url must be a non-empty string!");this._dataSource.url=h}_expandBuffer(h){let m=this._stashSize;for(;m+1024*1024*1<h;)m*=2;if(m+=1024*1024*1,m===this._bufferSize)return;let y=new ArrayBuffer(m);if(this._stashUsed>0){let k=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(y,0,m).set(k,0)}this._stashBuffer=y,this._bufferSize=m}_normalizeSpeed(h){let m=this._speedNormalizeList,y=m.length-1,k=0,W=0,pe=y;if(h<m[0])return m[0];for(;W<=pe;){if(k=W+Math.floor((pe-W)/2),k===y||h>=m[k]&&h<m[k+1])return m[k];m[k]<h?W=k+1:pe=k-1}}_adjustStashSize(h){let m=0;this._config.isLive||h<512?m=h:h>=512&&h<=1024?m=Math.floor(h*1.5):m=h*2,m>8192&&(m=8192);let y=m*1024+1024*1024*1;this._bufferSize<y&&this._expandBuffer(y),this._stashSize=m*1024}_dispatchChunks(h,m){return this._currentRange.to=m+h.byteLength-1,this._onDataArrival(h,m)}_onURLRedirect(h){this._redirectedURL=h,this._onRedirect&&this._onRedirect(h)}_onContentLengthKnown(h){h&&this._fullRequestFlag&&(this._totalLength=h,this._fullRequestFlag=!1)}_onLoaderChunkArrival(h,m,y){if(!this._onDataArrival)throw new X("IOController: No existing consumer (onDataArrival) callback!");if(this._paused)return;this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(h.byteLength);let k=this._speedSampler.lastSecondKBps;if(k!==0){let W=this._normalizeSpeed(k);this._speedNormalized!==W&&(this._speedNormalized=W,this._adjustStashSize(W))}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 W=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 rt=new Uint8Array(pe,be);W.set(rt,0),this._stashUsed=rt.byteLength,this._stashByteStart+=be}}else this._stashUsed=0,this._stashByteStart+=be;this._stashUsed+h.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+h.byteLength),W=new Uint8Array(this._stashBuffer,0,this._bufferSize)),W.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),W=new Uint8Array(this._stashBuffer,0,this._bufferSize)),W.set(new Uint8Array(h,pe),0),this._stashUsed+=be,this._stashByteStart=m+pe}}}else if(this._stashUsed===0){let W=this._dispatchChunks(h,m);if(W<h.byteLength){let pe=h.byteLength-W;pe>this._bufferSize&&this._expandBuffer(pe),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(h,W),0),this._stashUsed+=pe,this._stashByteStart=m+W}}else{this._stashUsed+h.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+h.byteLength);let W=new Uint8Array(this._stashBuffer,0,this._bufferSize);W.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);W.set(be,0)}this._stashUsed-=pe,this._stashByteStart+=pe}}_flushStashBuffer(h){if(this._stashUsed>0){let m=this._stashBuffer.slice(0,this._stashUsed),y=this._dispatchChunks(m,this._stashByteStart),k=m.byteLength-y;if(y<m.byteLength)if(h)p.w(this.TAG,`${k} bytes unconsumed data remain when flush buffer, dropped`);else{if(y>0){let W=new Uint8Array(this._stashBuffer,0,this._bufferSize),pe=new Uint8Array(m,y);W.set(pe,0),this._stashUsed=pe.byteLength,this._stashByteStart+=y}return 0}return this._stashUsed=0,this._stashByteStart=0,k}return 0}_onLoaderComplete(h,m){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}_onLoaderError(h,m){switch(p.e(this.TAG,`Loader error, code = ${m.code}, msg = ${m.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,h=E.UNRECOVERABLE_EARLY_EOF),h){case E.EARLY_EOF:{if(!this._config.isLive&&this._totalLength){let y=this._currentRange.to+1;y<this._totalLength&&(p.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(y,!1));return}h=E.UNRECOVERABLE_EARLY_EOF;break}case E.UNRECOVERABLE_EARLY_EOF:case E.CONNECTING_TIMEOUT:case E.HTTP_STATUS_CODE_INVALID:case E.EXCEPTION:break}if(this._onError)this._onError(h,m);else throw new l("IOException: "+m.msg)}}var oe=M;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 oe({},S()),m=h.loaderType;return h.destroy(),m=="fetch-stream-loader"||m=="xhr-moz-chunked-loader"}static getNetworkLoaderTypeName(){let h=new oe({},S()),m=h.loaderType;return h.destroy(),m}static supportNativeMediaPlayback(h){v.videoElement==null&&(v.videoElement=window.document.createElement("video"));let m=v.videoElement.canPlayType(h);return m==="probably"||m=="maybe"}static getFeatureList(){let h={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return h.mseFlvPlayback=v.supportMSEH264Playback(),h.networkStreamIO=v.supportNetworkStreamIO(),h.networkLoaderName=v.getNetworkLoaderTypeName(),h.mseLiveFlvPlayback=h.mseFlvPlayback&&h.networkStreamIO,h.nativeMP4H264Playback=v.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),h.nativeWebmVP8Playback=v.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),h.nativeWebmVP9Playback=v.supportNativeMediaPlayback('video/webm; codecs="vp9"'),h}}var Y=v,xe={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"};class Fe{static get forceGlobalTag(){return p.FORCE_GLOBAL_TAG}static set forceGlobalTag(h){p.FORCE_GLOBAL_TAG=h,Fe._notifyChange()}static get globalTag(){return p.GLOBAL_TAG}static set globalTag(h){p.GLOBAL_TAG=h,Fe._notifyChange()}static get enableAll(){return p.ENABLE_VERBOSE&&p.ENABLE_DEBUG&&p.ENABLE_INFO&&p.ENABLE_WARN&&p.ENABLE_ERROR}static set enableAll(h){p.ENABLE_VERBOSE=h,p.ENABLE_DEBUG=h,p.ENABLE_INFO=h,p.ENABLE_WARN=h,p.ENABLE_ERROR=h,Fe._notifyChange()}static get enableDebug(){return p.ENABLE_DEBUG}static set enableDebug(h){p.ENABLE_DEBUG=h,Fe._notifyChange()}static get enableVerbose(){return p.ENABLE_VERBOSE}static set enableVerbose(h){p.ENABLE_VERBOSE=h,Fe._notifyChange()}static get enableInfo(){return p.ENABLE_INFO}static set enableInfo(h){p.ENABLE_INFO=h,Fe._notifyChange()}static get enableWarn(){return p.ENABLE_WARN}static set enableWarn(h){p.ENABLE_WARN=h,Fe._notifyChange()}static get enableError(){return p.ENABLE_ERROR}static set enableError(h){p.ENABLE_ERROR=h,Fe._notifyChange()}static getConfig(){return{globalTag:p.GLOBAL_TAG,forceGlobalTag:p.FORCE_GLOBAL_TAG,enableVerbose:p.ENABLE_VERBOSE,enableDebug:p.ENABLE_DEBUG,enableInfo:p.ENABLE_INFO,enableWarn:p.ENABLE_WARN,enableError:p.ENABLE_ERROR,enableCallback:p.ENABLE_CALLBACK}}static applyConfig(h){p.GLOBAL_TAG=h.globalTag,p.FORCE_GLOBAL_TAG=h.forceGlobalTag,p.ENABLE_VERBOSE=h.enableVerbose,p.ENABLE_DEBUG=h.enableDebug,p.ENABLE_INFO=h.enableInfo,p.ENABLE_WARN=h.enableWarn,p.ENABLE_ERROR=h.enableError,p.ENABLE_CALLBACK=h.enableCallback}static _notifyChange(){let h=Fe.emitter;if(h.listenerCount("change")>0){let m=Fe.getConfig();h.emit("change",m)}}static registerListener(h){Fe.emitter.addListener("change",h)}static removeListener(h){Fe.emitter.removeListener("change",h)}static addLogListener(h){p.emitter.addListener("log",h),p.emitter.listenerCount("log")>0&&(p.ENABLE_CALLBACK=!0,Fe._notifyChange())}static removeLogListener(h){p.emitter.removeListener("log",h),p.emitter.listenerCount("log")===0&&(p.ENABLE_CALLBACK=!1,Fe._notifyChange())}}Fe.emitter=new(he());var Xe=Fe;class yt{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let h=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,m=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&h&&m}isSeekable(){return this.hasKeyframesIndex===!0}getNearestKeyframe(h){if(this.keyframesIndex==null)return null;let m=this.keyframesIndex,y=this._search(m.times,h);return{index:y,milliseconds:m.times[y],fileposition:m.filepositions[y]}}_search(h,m){let y=0,k=h.length-1,W=0,pe=0,be=k;for(m<h[0]&&(y=0,pe=be+1);pe<=be;)if(W=pe+Math.floor((be-pe)/2),W===k||m>=h[W]&&m<h[W+1]){y=W;break}else h[W]<m?pe=W+1:be=W-1;return y}}var $t=yt;function ti(Ne,h,m){let y=Ne;if(h+m<y.length){for(;m--;)if((y[++h]&192)!==128)return!1;return!0}else return!1}function je(Ne){let h=[],m=Ne,y=0,k=Ne.length;for(;y<k;){if(m[y]<128){h.push(String.fromCharCode(m[y])),++y;continue}else if(!(m[y]<192)){if(m[y]<224){if(ti(m,y,1)){let W=(m[y]&31)<<6|m[y+1]&63;if(W>=128){h.push(String.fromCharCode(W&65535)),y+=2;continue}}}else if(m[y]<240){if(ti(m,y,2)){let W=(m[y]&15)<<12|(m[y+1]&63)<<6|m[y+2]&63;if(W>=2048&&(W&63488)!==55296){h.push(String.fromCharCode(W&65535)),y+=3;continue}}}else if(m[y]<248&&ti(m,y,3)){let W=(m[y]&7)<<18|(m[y+1]&63)<<12|(m[y+2]&63)<<6|m[y+3]&63;if(W>65536&&W<1114112){W-=65536,h.push(String.fromCharCode(W>>>10|55296)),h.push(String.fromCharCode(W&1023|56320)),y+=4;continue}}}h.push("\uFFFD"),++y}return h.join("")}var mt=je;let Wt=function(){let Ne=new ArrayBuffer(2);return new DataView(Ne).setInt16(0,256,!0),new Int16Array(Ne)[0]===256}();class ht{static parseScriptData(h,m,y){let k={};try{let W=ht.parseValue(h,m,y),pe=ht.parseValue(h,m+W.size,y-W.size);k[W.data]=pe.data}catch(W){p.e("AMF",W.toString())}return k}static parseObject(h,m,y){if(y<3)throw new X("Data not enough when parse ScriptDataObject");let k=ht.parseString(h,m,y),W=ht.parseValue(h,m+k.size,y-k.size),pe=W.objectEnd;return{data:{name:k.data,value:W.data},size:k.size+W.size,objectEnd:pe}}static parseVariable(h,m,y){return ht.parseObject(h,m,y)}static parseString(h,m,y){if(y<2)throw new X("Data not enough when parse String");let W=new DataView(h,m,y).getUint16(0,!Wt),pe;return W>0?pe=mt(new Uint8Array(h,m+2,W)):pe="",{data:pe,size:2+W}}static parseLongString(h,m,y){if(y<4)throw new X("Data not enough when parse LongString");let W=new DataView(h,m,y).getUint32(0,!Wt),pe;return W>0?pe=mt(new Uint8Array(h,m+4,W)):pe="",{data:pe,size:4+W}}static parseDate(h,m,y){if(y<10)throw new X("Data size invalid when parse Date");let k=new DataView(h,m,y),W=k.getFloat64(0,!Wt),pe=k.getInt16(8,!Wt);return W+=pe*60*1e3,{data:new Date(W),size:10}}static parseValue(h,m,y){if(y<1)throw new X("Data not enough when parse Value");let k=new DataView(h,m,y),W=1,pe=k.getUint8(0),be,rt=!1;try{switch(pe){case 0:be=k.getFloat64(1,!Wt),W+=8;break;case 1:{be=!!k.getUint8(1),W+=1;break}case 2:{let ut=ht.parseString(h,m+1,y-1);be=ut.data,W+=ut.size;break}case 3:{be={};let ut=0;for((k.getUint32(y-4,!Wt)&16777215)===9&&(ut=3);W<y-4;){let _t=ht.parseObject(h,m+W,y-W-ut);if(_t.objectEnd)break;be[_t.data.name]=_t.data.value,W+=_t.size}W<=y-3&&(k.getUint32(W-1,!Wt)&16777215)===9&&(W+=3);break}case 8:{be={},W+=4;let ut=0;for((k.getUint32(y-4,!Wt)&16777215)===9&&(ut=3);W<y-8;){let _t=ht.parseVariable(h,m+W,y-W-ut);if(_t.objectEnd)break;be[_t.data.name]=_t.data.value,W+=_t.size}W<=y-3&&(k.getUint32(W-1,!Wt)&16777215)===9&&(W+=3);break}case 9:be=void 0,W=1,rt=!0;break;case 10:{be=[];let ut=k.getUint32(1,!Wt);W+=4;for(let _t=0;_t<ut;_t++){let Ut=ht.parseValue(h,m+W,y-W);be.push(Ut.data),W+=Ut.size}break}case 11:{let ut=ht.parseDate(h,m+1,y-1);be=ut.data,W+=ut.size;break}case 12:{let ut=ht.parseString(h,m+1,y-1);be=ut.data,W+=ut.size;break}default:W=y,p.w("AMF","Unsupported AMF value type "+pe)}}catch(ut){p.e("AMF",ut.toString())}return{data:be,size:W,objectEnd:rt}}}var li=ht;class Ge{constructor(h){this.TAG="ExpGolomb",this._buffer=h,this._buffer_index=0,this._total_bytes=h.byteLength,this._total_bits=h.byteLength*8,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){let h=this._total_bytes-this._buffer_index;if(h<=0)throw new X("ExpGolomb: _fillCurrentWord() but no bytes available");let m=Math.min(4,h),y=new Uint8Array(4);y.set(this._buffer.subarray(this._buffer_index,this._buffer_index+m)),this._current_word=new DataView(y.buffer).getUint32(0,!1),this._buffer_index+=m,this._current_word_bits_left=m*8}readBits(h){if(h>32)throw new P("ExpGolomb: readBits() bits exceeded max 32bits!");if(h<=this._current_word_bits_left){let pe=this._current_word>>>32-h;return this._current_word<<=h,this._current_word_bits_left-=h,pe}let m=this._current_word_bits_left?this._current_word:0;m=m>>>32-this._current_word_bits_left;let y=h-this._current_word_bits_left;this._fillCurrentWord();let k=Math.min(y,this._current_word_bits_left),W=this._current_word>>>32-k;return this._current_word<<=k,this._current_word_bits_left-=k,m=m<<k|W,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 ve=Ge;class we{static _ebsp2rbsp(h){let m=h,y=m.byteLength,k=new Uint8Array(y),W=0;for(let pe=0;pe<y;pe++)pe>=2&&m[pe]===3&&m[pe-1]===0&&m[pe-2]===0||(k[W]=m[pe],W++);return new Uint8Array(k.buffer,0,W)}static parseSPS(h){let m=we._ebsp2rbsp(h),y=new ve(m);y.readByte();let k=y.readByte();y.readByte();let W=y.readByte();y.readUEG();let pe=we.getProfileString(k),be=we.getLevelString(W),rt=1,ut=420,_t=[0,420,422,444],Ut=8;if((k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128||k===138||k===144)&&(rt=y.readUEG(),rt===3&&y.readBits(1),rt<=3&&(ut=_t[rt]),Ut=y.readUEG()+8,y.readUEG(),y.readBits(1),y.readBool())){let Ot=rt!==3?8:12;for(let Qt=0;Qt<Ot;Qt++)y.readBool()&&(Qt<6?we._skipScalingList(y,16):we._skipScalingList(y,64))}y.readUEG();let zt=y.readUEG();if(zt===0)y.readUEG();else if(zt===1){y.readBits(1),y.readSEG(),y.readSEG();let Ot=y.readUEG();for(let Qt=0;Qt<Ot;Qt++)y.readSEG()}let Tt=y.readUEG();y.readBits(1);let Gt=y.readUEG(),Pt=y.readUEG(),tt=y.readBits(1);tt===0&&y.readBits(1),y.readBits(1);let ze=0,Ve=0,at=0,Vt=0;y.readBool()&&(ze=y.readUEG(),Ve=y.readUEG(),at=y.readUEG(),Vt=y.readUEG());let pi=1,Dt=1,Rt=0,Nt=!0,Ee=0,De=0;if(y.readBool()){if(y.readBool()){let Ot=y.readByte(),Qt=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],oi=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Ot>0&&Ot<16?(pi=Qt[Ot-1],Dt=oi[Ot-1]):Ot===255&&(pi=y.readByte()<<8|y.readByte(),Dt=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 Ot=y.readBits(32),Qt=y.readBits(32);Nt=y.readBool(),Ee=Qt,De=Ot*2,Rt=Ee/De}}let Ye=1;(pi!==1||Dt!==1)&&(Ye=pi/Dt);let ot=0,Qe=0;if(rt===0)ot=1,Qe=2-tt;else{let Ot=rt===3?1:2,Qt=rt===1?2:1;ot=Ot,Qe=Qt*(2-tt)}let ct=(Gt+1)*16,Et=(2-tt)*((Pt+1)*16);ct-=(ze+Ve)*ot,Et-=(at+Vt)*Qe;let ni=Math.ceil(ct*Ye);return y.destroy(),y=null,{profile_string:pe,level_string:be,bit_depth:Ut,ref_frames:Tt,chroma_format:ut,chroma_format_string:we.getChromaFormatString(ut),frame_rate:{fixed:Nt,fps:Rt,fps_den:De,fps_num:Ee},sar_ratio:{width:pi,height:Dt},codec_size:{width:ct,height:Et},present_size:{width:ni,height:Et}}}static _skipScalingList(h,m){let y=8,k=8,W=0;for(let pe=0;pe<m;pe++)k!==0&&(W=h.readSEG(),k=(y+W+256)%256),y=k===0?y:k}static getProfileString(h){switch(h){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}static getLevelString(h){return(h/10).toFixed(1)}static getChromaFormatString(h){switch(h){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}var se=we,Oe={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};function ie(Ne){return Ne>>>8&255|(Ne&255)<<8}function C(Ne){return(Ne&4278190080)>>>24|(Ne&16711680)>>>8|(Ne&65280)<<8|(Ne&255)<<24}function O(Ne,h){return Ne[h]<<24|Ne[h+1]<<16|Ne[h+2]<<8|Ne[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 $t,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){let y=new ArrayBuffer(2);return new DataView(y).setInt16(0,256,!0),new Int16Array(y)[0]===256}()}destroy(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}static probe(h){let m=new Uint8Array(h),y={match:!1};if(m[0]!==70||m[1]!==76||m[2]!==86||m[3]!==1)return y;let k=(m[4]&4)>>>2!==0,W=(m[4]&1)!==0,pe=O(m,5);return pe<9?y:{match:!0,consumed:pe,dataOffset:pe,hasAudioTrack:k,hasVideoTrack:W}}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 $t}_isInitialMetadataDispatched(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1}parseChunks(h,m){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new X("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let y=0,k=this._littleEndian;if(m===0)if(h.byteLength>13)y=Q.probe(h).dataOffset;else return 0;for(this._firstParse&&(this._firstParse=!1,m+y!==this._dataOffset&&p.w(this.TAG,"First time parsing but chunk byteStart invalid!"),new DataView(h,y).getUint32(0,!k)!==0&&p.w(this.TAG,"PrevTagSize0 !== 0 !!!"),y+=4);y<h.byteLength;){this._dispatch=!0;let W=new DataView(h,y);if(y+11+4>h.byteLength)break;let pe=W.getUint8(0),be=W.getUint32(0,!k)&16777215;if(y+11+be+4>h.byteLength)break;if(pe!==8&&pe!==9&&pe!==18){p.w(this.TAG,`Unsupported tag type ${pe}, skipped`),y+=11+be+4;continue}let rt=W.getUint8(4),ut=W.getUint8(5),_t=W.getUint8(6),Ut=W.getUint8(7),zt=_t|ut<<8|rt<<16|Ut<<24;(W.getUint32(7,!k)&16777215)!==0&&p.w(this.TAG,"Meet tag which has StreamID != 0!");let Gt=y+11;switch(pe){case 8:this._parseAudioData(h,Gt,be,zt);break;case 9:this._parseVideoData(h,Gt,be,zt,m+y);break;case 18:this._parseScriptData(h,Gt,be);break}let Pt=W.getUint32(11+be,!k);Pt!==11+be&&p.w(this.TAG,`Invalid PrevTagSize ${Pt}`),y+=11+be+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),y}_parseScriptData(h,m,y){let k=li.parseScriptData(h,m,y);if(k.hasOwnProperty("onMetaData")){if(k.onMetaData==null||typeof k.onMetaData!="object"){p.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&p.w(this.TAG,"Found another onMetaData tag!"),this._metadata=k;let W=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},W)),typeof W.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=W.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof W.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=W.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof W.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=W.audiodatarate),typeof W.videodatarate=="number"&&(this._mediaInfo.videoDataRate=W.videodatarate),typeof W.width=="number"&&(this._mediaInfo.width=W.width),typeof W.height=="number"&&(this._mediaInfo.height=W.height),typeof W.duration=="number"){if(!this._durationOverrided){let pe=Math.floor(W.duration*this._timescale);this._duration=pe,this._mediaInfo.duration=pe}}else this._mediaInfo.duration=0;if(typeof W.framerate=="number"){let pe=Math.floor(W.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 W.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;let pe=W.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(pe),W.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=W,p.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(k).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},k))}_parseKeyframesIndex(h){let m=[],y=[];for(let k=1;k<h.times.length;k++){let W=this._timestampBase+Math.floor(h.times[k]*1e3);m.push(W),y.push(h.filepositions[k])}return{times:m,filepositions:y}}_parseAudioData(h,m,y,k){if(y<=1){p.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");return}if(this._hasAudioFlagOverrided===!0&&this._hasAudio===!1)return;let W=this._littleEndian,be=new DataView(h,m,y).getUint8(0),rt=be>>>4;if(rt!==2&&rt!==10){this._onError(Oe.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+rt);return}let ut=0,_t=(be&12)>>>2;if(_t>=0&&_t<=4)ut=this._flvSoundRateTable[_t];else{this._onError(Oe.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+_t);return}let Ut=(be&2)>>>1,zt=be&1,Tt=this._audioMetadata,Gt=this._audioTrack;if(Tt||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),Tt=this._audioMetadata={},Tt.type="audio",Tt.id=Gt.id,Tt.timescale=this._timescale,Tt.duration=this._duration,Tt.audioSampleRate=ut,Tt.channelCount=zt===0?1:2),rt===10){let Pt=this._parseAACAudioData(h,m+1,y-1);if(Pt==null)return;if(Pt.packetType===0){Tt.config&&p.w(this.TAG,"Found another AudioSpecificConfig!");let tt=Pt.data;Tt.audioSampleRate=tt.samplingRate,Tt.channelCount=tt.channelCount,Tt.codec=tt.codec,Tt.originalCodec=tt.originalCodec,Tt.config=tt.config,Tt.refSampleDuration=1024/Tt.audioSampleRate*Tt.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",Tt);let ze=this._mediaInfo;ze.audioCodec=Tt.originalCodec,ze.audioSampleRate=Tt.audioSampleRate,ze.audioChannelCount=Tt.channelCount,ze.hasVideo?ze.videoCodec!=null&&(ze.mimeType='video/x-flv; codecs="'+ze.videoCodec+","+ze.audioCodec+'"'):ze.mimeType='video/x-flv; codecs="'+ze.audioCodec+'"',ze.isComplete()&&this._onMediaInfo(ze)}else if(Pt.packetType===1){let tt=this._timestampBase+k,ze={unit:Pt.data,length:Pt.data.byteLength,dts:tt,pts:tt};Gt.samples.push(ze),Gt.length+=Pt.data.length}else p.e(this.TAG,`Flv: Unsupported AAC data type ${Pt.packetType}`)}else if(rt===2){if(!Tt.codec){let Ve=this._parseMP3AudioData(h,m+1,y-1,!0);if(Ve==null)return;Tt.audioSampleRate=Ve.samplingRate,Tt.channelCount=Ve.channelCount,Tt.codec=Ve.codec,Tt.originalCodec=Ve.originalCodec,Tt.refSampleDuration=1152/Tt.audioSampleRate*Tt.timescale,p.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",Tt);let at=this._mediaInfo;at.audioCodec=Tt.codec,at.audioSampleRate=Tt.audioSampleRate,at.audioChannelCount=Tt.channelCount,at.audioDataRate=Ve.bitRate,at.hasVideo?at.videoCodec!=null&&(at.mimeType='video/x-flv; codecs="'+at.videoCodec+","+at.audioCodec+'"'):at.mimeType='video/x-flv; codecs="'+at.audioCodec+'"',at.isComplete()&&this._onMediaInfo(at)}let Pt=this._parseMP3AudioData(h,m+1,y-1,!1);if(Pt==null)return;let tt=this._timestampBase+k,ze={unit:Pt,length:Pt.byteLength,dts:tt,pts:tt};Gt.samples.push(ze),Gt.length+=Pt.length}}_parseAACAudioData(h,m,y){if(y<=1){p.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}let k={},W=new Uint8Array(h,m,y);return k.packetType=W[0],W[0]===0?k.data=this._parseAACAudioSpecificConfig(h,m+1,y-1):k.data=W.subarray(1),k}_parseAACAudioSpecificConfig(h,m,y){let k=new Uint8Array(h,m,y),W=null,pe=0,be=0,rt=null,ut=0,_t=null;if(pe=be=k[0]>>>3,ut=(k[0]&7)<<1|k[1]>>>7,ut<0||ut>=this._mpegSamplingRates.length){this._onError(Oe.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}let Ut=this._mpegSamplingRates[ut],zt=(k[1]&120)>>>3;if(zt<0||zt>=8){this._onError(Oe.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}pe===5&&(_t=(k[1]&7)<<1|k[2]>>>7,rt=(k[2]&124)>>>2);let Tt=self.navigator.userAgent.toLowerCase();return Tt.indexOf("firefox")!==-1?ut>=6?(pe=5,W=new Array(4),_t=ut-3):(pe=2,W=new Array(2),_t=ut):Tt.indexOf("android")!==-1?(pe=2,W=new Array(2),_t=ut):(pe=5,_t=ut,W=new Array(4),ut>=6?_t=ut-3:zt===1&&(pe=2,W=new Array(2),_t=ut)),W[0]=pe<<3,W[0]|=(ut&15)>>>1,W[1]=(ut&15)<<7,W[1]|=(zt&15)<<3,pe===5&&(W[1]|=(_t&15)>>>1,W[2]=(_t&1)<<7,W[2]|=8,W[3]=0),{config:W,samplingRate:Ut,channelCount:zt,codec:"mp4a.40."+pe,originalCodec:"mp4a.40."+be}}_parseMP3AudioData(h,m,y,k){if(y<4){p.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}let W=this._littleEndian,pe=new Uint8Array(h,m,y),be=null;if(k){if(pe[0]!==255)return;let rt=pe[1]>>>3&3,ut=(pe[1]&6)>>1,_t=(pe[2]&240)>>>4,Ut=(pe[2]&12)>>>2,Tt=(pe[3]>>>6&3)!==3?2:1,Gt=0,Pt=0,tt=34,ze="mp3";switch(rt){case 0:Gt=this._mpegAudioV25SampleRateTable[Ut];break;case 2:Gt=this._mpegAudioV20SampleRateTable[Ut];break;case 3:Gt=this._mpegAudioV10SampleRateTable[Ut];break}switch(ut){case 1:tt=34,_t<this._mpegAudioL3BitRateTable.length&&(Pt=this._mpegAudioL3BitRateTable[_t]);break;case 2:tt=33,_t<this._mpegAudioL2BitRateTable.length&&(Pt=this._mpegAudioL2BitRateTable[_t]);break;case 3:tt=32,_t<this._mpegAudioL1BitRateTable.length&&(Pt=this._mpegAudioL1BitRateTable[_t]);break}be={bitRate:Pt,samplingRate:Gt,channelCount:Tt,codec:ze,originalCodec:ze}}else be=pe;return be}_parseVideoData(h,m,y,k,W){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,rt=pe&15;if(rt!==7){this._onError(Oe.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${rt}`);return}this._parseAVCVideoPacket(h,m+1,y-1,k,W,be)}_parseAVCVideoPacket(h,m,y,k,W,pe){if(y<4){p.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}let be=this._littleEndian,rt=new DataView(h,m,y),ut=rt.getUint8(0),Ut=(rt.getUint32(0,!be)&16777215)<<8>>8;if(ut===0)this._parseAVCDecoderConfigurationRecord(h,m+4,y-4);else if(ut===1)this._parseAVCVideoData(h,m+4,y-4,k,W,pe,Ut);else if(ut!==2){this._onError(Oe.FORMAT_ERROR,`Flv: Invalid video packet type ${ut}`);return}}_parseAVCDecoderConfigurationRecord(h,m,y){if(y<7){p.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}let k=this._videoMetadata,W=this._videoTrack,pe=this._littleEndian,be=new DataView(h,m,y);k?typeof k.avcc!="undefined"&&p.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),k=this._videoMetadata={},k.type="video",k.id=W.id,k.timescale=this._timescale,k.duration=this._duration);let rt=be.getUint8(0),ut=be.getUint8(1),_t=be.getUint8(2),Ut=be.getUint8(3);if(rt!==1||ut===0){this._onError(Oe.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(be.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(Oe.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`);return}let zt=be.getUint8(5)&31;if(zt===0){this._onError(Oe.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else zt>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${zt}`);let Tt=6;for(let Pt=0;Pt<zt;Pt++){let tt=be.getUint16(Tt,!pe);if(Tt+=2,tt===0)continue;let ze=new Uint8Array(h,m+Tt,tt);Tt+=tt;let Ve=se.parseSPS(ze);if(Pt!==0)continue;k.codecWidth=Ve.codec_size.width,k.codecHeight=Ve.codec_size.height,k.presentWidth=Ve.present_size.width,k.presentHeight=Ve.present_size.height,k.profile=Ve.profile_string,k.level=Ve.level_string,k.bitDepth=Ve.bit_depth,k.chromaFormat=Ve.chroma_format,k.sarRatio=Ve.sar_ratio,k.frameRate=Ve.frame_rate,(Ve.frame_rate.fixed===!1||Ve.frame_rate.fps_num===0||Ve.frame_rate.fps_den===0)&&(k.frameRate=this._referenceFrameRate);let at=k.frameRate.fps_den,Vt=k.frameRate.fps_num;k.refSampleDuration=k.timescale*(at/Vt);let Ct=ze.subarray(1,4),pi="avc1.";for(let Rt=0;Rt<3;Rt++){let Nt=Ct[Rt].toString(16);Nt.length<2&&(Nt="0"+Nt),pi+=Nt}k.codec=pi;let Dt=this._mediaInfo;Dt.width=k.codecWidth,Dt.height=k.codecHeight,Dt.fps=k.frameRate.fps,Dt.profile=k.profile,Dt.level=k.level,Dt.refFrames=Ve.ref_frames,Dt.chromaFormat=Ve.chroma_format_string,Dt.sarNum=k.sarRatio.width,Dt.sarDen=k.sarRatio.height,Dt.videoCodec=pi,Dt.hasAudio?Dt.audioCodec!=null&&(Dt.mimeType='video/x-flv; codecs="'+Dt.videoCodec+","+Dt.audioCodec+'"'):Dt.mimeType='video/x-flv; codecs="'+Dt.videoCodec+'"',Dt.isComplete()&&this._onMediaInfo(Dt)}let Gt=be.getUint8(Tt);if(Gt===0){this._onError(Oe.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");return}else Gt>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${Gt}`);Tt++;for(let Pt=0;Pt<Gt;Pt++){let tt=be.getUint16(Tt,!pe);Tt+=2,tt!==0&&(Tt+=tt)}k.avcc=new Uint8Array(y),k.avcc.set(new Uint8Array(h,m,y),0),p.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",k)}_parseAVCVideoData(h,m,y,k,W,pe,be){let rt=this._littleEndian,ut=new DataView(h,m,y),_t=[],Ut=0,zt=0;const Tt=this._naluLengthSize;let Gt=this._timestampBase+k,Pt=pe===1;for(;zt<y;){if(zt+4>=y){p.w(this.TAG,`Malformed Nalu near timestamp ${Gt}, offset = ${zt}, dataSize = ${y}`);break}let tt=ut.getUint32(zt,!rt);if(Tt===3&&(tt>>>=8),tt>y-Tt){p.w(this.TAG,`Malformed Nalus near timestamp ${Gt}, NaluSize > DataSize!`);return}let ze=ut.getUint8(zt+Tt)&31;ze===5&&(Pt=!0);let Ve=new Uint8Array(h,m+zt,Tt+tt),at={type:ze,data:Ve};_t.push(at),Ut+=Ve.byteLength,zt+=Tt+tt}if(_t.length){let tt=this._videoTrack,ze={units:_t,length:Ut,isKeyframe:Pt,dts:Gt,cts:be,pts:Gt+be};Pt&&(ze.fileposition=W),tt.samples.push(ze),tt.length+=Ut}}}var z=Q;class N{static init(){N.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 N.types)N.types.hasOwnProperty(m)&&(N.types[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);let h=N.constants={};h.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),h.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),h.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),h.STSC=h.STCO=h.STTS,h.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),h.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),h.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),h.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),h.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),h.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(h){let m=8,y=null,k=Array.prototype.slice.call(arguments,1),W=k.length;for(let be=0;be<W;be++)m+=k[be].byteLength;y=new Uint8Array(m),y[0]=m>>>24&255,y[1]=m>>>16&255,y[2]=m>>>8&255,y[3]=m&255,y.set(h,4);let pe=8;for(let be=0;be<W;be++)y.set(k[be],pe),pe+=k[be].byteLength;return y}static generateInitSegment(h){let m=N.box(N.types.ftyp,N.constants.FTYP),y=N.moov(h),k=new Uint8Array(m.byteLength+y.byteLength);return k.set(m,0),k.set(y,m.byteLength),k}static moov(h){let m=N.mvhd(h.timescale,h.duration),y=N.trak(h),k=N.mvex(h);return N.box(N.types.moov,m,y,k)}static mvhd(h,m){return N.box(N.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 N.box(N.types.trak,N.tkhd(h),N.mdia(h))}static tkhd(h){let m=h.id,y=h.duration,k=h.presentWidth,W=h.presentHeight;return N.box(N.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255,0,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,k>>>8&255,k&255,0,0,W>>>8&255,W&255,0,0]))}static mdia(h){return N.box(N.types.mdia,N.mdhd(h),N.hdlr(h),N.minf(h))}static mdhd(h){let m=h.timescale,y=h.duration;return N.box(N.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=N.constants.HDLR_AUDIO:m=N.constants.HDLR_VIDEO,N.box(N.types.hdlr,m)}static minf(h){let m=null;return h.type==="audio"?m=N.box(N.types.smhd,N.constants.SMHD):m=N.box(N.types.vmhd,N.constants.VMHD),N.box(N.types.minf,m,N.dinf(),N.stbl(h))}static dinf(){return N.box(N.types.dinf,N.box(N.types.dref,N.constants.DREF))}static stbl(h){return N.box(N.types.stbl,N.stsd(h),N.box(N.types.stts,N.constants.STTS),N.box(N.types.stsc,N.constants.STSC),N.box(N.types.stsz,N.constants.STSZ),N.box(N.types.stco,N.constants.STCO))}static stsd(h){return h.type==="audio"?h.codec==="mp3"?N.box(N.types.stsd,N.constants.STSD_PREFIX,N.mp3(h)):N.box(N.types.stsd,N.constants.STSD_PREFIX,N.mp4a(h)):N.box(N.types.stsd,N.constants.STSD_PREFIX,N.avc1(h))}static mp3(h){let m=h.channelCount,y=h.audioSampleRate,k=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,m,0,16,0,0,0,0,y>>>8&255,y&255,0,0]);return N.box(N.types[".mp3"],k)}static mp4a(h){let m=h.channelCount,y=h.audioSampleRate,k=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,m,0,16,0,0,0,0,y>>>8&255,y&255,0,0]);return N.box(N.types.mp4a,k,N.esds(h))}static esds(h){let m=h.config||[],y=m.length,k=new Uint8Array([0,0,0,0,3,23+y,0,1,0,4,15+y,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([y]).concat(m).concat([6,1,2]));return N.box(N.types.esds,k)}static avc1(h){let m=h.avcc,y=h.codecWidth,k=h.codecHeight,W=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,y>>>8&255,y&255,k>>>8&255,k&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return N.box(N.types.avc1,W,N.box(N.types.avcC,m))}static mvex(h){return N.box(N.types.mvex,N.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 N.box(N.types.trex,y)}static moof(h,m){return N.box(N.types.moof,N.mfhd(h.sequenceNumber),N.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 N.box(N.types.mfhd,m)}static traf(h,m){let y=h.id,k=N.box(N.types.tfhd,new Uint8Array([0,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&255])),W=N.box(N.types.tfdt,new Uint8Array([0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255])),pe=N.sdtp(h),be=N.trun(h,pe.byteLength+16+16+8+16+8+8);return N.box(N.types.traf,k,W,be,pe)}static sdtp(h){let m=h.samples||[],y=m.length,k=new Uint8Array(4+y);for(let W=0;W<y;W++){let pe=m[W].flags;k[W+4]=pe.isLeading<<6|pe.dependsOn<<4|pe.isDependedOn<<2|pe.hasRedundancy}return N.box(N.types.sdtp,k)}static trun(h,m){let y=h.samples||[],k=y.length,W=12+16*k,pe=new Uint8Array(W);m+=8+W,pe.set([0,0,15,1,k>>>24&255,k>>>16&255,k>>>8&255,k&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255],0);for(let be=0;be<k;be++){let rt=y[be].duration,ut=y[be].size,_t=y[be].flags,Ut=y[be].cts;pe.set([rt>>>24&255,rt>>>16&255,rt>>>8&255,rt&255,ut>>>24&255,ut>>>16&255,ut>>>8&255,ut&255,_t.isLeading<<2|_t.dependsOn,_t.isDependedOn<<6|_t.hasRedundancy<<4|_t.isNonSync,0,0,Ut>>>24&255,Ut>>>16&255,Ut>>>8&255,Ut&255],12+16*be)}return N.box(N.types.trun,pe)}static mdat(h){return N.box(N.types.mdat,h)}}N.init();var Z=N;class re{static getSilentFrame(h,m){if(h==="mp4a.40.2"){if(m===1)return new Uint8Array([0,200,0,128,35,128]);if(m===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(m===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(m===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(m===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(m===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(m===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(m===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(m===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}}var le=re;class _e{constructor(h,m,y,k,W){this.dts=h,this.pts=m,this.duration=y,this.originalDts=k,this.isSyncPoint=W,this.fileposition=null}}class Ae{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 We{constructor(){this._list=[]}clear(){this._list=[]}appendArray(h){let m=this._list;h.length!==0&&(m.length>0&&h[0].originalDts<m[m.length-1].originalDts&&this.clear(),Array.prototype.push.apply(m,h))}getLastSyncPointBeforeDts(h){if(this._list.length==0)return null;let m=this._list,y=0,k=m.length-1,W=0,pe=0,be=k;for(h<m[0].dts&&(y=0,pe=be+1);pe<=be;)if(W=pe+Math.floor((be-pe)/2),W===k||h>=m[W].dts&&h<m[W+1].dts){y=W;break}else m[W].dts<h?pe=W+1:be=W-1;return this._list[y]}}class He{constructor(h){this._type=h,this._list=[],this._lastAppendLocation=-1}get type(){return this._type}get length(){return this._list.length}isEmpty(){return this._list.length===0}clear(){this._list=[],this._lastAppendLocation=-1}_searchNearestSegmentBefore(h){let m=this._list;if(m.length===0)return-2;let y=m.length-1,k=0,W=0,pe=y,be=0;if(h<m[0].originalBeginDts)return be=-1,be;for(;W<=pe;)if(k=W+Math.floor((pe-W)/2),k===y||h>m[k].lastSample.originalDts&&h<m[k+1].originalBeginDts){be=k;break}else m[k].originalBeginDts<h?W=k+1:pe=k-1;return be}_searchNearestSegmentAfter(h){return this._searchNearestSegmentBefore(h)+1}append(h){let m=this._list,y=h,k=this._lastAppendLocation,W=0;k!==-1&&k<m.length&&y.originalBeginDts>=m[k].lastSample.originalDts&&(k===m.length-1||k<m.length-1&&y.originalBeginDts<m[k+1].originalBeginDts)?W=k+1:m.length>0&&(W=this._searchNearestSegmentBefore(y.originalBeginDts)+1),this._lastAppendLocation=W,this._list.splice(W,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 Be{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 He("audio"),this._videoSegmentInfoList=new He("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(V.chrome&&(V.version.major<50||V.version.major===50&&V.version.build<2661)),this._fillSilentAfterSeek=V.msedge||V.msie,this._mp3UseMpegAudio=!V.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}destroy(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}bindDataSource(h){return h.onDataAvailable=this.remux.bind(this),h.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}get onInitSegment(){return this._onInitSegment}set onInitSegment(h){this._onInitSegment=h}get onMediaSegment(){return this._onMediaSegment}set onMediaSegment(h){this._onMediaSegment=h}insertDiscontinuity(){this._audioNextDts=this._videoNextDts=void 0}seek(h){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}remux(h,m){if(!this._onMediaSegment)throw new X("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(h,m),this._remuxVideo(m),this._remuxAudio(h)}_onTrackMetadataReceived(h,m){let y=null,k="mp4",W=m.codec;if(h==="audio")this._audioMeta=m,m.codec==="mp3"&&this._mp3UseMpegAudio?(k="mpeg",W="",y=new Uint8Array):y=Z.generateInitSegment(m);else if(h==="video")this._videoMeta=m,y=Z.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:W,container:`${h}/${k}`,mediaDuration:m.duration})}_calculateDtsBase(h,m){this._dtsBaseInited||(h.samples&&h.samples.length&&(this._audioDtsBase=h.samples[0].dts),m.samples&&m.samples.length&&(this._videoDtsBase=m.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}flushStashedSamples(){let h=this._videoStashedLastSample,m=this._audioStashedLastSample,y={type:"video",id:1,sequenceNumber:0,samples:[],length:0};h!=null&&(y.samples.push(h),y.length=h.length);let k={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};m!=null&&(k.samples.push(m),k.length=m.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(y,!0),this._remuxAudio(k,!0)}_remuxAudio(h,m){if(this._audioMeta==null)return;let y=h,k=y.samples,W,pe=-1,be=-1,rt=-1,ut=this._audioMeta.refSampleDuration,_t=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,Ut=this._dtsBaseInited&&this._audioNextDts===void 0,zt=!1;if(!k||k.length===0||k.length===1&&!m)return;let Tt=0,Gt=null,Pt=0;_t?(Tt=0,Pt=y.length):(Tt=8,Pt=8+y.length);let tt=null;if(k.length>1&&(tt=k.pop(),Pt-=tt.length),this._audioStashedLastSample!=null){let Dt=this._audioStashedLastSample;this._audioStashedLastSample=null,k.unshift(Dt),Pt+=Dt.length}tt!=null&&(this._audioStashedLastSample=tt);let ze=k[0].dts-this._dtsBase;if(this._audioNextDts)W=ze-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())W=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(zt=!0);else{let Dt=this._audioSegmentInfoList.getLastSampleBefore(ze);if(Dt!=null){let Rt=ze-(Dt.originalDts+Dt.duration);Rt<=3&&(Rt=0);let Nt=Dt.dts+Dt.duration+Rt;W=ze-Nt}else W=0}if(zt){let Dt=ze-W,Rt=this._videoSegmentInfoList.getLastSegmentBefore(ze);if(Rt!=null&&Rt.beginDts<Dt){let Nt=le.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(Nt){let Ee=Rt.beginDts,De=Dt-Rt.beginDts;p.v(this.TAG,`InsertPrefixSilentAudio: dts: ${Ee}, duration: ${De}`),k.unshift({unit:Nt,dts:Ee,pts:Ee}),Pt+=Nt.byteLength}}else zt=!1}let Ve=[];for(let Dt=0;Dt<k.length;Dt++){let Rt=k[Dt],Nt=Rt.unit,Ee=Rt.dts-this._dtsBase,De=Ee-W;pe===-1&&(pe=De);let qe=0;Dt!==k.length-1?qe=k[Dt+1].dts-this._dtsBase-W-De:tt!=null?qe=tt.dts-this._dtsBase-W-De:Ve.length>=1?qe=Ve[Ve.length-1].duration:qe=Math.floor(ut);let Ye=!1,ot=null;if(qe>ut*1.5&&this._audioMeta.codec!=="mp3"&&this._fillAudioTimestampGap&&!V.safari){Ye=!0;let Qe=Math.abs(qe-ut),ct=Math.ceil(Qe/ut),Et=De+ut;p.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
dts: ${De+qe} ms, expected: ${De+Math.round(ut)} ms, delta: ${Math.round(Qe)} ms, generate: ${ct} frames`);let ni=le.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);ni==null&&(p.w(this.TAG,`Unable to generate silent frame for ${this._audioMeta.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),ni=Nt),ot=[];for(let Qt=0;Qt<ct;Qt++){let oi=Math.round(Et);if(ot.length>0){let Ei=ot[ot.length-1];Ei.duration=oi-Ei.dts}let mi={dts:oi,pts:oi,cts:0,unit:ni,size:ni.byteLength,duration:0,originalDts:Ee,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};ot.push(mi),Pt+=mi.size,Et+=ut}let Ot=ot[ot.length-1];Ot.duration=De+qe-Ot.dts,qe=Math.round(ut)}Ve.push({dts:De,pts:De,cts:0,unit:Rt.unit,size:Rt.unit.byteLength,duration:qe,originalDts:Ee,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),Ye&&Ve.push.apply(Ve,ot)}_t?Gt=new Uint8Array(Pt):(Gt=new Uint8Array(Pt),Gt[0]=Pt>>>24&255,Gt[1]=Pt>>>16&255,Gt[2]=Pt>>>8&255,Gt[3]=Pt&255,Gt.set(Z.types.mdat,4));for(let Dt=0;Dt<Ve.length;Dt++){let Rt=Ve[Dt].unit;Gt.set(Rt,Tt),Tt+=Rt.byteLength}let at=Ve[Ve.length-1];be=at.dts+at.duration,this._audioNextDts=be;let Vt=new Ae;Vt.beginDts=pe,Vt.endDts=be,Vt.beginPts=pe,Vt.endPts=be,Vt.originalBeginDts=Ve[0].originalDts,Vt.originalEndDts=at.originalDts+at.duration,Vt.firstSample=new _e(Ve[0].dts,Ve[0].pts,Ve[0].duration,Ve[0].originalDts,!1),Vt.lastSample=new _e(at.dts,at.pts,at.duration,at.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(Vt),y.samples=Ve,y.sequenceNumber++;let Ct=null;_t?Ct=new Uint8Array:Ct=Z.moof(y,pe),y.samples=[],y.length=0;let pi={type:"audio",data:this._mergeBoxes(Ct,Gt).buffer,sampleCount:Ve.length,info:Vt};_t&&Ut&&(pi.timestampOffset=pe),this._onMediaSegment("audio",pi)}_remuxVideo(h,m){if(this._videoMeta==null)return;let y=h,k=y.samples,W,pe=-1,be=-1,rt=-1,ut=-1;if(!k||k.length===0||k.length===1&&!m)return;let _t=8,Ut=null,zt=8+h.length,Tt=null;if(k.length>1&&(Tt=k.pop(),zt-=Tt.length),this._videoStashedLastSample!=null){let at=this._videoStashedLastSample;this._videoStashedLastSample=null,k.unshift(at),zt+=at.length}Tt!=null&&(this._videoStashedLastSample=Tt);let Gt=k[0].dts-this._dtsBase;if(this._videoNextDts)W=Gt-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())W=0;else{let at=this._videoSegmentInfoList.getLastSampleBefore(Gt);if(at!=null){let Vt=Gt-(at.originalDts+at.duration);Vt<=3&&(Vt=0);let Ct=at.dts+at.duration+Vt;W=Gt-Ct}else W=0}let Pt=new Ae,tt=[];for(let at=0;at<k.length;at++){let Vt=k[at],Ct=Vt.dts-this._dtsBase,pi=Vt.isKeyframe,Dt=Ct-W,Rt=Vt.cts,Nt=Dt+Rt;pe===-1&&(pe=Dt,rt=Nt);let Ee=0;if(at!==k.length-1?Ee=k[at+1].dts-this._dtsBase-W-Dt:Tt!=null?Ee=Tt.dts-this._dtsBase-W-Dt:tt.length>=1?Ee=tt[tt.length-1].duration:Ee=Math.floor(this._videoMeta.refSampleDuration),pi){let De=new _e(Dt,Nt,Ee,Vt.dts,!0);De.fileposition=Vt.fileposition,Pt.appendSyncPoint(De)}tt.push({dts:Dt,pts:Nt,cts:Rt,units:Vt.units,size:Vt.length,isKeyframe:pi,duration:Ee,originalDts:Ct,flags:{isLeading:0,dependsOn:pi?2:1,isDependedOn:pi?1:0,hasRedundancy:0,isNonSync:pi?0:1}})}Ut=new Uint8Array(zt),Ut[0]=zt>>>24&255,Ut[1]=zt>>>16&255,Ut[2]=zt>>>8&255,Ut[3]=zt&255,Ut.set(Z.types.mdat,4);for(let at=0;at<tt.length;at++){let Vt=tt[at].units;for(;Vt.length;){let pi=Vt.shift().data;Ut.set(pi,_t),_t+=pi.byteLength}}let ze=tt[tt.length-1];if(be=ze.dts+ze.duration,ut=ze.pts+ze.duration,this._videoNextDts=be,Pt.beginDts=pe,Pt.endDts=be,Pt.beginPts=rt,Pt.endPts=ut,Pt.originalBeginDts=tt[0].originalDts,Pt.originalEndDts=ze.originalDts+ze.duration,Pt.firstSample=new _e(tt[0].dts,tt[0].pts,tt[0].duration,tt[0].originalDts,tt[0].isKeyframe),Pt.lastSample=new _e(ze.dts,ze.pts,ze.duration,ze.originalDts,ze.isKeyframe),this._isLive||this._videoSegmentInfoList.append(Pt),y.samples=tt,y.sequenceNumber++,this._forceFirstIDR){let at=tt[0].flags;at.dependsOn=2,at.isNonSync=0}let Ve=Z.moof(y,pe);y.samples=[],y.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(Ve,Ut).buffer,sampleCount:tt.length,info:Pt})}_mergeBoxes(h,m){let y=new Uint8Array(h.byteLength+m.byteLength);return y.set(h,0),y.set(m,h.byteLength),y}}var Ke=Be,Ie={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 et{constructor(h,m){this.TAG="TransmuxingController",this._emitter=new(he()),this._config=m,h.segments||(h.segments=[{duration:h.duration,filesize:h.filesize,url:h.url}]),typeof h.cors!="boolean"&&(h.cors=!0),typeof h.withCredentials!="boolean"&&(h.withCredentials=!1),this._mediaDataSource=h,this._currentSegmentIndex=0;let y=0;this._mediaDataSource.segments.forEach(k=>{k.timestampBase=y,y+=k.duration,k.cors=h.cors,k.withCredentials=h.withCredentials,m.referrerPolicy&&(k.referrerPolicy=m.referrerPolicy)}),!isNaN(y)&&this._mediaDataSource.duration!==y&&(this._mediaDataSource.duration=y),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}destroy(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null}on(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}start(){this._loadSegment(0),this._enableStatisticsReporter()}_loadSegment(h,m){this._currentSegmentIndex=h;let y=this._mediaDataSource.segments[h],k=this._ioctl=new oe(y,this._config,h);k.onError=this._onIOException.bind(this),k.onSeeked=this._onIOSeeked.bind(this),k.onComplete=this._onIOComplete.bind(this),k.onRedirect=this._onIORedirect.bind(this),k.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),m?this._demuxer.bindDataSource(this._ioctl):k.onDataArrival=this._onInitChunkArrival.bind(this),k.open(m)}stop(){this._internalAbort(),this._disableStatisticsReporter()}_internalAbort(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}pause(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}resume(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}seek(h){if(this._mediaInfo==null||!this._mediaInfo.isSeekable())return;let m=this._searchSegmentIndexContains(h);if(m===this._currentSegmentIndex){let y=this._mediaInfo.segments[m];if(y==null)this._pendingSeekTime=h;else{let k=y.getNearestKeyframe(h);this._remuxer.seek(k.milliseconds),this._ioctl.seek(k.fileposition),this._pendingResolveSeekPoint=k.milliseconds}}else{let y=this._mediaInfo.segments[m];if(y==null)this._pendingSeekTime=h,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(m);else{let k=y.getNearestKeyframe(h);this._internalAbort(),this._remuxer.seek(h),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[m].timestampBase,this._loadSegment(m,k.fileposition),this._pendingResolveSeekPoint=k.milliseconds,this._reportSegmentMediaInfo(m)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(h){let m=this._mediaDataSource.segments,y=m.length-1;for(let k=0;k<m.length;k++)if(h<m[k].timestampBase){y=k-1;break}return y}_onInitChunkArrival(h,m){let y=null,k=0;if(m>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,k=this._demuxer.parseChunks(h,m);else if((y=z.probe(h)).match){this._demuxer=new z(y,this._config),this._remuxer||(this._remuxer=new Ke(this._config));let W=this._mediaDataSource;W.duration!=null&&!isNaN(W.duration)&&(this._demuxer.overridedDuration=W.duration),typeof W.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=W.hasAudio),typeof W.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=W.hasVideo),this._demuxer.timestampBase=W.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),k=this._demuxer.parseChunks(h,m)}else y=null,p.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(()=>{this._internalAbort()}),this._emitter.emit(Ie.DEMUX_ERROR,Oe.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),k=0;return k}_onMediaInfo(h){this._mediaInfo==null&&(this._mediaInfo=Object.assign({},h),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,$t.prototype));let m=Object.assign({},h);Object.setPrototypeOf(m,$t.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(Ie.METADATA_ARRIVED,h)}_onScriptDataArrived(h){this._emitter.emit(Ie.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(Ie.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(h){let m=this._ioctl.extraData;this._mediaDataSource.segments[m].redirectedURL=h}_onIORecoveredEarlyEof(){this._emitter.emit(Ie.RECOVERED_EARLY_EOF)}_onIOException(h,m){p.e(this.TAG,`IOException: type = ${h}, code = ${m.code}, msg = ${m.msg}`),this._emitter.emit(Ie.IO_ERROR,h,m),this._disableStatisticsReporter()}_onDemuxException(h,m){p.e(this.TAG,`DemuxException: type = ${h}, info = ${m}`),this._emitter.emit(Ie.DEMUX_ERROR,h,m)}_onRemuxerInitSegmentArrival(h,m){this._emitter.emit(Ie.INIT_SEGMENT,h,m)}_onRemuxerMediaSegmentArrival(h,m){if(this._pendingSeekTime==null&&(this._emitter.emit(Ie.MEDIA_SEGMENT,h,m),this._pendingResolveSeekPoint!=null&&h==="video")){let y=m.info.syncPoints,k=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,V.safari&&y.length>0&&y[0].originalDts===k&&(k=y[0].pts),this._emitter.emit(Ie.RECOMMEND_SEEKPOINT,k)}}_enableStatisticsReporter(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}_disableStatisticsReporter(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}_reportSegmentMediaInfo(h){let m=this._mediaInfo.segments[h],y=Object.assign({},m);y.duration=this._mediaInfo.duration,y.segmentCount=this._mediaInfo.segmentCount,delete y.segments,delete y.keyframesIndex,this._emitter.emit(Ie.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(Ie.STATISTICS_INFO,h)}}var Kt=et,Mt=function(Ne){let h="TransmuxingWorker",m=null,y=Pt.bind(this);de.install(),Ne.addEventListener("message",function(tt){switch(tt.data.cmd){case"init":m=new Kt(tt.data.param[0],tt.data.param[1]),m.on(Ie.IO_ERROR,zt.bind(this)),m.on(Ie.DEMUX_ERROR,Tt.bind(this)),m.on(Ie.INIT_SEGMENT,k.bind(this)),m.on(Ie.MEDIA_SEGMENT,W.bind(this)),m.on(Ie.LOADING_COMPLETE,pe.bind(this)),m.on(Ie.RECOVERED_EARLY_EOF,be.bind(this)),m.on(Ie.MEDIA_INFO,rt.bind(this)),m.on(Ie.METADATA_ARRIVED,ut.bind(this)),m.on(Ie.SCRIPTDATA_ARRIVED,_t.bind(this)),m.on(Ie.STATISTICS_INFO,Ut.bind(this)),m.on(Ie.RECOMMEND_SEEKPOINT,Gt.bind(this));break;case"destroy":m&&(m.destroy(),m=null),Ne.postMessage({msg:"destroyed"});break;case"start":m.start();break;case"stop":m.stop();break;case"seek":m.seek(tt.data.param);break;case"pause":m.pause();break;case"resume":m.resume();break;case"logging_config":{let ze=tt.data.param;Xe.applyConfig(ze),ze.enableCallback===!0?Xe.addLogListener(y):Xe.removeLogListener(y);break}}});function k(tt,ze){let Ve={msg:Ie.INIT_SEGMENT,data:{type:tt,data:ze}};Ne.postMessage(Ve,[ze.data])}function W(tt,ze){let Ve={msg:Ie.MEDIA_SEGMENT,data:{type:tt,data:ze}};Ne.postMessage(Ve,[ze.data])}function pe(){let tt={msg:Ie.LOADING_COMPLETE};Ne.postMessage(tt)}function be(){let tt={msg:Ie.RECOVERED_EARLY_EOF};Ne.postMessage(tt)}function rt(tt){let ze={msg:Ie.MEDIA_INFO,data:tt};Ne.postMessage(ze)}function ut(tt){let ze={msg:Ie.METADATA_ARRIVED,data:tt};Ne.postMessage(ze)}function _t(tt){let ze={msg:Ie.SCRIPTDATA_ARRIVED,data:tt};Ne.postMessage(ze)}function Ut(tt){let ze={msg:Ie.STATISTICS_INFO,data:tt};Ne.postMessage(ze)}function zt(tt,ze){Ne.postMessage({msg:Ie.IO_ERROR,data:{type:tt,info:ze}})}function Tt(tt,ze){Ne.postMessage({msg:Ie.DEMUX_ERROR,data:{type:tt,info:ze}})}function Gt(tt){Ne.postMessage({msg:Ie.RECOMMEND_SEEKPOINT,data:tt})}function Pt(tt,ze){Ne.postMessage({msg:"logcat_callback",data:{type:tt,logcat:ze}})}};class Zt{constructor(h,m){if(this.TAG="Transmuxer",this._emitter=new(he()),m.enableWorker&&typeof Worker!="undefined")try{let y=K(82059);this._worker=y(Mt),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)},Xe.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:Xe.getConfig()})}catch(y){p.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new Kt(h,m)}else this._controller=new Kt(h,m);if(this._controller){let y=this._controller;y.on(Ie.IO_ERROR,this._onIOError.bind(this)),y.on(Ie.DEMUX_ERROR,this._onDemuxError.bind(this)),y.on(Ie.INIT_SEGMENT,this._onInitSegment.bind(this)),y.on(Ie.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),y.on(Ie.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),y.on(Ie.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),y.on(Ie.MEDIA_INFO,this._onMediaInfo.bind(this)),y.on(Ie.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),y.on(Ie.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),y.on(Ie.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),y.on(Ie.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),Xe.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(Ie.INIT_SEGMENT,h,m)})}_onMediaSegment(h,m){Promise.resolve().then(()=>{this._emitter.emit(Ie.MEDIA_SEGMENT,h,m)})}_onLoadingComplete(){Promise.resolve().then(()=>{this._emitter.emit(Ie.LOADING_COMPLETE)})}_onRecoveredEarlyEof(){Promise.resolve().then(()=>{this._emitter.emit(Ie.RECOVERED_EARLY_EOF)})}_onMediaInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Ie.MEDIA_INFO,h)})}_onMetaDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Ie.METADATA_ARRIVED,h)})}_onScriptDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Ie.SCRIPTDATA_ARRIVED,h)})}_onStatisticsInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Ie.STATISTICS_INFO,h)})}_onIOError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Ie.IO_ERROR,h,m)})}_onDemuxError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Ie.DEMUX_ERROR,h,m)})}_onRecommendSeekpoint(h){Promise.resolve().then(()=>{this._emitter.emit(Ie.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 Ie.INIT_SEGMENT:case Ie.MEDIA_SEGMENT:this._emitter.emit(m.msg,y.type,y.data);break;case Ie.LOADING_COMPLETE:case Ie.RECOVERED_EARLY_EOF:this._emitter.emit(m.msg);break;case Ie.MEDIA_INFO:Object.setPrototypeOf(y,$t.prototype),this._emitter.emit(m.msg,y);break;case Ie.METADATA_ARRIVED:case Ie.SCRIPTDATA_ARRIVED:case Ie.STATISTICS_INFO:this._emitter.emit(m.msg,y);break;case Ie.IO_ERROR:case Ie.DEMUX_ERROR:this._emitter.emit(m.msg,y.type,y.info);break;case Ie.RECOMMEND_SEEKPOINT:this._emitter.emit(m.msg,y);break;case"logcat_callback":p.emitter.emit("log",y.type,y.logcat);break;default:break}}}var ii=Zt,Ft={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};class ri{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 We}destroy(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}on(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaSource)throw new X("MediaSource has been attached to an HTMLMediaElement!");let m=this._mediaSource=new window.MediaSource;m.addEventListener("sourceopen",this.e.onSourceOpen),m.addEventListener("sourceended",this.e.onSourceEnded),m.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=h,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),h.src=this._mediaSourceObjectURL}detachMediaElement(){if(this._mediaSource){let h=this._mediaSource;for(let m in this._sourceBuffers){let y=this._pendingSegments[m];y.splice(0,y.length),this._pendingSegments[m]=null,this._pendingRemoveRanges[m]=null,this._lastInitSegments[m]=null;let k=this._sourceBuffers[m];if(k){if(h.readyState!=="closed"){try{h.removeSourceBuffer(k)}catch(W){p.e(this.TAG,W.message)}k.removeEventListener("error",this.e.onSourceBufferError),k.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[m]=null,this._sourceBuffers[m]=null}}if(h.readyState==="open")try{h.endOfStream()}catch(m){p.e(this.TAG,m.message)}h.removeEventListener("sourceopen",this.e.onSourceOpen),h.removeEventListener("sourceended",this.e.onSourceEnded),h.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}appendInitSegment(h,m){if(!this._mediaSource||this._mediaSource.readyState!=="open"){this._pendingSourceBufferInit.push(h),this._pendingSegments[h.type].push(h);return}let y=h,k=`${y.container}`;y.codec&&y.codec.length>0&&(k+=`;codecs=${y.codec}`);let W=!1;if(p.v(this.TAG,"Received Initialization Segment, mimeType: "+k),this._lastInitSegments[y.type]=y,k!==this._mimeTypes[y.type]){if(this._mimeTypes[y.type])p.v(this.TAG,`Notice: ${y.type} mimeType changed, origin: ${this._mimeTypes[y.type]}, target: ${k}`);else{W=!0;try{let pe=this._sourceBuffers[y.type]=this._mediaSource.addSourceBuffer(k);pe.addEventListener("error",this.e.onSourceBufferError),pe.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(pe){p.e(this.TAG,pe.message),this._emitter.emit(Ft.ERROR,{code:pe.code,msg:pe.message});return}}this._mimeTypes[y.type]=k}m||this._pendingSegments[y.type].push(y),W||this._sourceBuffers[y.type]&&!this._sourceBuffers[y.type].updating&&this._doAppendSegments(),V.safari&&y.container==="audio/mpeg"&&y.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=y.mediaDuration/1e3,this._updateMediaSourceDuration())}appendMediaSegment(h){let m=h;this._pendingSegments[m.type].push(m),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();let y=this._sourceBuffers[m.type];y&&!y.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()}seek(h){for(let m in this._sourceBuffers){if(!this._sourceBuffers[m])continue;let y=this._sourceBuffers[m];if(this._mediaSource.readyState==="open")try{y.abort()}catch(W){p.e(this.TAG,W.message)}this._idrList.clear();let k=this._pendingSegments[m];if(k.splice(0,k.length),this._mediaSource.readyState!=="closed"){for(let W=0;W<y.buffered.length;W++){let pe=y.buffered.start(W),be=y.buffered.end(W);this._pendingRemoveRanges[m].push({start:pe,end:be})}if(y.updating||this._doRemoveRanges(),V.safari){let W=this._lastInitSegments[m];W&&(this._pendingSegments[m].push(W),y.updating||this._doAppendSegments())}}}}endOfStream(){let h=this._mediaSource,m=this._sourceBuffers;if(!h||h.readyState!=="open"){h&&h.readyState==="closed"&&this._hasPendingSegments()&&(this._hasPendingEos=!0);return}m.video&&m.video.updating||m.audio&&m.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,h.endOfStream())}getNearestKeyframe(h){return this._idrList.getLastSyncPointBeforeDts(h)}_needCleanupSourceBuffer(){if(!this._config.autoCleanupSourceBuffer)return!1;let h=this._mediaElement.currentTime;for(let m in this._sourceBuffers){let y=this._sourceBuffers[m];if(y){let k=y.buffered;if(k.length>=1&&h-k.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}_doCleanupSourceBuffer(){let h=this._mediaElement.currentTime;for(let m in this._sourceBuffers){let y=this._sourceBuffers[m];if(y){let k=y.buffered,W=!1;for(let pe=0;pe<k.length;pe++){let be=k.start(pe),rt=k.end(pe);if(be<=h&&h<rt+3){if(h-be>=this._config.autoCleanupMaxBackwardDuration){W=!0;let ut=h-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[m].push({start:be,end:ut})}}else rt<h&&(W=!0,this._pendingRemoveRanges[m].push({start:be,end:rt}))}W&&!y.updating&&this._doRemoveRanges()}}}_updateMediaSourceDuration(){let h=this._sourceBuffers;if(this._mediaElement.readyState===0||this._mediaSource.readyState!=="open"||h.video&&h.video.updating||h.audio&&h.audio.updating)return;let m=this._mediaSource.duration,y=this._pendingMediaDuration;y>0&&(isNaN(m)||y>m)&&(p.v(this.TAG,`Update MediaSource duration from ${m} to ${y}`),this._mediaSource.duration=y),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}_doRemoveRanges(){for(let h in this._pendingRemoveRanges){if(!this._sourceBuffers[h]||this._sourceBuffers[h].updating)continue;let m=this._sourceBuffers[h],y=this._pendingRemoveRanges[h];for(;y.length&&!m.updating;){let k=y.shift();m.remove(k.start,k.end)}}}_doAppendSegments(){let h=this._pendingSegments;for(let m in h)if(!(!this._sourceBuffers[m]||this._sourceBuffers[m].updating)&&h[m].length>0){let y=h[m].shift();if(y.timestampOffset){let k=this._sourceBuffers[m].timestampOffset,W=y.timestampOffset/1e3;Math.abs(k-W)>.1&&(p.v(this.TAG,`Update MPEG audio timestampOffset from ${k} to ${W}`),this._sourceBuffers[m].timestampOffset=W),delete y.timestampOffset}if(!y.data||y.data.byteLength===0)continue;try{this._sourceBuffers[m].appendBuffer(y.data),this._isBufferFull=!1,m==="video"&&y.hasOwnProperty("info")&&this._idrList.appendArray(y.info.syncPoints)}catch(k){this._pendingSegments[m].unshift(y),k.code===22?(this._isBufferFull||this._emitter.emit(Ft.BUFFER_FULL),this._isBufferFull=!0):(p.e(this.TAG,k.message),this._emitter.emit(Ft.ERROR,{code:k.code,msg:k.message}))}}}_onSourceOpen(){if(p.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0){let h=this._pendingSourceBufferInit;for(;h.length;){let m=h.shift();this.appendInitSegment(m,!0)}}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(Ft.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(Ft.UPDATE_END)}_onSourceBufferError(h){p.e(this.TAG,`SourceBuffer Error: ${h}`)}}var St=ri;const ft={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},gt={NETWORK_EXCEPTION:E.EXCEPTION,NETWORK_STATUS_CODE_INVALID:E.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:E.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:E.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:Oe.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:Oe.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:Oe.CODEC_UNSUPPORTED};class Ht{constructor(h,m){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(he()),this._config=S(),typeof m=="object"&&Object.assign(this._config,m),h.type.toLowerCase()!=="flv")throw new P("FlvPlayer requires an flv MediaDataSource input!");h.isLive===!0&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=h,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;let y=V.chrome&&(V.version.major<50||V.version.major===50&&V.version.build<2661);this._alwaysSeekKeyframe=!!(y||V.msedge||V.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}destroy(){this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(h,m){h===xe.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(xe.MEDIA_INFO,this.mediaInfo)}):h===xe.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(xe.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 St(this._config),this._msectl.on(Ft.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(Ft.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(Ft.SOURCE_OPEN,()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())}),this._msectl.on(Ft.ERROR,m=>{this._emitter.emit(xe.ERROR,ft.MEDIA_ERROR,gt.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 ii(this._mediaDataSource,this._config),this._transmuxer.on(Ie.INIT_SEGMENT,(h,m)=>{this._msectl.appendInitSegment(m)}),this._transmuxer.on(Ie.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(Ie.LOADING_COMPLETE,()=>{this._msectl.endOfStream(),this._emitter.emit(xe.LOADING_COMPLETE)}),this._transmuxer.on(Ie.RECOVERED_EARLY_EOF,()=>{this._emitter.emit(xe.RECOVERED_EARLY_EOF)}),this._transmuxer.on(Ie.IO_ERROR,(h,m)=>{this._emitter.emit(xe.ERROR,ft.NETWORK_ERROR,h,m)}),this._transmuxer.on(Ie.DEMUX_ERROR,(h,m)=>{this._emitter.emit(xe.ERROR,ft.MEDIA_ERROR,h,{code:-1,msg:m})}),this._transmuxer.on(Ie.MEDIA_INFO,h=>{this._mediaInfo=h,this._emitter.emit(xe.MEDIA_INFO,Object.assign({},h))}),this._transmuxer.on(Ie.METADATA_ARRIVED,h=>{this._emitter.emit(xe.METADATA_ARRIVED,h)}),this._transmuxer.on(Ie.SCRIPTDATA_ARRIVED,h=>{this._emitter.emit(xe.SCRIPTDATA_ARRIVED,h)}),this._transmuxer.on(Ie.STATISTICS_INFO,h=>{this._statisticsInfo=this._fillStatisticsInfo(h),this._emitter.emit(xe.STATISTICS_INFO,Object.assign({},this._statisticsInfo))}),this._transmuxer.on(Ie.RECOMMEND_SEEKPOINT,h=>{this._mediaElement&&!this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h/1e3)}),this._transmuxer.open()}}unload(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}play(){return this._mediaElement.play()}pause(){this._mediaElement.pause()}get type(){return this._type}get buffered(){return this._mediaElement.buffered}get duration(){return this._mediaElement.duration}get volume(){return this._mediaElement.volume}set volume(h){this._mediaElement.volume=h}get muted(){return this._mediaElement.muted}set muted(h){this._mediaElement.muted=h}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(h){this._mediaElement?this._internalSeek(h):this._pendingSeekTime=h}get mediaInfo(){return Object.assign({},this._mediaInfo)}get statisticsInfo(){return this._statisticsInfo==null&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}_fillStatisticsInfo(h){if(h.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return h;let m=!0,y=0,k=0;if(this._mediaElement.getVideoPlaybackQuality){let W=this._mediaElement.getVideoPlaybackQuality();y=W.totalVideoFrames,k=W.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,k=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=k),h}_onmseUpdateEnd(){if(!this._config.lazyLoad||this._config.isLive)return;let h=this._mediaElement.buffered,m=this._mediaElement.currentTime,y=0,k=0;for(let W=0;W<h.length;W++){let pe=h.start(W),be=h.end(W);if(pe<=m&&m<be){y=pe,k=be;break}}k>=m+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(p.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}_onmseBufferFull(){p.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._progressChecker==null&&this._suspendTransmuxer()}_suspendTransmuxer(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker==null&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}_checkProgressAndResume(){let h=this._mediaElement.currentTime,m=this._mediaElement.buffered,y=!1;for(let k=0;k<m.length;k++){let W=m.start(k),pe=m.end(k);if(h>=W&&h<pe){h>=pe-this._config.lazyLoadRecoverDuration&&(y=!0);break}}y&&(window.clearInterval(this._progressChecker),this._progressChecker=null,y&&(p.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}_isTimepointBuffered(h){let m=this._mediaElement.buffered;for(let y=0;y<m.length;y++){let k=m.start(y),W=m.end(y);if(h>=k&&h<W)return!0}return!1}_internalSeek(h){let m=this._isTimepointBuffered(h),y=!1,k=0;if(h<1&&this._mediaElement.buffered.length>0){let W=this._mediaElement.buffered.start(0);(W<1&&h<W||V.safari)&&(y=!0,k=V.safari?.1:W)}if(y)this._requestSetTime=!0,this._mediaElement.currentTime=k;else if(m){if(!this._alwaysSeekKeyframe)this._requestSetTime=!0,this._mediaElement.currentTime=h;else{let W=this._msectl.getNearestKeyframe(Math.floor(h*1e3));this._requestSetTime=!0,W!=null?this._mediaElement.currentTime=W.dts/1e3:this._mediaElement.currentTime=h}this._progressChecker!=null&&this._checkProgressAndResume()}else this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(h),this._transmuxer.seek(Math.floor(h*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h)}_checkAndApplyUnbufferedSeekpoint(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){let h=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(h)||(this._progressChecker!=null&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(h),this._transmuxer.seek(Math.floor(h*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_checkAndResumeStuckPlayback(h){let m=this._mediaElement;if(h||!this._receivedCanPlay||m.readyState<2){let y=m.buffered;y.length>0&&m.currentTime<y.start(0)&&(p.w(this.TAG,`Playback seems stuck at ${m.currentTime}, seek to ${y.start(0)}`),this._requestSetTime=!0,this._mediaElement.currentTime=y.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}_onvLoadedMetadata(h){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}_onvSeeking(h){let m=this._mediaElement.currentTime,y=this._mediaElement.buffered;if(this._requestSetTime){this._requestSetTime=!1;return}if(m<1&&y.length>0){let k=y.start(0);if(k<1&&m<k||V.safari){this._requestSetTime=!0,this._mediaElement.currentTime=V.safari?.1:k;return}}if(this._isTimepointBuffered(m)){if(this._alwaysSeekKeyframe){let k=this._msectl.getNearestKeyframe(Math.floor(m*1e3));k!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=k.dts/1e3)}this._progressChecker!=null&&this._checkProgressAndResume();return}this._seekpointRecord={seekPoint:m,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_onvCanPlay(h){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}_onvStalled(h){this._checkAndResumeStuckPlayback(!0)}_onvProgress(h){this._checkAndResumeStuckPlayback()}}var pt=Ht;class dt{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===xe.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(xe.MEDIA_INFO,this.mediaInfo)}):h===xe.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(xe.STATISTICS_INFO,this.statisticsInfo)}),this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaElement=h,h.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{h.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(m){}}detachMediaElement(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}load(){if(!this._mediaElement)throw new X("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}unload(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}play(){return this._mediaElement.play()}pause(){this._mediaElement.pause()}get type(){return this._type}get buffered(){return this._mediaElement.buffered}get duration(){return this._mediaElement.duration}get volume(){return this._mediaElement.volume}set volume(h){this._mediaElement.volume=h}get muted(){return this._mediaElement.muted}set muted(h){this._mediaElement.muted=h}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(h){this._mediaElement?this._mediaElement.currentTime=h:this._pendingSeekTime=h}get mediaInfo(){let m={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(m.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(m.width=this._mediaElement.videoWidth,m.height=this._mediaElement.videoHeight)),m}get statisticsInfo(){let h={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return h;let m=!0,y=0,k=0;if(this._mediaElement.getVideoPlaybackQuality){let W=this._mediaElement.getVideoPlaybackQuality();y=W.totalVideoFrames,k=W.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,k=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=k),h}_onvLoadedMetadata(h){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(xe.MEDIA_INFO,this.mediaInfo)}_reportStatisticsInfo(){this._emitter.emit(xe.STATISTICS_INFO,this.statisticsInfo)}}var vt=dt;de.install();function Bt(Ne,h){let m=Ne;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 pt(m,h);default:return new vt(m,h)}}function ai(){return Y.supportMSEH264Playback()}function xt(){return Y.getFeatureList()}let Xt={};Xt.createPlayer=Bt,Xt.isSupported=ai,Xt.getFeatureList=xt,Xt.BaseLoader=A,Xt.LoaderStatus=_,Xt.LoaderErrors=E,Xt.Events=xe,Xt.ErrorTypes=ft,Xt.ErrorDetails=gt,Xt.FlvPlayer=pt,Xt.NativePlayer=vt,Xt.LoggingControl=Xe,Object.defineProperty(Xt,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var Lt=Xt},25769:function(Yt,st,K){"use strict";var U=K(98040),de={"text/plain":"Text","text/html":"Url",default:"Text"},Se="Copy to clipboard: #{key}, Enter";function he(p){var me=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,me)}function j(p,me){var ce,l,X,P,g,_,E=!1;me||(me={}),ce=me.debug||!1;try{X=U(),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(B){if(B.stopPropagation(),me.format)if(B.preventDefault(),typeof B.clipboardData=="undefined"){ce&&console.warn("unable to use e.clipboardData"),ce&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var H=de[me.format]||de.default;window.clipboardData.setData(H,p)}else B.clipboardData.clearData(),B.clipboardData.setData(me.format,p);me.onCopy&&(B.preventDefault(),me.onCopy(B.clipboardData))}),document.body.appendChild(_),P.selectNodeContents(_),g.addRange(P);var A=document.execCommand("copy");if(!A)throw new Error("copy command was unsuccessful");E=!0}catch(B){ce&&console.error("unable to copy using execCommand: ",B),ce&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(me.format||"text",p),me.onCopy&&me.onCopy(window.clipboardData),E=!0}catch(H){ce&&console.error("unable to copy using clipboardData: ",H),ce&&console.error("falling back to prompt"),l=he("message"in me?me.message:Se),window.prompt(l,p)}}finally{g&&(typeof g.removeRange=="function"?g.removeRange(P):g.removeAllRanges()),_&&document.body.removeChild(_),X()}return E}Yt.exports=j},3867:function(Yt,st,K){var U=K(97671);(function(de,Se){Yt.exports=Se()})(this,function(){"use strict";function de(O){var Q=typeof O;return O!==null&&(Q==="object"||Q==="function")}function Se(O){return typeof O=="function"}var he=void 0;Array.isArray?he=Array.isArray:he=function(O){return Object.prototype.toString.call(O)==="[object Array]"};var j=he,p=0,me=void 0,ce=void 0,l=function(Q,z){R[p]=Q,R[p+1]=z,p+=2,p===2&&(ce?ce(q):ee())};function X(O){ce=O}function P(O){l=O}var g=typeof window!="undefined"?window:void 0,_=g||{},E=_.MutationObserver||_.WebKitMutationObserver,A=typeof self=="undefined"&&typeof U!="undefined"&&{}.toString.call(U)==="[object process]",B=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function H(){return function(){return U.nextTick(q)}}function V(){return typeof me!="undefined"?function(){me(q)}:w()}function L(){var O=0,Q=new E(q),z=document.createTextNode("");return Q.observe(z,{characterData:!0}),function(){z.data=O=++O%2}}function I(){var O=new MessageChannel;return O.port1.onmessage=q,function(){return O.port2.postMessage(0)}}function w(){var O=setTimeout;return function(){return O(q,1)}}var R=new Array(1e3);function q(){for(var O=0;O<p;O+=2){var Q=R[O],z=R[O+1];Q(z),R[O]=void 0,R[O+1]=void 0}p=0}function ne(){try{var O=Function("return this")().require("vertx");return me=O.runOnLoop||O.runOnContext,V()}catch(Q){return w()}}var ee=void 0;A?ee=H():E?ee=L():B?ee=I():g===void 0?ee=ne():ee=w();function ye(O,Q){var z=this,N=new this.constructor($e);N[Te]===void 0&&ht(N);var Z=z._state;if(Z){var re=arguments[Z-1];l(function(){return ti(Z,N,re,z._result)})}else yt(z,N,O,Q);return N}function Le(O){var Q=this;if(O&&typeof O=="object"&&O.constructor===Q)return O;var z=new Q($e);return ae(z,O),z}var Te=Math.random().toString(36).substring(2);function $e(){}var J=void 0,D=1,F=2;function M(){return new TypeError("You cannot resolve a promise with itself")}function oe(){return new TypeError("A promises callback cannot return that same promise.")}function te(O,Q,z,N){try{O.call(Q,z,N)}catch(Z){return Z}}function S(O,Q,z){l(function(N){var Z=!1,re=te(z,Q,function(le){Z||(Z=!0,Q!==le?ae(N,le):Fe(N,le))},function(le){Z||(Z=!0,Xe(N,le))},"Settle: "+(N._label||" unknown promise"));!Z&&re&&(Z=!0,Xe(N,re))},O)}function v(O,Q){Q._state===D?Fe(O,Q._result):Q._state===F?Xe(O,Q._result):yt(Q,void 0,function(z){return ae(O,z)},function(z){return Xe(O,z)})}function Y(O,Q,z){Q.constructor===O.constructor&&z===ye&&Q.constructor.resolve===Le?v(O,Q):z===void 0?Fe(O,Q):Se(z)?S(O,Q,z):Fe(O,Q)}function ae(O,Q){if(O===Q)Xe(O,M());else if(de(Q)){var z=void 0;try{z=Q.then}catch(N){Xe(O,N);return}Y(O,Q,z)}else Fe(O,Q)}function xe(O){O._onerror&&O._onerror(O._result),$t(O)}function Fe(O,Q){O._state===J&&(O._result=Q,O._state=D,O._subscribers.length!==0&&l($t,O))}function Xe(O,Q){O._state===J&&(O._state=F,O._result=Q,l(xe,O))}function yt(O,Q,z,N){var Z=O._subscribers,re=Z.length;O._onerror=null,Z[re]=Q,Z[re+D]=z,Z[re+F]=N,re===0&&O._state&&l($t,O)}function $t(O){var Q=O._subscribers,z=O._state;if(Q.length!==0){for(var N=void 0,Z=void 0,re=O._result,le=0;le<Q.length;le+=3)N=Q[le],Z=Q[le+z],N?ti(z,N,Z,re):Z(re);O._subscribers.length=0}}function ti(O,Q,z,N){var Z=Se(z),re=void 0,le=void 0,_e=!0;if(Z){try{re=z(N)}catch(Ae){_e=!1,le=Ae}if(Q===re){Xe(Q,oe());return}}else re=N;Q._state!==J||(Z&&_e?ae(Q,re):_e===!1?Xe(Q,le):O===D?Fe(Q,re):O===F&&Xe(Q,re))}function je(O,Q){try{Q(function(N){ae(O,N)},function(N){Xe(O,N)})}catch(z){Xe(O,z)}}var mt=0;function Wt(){return mt++}function ht(O){O[Te]=mt++,O._state=void 0,O._result=void 0,O._subscribers=[]}function li(){return new Error("Array Methods must be provided an Array")}var Ge=function(){function O(Q,z){this._instanceConstructor=Q,this.promise=new Q($e),this.promise[Te]||ht(this.promise),j(z)?(this.length=z.length,this._remaining=z.length,this._result=new Array(this.length),this.length===0?Fe(this.promise,this._result):(this.length=this.length||0,this._enumerate(z),this._remaining===0&&Fe(this.promise,this._result))):Xe(this.promise,li())}return O.prototype._enumerate=function(z){for(var N=0;this._state===J&&N<z.length;N++)this._eachEntry(z[N],N)},O.prototype._eachEntry=function(z,N){var Z=this._instanceConstructor,re=Z.resolve;if(re===Le){var le=void 0,_e=void 0,Ae=!1;try{le=z.then}catch(He){Ae=!0,_e=He}if(le===ye&&z._state!==J)this._settledAt(z._state,N,z._result);else if(typeof le!="function")this._remaining--,this._result[N]=z;else if(Z===ie){var We=new Z($e);Ae?Xe(We,_e):Y(We,z,le),this._willSettleAt(We,N)}else this._willSettleAt(new Z(function(He){return He(z)}),N)}else this._willSettleAt(re(z),N)},O.prototype._settledAt=function(z,N,Z){var re=this.promise;re._state===J&&(this._remaining--,z===F?Xe(re,Z):this._result[N]=Z),this._remaining===0&&Fe(re,this._result)},O.prototype._willSettleAt=function(z,N){var Z=this;yt(z,void 0,function(re){return Z._settledAt(D,N,re)},function(re){return Z._settledAt(F,N,re)})},O}();function ve(O){return new Ge(this,O).promise}function we(O){var Q=this;return j(O)?new Q(function(z,N){for(var Z=O.length,re=0;re<Z;re++)Q.resolve(O[re]).then(z,N)}):new Q(function(z,N){return N(new TypeError("You must pass an array to race."))})}function se(O){var Q=this,z=new Q($e);return Xe(z,O),z}function Re(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Oe(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var ie=function(){function O(Q){this[Te]=Wt(),this._result=this._state=void 0,this._subscribers=[],$e!==Q&&(typeof Q!="function"&&Re(),this instanceof O?je(this,Q):Oe())}return O.prototype.catch=function(z){return this.then(null,z)},O.prototype.finally=function(z){var N=this,Z=N.constructor;return Se(z)?N.then(function(re){return Z.resolve(z()).then(function(){return re})},function(re){return Z.resolve(z()).then(function(){throw re})}):N.then(z,z)},O}();ie.prototype.then=ye,ie.all=ve,ie.race=we,ie.resolve=Le,ie.reject=se,ie._setScheduler=X,ie._setAsap=P,ie._asap=l;function C(){var O=void 0;if(typeof K.g!="undefined")O=K.g;else if(typeof self!="undefined")O=self;else try{O=Function("return this")()}catch(N){throw new Error("polyfill failed because global object is unavailable in this environment")}var Q=O.Promise;if(Q){var z=null;try{z=Object.prototype.toString.call(Q.resolve())}catch(N){}if(z==="[object Promise]"&&!Q.cast)return}O.Promise=ie}return ie.polyfill=C,ie.Promise=ie,ie})},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)},U;st&&typeof st.ownKeys=="function"?U=st.ownKeys:Object.getOwnPropertySymbols?U=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:U=function(I){return Object.getOwnPropertyNames(I)};function de(L){console&&console.warn&&console.warn(L)}var Se=Number.isNaN||function(I){return I!==I};function he(){he.init.call(this)}Yt.exports=he,Yt.exports.once=B,he.EventEmitter=he,he.prototype._events=void 0,he.prototype._eventsCount=0,he.prototype._maxListeners=void 0;var j=10;function p(L){if(typeof L!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof L)}Object.defineProperty(he,"defaultMaxListeners",{enumerable:!0,get:function(){return j},set:function(L){if(typeof L!="number"||L<0||Se(L))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+L+".");j=L}}),he.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},he.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||Se(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function me(L){return L._maxListeners===void 0?he.defaultMaxListeners:L._maxListeners}he.prototype.getMaxListeners=function(){return me(this)},he.prototype.emit=function(I){for(var w=[],R=1;R<arguments.length;R++)w.push(arguments[R]);var q=I==="error",ne=this._events;if(ne!==void 0)q=q&&ne.error===void 0;else if(!q)return!1;if(q){var ee;if(w.length>0&&(ee=w[0]),ee instanceof Error)throw ee;var ye=new Error("Unhandled error."+(ee?" ("+ee.message+")":""));throw ye.context=ee,ye}var Le=ne[I];if(Le===void 0)return!1;if(typeof Le=="function")K(Le,this,w);else for(var Te=Le.length,$e=_(Le,Te),R=0;R<Te;++R)K($e[R],this,w);return!0};function ce(L,I,w,R){var q,ne,ee;if(p(w),ne=L._events,ne===void 0?(ne=L._events=Object.create(null),L._eventsCount=0):(ne.newListener!==void 0&&(L.emit("newListener",I,w.listener?w.listener:w),ne=L._events),ee=ne[I]),ee===void 0)ee=ne[I]=w,++L._eventsCount;else if(typeof ee=="function"?ee=ne[I]=R?[w,ee]:[ee,w]:R?ee.unshift(w):ee.push(w),q=me(L),q>0&&ee.length>q&&!ee.warned){ee.warned=!0;var ye=new Error("Possible EventEmitter memory leak detected. "+ee.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");ye.name="MaxListenersExceededWarning",ye.emitter=L,ye.type=I,ye.count=ee.length,de(ye)}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,ne,ee,ye;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(ne=-1,ee=R.length-1;ee>=0;ee--)if(R[ee]===w||R[ee].listener===w){ye=R[ee].listener,ne=ee;break}if(ne<0)return this;ne===0?R.shift():E(R,ne),R.length===1&&(q[I]=R[0]),q.removeListener!==void 0&&this.emit("removeListener",I,ye||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 ne=Object.keys(R),ee;for(q=0;q<ne.length;++q)ee=ne[q],ee!=="removeListener"&&this.removeAllListeners(ee);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?U(this._events):[]};function _(L,I){for(var w=new Array(I),R=0;R<I;++R)w[R]=L[R];return w}function E(L,I){for(;I+1<L.length;I++)L[I]=L[I+1];L.pop()}function A(L){for(var I=new Array(L.length),w=0;w<I.length;++w)I[w]=L[w].listener||L[w];return I}function B(L,I){return new Promise(function(w,R){function q(ee){L.removeListener(I,ne),R(ee)}function ne(){typeof L.removeListener=="function"&&L.removeListener("error",q),w([].slice.call(arguments))}V(L,I,ne,{once:!0}),I!=="error"&&H(L,q,{once:!0})})}function H(L,I,w){typeof L.on=="function"&&V(L,"error",I,w)}function V(L,I,w,R){if(typeof L.on=="function")R.once?L.once(I,w):L.on(I,w);else if(typeof L.addEventListener=="function")L.addEventListener(I,function q(ne){R.once&&L.removeEventListener(I,q),w(ne)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof L)}},24334:function(Yt,st,K){var U,de;(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,j="2.6.4",p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",me=function(D){for(var F={},M=0,oe=D.length;M<oe;M++)F[D.charAt(M)]=M;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],M=D.charCodeAt(0)<<16|(D.length>1?D.charCodeAt(1):0)<<8|(D.length>2?D.charCodeAt(2):0),oe=[p.charAt(M>>>18),p.charAt(M>>>12&63),F>=2?"=":p.charAt(M>>>6&63),F>=1?"=":p.charAt(M&63)];return oe.join("")},_=Se.btoa&&typeof Se.btoa=="function"?function(D){return Se.btoa(D)}:function(D){if(D.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return D.replace(/[\s\S]{1,3}/g,g)},E=function(D){return _(P(String(D)))},A=function(D){return D.replace(/[+\/]/g,function(F){return F=="+"?"-":"_"}).replace(/=/g,"")},B=function(D,F){return F?A(E(D)):E(D)},H=function(D){return B(D,!0)},V;Se.Uint8Array&&(V=function(D,F){for(var M="",oe=0,te=D.length;oe<te;oe+=3){var S=D[oe],v=D[oe+1],Y=D[oe+2],ae=S<<16|v<<8|Y;M+=p.charAt(ae>>>18)+p.charAt(ae>>>12&63)+(typeof v!="undefined"?p.charAt(ae>>>6&63):"=")+(typeof Y!="undefined"?p.charAt(ae&63):"=")}return F?A(M):M});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),M=F-65536;return ce((M>>>10)+55296)+ce((M&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,M=F%4,oe=(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(oe>>>16),ce(oe>>>8&255),ce(oe&255)];return te.length-=[0,0,2,1][M],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)},ne=function(D){return q(String(D).replace(/[^A-Za-z0-9\+\/]/g,""))},ee=function(D){return w(q(D))},ye=function(D){return String(D).replace(/[-_]/g,function(F){return F=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},Le=function(D){return ee(ye(D))},Te;Se.Uint8Array&&(Te=function(D){return Uint8Array.from(ne(ye(D)),function(F){return F.charCodeAt(0)})});var $e=function(){var D=Se.Base64;return Se.Base64=he,D};if(Se.Base64={VERSION:j,atob:ne,btoa:_,fromBase64:Le,toBase64:B,utob:P,encode:B,encodeURI:H,btou:w,decode:Le,noConflict:$e,fromUint8Array:V,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 Le(this)})),Object.defineProperty(String.prototype,"toBase64",J(function(D){return B(this,D)})),Object.defineProperty(String.prototype,"toBase64URI",J(function(){return B(this,!0)}))}}return Se.Meteor&&(Base64=Se.Base64),Yt.exports?Yt.exports.Base64=Se.Base64:(U=[],de=function(){return Se.Base64}.apply(st,U),de!==void 0&&(Yt.exports=de)),{Base64:Se.Base64}})},53184:function(Yt,st,K){"use strict";var U,de;function Se(he,j,p){var me=function(ce,l){return he.js_beautify(ce,l)};return me.js=he.js_beautify,me.css=j.css_beautify,me.html=p.html_beautify,me.js_beautify=he.js_beautify,me.css_beautify=j.css_beautify,me.html_beautify=p.html_beautify,me}U=[K(58553),K(87804),K(40998)],de=function(he,j,p){return Se(he,j,p)}.apply(st,U),de!==void 0&&(Yt.exports=de)},87804:function(Yt,st){var K,U;(function(){var de;(function(){"use strict";var he=[,,function(ce){function l(g){this.__parent=g,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var _=this.__items.length-1;_>=0;_--)if(this.__items[_].match(g))return!0;return!1},l.prototype.set_indent=function(g,_){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=_||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},l.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(g){this.__items.push(g);var _=g.lastIndexOf(`
`);_!==-1?this.__character_count=g.length-_:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function X(g,_){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),_=_||"",g.indent_level>0&&(_=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=_,this.__base_string_length=_.length}X.prototype.get_indent_size=function(g,_){var E=this.__base_string_length;return _=_||0,g<0&&(E=0),E+=g*this.__indent_size,E+=_,E},X.prototype.get_indent_string=function(g,_){var E=this.__base_string;return _=_||0,g<0&&(g=0,E=""),_+=g*this.__indent_size,this.__ensure_cache(_),E+=this.__cache[_],E},X.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},X.prototype.__add_column=function(){var g=this.__cache.length,_=0,E="";this.__indent_size&&g>=this.__indent_size&&(_=Math.floor(g/this.__indent_size),g-=_*this.__indent_size,E=new Array(_+1).join(this.__indent_string)),g&&(E+=new Array(g+1).join(" ")),this.__cache.push(E)};function P(g,_){this.__indent_cache=new X(g,_),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}P.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},P.prototype.get_line_number=function(){return this.__lines.length},P.prototype.get_indent_string=function(g,_){return this.__indent_cache.get_indent_string(g,_)},P.prototype.get_indent_size=function(g,_){return this.__indent_cache.get_indent_size(g,_)},P.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},P.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},P.prototype.get_code=function(g){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var E=this.__lines.join(`
`);return g!==`
`&&(E=E.replace(/[\n]/g,g)),E},P.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},P.prototype.set_indent=function(g,_){return g=g||0,_=_||0,this.next_line.set_indent(g,_),this.__lines.length>1?(this.current_line.set_indent(g,_),!0):(this.current_line.set_indent(),!1)},P.prototype.add_raw_token=function(g){for(var _=0;_<g.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},P.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},P.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},P.prototype.remove_indent=function(g){for(var _=this.__lines.length;g<_;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},P.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},P.prototype.just_added_newline=function(){return this.current_line.is_empty()},P.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},P.prototype.ensure_empty_line_above=function(g,_){for(var E=this.__lines.length-2;E>=0;){var A=this.__lines[E];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==_){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},ce.exports.Output=P},,,,function(ce){function l(g,_){this.raw_options=X(g,_),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(g,_){var E=this.raw_options[g],A=_||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(A=E.concat()):typeof E=="string"&&(A=E.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,_){var E=this.raw_options[g],A=E===void 0?!!_:!!E;return A},l.prototype._get_characters=function(g,_){var E=this.raw_options[g],A=_||"";return typeof E=="string"&&(A=E.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,_){var E=this.raw_options[g];_=parseInt(_,10),isNaN(_)&&(_=0);var A=parseInt(E,10);return isNaN(A)&&(A=_),A},l.prototype._get_selection=function(g,_,E){var A=this._get_selection_list(g,_,E);if(A.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A[0]},l.prototype._get_selection_list=function(g,_,E){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[_[0]],!this._is_valid_selection(E,_))throw new Error("Invalid Default Value!");var A=this._get_array(g,E);if(!this._is_valid_selection(A,_))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A},l.prototype._is_valid_selection=function(g,_){return g.length&&_.length&&!g.some(function(E){return _.indexOf(E)===-1})};function X(g,_){var E={};g=P(g);var A;for(A in g)A!==_&&(E[A]=g[A]);if(_&&g[_])for(A in g[_])E[A]=g[_][A];return E}function P(g){var _={},E;for(E in g){var A=E.replace(/-/g,"_");_[A]=g[E]}return _}ce.exports.Options=l,ce.exports.normalizeOpts=P,ce.exports.mergeOpts=X},,function(ce){var l=RegExp.prototype.hasOwnProperty("sticky");function X(P){this.__input=P||"",this.__input_length=this.__input.length,this.__position=0}X.prototype.restart=function(){this.__position=0},X.prototype.back=function(){this.__position>0&&(this.__position-=1)},X.prototype.hasNext=function(){return this.__position<this.__input_length},X.prototype.next=function(){var P=null;return this.hasNext()&&(P=this.__input.charAt(this.__position),this.__position+=1),P},X.prototype.peek=function(P){var g=null;return P=P||0,P+=this.__position,P>=0&&P<this.__input_length&&(g=this.__input.charAt(P)),g},X.prototype.__match=function(P,g){P.lastIndex=g;var _=P.exec(this.__input);return _&&!(l&&P.sticky)&&_.index!==g&&(_=null),_},X.prototype.test=function(P,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(P,g):!1},X.prototype.testChar=function(P,g){var _=this.peek(g);return P.lastIndex=0,_!==null&&P.test(_)},X.prototype.match=function(P){var g=this.__match(P,this.__position);return g?this.__position+=g[0].length:g=null,g},X.prototype.read=function(P,g,_){var E="",A;return P&&(A=this.match(P),A&&(E+=A[0])),g&&(A||!P)&&(E+=this.readUntil(g,_)),E},X.prototype.readUntil=function(P,g){var _="",E=this.__position;P.lastIndex=this.__position;var A=P.exec(this.__input);return A?(E=A.index,g&&(E+=A[0].length)):E=this.__input_length,_=this.__input.substring(this.__position,E),this.__position=E,_},X.prototype.readUntilAfter=function(P){return this.readUntil(P,!0)},X.prototype.get_regexp=function(P,g){var _=null,E="g";return g&&l&&(E="y"),typeof P=="string"&&P!==""?_=new RegExp(P,E):P&&(_=new RegExp(P.source,E)),_},X.prototype.get_literal_regexp=function(P){return RegExp(P.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},X.prototype.peekUntilAfter=function(P){var g=this.__position,_=this.readUntilAfter(P);return this.__position=g,_},X.prototype.lookBack=function(P){var g=this.__position-1;return g>=P.length&&this.__input.substring(g-P.length,g).toLowerCase()===P},ce.exports.InputScanner=X},,,,,function(ce){function l(X,P){X=typeof X=="string"?X:X.source,P=typeof P=="string"?P:P.source,this.__directives_block_pattern=new RegExp(X+/ beautify( \w+[:]\w+)+ /.source+P,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(X+/\sbeautify\signore:end\s/.source+P,"g")}l.prototype.get_directives=function(X){if(!X.match(this.__directives_block_pattern))return null;var P={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(X);g;)P[g[1]]=g[2],g=this.__directive_pattern.exec(X);return P},l.prototype.readIgnored=function(X){return X.readUntilAfter(this.__directives_end_ignore_pattern)},ce.exports.Directives=l},,function(ce,l,X){var P=X(16).Beautifier,g=X(17).Options;function _(E,A){var B=new P(E,A);return B.beautify()}ce.exports=_,ce.exports.defaultOptions=function(){return new g}},function(ce,l,X){var P=X(17).Options,g=X(2).Output,_=X(8).InputScanner,E=X(13).Directives,A=new E(/\/\*/,/\*\//),B=/\r\n|[\r\n]/,H=/\r\n|[\r\n]/g,V=/\s/,L=/(?:\s|\n)+/g,I=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function R(q,ne){this._source_text=q||"",this._options=new P(ne),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 ne="";for(this._ch=this._input.next();this._ch;){if(ne+=this._ch,this._ch==="\\")ne+=this._input.next();else if(q.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return ne},R.prototype.eatWhitespace=function(q){for(var ne=V.test(this._input.peek()),ee=0;V.test(this._input.peek());)this._ch=this._input.next(),q&&this._ch===`
`&&(ee===0||ee<this._options.max_preserve_newlines)&&(ee++,this._output.add_new_line(!0));return ne},R.prototype.foundNestedPseudoClass=function(){for(var q=0,ne=1,ee=this._input.peek(ne);ee;){if(ee==="{")return!0;if(ee==="(")q+=1;else if(ee===")"){if(q===0)return!1;q-=1}else if(ee===";"||ee==="}")return!1;ne++,ee=this._input.peek(ne)}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,ne=this._options.eol;ne==="auto"&&(ne=`
`,q&&B.test(q||"")&&(ne=q.match(B)[0])),q=q.replace(H,`
`);var ee=q.match(/^[\t ]*/)[0];this._output=new g(this._options,ee),this._input=new _(q),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ye=0,Le=!1,Te=!1,$e=!1,J=!1,D=!1,F=this._ch,M=!1,oe,te,S;oe=this._input.read(L),te=oe!=="",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),Y=A.get_directives(v);Y&&Y.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 ae=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ae.match(/[ :]$/)&&(ae=this.eatString(": ").replace(/\s+$/,""),this.print_string(ae),this._output.space_before_token=!0),ye===0&&ae.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 xe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);xe.match(/[ :]$/)&&(xe=this.eatString(": ").replace(/\s+$/,""),this.print_string(xe),this._output.space_before_token=!0),ye===0&&xe.indexOf(":")!==-1?(Te=!0,this.indent()):xe in this.NESTED_AT_RULE?(this._nestedLevel+=1,xe in this.CONDITIONAL_GROUP_RULE&&($e=!0)):ye===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,$e?($e=!1,Le=this._indentLevel>=this._nestedLevel):Le=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&Le&&this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(S==="("?this._output.space_before_token=!1:S!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),S==="{"&&this._output.trim(!0),Te&&(this.outdent(),Te=!1),this.print_string(this._ch),Le=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&this._input.peek()!=="}"&&this._output.add_new_line(!0),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var Fe=0;Fe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Fe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Fe])){M=!0;break}(Le||$e)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!J&&ye===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 Xe=S==='"'||S==="'";this.preserveSingleSpace(Xe||te),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")M=!1,ye===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(),ye++,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(")")),ye&&(ye--,this.outdent()));else{var yt=!1;this._input.lookBack("with")&&(yt=!0),this.preserveSingleSpace(te||yt),this.print_string(this._ch),Te&&S==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),D=!0):(this.eatWhitespace(),ye++,this.indent())}else if(this._ch===")")ye&&(ye--,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)&&ye===0&&!J?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Te&&ye===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&V.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(te),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),V.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var $t=S==='"'||S==="'";this.preserveSingleSpace($t||te),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&M&&this._output.add_new_line()}var ti=this._output.get_code(ne);return ti},ce.exports.Beautifier=R},function(ce,l,X){var P=X(6).Options;function g(_){P.call(this,_,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var E=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||E;var A=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var B=0;B<A.length;B++)A[B]!=="expand"?this.brace_style="collapse":this.brace_style=A[B]}g.prototype=new P,ce.exports.Options=g}],j={};function p(ce){var l=j[ce];if(l!==void 0)return l.exports;var X=j[ce]={exports:{}};return he[ce](X,X.exports,p),X.exports}var me=p(15);de=me})();var Se=de;K=[],U=function(){return{css_beautify:Se}}.apply(st,K),U!==void 0&&(Yt.exports=U)})()},40998:function(Yt,st,K){var U,de;(function(){var Se;(function(){"use strict";var me=[,,function(P){function g(A){this.__parent=A,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}g.prototype.clone_empty=function(){var A=new g(this.__parent);return A.set_indent(this.__indent_count,this.__alignment_count),A},g.prototype.item=function(A){return A<0?this.__items[this.__items.length+A]:this.__items[A]},g.prototype.has_match=function(A){for(var B=this.__items.length-1;B>=0;B--)if(this.__items[B].match(A))return!0;return!1},g.prototype.set_indent=function(A,B){this.is_empty()&&(this.__indent_count=A||0,this.__alignment_count=B||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 B=A.lastIndexOf(`
`);B!==-1?this.__character_count=A.length-B: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,B){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)),B=B||"",A.indent_level>0&&(B=new Array(A.indent_level+1).join(this.__indent_string)),this.__base_string=B,this.__base_string_length=B.length}_.prototype.get_indent_size=function(A,B){var H=this.__base_string_length;return B=B||0,A<0&&(H=0),H+=A*this.__indent_size,H+=B,H},_.prototype.get_indent_string=function(A,B){var H=this.__base_string;return B=B||0,A<0&&(A=0,H=""),B+=A*this.__indent_size,this.__ensure_cache(B),H+=this.__cache[B],H},_.prototype.__ensure_cache=function(A){for(;A>=this.__cache.length;)this.__add_column()},_.prototype.__add_column=function(){var A=this.__cache.length,B=0,H="";this.__indent_size&&A>=this.__indent_size&&(B=Math.floor(A/this.__indent_size),A-=B*this.__indent_size,H=new Array(B+1).join(this.__indent_string)),A&&(H+=new Array(A+1).join(" ")),this.__cache.push(H)};function E(A,B){this.__indent_cache=new _(A,B),this.raw=!1,this._end_with_newline=A.end_with_newline,this.indent_size=A.indent_size,this.wrap_line_length=A.wrap_line_length,this.indent_empty_lines=A.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new g(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}E.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},E.prototype.get_line_number=function(){return this.__lines.length},E.prototype.get_indent_string=function(A,B){return this.__indent_cache.get_indent_string(A,B)},E.prototype.get_indent_size=function(A,B){return this.__indent_cache.get_indent_size(A,B)},E.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},E.prototype.add_new_line=function(A){return this.is_empty()||!A&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},E.prototype.get_code=function(A){this.trim(!0);var B=this.current_line.pop();B&&(B[B.length-1]===`
`&&(B=B.replace(/\n+$/g,"")),this.current_line.push(B)),this._end_with_newline&&this.__add_outputline();var H=this.__lines.join(`
`);return A!==`
`&&(H=H.replace(/[\n]/g,A)),H},E.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},E.prototype.set_indent=function(A,B){return A=A||0,B=B||0,this.next_line.set_indent(A,B),this.__lines.length>1?(this.current_line.set_indent(A,B),!0):(this.current_line.set_indent(),!1)},E.prototype.add_raw_token=function(A){for(var B=0;B<A.newlines;B++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(A.whitespace_before),this.current_line.push(A.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},E.prototype.add_token=function(A){this.__add_space_before_token(),this.current_line.push(A),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},E.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},E.prototype.remove_indent=function(A){for(var B=this.__lines.length;A<B;)this.__lines[A]._remove_indent(),A++;this.current_line._remove_wrap_indent()},E.prototype.trim=function(A){for(A=A===void 0?!1:A,this.current_line.trim();A&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},E.prototype.just_added_newline=function(){return this.current_line.is_empty()},E.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},E.prototype.ensure_empty_line_above=function(A,B){for(var H=this.__lines.length-2;H>=0;){var V=this.__lines[H];if(V.is_empty())break;if(V.item(0).indexOf(A)!==0&&V.item(-1)!==B){this.__lines.splice(H+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}H--}},P.exports.Output=E},function(P){function g(_,E,A,B){this.type=_,this.text=E,this.comments_before=null,this.newlines=A||0,this.whitespace_before=B||"",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,B){this.raw_options=_(A,B),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,B){var H=this.raw_options[A],V=B||[];return typeof H=="object"?H!==null&&typeof H.concat=="function"&&(V=H.concat()):typeof H=="string"&&(V=H.split(/[^a-zA-Z0-9_\/\-]+/)),V},g.prototype._get_boolean=function(A,B){var H=this.raw_options[A],V=H===void 0?!!B:!!H;return V},g.prototype._get_characters=function(A,B){var H=this.raw_options[A],V=B||"";return typeof H=="string"&&(V=H.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),V},g.prototype._get_number=function(A,B){var H=this.raw_options[A];B=parseInt(B,10),isNaN(B)&&(B=0);var V=parseInt(H,10);return isNaN(V)&&(V=B),V},g.prototype._get_selection=function(A,B,H){var V=this._get_selection_list(A,B,H);if(V.length!==1)throw new Error("Invalid Option Value: The option '"+A+`' can only be one of the following values:
`+B+`
You passed in: '`+this.raw_options[A]+"'");return V[0]},g.prototype._get_selection_list=function(A,B,H){if(!B||B.length===0)throw new Error("Selection list cannot be empty.");if(H=H||[B[0]],!this._is_valid_selection(H,B))throw new Error("Invalid Default Value!");var V=this._get_array(A,H);if(!this._is_valid_selection(V,B))throw new Error("Invalid Option Value: The option '"+A+`' can contain only the following values:
`+B+`
You passed in: '`+this.raw_options[A]+"'");return V},g.prototype._is_valid_selection=function(A,B){return A.length&&B.length&&!A.some(function(H){return B.indexOf(H)===-1})};function _(A,B){var H={};A=E(A);var V;for(V in A)V!==B&&(H[V]=A[V]);if(B&&A[B])for(V in A[B])H[V]=A[B][V];return H}function E(A){var B={},H;for(H in A){var V=H.replace(/-/g,"_");B[V]=A[H]}return B}P.exports.Options=g,P.exports.normalizeOpts=E,P.exports.mergeOpts=_},,function(P){var g=RegExp.prototype.hasOwnProperty("sticky");function _(E){this.__input=E||"",this.__input_length=this.__input.length,this.__position=0}_.prototype.restart=function(){this.__position=0},_.prototype.back=function(){this.__position>0&&(this.__position-=1)},_.prototype.hasNext=function(){return this.__position<this.__input_length},_.prototype.next=function(){var E=null;return this.hasNext()&&(E=this.__input.charAt(this.__position),this.__position+=1),E},_.prototype.peek=function(E){var A=null;return E=E||0,E+=this.__position,E>=0&&E<this.__input_length&&(A=this.__input.charAt(E)),A},_.prototype.__match=function(E,A){E.lastIndex=A;var B=E.exec(this.__input);return B&&!(g&&E.sticky)&&B.index!==A&&(B=null),B},_.prototype.test=function(E,A){return A=A||0,A+=this.__position,A>=0&&A<this.__input_length?!!this.__match(E,A):!1},_.prototype.testChar=function(E,A){var B=this.peek(A);return E.lastIndex=0,B!==null&&E.test(B)},_.prototype.match=function(E){var A=this.__match(E,this.__position);return A?this.__position+=A[0].length:A=null,A},_.prototype.read=function(E,A,B){var H="",V;return E&&(V=this.match(E),V&&(H+=V[0])),A&&(V||!E)&&(H+=this.readUntil(A,B)),H},_.prototype.readUntil=function(E,A){var B="",H=this.__position;E.lastIndex=this.__position;var V=E.exec(this.__input);return V?(H=V.index,A&&(H+=V[0].length)):H=this.__input_length,B=this.__input.substring(this.__position,H),this.__position=H,B},_.prototype.readUntilAfter=function(E){return this.readUntil(E,!0)},_.prototype.get_regexp=function(E,A){var B=null,H="g";return A&&g&&(H="y"),typeof E=="string"&&E!==""?B=new RegExp(E,H):E&&(B=new RegExp(E.source,H)),B},_.prototype.get_literal_regexp=function(E){return RegExp(E.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(E){var A=this.__position,B=this.readUntilAfter(E);return this.__position=A,B},_.prototype.lookBack=function(E){var A=this.__position-1;return A>=E.length&&this.__input.substring(A-E.length,A).toLowerCase()===E},P.exports.InputScanner=_},function(P,g,_){var E=_(8).InputScanner,A=_(3).Token,B=_(10).TokenStream,H=_(11).WhitespacePattern,V={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},L=function(I,w){this._input=new E(I),this._options=w||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new H(this._input)};L.prototype.tokenize=function(){this._input.restart(),this.__tokens=new B,this._reset();for(var I,w=new A(V.START,""),R=null,q=[],ne=new B;w.type!==V.EOF;){for(I=this._get_next_token(w,R);this._is_comment(I);)ne.add(I),I=this._get_next_token(w,R);ne.isEmpty()||(I.comments_before=ne,ne=new B),I.parent=R,this._is_opening(I)?(q.push(R),R=I):R&&this._is_closing(I,R)&&(I.opened=R,R.closed=I,R=q.pop(),I.parent=R),I.previous=w,w.next=I,this.__tokens.add(I),w=I}return this.__tokens},L.prototype._is_first_token=function(){return this.__tokens.isEmpty()},L.prototype._reset=function(){},L.prototype._get_next_token=function(I,w){this._readWhitespace();var R=this._input.read(/.+/g);return R?this._create_token(V.RAW,R):this._create_token(V.EOF,"")},L.prototype._is_comment=function(I){return!1},L.prototype._is_opening=function(I){return!1},L.prototype._is_closing=function(I,w){return!1},L.prototype._create_token=function(I,w){var R=new A(I,w,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return R},L.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=L,P.exports.TOKEN=V},function(P){function g(_){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=_}g.prototype.restart=function(){this.__position=0},g.prototype.isEmpty=function(){return this.__tokens_length===0},g.prototype.hasNext=function(){return this.__position<this.__tokens_length},g.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__tokens[this.__position],this.__position+=1),_},g.prototype.peek=function(_){var E=null;return _=_||0,_+=this.__position,_>=0&&_<this.__tokens_length&&(E=this.__tokens[_]),E},g.prototype.add=function(_){this.__parent_token&&(_.parent=this.__parent_token),this.__tokens.push(_),this.__tokens_length+=1},P.exports.TokenStream=g},function(P,g,_){var E=_(12).Pattern;function A(B,H){E.call(this,B,H),H?this._line_regexp=this._input.get_regexp(H._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}A.prototype=new E,A.prototype.__set_whitespace_patterns=function(B,H){B+="\\t ",H+="\\n\\r",this._match_pattern=this._input.get_regexp("["+B+H+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+H+"]")},A.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var B=this._input.read(this._match_pattern);if(B===" ")this.whitespace_before_token=" ";else if(B){var H=this.__split(this._newline_regexp,B);this.newline_count=H.length-1,this.whitespace_before_token=H[this.newline_count]}return B},A.prototype.matching=function(B,H){var V=this._create();return V.__set_whitespace_patterns(B,H),V._update(),V},A.prototype._create=function(){return new A(this._input,this)},A.prototype.__split=function(B,H){B.lastIndex=0;for(var V=0,L=[],I=B.exec(H);I;)L.push(H.substring(V,I.index)),V=I.index+I[0].length,I=B.exec(H);return V<H.length?L.push(H.substring(V,H.length)):L.push(""),L},P.exports.WhitespacePattern=A},function(P){function g(_,E){this._input=_,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,E&&(this._starting_pattern=this._input.get_regexp(E._starting_pattern,!0),this._match_pattern=this._input.get_regexp(E._match_pattern,!0),this._until_pattern=this._input.get_regexp(E._until_pattern),this._until_after=E._until_after)}g.prototype.read=function(){var _=this._input.read(this._starting_pattern);return(!this._starting_pattern||_)&&(_+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),_},g.prototype.read_match=function(){return this._input.match(this._match_pattern)},g.prototype.until_after=function(_){var E=this._create();return E._until_after=!0,E._until_pattern=this._input.get_regexp(_),E._update(),E},g.prototype.until=function(_){var E=this._create();return E._until_after=!1,E._until_pattern=this._input.get_regexp(_),E._update(),E},g.prototype.starting_with=function(_){var E=this._create();return E._starting_pattern=this._input.get_regexp(_,!0),E._update(),E},g.prototype.matching=function(_){var E=this._create();return E._match_pattern=this._input.get_regexp(_,!0),E._update(),E},g.prototype._create=function(){return new g(this._input,this)},g.prototype._update=function(){},P.exports.Pattern=g},function(P){function g(_,E){_=typeof _=="string"?_:_.source,E=typeof E=="string"?E:E.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+E,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+E,"g")}g.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var E={};this.__directive_pattern.lastIndex=0;for(var A=this.__directive_pattern.exec(_);A;)E[A[1]]=A[2],A=this.__directive_pattern.exec(_);return E},g.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=g},function(P,g,_){var E=_(12).Pattern,A={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function B(H,V){E.call(this,H,V),this.__template_pattern=null,this._disabled=Object.assign({},A),this._excluded=Object.assign({},A),V&&(this.__template_pattern=this._input.get_regexp(V.__template_pattern),this._excluded=Object.assign(this._excluded,V._excluded),this._disabled=Object.assign(this._disabled,V._disabled));var L=new E(H);this.__patterns={handlebars_comment:L.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:L.starting_with(/{{{/).until_after(/}}}/),handlebars:L.starting_with(/{{/).until_after(/}}/),php:L.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:L.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:L.starting_with(/{%/).until_after(/%}/),django_value:L.starting_with(/{{/).until_after(/}}/),django_comment:L.starting_with(/{#/).until_after(/#}/),smarty:L.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:L.starting_with(/{\*/).until_after(/\*}/),smarty_literal:L.starting_with(/{literal}/).until_after(/{\/literal}/)}}B.prototype=new E,B.prototype._create=function(){return new B(this._input,this)},B.prototype._update=function(){this.__set_templated_pattern()},B.prototype.disable=function(H){var V=this._create();return V._disabled[H]=!0,V._update(),V},B.prototype.read_options=function(H){var V=this._create();for(var L in A)V._disabled[L]=H.templating.indexOf(L)===-1;return V._update(),V},B.prototype.exclude=function(H){var V=this._create();return V._excluded[H]=!0,V._update(),V},B.prototype.read=function(){var H="";this._match_pattern?H=this._input.read(this._starting_pattern):H=this._input.read(this._starting_pattern,this.__template_pattern);for(var V=this._read_template();V;)this._match_pattern?V+=this._input.read(this._match_pattern):V+=this._input.readUntil(this.__template_pattern),H+=V,V=this._read_template();return this._until_after&&(H+=this._input.readUntilAfter(this._until_pattern)),H},B.prototype.__set_templated_pattern=function(){var H=[];this._disabled.php||H.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||H.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(H.push(this.__patterns.django._starting_pattern.source),H.push(this.__patterns.django_value._starting_pattern.source),H.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||H.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&H.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+H.join("|")+")")},B.prototype._read_template=function(){var H="",V=this._input.peek();if(V==="<"){var L=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&L==="?"&&(H=H||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&L==="%"&&(H=H||this.__patterns.erb.read())}else V==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(H=H||this.__patterns.handlebars_comment.read(),H=H||this.__patterns.handlebars_unescaped.read(),H=H||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(H=H||this.__patterns.django_value.read()),this._excluded.django||(H=H||this.__patterns.django_comment.read(),H=H||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(H=H||this.__patterns.smarty_comment.read(),H=H||this.__patterns.smarty_literal.read(),H=H||this.__patterns.smarty.read()));return H},P.exports.TemplatablePattern=B},,,,function(P,g,_){var E=_(19).Beautifier,A=_(20).Options;function B(H,V,L,I){var w=new E(H,V,L,I);return w.beautify()}P.exports=B,P.exports.defaultOptions=function(){return new A}},function(P,g,_){var E=_(20).Options,A=_(2).Output,B=_(21).Tokenizer,H=_(21).TOKEN,V=/\r\n|[\r\n]/,L=/\r\n|[\r\n]/g,I=function(J,D){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=J.max_preserve_newlines,this.preserve_newlines=J.preserve_newlines,this._output=new A(J,D)};I.prototype.current_line_has_match=function(J){return this._output.current_line.has_match(J)},I.prototype.set_space_before_token=function(J,D){this._output.space_before_token=J,this._output.non_breaking_space=D},I.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},I.prototype.add_raw_token=function(J){this._output.add_raw_token(J)},I.prototype.print_preserved_newlines=function(J){var D=0;J.type!==H.TEXT&&J.previous.type!==H.TEXT&&(D=J.newlines?1:0),this.preserve_newlines&&(D=J.newlines<this.max_preserve_newlines+1?J.newlines:this.max_preserve_newlines+1);for(var 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!==H.EOF&&J.closed!==F;){if(F.type===H.ATTRIBUTE&&F.text==="type"){F.next&&F.next.type===H.EQUALS&&F.next.next&&F.next.next.type===H.VALUE&&(D=F.next.next.text);break}F=F.next}return D},R=function(J,D){var F=null,M=null;return D.closed?(J==="script"?F="text/javascript":J==="style"&&(F="text/css"),F=w(D)||F,F.search("text/css")>-1?M="css":F.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?M="javascript":F.search(/(text|application|dojo)\/(x-)?(html)/)>-1?M="html":F.search(/test\/null/)>-1&&(M="null"),M):null};function q(J,D){return D.indexOf(J)!==-1}function ne(J,D,F){this.parent=J||null,this.tag=D?D.tag_name:"",this.indent_level=F||0,this.parser_token=D||null}function ee(J){this._printer=J,this._current_frame=null}ee.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},ee.prototype.record_tag=function(J){var D=new ne(this._current_frame,J,this._printer.indent_level);this._current_frame=D},ee.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},ee.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},ee.prototype.try_pop=function(J,D){var F=this._get_frame([J],D);return this._try_pop_frame(F)},ee.prototype.indent_to_tag=function(J){var D=this._get_frame(J);D&&(this._printer.indent_level=D.indent_level)};function ye(J,D,F,M){this._source_text=J||"",D=D||{},this._js_beautify=F,this._css_beautify=M,this._tag_stack=null;var oe=new E(D,"html");this._options=oe,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}ye.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var J=this._source_text,D=this._options.eol;this._options.eol==="auto"&&(D=`
`,J&&V.test(J)&&(D=J.match(V)[0])),J=J.replace(L,`
`);var F=J.match(/^[\t ]*/)[0],M={text:"",type:""},oe=new Le(this._options),te=new I(this._options,F),S=new B(J,this._options).tokenize();this._tag_stack=new ee(te);for(var v=null,Y=S.next();Y.type!==H.EOF;)Y.type===H.TAG_OPEN||Y.type===H.COMMENT?(v=this._handle_tag_open(te,Y,oe,M,S),oe=v):Y.type===H.ATTRIBUTE||Y.type===H.EQUALS||Y.type===H.VALUE||Y.type===H.TEXT&&!oe.tag_complete?v=this._handle_inside_tag(te,Y,oe,M):Y.type===H.TAG_CLOSE?v=this._handle_tag_close(te,Y,oe):Y.type===H.TEXT?v=this._handle_text(te,Y,oe):Y.type===H.CONTROL_FLOW_OPEN?v=this._handle_control_flow_open(te,Y):Y.type===H.CONTROL_FLOW_CLOSE?v=this._handle_control_flow_close(te,Y):te.add_raw_token(Y),M=v,Y=S.next();var ae=te._output.get_code(D);return ae},ye.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},ye.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},ye.prototype._handle_tag_close=function(J,D,F){var M={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(),M},ye.prototype._handle_inside_tag=function(J,D,F,M){var oe=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===H.TEXT?J.print_preserved_newlines(D)?(D.newlines=0,J.add_raw_token(D)):J.print_token(D):(D.type===H.ATTRIBUTE?J.set_space_before_token(!0):(D.type===H.EQUALS||D.type===H.VALUE&&D.previous.type===H.EQUALS)&&J.set_space_before_token(!1),D.type===H.ATTRIBUTE&&F.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(J.traverse_whitespace(D),oe=oe||D.newlines!==0),this._is_wrap_attributes_force&&F.attr_count>=this._options.wrap_attributes_min_attrs&&(M.type!==H.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(J.print_newline(!1),oe=!0)),J.print_token(D),oe=oe||J.previous_token_wrapped(),F.has_wrapped_attrs=oe),te},ye.prototype._handle_text=function(J,D,F){var M={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)),M},ye.prototype._print_custom_beatifier_text=function(J,D,F){var M=this;if(D.text!==""){var oe=D.text,te,S=1,v="",Y="";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($t,ti){var je=new ye($t,ti,M._js_beautify,M._css_beautify);return je.beautify()}),this._options.indent_scripts==="keep"?S=0:this._options.indent_scripts==="separate"&&(S=-J.indent_level);var ae=J.get_full_indent(S);if(oe=oe.replace(/\n[ \t]*$/,""),F.custom_beautifier_name!=="html"&&oe[0]==="<"&&oe.match(/^(<!--|<!\[CDATA\[)/)){var xe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(oe);if(!xe){J.add_raw_token(D);return}v=ae+xe[1]+`
`,oe=xe[4],xe[5]&&(Y=ae+xe[5]),oe=oe.replace(/\n[ \t]*$/,""),(xe[2]||xe[3].indexOf(`
`)!==-1)&&(xe=xe[3].match(/[ \t]+$/),xe&&(D.whitespace_before=xe[0]))}if(oe)if(te){var Fe=function(){this.eol=`
`};Fe.prototype=this._options.raw_options;var Xe=new Fe;oe=te(ae+oe,Xe)}else{var yt=D.whitespace_before;yt&&(oe=oe.replace(new RegExp(`
(`+yt+")?","g"),`
`)),oe=ae+oe.replace(/\n/g,`
`+ae)}v&&(oe?oe=v+oe+`
`+Y:oe=v+Y),J.print_newline(!1),oe&&(D.text=oe,D.whitespace_before="",D.newlines=0,J.add_raw_token(D),J.print_newline(!0))}},ye.prototype._handle_tag_open=function(J,D,F,M,oe){var te=this._get_tag_open_token(D);if((F.is_unformatted||F.is_content_unformatted)&&!F.is_empty_element&&D.type===H.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,M),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=oe.peek(S),v.type===H.ATTRIBUTE&&(te.attr_count+=1),S+=1;while(v.type!==H.EOF&&v.type!==H.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(te.alignment_size=D.text.length+1),!te.tag_complete&&!te.is_unformatted&&(J.alignment_size=te.alignment_size),te};var Le=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 M;this.tag_start_char=F.text[0],this.text=F.text,this.tag_start_char==="<"?(M=F.text.match(/^<([^\s>]*)/),this.tag_check=M?M[1]:""):(M=F.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=M?M[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===H.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||F.closed&&F.closed.text==="/>";var oe=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(oe=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!J.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(oe)))}};ye.prototype._get_tag_open_token=function(J){var D=new Le(this._options,this._tag_stack.get_parser_token(),J);return D.alignment_size=this._options.wrap_attributes_indent_size,D.is_end_tag=D.is_end_tag||q(D.tag_check,this._options.void_elements),D.is_empty_element=D.tag_complete||D.is_start_tag&&D.is_end_tag,D.is_unformatted=!D.tag_complete&&q(D.tag_check,this._options.unformatted),D.is_content_unformatted=!D.is_empty_element&&q(D.tag_check,this._options.content_unformatted),D.is_inline_element=q(D.tag_name,this._options.inline)||this._options.inline_custom_elements&&D.tag_name.includes("-")||D.tag_start_char==="{",D},ye.prototype._set_tag_position=function(J,D,F,M,oe){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==="!--"&&oe.type===H.TAG_CLOSE&&M.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&&!(M.is_inline_element||M.is_unformatted)&&!(oe.type===H.TAG_CLOSE&&F.start_tag_token===M)&&oe.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)&&(oe.type!=="TK_CONTENT"||F.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,F)},ye.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"],$e=["a","audio","del","ins","map","noscript","video"];ye.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||$e.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=ye},function(P,g,_){var E=_(6).Options;function A(B){E.call(this,B,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}A.prototype=new E,P.exports.Options=A},function(P,g,_){var E=_(9).Tokenizer,A=_(9).TOKEN,B=_(13).Directives,H=_(14).TemplatablePattern,V=_(12).Pattern,L={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",CONTROL_FLOW_OPEN:"TK_CONTROL_FLOW_OPEN",CONTROL_FLOW_CLOSE:"TK_CONTROL_FLOW_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:A.START,RAW:A.RAW,EOF:A.EOF},I=new B(/<\!--/,/-->/),w=function(R,q){E.call(this,R,q),this._current_tag_name="";var ne=new H(this._input).read_options(this._options),ee=new V(this._input);if(this.__patterns={word:ne.until(/[\n\r\t <]/),word_control_flow_close_excluded:ne.until(/[\n\r\t <}]/),single_quote:ne.until_after(/'/),double_quote:ne.until_after(/"/),attribute:ne.until(/[\n\r\t =>]|\/>/),element_name:ne.until(/[\n\r\t >\/]/),angular_control_flow_start:ee.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:ee.starting_with(/{{!--/).until_after(/--}}/),handlebars:ee.starting_with(/{{/).until_after(/}}/),handlebars_open:ee.until(/[\n\r\t }]/),handlebars_raw_close:ee.until(/}}/),comment:ee.starting_with(/<!--/).until_after(/-->/),cdata:ee.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:ee.starting_with(/<!\[/).until_after(/]>/),processing:ee.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 ye=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=ee.matching(ye).until_after(ye)}};w.prototype=new E,w.prototype._is_comment=function(R){return!1},w.prototype._is_opening=function(R){return R.type===L.TAG_OPEN||R.type===L.CONTROL_FLOW_OPEN},w.prototype._is_closing=function(R,q){return R.type===L.TAG_CLOSE&&q&&((R.text===">"||R.text==="/>")&&q.text[0]==="<"||R.text==="}}"&&q.text[0]==="{"&&q.text[1]==="{")||R.type===L.CONTROL_FLOW_CLOSE&&R.text==="}"&&q.text.endsWith("{")},w.prototype._reset=function(){this._current_tag_name=""},w.prototype._get_next_token=function(R,q){var ne=null;this._readWhitespace();var ee=this._input.peek();return ee===null?this._create_token(L.EOF,""):(ne=ne||this._read_open_handlebars(ee,q),ne=ne||this._read_attribute(ee,R,q),ne=ne||this._read_close(ee,q),ne=ne||this._read_script_and_style(ee,R),ne=ne||this._read_control_flows(ee,q),ne=ne||this._read_raw_content(ee,R,q),ne=ne||this._read_content_word(ee,q),ne=ne||this._read_comment_or_cdata(ee),ne=ne||this._read_processing(ee),ne=ne||this._read_open(ee,q),ne=ne||this._create_token(L.UNKNOWN,this._input.next()),ne)},w.prototype._read_comment_or_cdata=function(R){var q=null,ne=null,ee=null;if(R==="<"){var ye=this._input.peek(1);ye==="!"&&(ne=this.__patterns.comment.read(),ne?(ee=I.get_directives(ne),ee&&ee.ignore==="start"&&(ne+=I.readIgnored(this._input))):ne=this.__patterns.cdata.read()),ne&&(q=this._create_token(L.COMMENT,ne),q.directives=ee)}return q},w.prototype._read_processing=function(R){var q=null,ne=null,ee=null;if(R==="<"){var ye=this._input.peek(1);(ye==="!"||ye==="?")&&(ne=this.__patterns.conditional_comment.read(),ne=ne||this.__patterns.processing.read()),ne&&(q=this._create_token(L.COMMENT,ne),q.directives=ee)}return q},w.prototype._read_open=function(R,q){var ne=null,ee=null;return(!q||q.type===L.CONTROL_FLOW_OPEN)&&R==="<"&&(ne=this._input.next(),this._input.peek()==="/"&&(ne+=this._input.next()),ne+=this.__patterns.element_name.read(),ee=this._create_token(L.TAG_OPEN,ne)),ee},w.prototype._read_open_handlebars=function(R,q){var ne=null,ee=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)==="!"?(ne=this.__patterns.handlebars_comment.read(),ne=ne||this.__patterns.handlebars.read(),ee=this._create_token(L.COMMENT,ne)):(ne=this.__patterns.handlebars_open.read(),ee=this._create_token(L.TAG_OPEN,ne))),ee},w.prototype._read_control_flows=function(R,q){var ne="",ee=null;if(!this._options.templating.includes("angular"))return ee;if(R==="@"){if(ne=this.__patterns.angular_control_flow_start.read(),ne==="")return ee;for(var ye=ne.endsWith("(")?1:0,Le=0;!(ne.endsWith("{")&&ye===Le);){var Te=this._input.next();if(Te===null)break;Te==="("?ye++:Te===")"&&Le++,ne+=Te}ee=this._create_token(L.CONTROL_FLOW_OPEN,ne)}else R==="}"&&q&&q.type===L.CONTROL_FLOW_OPEN&&(ne=this._input.next(),ee=this._create_token(L.CONTROL_FLOW_CLOSE,ne));return ee},w.prototype._read_close=function(R,q){var ne=null,ee=null;return q&&q.type===L.TAG_OPEN&&(q.text[0]==="<"&&(R===">"||R==="/"&&this._input.peek(1)===">")?(ne=this._input.next(),R==="/"&&(ne+=this._input.next()),ee=this._create_token(L.TAG_CLOSE,ne)):q.text[0]==="{"&&R==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),ee=this._create_token(L.TAG_CLOSE,"}}"))),ee},w.prototype._read_attribute=function(R,q,ne){var ee=null,ye="";if(ne&&ne.text[0]==="<")if(R==="=")ee=this._create_token(L.EQUALS,this._input.next());else if(R==='"'||R==="'"){var Le=this._input.next();R==='"'?Le+=this.__patterns.double_quote.read():Le+=this.__patterns.single_quote.read(),ee=this._create_token(L.VALUE,Le)}else ye=this.__patterns.attribute.read(),ye&&(q.type===L.EQUALS?ee=this._create_token(L.VALUE,ye):ee=this._create_token(L.ATTRIBUTE,ye));return ee},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,ne){var ee="";if(ne&&ne.text[0]==="{")ee=this.__patterns.handlebars_raw_close.read();else if(q.type===L.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var ye=q.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ye)&&(ee=this._input.readUntil(new RegExp("</"+ye+"[\\n\\r\\t ]*?>","ig")))}return ee?this._create_token(L.TEXT,ee):null},w.prototype._read_script_and_style=function(R,q){if(q.type===L.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var ne=q.opened.text.substr(1).toLowerCase();if(ne==="script"||ne==="style"){var ee=this._read_comment_or_cdata(R);if(ee)return ee.type=L.TEXT,ee;var ye=this._input.readUntil(new RegExp("</"+ne+"[\\n\\r\\t ]*?>","ig"));if(ye)return this._create_token(L.TEXT,ye)}}return null},w.prototype._read_content_word=function(R,q){var ne="";return this._options.unformatted_content_delimiter&&R===this._options.unformatted_content_delimiter[0]&&(ne=this.__patterns.unformatted_content_delimiter.read()),ne||(ne=q&&q.type===L.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),ne?this._create_token(L.TEXT,ne):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)U=[K,K(58553),K(87804)],de=function(me){var ce=K(58553),l=K(87804);return{html_beautify:function(X,P){return he(X,P,ce.js_beautify,l.css_beautify)}}}.apply(st,U),de!==void 0&&(Yt.exports=de);else var j,p})()},58553:function(Yt,st){var K,U;(function(){var de;(function(){"use strict";var he=[function(ce,l,X){var P=X(1).Beautifier,g=X(5).Options;function _(E,A){var B=new P(E,A);return B.beautify()}ce.exports=_,ce.exports.defaultOptions=function(){return new g}},function(ce,l,X){var P=X(2).Output,g=X(3).Token,_=X(4),E=X(5).Options,A=X(7).Tokenizer,B=X(7).line_starters,H=X(7).positionable_operators,V=X(7).TOKEN;function L(v,Y){return Y.indexOf(v)!==-1}function I(v){return v.replace(/^\s+/g,"")}function w(v){for(var Y={},ae=0;ae<v.length;ae++)Y[v[ae].replace(/-/g,"_")]=v[ae];return Y}function R(v,Y){return v&&v.type===V.RESERVED&&v.text===Y}function q(v,Y){return v&&v.type===V.RESERVED&&L(v.text,Y)}var ne=["case","return","do","if","throw","else","await","break","continue","async"],ee=["before-newline","after-newline","preserve-newline"],ye=w(ee),Le=[ye.before_newline,ye.preserve_newline],Te={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function $e(v,Y){Y.multiline_frame||Y.mode===Te.ForInitializer||Y.mode===Te.Conditional||v.remove_indent(Y.start_line_index)}function J(v){v=v.replace(_.allLineBreaks,`
`);for(var Y=[],ae=v.indexOf(`
`);ae!==-1;)Y.push(v.substring(0,ae)),v=v.substring(ae+1),ae=v.indexOf(`
`);return v.length&&Y.push(v),Y}function D(v){return v===Te.ArrayLiteral}function F(v){return L(v,[Te.Expression,Te.ForInitializer,Te.Conditional])}function M(v,Y){for(var ae=0;ae<v.length;ae++){var xe=v[ae].trim();if(xe.charAt(0)!==Y)return!1}return!0}function oe(v,Y){for(var ae=0,xe=v.length,Fe;ae<xe;ae++)if(Fe=v[ae],Fe&&Fe.indexOf(Y)!==0)return!1;return!0}function te(v,Y){Y=Y||{},this._source_text=v||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new E(Y)}te.prototype.create_flags=function(v,Y){var ae=0;v&&(ae=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>ae&&(ae=v.line_indent_level));var xe={mode:Y,parent:v,last_token:v?v.last_token:new g(V.START_BLOCK,""),last_word:v?v.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:ae,alignment:0,line_indent_level:v?v.line_indent_level:ae,start_line_index:this._output.get_line_number(),ternary_depth:0};return xe},te.prototype._reset=function(v){var Y=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new P(this._options,Y),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Te.BlockStatement);var ae=new A(v,this._options);return this._tokens=ae.tokenize(),v},te.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,Y=this._reset(this._source_text),ae=this._options.eol;this._options.eol==="auto"&&(ae=`
`,Y&&_.lineBreak.test(Y||"")&&(ae=Y.match(_.lineBreak)[0]));for(var xe=this._tokens.next();xe;)this.handle_token(xe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=xe,xe=this._tokens.next();return v=this._output.get_code(ae),v},te.prototype.handle_token=function(v,Y){v.type===V.START_EXPR?this.handle_start_expr(v):v.type===V.END_EXPR?this.handle_end_expr(v):v.type===V.START_BLOCK?this.handle_start_block(v):v.type===V.END_BLOCK?this.handle_end_block(v):v.type===V.WORD?this.handle_word(v):v.type===V.RESERVED?this.handle_word(v):v.type===V.SEMICOLON?this.handle_semicolon(v):v.type===V.STRING?this.handle_string(v):v.type===V.EQUALS?this.handle_equals(v):v.type===V.OPERATOR?this.handle_operator(v):v.type===V.COMMA?this.handle_comma(v):v.type===V.BLOCK_COMMENT?this.handle_block_comment(v,Y):v.type===V.COMMENT?this.handle_comment(v,Y):v.type===V.DOT?this.handle_dot(v):v.type===V.EOF?this.handle_eof(v):v.type===V.UNKNOWN?this.handle_unknown(v,Y):this.handle_unknown(v,Y)},te.prototype.handle_whitespace_and_comments=function(v,Y){var ae=v.newlines,xe=this._options.keep_array_indentation&&D(this._flags.mode);if(v.comments_before)for(var Fe=v.comments_before.next();Fe;)this.handle_whitespace_and_comments(Fe,Y),this.handle_token(Fe,Y),Fe=v.comments_before.next();if(xe)for(var Xe=0;Xe<ae;Xe+=1)this.print_newline(Xe>0,Y);else if(this._options.max_preserve_newlines&&ae>this._options.max_preserve_newlines&&(ae=this._options.max_preserve_newlines),this._options.preserve_newlines&&ae>1){this.print_newline(!1,Y);for(var yt=1;yt<ae;yt+=1)this.print_newline(!0,Y)}};var S=["async","break","continue","return","throw","yield"];te.prototype.allow_wrap_or_preserved_newline=function(v,Y){if(Y=Y===void 0?!1:Y,!this._output.just_added_newline()){var ae=this._options.preserve_newlines&&v.newlines||Y,xe=L(this._flags.last_token.text,H)||L(v.text,H);if(xe){var Fe=L(this._flags.last_token.text,H)&&L(this._options.operator_position,Le)||L(v.text,H);ae=ae&&Fe}if(ae)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(q(this._flags.last_token,S))return;this._output.set_wrap_point()}}},te.prototype.print_newline=function(v,Y){if(!Y&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==V.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var ae=this._tokens.peek();this._flags.mode===Te.Statement&&!(this._flags.if_block&&R(ae,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},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===V.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var Y=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(Y),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&&$e(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 Y=!1;return Y=Y||q(this._flags.last_token,["var","let","const"])&&v.type===V.WORD,Y=Y||R(this._flags.last_token,"do"),Y=Y||!(this._flags.parent.mode===Te.ObjectLiteral&&this._flags.mode===Te.Statement)&&q(this._flags.last_token,S)&&!v.newlines,Y=Y||R(this._flags.last_token,"else")&&!(R(v,"if")&&!v.comments_before),Y=Y||this._flags.last_token.type===V.END_EXPR&&(this._previous_flags.mode===Te.ForInitializer||this._previous_flags.mode===Te.Conditional),Y=Y||this._flags.last_token.type===V.WORD&&this._flags.mode===Te.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==V.WORD&&v.type!==V.RESERVED,Y=Y||this._flags.mode===Te.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"])),Y?(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 Y=Te.Expression;if(v.text==="["){if(this._flags.last_token.type===V.WORD||this._flags.last_token.text===")"){q(this._flags.last_token,B)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(Y),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}Y=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,[V.START_EXPR,V.END_EXPR,V.WORD,V.OPERATOR,V.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===V.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,Y=Te.ForInitializer):L(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,Y=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,B)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===V.WORD){this._output.space_before_token=!1;var ae=this._tokens.peek(-3);if(this._options.space_after_named_function&&ae){var xe=this._tokens.peek(-4);q(ae,["async","function"])||ae.text==="*"&&q(xe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Te.ObjectLiteral?(ae.text==="{"||ae.text===","||ae.text==="*"&&(xe.text==="{"||xe.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(v);(this._flags.last_token.type===V.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(L(this._last_last_text,["function","yield"])||this._flags.mode===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===V.START_BLOCK?this.print_newline():(this._flags.last_token.type===V.END_EXPR||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===V.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(Y),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===V.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(v),this.restore_mode(),$e(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===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 Y=this._tokens.peek(),ae=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===V.END_EXPR?(this.set_mode(Te.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Te.BlockStatement):ae&&(L(ae.text,[":",","])&&L(Y.type,[V.STRING,V.WORD,V.RESERVED])||L(Y.text,["get","set","..."])&&L(ae.type,[V.WORD,V.RESERVED]))?L(this._last_last_text,["class","interface"])&&!L(ae.text,[":",","])?this.set_mode(Te.BlockStatement):this.set_mode(Te.ObjectLiteral):this._flags.last_token.type===V.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Te.BlockStatement):L(this._flags.last_token.type,[V.EQUALS,V.START_EXPR,V.COMMA,V.OPERATOR])||q(this._flags.last_token,["return","throw","import","default"])?this.set_mode(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 xe=!Y.comments_before&&Y.text==="}",Fe=xe&&this._flags.last_word==="function"&&this._flags.last_token.type===V.END_EXPR;if(this._options.brace_preserve_inline){var Xe=0,yt=null;this._flags.inline_frame=!0;do if(Xe+=1,yt=this._tokens.peek(Xe-1),yt.newlines){this._flags.inline_frame=!1;break}while(yt.type!==V.EOF&&!(yt.type===V.END_BLOCK&&yt.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==V.OPERATOR&&(Fe||this._flags.last_token.type===V.EQUALS||q(this._flags.last_token,ne)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(D(this._previous_flags.mode)&&(this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.COMMA)&&((this._flags.last_token.type===V.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(v),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==V.OPERATOR&&this._flags.last_token.type!==V.START_EXPR&&(L(this._flags.last_token.type,[V.START_BLOCK,V.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!xe&&!(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 Y=this._flags.last_token.type===V.START_BLOCK;this._flags.inline_frame&&!Y?this._output.space_before_token=!0:this._options.brace_style==="expand"?Y||this.print_newline():Y||(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===V.RESERVED){if(L(v.text,["set","get"])&&this._flags.mode!==Te.ObjectLiteral)v.type=V.WORD;else if(v.text==="import"&&L(this._tokens.peek().text,["(","."]))v.type=V.WORD;else if(L(v.text,["as","from"])&&!this._flags.import_block)v.type=V.WORD;else if(this._flags.mode===Te.ObjectLiteral){var Y=this._tokens.peek();Y.text===":"&&(v.type=V.WORD)}}if(this.start_of_statement(v)?q(this._flags.last_token,["var","let","const"])&&v.type===V.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!F(this._flags.mode)&&(this._flags.last_token.type!==V.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==V.EQUALS&&(this._options.preserve_newlines||!q(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(R(v,"while")){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&R(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===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===V.COMMA||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR)&&!this.start_of_object_property()&&!(L(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===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===V.OPERATOR))&&!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD?q(this._flags.last_token,["get","set","new","export"])||q(this._flags.last_token,S)?this._output.space_before_token=!0:R(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===V.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(F(this._flags.mode)||D(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var ae="NONE";if(this._flags.last_token.type===V.END_BLOCK?this._previous_flags.inline_frame?ae="SPACE":q(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?ae="NEWLINE":(ae="SPACE",this._output.space_before_token=!0):ae="NEWLINE":this._flags.last_token.type===V.SEMICOLON&&this._flags.mode===Te.BlockStatement?ae="NEWLINE":this._flags.last_token.type===V.SEMICOLON&&F(this._flags.mode)?ae="SPACE":this._flags.last_token.type===V.STRING?ae="NEWLINE":this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD||this._flags.last_token.text==="*"&&(L(this._last_last_text,["function","yield"])||this._flags.mode===Te.ObjectLiteral&&L(this._last_last_text,["{",","]))?ae="SPACE":this._flags.last_token.type===V.START_BLOCK?this._flags.inline_frame?ae="SPACE":ae="NEWLINE":this._flags.last_token.type===V.END_EXPR&&(this._output.space_before_token=!0,ae="NEWLINE"),q(v,B)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ae="SPACE":ae="NEWLINE"),q(v,["else","catch","finally"]))if((!(this._flags.last_token.type===V.END_BLOCK&&this._previous_flags.mode===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 xe=this._output.current_line;xe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ae==="NEWLINE"?q(this._flags.last_token,ne)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&q(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==V.END_EXPR?(this._flags.last_token.type!==V.START_EXPR||!q(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(R(v,"if")&&R(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):q(v,B)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&D(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ae==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===V.WORD||v.previous.type===V.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===V.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&R(v,"from")&&(this._flags.import_block=!1))},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 Y=this._tokens.peek();this._flags.mode===Te.Statement&&!(this._flags.if_block&&R(Y,"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===V.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===V.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},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 Y=v.text==="*"&&(q(this._flags.last_token,["function","yield"])||L(this._flags.last_token.type,[V.START_BLOCK,V.COMMA,V.END_BLOCK,V.SEMICOLON])),ae=L(v.text,["-","+"])&&(L(this._flags.last_token.type,[V.START_BLOCK,V.START_EXPR,V.EQUALS,V.OPERATOR])||L(this._flags.last_token.text,B)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var xe=!Y;this.handle_whitespace_and_comments(v,xe)}if(v.text==="*"&&this._flags.last_token.type===V.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(L(v.text,["-","+"])&&this.start_of_object_property()){this.print_token(v);return}if(this._flags.last_token.type===V.OPERATOR&&L(this._options.operator_position,Le)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==V.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var Fe=!0,Xe=!0,yt=!1;if(v.text===":"?this._flags.ternary_depth===0?Fe=!1:(this._flags.ternary_depth-=1,yt=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!ae&&!Y&&this._options.preserve_newlines&&L(v.text,H)){var $t=v.text===":",ti=$t&&yt,je=$t&&!yt;switch(this._options.operator_position){case ye.before_newline:this._output.space_before_token=!je,this.print_token(v),(!$t||ti)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case ye.after_newline:this._output.space_before_token=!0,!$t||ti?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 ye.preserve_newline:je||this.allow_wrap_or_preserved_newline(v),Fe=!(this._output.just_added_newline()||je),this._output.space_before_token=Fe,this.print_token(v),this._output.space_before_token=!0;return}}if(Y){this.allow_wrap_or_preserved_newline(v),Fe=!1;var mt=this._tokens.peek();Xe=mt&&L(mt.type,[V.WORD,V.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),Fe=this._flags.last_token.type===V.START_BLOCK,Xe=!1;else if(L(v.text,["--","++","!","~"])||ae){if((this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),Fe=!1,Xe=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var Wt=q(this._flags.last_token,ne)&&v.newlines;Wt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(Wt,!0)}this._flags.last_token.text===";"&&F(this._flags.mode)&&(Fe=!0),this._flags.last_token.type===V.RESERVED?Fe=!0:this._flags.last_token.type===V.END_EXPR?Fe=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===V.OPERATOR&&(Fe=L(v.text,["--","-","++","+"])&&L(this._flags.last_token.text,["--","-","++","+"]),L(v.text,["+","-"])&&L(this._flags.last_token.text,["--","++"])&&(Xe=!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||Fe,this.print_token(v),this._output.space_before_token=Xe},te.prototype.handle_block_comment=function(v,Y){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,Y),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,Y)},te.prototype.print_block_commment=function(v,Y){var ae=J(v.text),xe,Fe=!1,Xe=!1,yt=v.whitespace_before,$t=yt.length;if(this.print_newline(!1,Y),this.print_token_line_indentation(v),this._output.add_token(ae[0]),this.print_newline(!1,Y),ae.length>1){for(ae=ae.slice(1),Fe=M(ae,"*"),Xe=oe(ae,yt),Fe&&(this._flags.alignment=1),xe=0;xe<ae.length;xe++)Fe?(this.print_token_line_indentation(v),this._output.add_token(I(ae[xe]))):Xe&&ae[xe]?(this.print_token_line_indentation(v),this._output.add_token(ae[xe].substring($t))):(this._output.current_line.set_indent(-1),this._output.add_token(ae[xe])),this.print_newline(!1,Y);this._flags.alignment=0}},te.prototype.handle_comment=function(v,Y){v.newlines?this.print_newline(!1,Y):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,Y)},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,ne)?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,Y){this.print_token(v),v.text[v.text.length-1]===`
`&&this.print_newline(!1,Y)},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 E=this.__base_string_length;return _=_||0,g<0&&(E=0),E+=g*this.__indent_size,E+=_,E},X.prototype.get_indent_string=function(g,_){var E=this.__base_string;return _=_||0,g<0&&(g=0,E=""),_+=g*this.__indent_size,this.__ensure_cache(_),E+=this.__cache[_],E},X.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},X.prototype.__add_column=function(){var g=this.__cache.length,_=0,E="";this.__indent_size&&g>=this.__indent_size&&(_=Math.floor(g/this.__indent_size),g-=_*this.__indent_size,E=new Array(_+1).join(this.__indent_string)),g&&(E+=new Array(g+1).join(" ")),this.__cache.push(E)};function P(g,_){this.__indent_cache=new X(g,_),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}P.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},P.prototype.get_line_number=function(){return this.__lines.length},P.prototype.get_indent_string=function(g,_){return this.__indent_cache.get_indent_string(g,_)},P.prototype.get_indent_size=function(g,_){return this.__indent_cache.get_indent_size(g,_)},P.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},P.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},P.prototype.get_code=function(g){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var E=this.__lines.join(`
`);return g!==`
`&&(E=E.replace(/[\n]/g,g)),E},P.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},P.prototype.set_indent=function(g,_){return g=g||0,_=_||0,this.next_line.set_indent(g,_),this.__lines.length>1?(this.current_line.set_indent(g,_),!0):(this.current_line.set_indent(),!1)},P.prototype.add_raw_token=function(g){for(var _=0;_<g.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},P.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},P.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},P.prototype.remove_indent=function(g){for(var _=this.__lines.length;g<_;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},P.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},P.prototype.just_added_newline=function(){return this.current_line.is_empty()},P.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},P.prototype.ensure_empty_line_above=function(g,_){for(var E=this.__lines.length-2;E>=0;){var A=this.__lines[E];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==_){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},ce.exports.Output=P},function(ce){function l(X,P,g,_){this.type=X,this.text=P,this.comments_before=null,this.newlines=g||0,this.whitespace_before=_||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}ce.exports.Token=l},function(ce,l){var X="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",P="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",_="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",E="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",A="(?:"+E+"|["+X+g+"])",B="(?:"+E+"|["+P+g+_+"])*";l.identifier=new RegExp(A+B,"g"),l.identifierStart=new RegExp(A),l.identifierMatch=new RegExp("(?:"+E+"|["+P+g+_+"])+");var H=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;l.newline=/[\n\r\u2028\u2029]/,l.lineBreak=new RegExp(`\r
|`+l.newline.source),l.allLineBreaks=new RegExp(l.lineBreak.source,"g")},function(ce,l,X){var P=X(6).Options,g=["before-newline","after-newline","preserve-newline"];function _(E){P.call(this,E,"js");var A=this.raw_options.brace_style||null;A==="expand-strict"?this.raw_options.brace_style="expand":A==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var B=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var H=0;H<B.length;H++)B[H]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=B[H];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",g),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}_.prototype=new P,ce.exports.Options=_},function(ce){function l(g,_){this.raw_options=X(g,_),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(g,_){var E=this.raw_options[g],A=_||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(A=E.concat()):typeof E=="string"&&(A=E.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,_){var E=this.raw_options[g],A=E===void 0?!!_:!!E;return A},l.prototype._get_characters=function(g,_){var E=this.raw_options[g],A=_||"";return typeof E=="string"&&(A=E.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,_){var E=this.raw_options[g];_=parseInt(_,10),isNaN(_)&&(_=0);var A=parseInt(E,10);return isNaN(A)&&(A=_),A},l.prototype._get_selection=function(g,_,E){var A=this._get_selection_list(g,_,E);if(A.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A[0]},l.prototype._get_selection_list=function(g,_,E){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[_[0]],!this._is_valid_selection(E,_))throw new Error("Invalid Default Value!");var A=this._get_array(g,E);if(!this._is_valid_selection(A,_))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+_+`
You passed in: '`+this.raw_options[g]+"'");return A},l.prototype._is_valid_selection=function(g,_){return g.length&&_.length&&!g.some(function(E){return _.indexOf(E)===-1})};function X(g,_){var E={};g=P(g);var A;for(A in g)A!==_&&(E[A]=g[A]);if(_&&g[_])for(A in g[_])E[A]=g[_][A];return E}function P(g){var _={},E;for(E in g){var A=E.replace(/-/g,"_");_[A]=g[E]}return _}ce.exports.Options=l,ce.exports.normalizeOpts=P,ce.exports.mergeOpts=X},function(ce,l,X){var P=X(8).InputScanner,g=X(9).Tokenizer,_=X(9).TOKEN,E=X(13).Directives,A=X(4),B=X(12).Pattern,H=X(14).TemplatablePattern;function V(M,oe){return oe.indexOf(M)!==-1}var L={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:_.START,RAW:_.RAW,EOF:_.EOF},I=new E(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,R=/[0-9]/,q=/[^\d\.]/,ne=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),ee=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";ee=ee.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),ee="\\?\\.(?!\\d) "+ee,ee=ee.replace(/ /g,"|");var ye=new RegExp(ee),Le="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Te=Le.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),$e=new RegExp("^(?:"+Te.join("|")+")$"),J,D=function(M,oe){g.call(this,M,oe),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var te=new B(this._input),S=new H(this._input).read_options(this._options);this.__patterns={template:S,identifier:S.starting_with(A.identifier).matching(A.identifierMatch),number:te.matching(w),punct:te.matching(ye),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(M){return M.type===L.COMMENT||M.type===L.BLOCK_COMMENT||M.type===L.UNKNOWN},D.prototype._is_opening=function(M){return M.type===L.START_BLOCK||M.type===L.START_EXPR},D.prototype._is_closing=function(M,oe){return(M.type===L.END_BLOCK||M.type===L.END_EXPR)&&oe&&(M.text==="]"&&oe.text==="["||M.text===")"&&oe.text==="("||M.text==="}"&&oe.text==="{")},D.prototype._reset=function(){J=!1},D.prototype._get_next_token=function(M,oe){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(M),te=te||this._read_singles(S),te=te||this._read_comment(S),te=te||this._read_regexp(S,M),te=te||this._read_xml(S,M),te=te||this._read_punctuation(),te=te||this._create_token(L.UNKNOWN,this._input.next()),te)},D.prototype._read_word=function(M){var oe;if(oe=this.__patterns.identifier.read(),oe!=="")return oe=oe.replace(A.allLineBreaks,`
`),!(M.type===L.DOT||M.type===L.RESERVED&&(M.text==="set"||M.text==="get"))&&$e.test(oe)?(oe==="in"||oe==="of")&&(M.type===L.WORD||M.type===L.STRING)?this._create_token(L.OPERATOR,oe):this._create_token(L.RESERVED,oe):this._create_token(L.WORD,oe);if(oe=this.__patterns.number.read(),oe!=="")return this._create_token(L.WORD,oe)},D.prototype._read_singles=function(M){var oe=null;return M==="("||M==="["?oe=this._create_token(L.START_EXPR,M):M===")"||M==="]"?oe=this._create_token(L.END_EXPR,M):M==="{"?oe=this._create_token(L.START_BLOCK,M):M==="}"?oe=this._create_token(L.END_BLOCK,M):M===";"?oe=this._create_token(L.SEMICOLON,M):M==="."&&q.test(this._input.peek(1))?oe=this._create_token(L.DOT,M):M===","&&(oe=this._create_token(L.COMMA,M)),oe&&this._input.next(),oe},D.prototype._read_pair=function(M,oe){var te=null;return M==="#"&&oe==="{"&&(te=this._create_token(L.START_BLOCK,M+oe)),te&&(this._input.next(),this._input.next()),te},D.prototype._read_punctuation=function(){var M=this.__patterns.punct.read();if(M!=="")return M==="="?this._create_token(L.EQUALS,M):M==="?."?this._create_token(L.DOT,M):this._create_token(L.OPERATOR,M)},D.prototype._read_non_javascript=function(M){var oe="";if(M==="#"){if(this._is_first_token()&&(oe=this.__patterns.shebang.read(),oe))return this._create_token(L.UNKNOWN,oe.trim()+`
`);if(oe=this.__patterns.include.read(),oe)return this._create_token(L.UNKNOWN,oe.trim()+`
`);M=this._input.next();var te="#";if(this._input.hasNext()&&this._input.testChar(R)){do M=this._input.next(),te+=M;while(this._input.hasNext()&&M!=="#"&&M!=="=");return M==="#"||(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(M==="<"&&this._is_first_token()){if(oe=this.__patterns.html_comment_start.read(),oe){for(;this._input.hasNext()&&!this._input.testChar(A.newline);)oe+=this._input.next();return J=!0,this._create_token(L.COMMENT,oe)}}else if(J&&M==="-"&&(oe=this.__patterns.html_comment_end.read(),oe))return J=!1,this._create_token(L.COMMENT,oe);return null},D.prototype._read_comment=function(M){var oe=null;if(M==="/"){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,`
`),oe=this._create_token(L.BLOCK_COMMENT,te),oe.directives=S}else this._input.peek(1)==="/"&&(te=this.__patterns.comment.read(),oe=this._create_token(L.COMMENT,te))}return oe},D.prototype._read_string=function(M){if(M==="`"||M==="'"||M==='"'){var oe=this._input.next();return this.has_char_escapes=!1,M==="`"?oe+=this._read_string_recursive("`",!0,"${"):oe+=this._read_string_recursive(M),this.has_char_escapes&&this._options.unescape_strings&&(oe=F(oe)),this._input.peek()===M&&(oe+=this._input.next()),oe=oe.replace(A.allLineBreaks,`
`),this._create_token(L.STRING,oe)}return null},D.prototype._allow_regexp_or_xml=function(M){return M.type===L.RESERVED&&V(M.text,["return","case","throw","else","do","typeof","yield"])||M.type===L.END_EXPR&&M.text===")"&&M.opened.previous.type===L.RESERVED&&V(M.opened.previous.text,["if","while","for"])||V(M.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(M,oe){if(M==="/"&&this._allow_regexp_or_xml(oe)){for(var te=this._input.next(),S=!1,v=!1;this._input.hasNext()&&(S||v||this._input.peek()!==M)&&!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()===M&&(te+=this._input.next(),te+=this._input.read(A.identifier)),this._create_token(L.STRING,te)}return null},D.prototype._read_xml=function(M,oe){if(this._options.e4x&&M==="<"&&this._allow_regexp_or_xml(oe)){var te="",S=this.__patterns.xml.read_match();if(S){for(var v=S[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),Y=v.indexOf("{")===0,ae=0;S;){var xe=!!S[1],Fe=S[2],Xe=!!S[S.length-1]||Fe.slice(0,8)==="![CDATA[";if(!Xe&&(Fe===v||Y&&Fe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(xe?--ae:++ae),te+=S[0],ae<=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(M){for(var oe="",te=0,S=new P(M),v=null;S.hasNext();)if(v=S.match(/([\s]|[^\\]|\\\\)+/g),v&&(oe+=v[0]),S.peek()==="\\"){if(S.next(),S.peek()==="x")v=S.match(/x([0-9A-Fa-f]{2})/g);else if(S.peek()==="u")v=S.match(/u([0-9A-Fa-f]{4})/g),v||(v=S.match(/u\{([0-9A-Fa-f]+)\}/g));else{oe+="\\",S.hasNext()&&(oe+=S.next());continue}if(!v||(te=parseInt(v[1],16),te>126&&te<=255&&v[0].indexOf("x")===0))return M;te>=0&&te<32||te>1114111?oe+="\\"+v[0]:te===34||te===39||te===92?oe+="\\"+String.fromCharCode(te):oe+=String.fromCharCode(te)}return oe}D.prototype._read_string_recursive=function(M,oe,te){var S,v;M==="'"?v=this.__patterns.single_quote:M==='"'?v=this.__patterns.double_quote:M==="`"?v=this.__patterns.template_text:M==="}"&&(v=this.__patterns.template_expression);for(var Y=v.read(),ae="";this._input.hasNext();){if(ae=this._input.next(),ae===M||!oe&&A.newline.test(ae)){this._input.back();break}else ae==="\\"&&this._input.hasNext()?(S=this._input.peek(),S==="x"||S==="u"?this.has_char_escapes=!0:S==="\r"&&this._input.peek(1)===`
`&&this._input.next(),ae+=this._input.next()):te&&(te==="${"&&ae==="$"&&this._input.peek()==="{"&&(ae+=this._input.next()),te===ae&&(M==="`"?ae+=this._read_string_recursive("}",oe,"`"):ae+=this._read_string_recursive("`",oe,"${"),this._input.hasNext()&&(ae+=this._input.next())));ae+=v.read(),Y+=ae}return Y},ce.exports.Tokenizer=D,ce.exports.TOKEN=L,ce.exports.positionable_operators=ne.slice(),ce.exports.line_starters=Le.slice()},function(ce){var l=RegExp.prototype.hasOwnProperty("sticky");function X(P){this.__input=P||"",this.__input_length=this.__input.length,this.__position=0}X.prototype.restart=function(){this.__position=0},X.prototype.back=function(){this.__position>0&&(this.__position-=1)},X.prototype.hasNext=function(){return this.__position<this.__input_length},X.prototype.next=function(){var P=null;return this.hasNext()&&(P=this.__input.charAt(this.__position),this.__position+=1),P},X.prototype.peek=function(P){var g=null;return P=P||0,P+=this.__position,P>=0&&P<this.__input_length&&(g=this.__input.charAt(P)),g},X.prototype.__match=function(P,g){P.lastIndex=g;var _=P.exec(this.__input);return _&&!(l&&P.sticky)&&_.index!==g&&(_=null),_},X.prototype.test=function(P,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(P,g):!1},X.prototype.testChar=function(P,g){var _=this.peek(g);return P.lastIndex=0,_!==null&&P.test(_)},X.prototype.match=function(P){var g=this.__match(P,this.__position);return g?this.__position+=g[0].length:g=null,g},X.prototype.read=function(P,g,_){var E="",A;return P&&(A=this.match(P),A&&(E+=A[0])),g&&(A||!P)&&(E+=this.readUntil(g,_)),E},X.prototype.readUntil=function(P,g){var _="",E=this.__position;P.lastIndex=this.__position;var A=P.exec(this.__input);return A?(E=A.index,g&&(E+=A[0].length)):E=this.__input_length,_=this.__input.substring(this.__position,E),this.__position=E,_},X.prototype.readUntilAfter=function(P){return this.readUntil(P,!0)},X.prototype.get_regexp=function(P,g){var _=null,E="g";return g&&l&&(E="y"),typeof P=="string"&&P!==""?_=new RegExp(P,E):P&&(_=new RegExp(P.source,E)),_},X.prototype.get_literal_regexp=function(P){return RegExp(P.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},X.prototype.peekUntilAfter=function(P){var g=this.__position,_=this.readUntilAfter(P);return this.__position=g,_},X.prototype.lookBack=function(P){var g=this.__position-1;return g>=P.length&&this.__input.substring(g-P.length,g).toLowerCase()===P},ce.exports.InputScanner=X},function(ce,l,X){var P=X(8).InputScanner,g=X(3).Token,_=X(10).TokenStream,E=X(11).WhitespacePattern,A={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},B=function(H,V){this._input=new P(H),this._options=V||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new E(this._input)};B.prototype.tokenize=function(){this._input.restart(),this.__tokens=new _,this._reset();for(var H,V=new g(A.START,""),L=null,I=[],w=new _;V.type!==A.EOF;){for(H=this._get_next_token(V,L);this._is_comment(H);)w.add(H),H=this._get_next_token(V,L);w.isEmpty()||(H.comments_before=w,w=new _),H.parent=L,this._is_opening(H)?(I.push(L),L=H):L&&this._is_closing(H,L)&&(H.opened=L,L.closed=H,L=I.pop(),H.parent=L),H.previous=V,V.next=H,this.__tokens.add(H),V=H}return this.__tokens},B.prototype._is_first_token=function(){return this.__tokens.isEmpty()},B.prototype._reset=function(){},B.prototype._get_next_token=function(H,V){this._readWhitespace();var L=this._input.read(/.+/g);return L?this._create_token(A.RAW,L):this._create_token(A.EOF,"")},B.prototype._is_comment=function(H){return!1},B.prototype._is_opening=function(H){return!1},B.prototype._is_closing=function(H,V){return!1},B.prototype._create_token=function(H,V){var L=new g(H,V,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return L},B.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},ce.exports.Tokenizer=B,ce.exports.TOKEN=A},function(ce){function l(X){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=X}l.prototype.restart=function(){this.__position=0},l.prototype.isEmpty=function(){return this.__tokens_length===0},l.prototype.hasNext=function(){return this.__position<this.__tokens_length},l.prototype.next=function(){var X=null;return this.hasNext()&&(X=this.__tokens[this.__position],this.__position+=1),X},l.prototype.peek=function(X){var P=null;return X=X||0,X+=this.__position,X>=0&&X<this.__tokens_length&&(P=this.__tokens[X]),P},l.prototype.add=function(X){this.__parent_token&&(X.parent=this.__parent_token),this.__tokens.push(X),this.__tokens_length+=1},ce.exports.TokenStream=l},function(ce,l,X){var P=X(12).Pattern;function g(_,E){P.call(this,_,E),E?this._line_regexp=this._input.get_regexp(E._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new P,g.prototype.__set_whitespace_patterns=function(_,E){_+="\\t ",E+="\\n\\r",this._match_pattern=this._input.get_regexp("["+_+E+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+E+"]")},g.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var _=this._input.read(this._match_pattern);if(_===" ")this.whitespace_before_token=" ";else if(_){var E=this.__split(this._newline_regexp,_);this.newline_count=E.length-1,this.whitespace_before_token=E[this.newline_count]}return _},g.prototype.matching=function(_,E){var A=this._create();return A.__set_whitespace_patterns(_,E),A._update(),A},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(_,E){_.lastIndex=0;for(var A=0,B=[],H=_.exec(E);H;)B.push(E.substring(A,H.index)),A=H.index+H[0].length,H=_.exec(E);return A<E.length?B.push(E.substring(A,E.length)):B.push(""),B},ce.exports.WhitespacePattern=g},function(ce){function l(X,P){this._input=X,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,P&&(this._starting_pattern=this._input.get_regexp(P._starting_pattern,!0),this._match_pattern=this._input.get_regexp(P._match_pattern,!0),this._until_pattern=this._input.get_regexp(P._until_pattern),this._until_after=P._until_after)}l.prototype.read=function(){var X=this._input.read(this._starting_pattern);return(!this._starting_pattern||X)&&(X+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),X},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(X){var P=this._create();return P._until_after=!0,P._until_pattern=this._input.get_regexp(X),P._update(),P},l.prototype.until=function(X){var P=this._create();return P._until_after=!1,P._until_pattern=this._input.get_regexp(X),P._update(),P},l.prototype.starting_with=function(X){var P=this._create();return P._starting_pattern=this._input.get_regexp(X,!0),P._update(),P},l.prototype.matching=function(X){var P=this._create();return P._match_pattern=this._input.get_regexp(X,!0),P._update(),P},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},ce.exports.Pattern=l},function(ce){function l(X,P){X=typeof X=="string"?X:X.source,P=typeof P=="string"?P:P.source,this.__directives_block_pattern=new RegExp(X+/ beautify( \w+[:]\w+)+ /.source+P,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(X+/\sbeautify\signore:end\s/.source+P,"g")}l.prototype.get_directives=function(X){if(!X.match(this.__directives_block_pattern))return null;var P={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(X);g;)P[g[1]]=g[2],g=this.__directive_pattern.exec(X);return P},l.prototype.readIgnored=function(X){return X.readUntilAfter(this.__directives_end_ignore_pattern)},ce.exports.Directives=l},function(ce,l,X){var P=X(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function _(E,A){P.call(this,E,A),this.__template_pattern=null,this._disabled=Object.assign({},g),this._excluded=Object.assign({},g),A&&(this.__template_pattern=this._input.get_regexp(A.__template_pattern),this._excluded=Object.assign(this._excluded,A._excluded),this._disabled=Object.assign(this._disabled,A._disabled));var B=new P(E);this.__patterns={handlebars_comment:B.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:B.starting_with(/{{{/).until_after(/}}}/),handlebars:B.starting_with(/{{/).until_after(/}}/),php:B.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:B.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:B.starting_with(/{%/).until_after(/%}/),django_value:B.starting_with(/{{/).until_after(/}}/),django_comment:B.starting_with(/{#/).until_after(/#}/),smarty:B.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:B.starting_with(/{\*/).until_after(/\*}/),smarty_literal:B.starting_with(/{literal}/).until_after(/{\/literal}/)}}_.prototype=new P,_.prototype._create=function(){return new _(this._input,this)},_.prototype._update=function(){this.__set_templated_pattern()},_.prototype.disable=function(E){var A=this._create();return A._disabled[E]=!0,A._update(),A},_.prototype.read_options=function(E){var A=this._create();for(var B in g)A._disabled[B]=E.templating.indexOf(B)===-1;return A._update(),A},_.prototype.exclude=function(E){var A=this._create();return A._excluded[E]=!0,A._update(),A},_.prototype.read=function(){var E="";this._match_pattern?E=this._input.read(this._starting_pattern):E=this._input.read(this._starting_pattern,this.__template_pattern);for(var A=this._read_template();A;)this._match_pattern?A+=this._input.read(this._match_pattern):A+=this._input.readUntil(this.__template_pattern),E+=A,A=this._read_template();return this._until_after&&(E+=this._input.readUntilAfter(this._until_pattern)),E},_.prototype.__set_templated_pattern=function(){var E=[];this._disabled.php||E.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||E.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(E.push(this.__patterns.django._starting_pattern.source),E.push(this.__patterns.django_value._starting_pattern.source),E.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||E.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&E.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+E.join("|")+")")},_.prototype._read_template=function(){var E="",A=this._input.peek();if(A==="<"){var B=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&B==="?"&&(E=E||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&B==="%"&&(E=E||this.__patterns.erb.read())}else A==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(E=E||this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars_unescaped.read(),E=E||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(E=E||this.__patterns.django_value.read()),this._excluded.django||(E=E||this.__patterns.django_comment.read(),E=E||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(E=E||this.__patterns.smarty_comment.read(),E=E||this.__patterns.smarty_literal.read(),E=E||this.__patterns.smarty.read()));return E},ce.exports.TemplatablePattern=_}],j={};function p(ce){var l=j[ce];if(l!==void 0)return l.exports;var X=j[ce]={exports:{}};return he[ce](X,X.exports,p),X.exports}var me=p(0);de=me})();var Se=de;K=[],U=function(){return{js_beautify:Se}}.apply(st,K),U!==void 0&&(Yt.exports=U)})()},75918:function(Yt,st,K){"use strict";K.d(st,{Wi:function(){return p},Z0:function(){return me},aU:function(){return j},eZ:function(){return l},wY:function(){return ce}});var U=K(4348),de=K(69323),Se=K(13268),he=function(X,P,g,_){function E(A){return A instanceof g?A:new g(function(B){B(A)})}return new(g||(g=Promise))(function(A,B){function H(I){try{L(_.next(I))}catch(w){B(w)}}function V(I){try{L(_.throw(I))}catch(w){B(w)}}function L(I){I.done?A(I.value):E(I.value).then(H,V)}L((_=_.apply(X,P||[])).next())})};class j extends de.JT{constructor(P,g="",_="",E=!0,A){super(),this._onDidChange=this._register(new U.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=P,this._label=g,this._cssClass=_,this._enabled=E,this._actionCallback=A}get id(){return this._id}get label(){return this._label}set label(P){this._setLabel(P)}_setLabel(P){this._label!==P&&(this._label=P,this._onDidChange.fire({label:P}))}get tooltip(){return this._tooltip||""}set tooltip(P){this._setTooltip(P)}_setTooltip(P){this._tooltip!==P&&(this._tooltip=P,this._onDidChange.fire({tooltip:P}))}get class(){return this._cssClass}set class(P){this._setClass(P)}_setClass(P){this._cssClass!==P&&(this._cssClass=P,this._onDidChange.fire({class:P}))}get enabled(){return this._enabled}set enabled(P){this._setEnabled(P)}_setEnabled(P){this._enabled!==P&&(this._enabled=P,this._onDidChange.fire({enabled:P}))}get checked(){return this._checked}set checked(P){this._setChecked(P)}_setChecked(P){this._checked!==P&&(this._checked=P,this._onDidChange.fire({checked:P}))}run(P,g){return he(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(P))})}}class p extends de.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new U.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new U.Q5),this.onDidRun=this._onDidRun.event}run(P,g){return he(this,void 0,void 0,function*(){if(!P.enabled)return;this._onBeforeRun.fire({action:P});let _;try{yield this.runAction(P,g)}catch(E){_=E}this._onDidRun.fire({action:P,error:_})})}runAction(P,g){return he(this,void 0,void 0,function*(){yield P.run(g)})}}class me extends j{constructor(P){super(me.ID,P,P?"separator text":"separator"),this.checked=!1,this.enabled=!1}}me.ID="vs.actions.separator";class ce{constructor(P,g,_,E){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=P,this.label=g,this.class=E,this._actions=_}get actions(){return this._actions}dispose(){}run(){return he(this,void 0,void 0,function*(){})}}class l extends j{constructor(){super(l.ID,Se.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Yt,st,K){"use strict";K.d(st,{ok:function(){return U}});function U(de,Se){if(!de)throw new Error(Se?`Assertion failed (${Se})`:"Assertion Failed")}},52615:function(Yt,st,K){"use strict";K.d(st,{CM:function(){return j},JL:function(){return p},dT:function(){return ce},fK:function(){return he},lA:function(){return me}});var U=K(4348);class de{constructor(){this._icons=new Map,this._onDidRegister=new U.Q5}add(X){const P=this._icons.get(X.id);P?X.description?P.description=X.description:console.error(`Duplicate registration of codicon ${X.id}`):(this._icons.set(X.id,X),this._onDidRegister.fire(X))}get(X){return this._icons.get(X)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Se=new de,he=Se;function j(l,X){return new me(l,X)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(X,P)=>` ${P} `).trim():""}class me{constructor(X,P,g){this.id=X,this.definition=P,this.description=g,Se.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var ce;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const X=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function P(E){if(E instanceof me)return["codicon","codicon-"+E.id];const A=X.exec(E.id);if(!A)return P(me.error);let[,B,H]=A;const V=["codicon","codicon-"+B];return H&&V.push("codicon-modifier-"+H.substr(1)),V}l.asClassNameArray=P;function g(E){return P(E).join(" ")}l.asClassName=g;function _(E){return"."+P(E).join(".")}l.asCSSSelector=_})(ce||(ce={})),function(l){l.add=new l("add",{fontCharacter:"\\ea60"}),l.plus=new l("plus",l.add.definition),l.gistNew=new l("gist-new",l.add.definition),l.repoCreate=new l("repo-create",l.add.definition),l.lightbulb=new l("lightbulb",{fontCharacter:"\\ea61"}),l.lightBulb=new l("light-bulb",{fontCharacter:"\\ea61"}),l.repo=new l("repo",{fontCharacter:"\\ea62"}),l.repoDelete=new l("repo-delete",{fontCharacter:"\\ea62"}),l.gistFork=new l("gist-fork",{fontCharacter:"\\ea63"}),l.repoForked=new l("repo-forked",{fontCharacter:"\\ea63"}),l.gitPullRequest=new l("git-pull-request",{fontCharacter:"\\ea64"}),l.gitPullRequestAbandoned=new l("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),l.recordKeys=new l("record-keys",{fontCharacter:"\\ea65"}),l.keyboard=new l("keyboard",{fontCharacter:"\\ea65"}),l.tag=new l("tag",{fontCharacter:"\\ea66"}),l.tagAdd=new l("tag-add",{fontCharacter:"\\ea66"}),l.tagRemove=new l("tag-remove",{fontCharacter:"\\ea66"}),l.person=new l("person",{fontCharacter:"\\ea67"}),l.personFollow=new l("person-follow",{fontCharacter:"\\ea67"}),l.personOutline=new l("person-outline",{fontCharacter:"\\ea67"}),l.personFilled=new l("person-filled",{fontCharacter:"\\ea67"}),l.gitBranch=new l("git-branch",{fontCharacter:"\\ea68"}),l.gitBranchCreate=new l("git-branch-create",{fontCharacter:"\\ea68"}),l.gitBranchDelete=new l("git-branch-delete",{fontCharacter:"\\ea68"}),l.sourceControl=new l("source-control",{fontCharacter:"\\ea68"}),l.mirror=new l("mirror",{fontCharacter:"\\ea69"}),l.mirrorPublic=new l("mirror-public",{fontCharacter:"\\ea69"}),l.star=new l("star",{fontCharacter:"\\ea6a"}),l.starAdd=new l("star-add",{fontCharacter:"\\ea6a"}),l.starDelete=new l("star-delete",{fontCharacter:"\\ea6a"}),l.starEmpty=new l("star-empty",{fontCharacter:"\\ea6a"}),l.comment=new l("comment",{fontCharacter:"\\ea6b"}),l.commentAdd=new l("comment-add",{fontCharacter:"\\ea6b"}),l.alert=new l("alert",{fontCharacter:"\\ea6c"}),l.warning=new l("warning",{fontCharacter:"\\ea6c"}),l.search=new l("search",{fontCharacter:"\\ea6d"}),l.searchSave=new l("search-save",{fontCharacter:"\\ea6d"}),l.logOut=new l("log-out",{fontCharacter:"\\ea6e"}),l.signOut=new l("sign-out",{fontCharacter:"\\ea6e"}),l.logIn=new l("log-in",{fontCharacter:"\\ea6f"}),l.signIn=new l("sign-in",{fontCharacter:"\\ea6f"}),l.eye=new l("eye",{fontCharacter:"\\ea70"}),l.eyeUnwatch=new l("eye-unwatch",{fontCharacter:"\\ea70"}),l.eyeWatch=new l("eye-watch",{fontCharacter:"\\ea70"}),l.circleFilled=new l("circle-filled",{fontCharacter:"\\ea71"}),l.primitiveDot=new l("primitive-dot",{fontCharacter:"\\ea71"}),l.closeDirty=new l("close-dirty",{fontCharacter:"\\ea71"}),l.debugBreakpoint=new l("debug-breakpoint",{fontCharacter:"\\ea71"}),l.debugBreakpointDisabled=new l("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),l.debugHint=new l("debug-hint",{fontCharacter:"\\ea71"}),l.primitiveSquare=new l("primitive-square",{fontCharacter:"\\ea72"}),l.edit=new l("edit",{fontCharacter:"\\ea73"}),l.pencil=new l("pencil",{fontCharacter:"\\ea73"}),l.info=new l("info",{fontCharacter:"\\ea74"}),l.issueOpened=new l("issue-opened",{fontCharacter:"\\ea74"}),l.gistPrivate=new l("gist-private",{fontCharacter:"\\ea75"}),l.gitForkPrivate=new l("git-fork-private",{fontCharacter:"\\ea75"}),l.lock=new l("lock",{fontCharacter:"\\ea75"}),l.mirrorPrivate=new l("mirror-private",{fontCharacter:"\\ea75"}),l.close=new l("close",{fontCharacter:"\\ea76"}),l.removeClose=new l("remove-close",{fontCharacter:"\\ea76"}),l.x=new l("x",{fontCharacter:"\\ea76"}),l.repoSync=new l("repo-sync",{fontCharacter:"\\ea77"}),l.sync=new l("sync",{fontCharacter:"\\ea77"}),l.clone=new l("clone",{fontCharacter:"\\ea78"}),l.desktopDownload=new l("desktop-download",{fontCharacter:"\\ea78"}),l.beaker=new l("beaker",{fontCharacter:"\\ea79"}),l.microscope=new l("microscope",{fontCharacter:"\\ea79"}),l.vm=new l("vm",{fontCharacter:"\\ea7a"}),l.deviceDesktop=new l("device-desktop",{fontCharacter:"\\ea7a"}),l.file=new l("file",{fontCharacter:"\\ea7b"}),l.fileText=new l("file-text",{fontCharacter:"\\ea7b"}),l.more=new l("more",{fontCharacter:"\\ea7c"}),l.ellipsis=new l("ellipsis",{fontCharacter:"\\ea7c"}),l.kebabHorizontal=new l("kebab-horizontal",{fontCharacter:"\\ea7c"}),l.mailReply=new l("mail-reply",{fontCharacter:"\\ea7d"}),l.reply=new l("reply",{fontCharacter:"\\ea7d"}),l.organization=new l("organization",{fontCharacter:"\\ea7e"}),l.organizationFilled=new l("organization-filled",{fontCharacter:"\\ea7e"}),l.organizationOutline=new l("organization-outline",{fontCharacter:"\\ea7e"}),l.newFile=new l("new-file",{fontCharacter:"\\ea7f"}),l.fileAdd=new l("file-add",{fontCharacter:"\\ea7f"}),l.newFolder=new l("new-folder",{fontCharacter:"\\ea80"}),l.fileDirectoryCreate=new l("file-directory-create",{fontCharacter:"\\ea80"}),l.trash=new l("trash",{fontCharacter:"\\ea81"}),l.trashcan=new l("trashcan",{fontCharacter:"\\ea81"}),l.history=new l("history",{fontCharacter:"\\ea82"}),l.clock=new l("clock",{fontCharacter:"\\ea82"}),l.folder=new l("folder",{fontCharacter:"\\ea83"}),l.fileDirectory=new l("file-directory",{fontCharacter:"\\ea83"}),l.symbolFolder=new l("symbol-folder",{fontCharacter:"\\ea83"}),l.logoGithub=new l("logo-github",{fontCharacter:"\\ea84"}),l.markGithub=new l("mark-github",{fontCharacter:"\\ea84"}),l.github=new l("github",{fontCharacter:"\\ea84"}),l.terminal=new l("terminal",{fontCharacter:"\\ea85"}),l.console=new l("console",{fontCharacter:"\\ea85"}),l.repl=new l("repl",{fontCharacter:"\\ea85"}),l.zap=new l("zap",{fontCharacter:"\\ea86"}),l.symbolEvent=new l("symbol-event",{fontCharacter:"\\ea86"}),l.error=new l("error",{fontCharacter:"\\ea87"}),l.stop=new l("stop",{fontCharacter:"\\ea87"}),l.variable=new l("variable",{fontCharacter:"\\ea88"}),l.symbolVariable=new l("symbol-variable",{fontCharacter:"\\ea88"}),l.array=new l("array",{fontCharacter:"\\ea8a"}),l.symbolArray=new l("symbol-array",{fontCharacter:"\\ea8a"}),l.symbolModule=new l("symbol-module",{fontCharacter:"\\ea8b"}),l.symbolPackage=new l("symbol-package",{fontCharacter:"\\ea8b"}),l.symbolNamespace=new l("symbol-namespace",{fontCharacter:"\\ea8b"}),l.symbolObject=new l("symbol-object",{fontCharacter:"\\ea8b"}),l.symbolMethod=new l("symbol-method",{fontCharacter:"\\ea8c"}),l.symbolFunction=new l("symbol-function",{fontCharacter:"\\ea8c"}),l.symbolConstructor=new l("symbol-constructor",{fontCharacter:"\\ea8c"}),l.symbolBoolean=new l("symbol-boolean",{fontCharacter:"\\ea8f"}),l.symbolNull=new l("symbol-null",{fontCharacter:"\\ea8f"}),l.symbolNumeric=new l("symbol-numeric",{fontCharacter:"\\ea90"}),l.symbolNumber=new l("symbol-number",{fontCharacter:"\\ea90"}),l.symbolStructure=new l("symbol-structure",{fontCharacter:"\\ea91"}),l.symbolStruct=new l("symbol-struct",{fontCharacter:"\\ea91"}),l.symbolParameter=new l("symbol-parameter",{fontCharacter:"\\ea92"}),l.symbolTypeParameter=new l("symbol-type-parameter",{fontCharacter:"\\ea92"}),l.symbolKey=new l("symbol-key",{fontCharacter:"\\ea93"}),l.symbolText=new l("symbol-text",{fontCharacter:"\\ea93"}),l.symbolReference=new l("symbol-reference",{fontCharacter:"\\ea94"}),l.goToFile=new l("go-to-file",{fontCharacter:"\\ea94"}),l.symbolEnum=new l("symbol-enum",{fontCharacter:"\\ea95"}),l.symbolValue=new l("symbol-value",{fontCharacter:"\\ea95"}),l.symbolRuler=new l("symbol-ruler",{fontCharacter:"\\ea96"}),l.symbolUnit=new l("symbol-unit",{fontCharacter:"\\ea96"}),l.activateBreakpoints=new l("activate-breakpoints",{fontCharacter:"\\ea97"}),l.archive=new l("archive",{fontCharacter:"\\ea98"}),l.arrowBoth=new l("arrow-both",{fontCharacter:"\\ea99"}),l.arrowDown=new l("arrow-down",{fontCharacter:"\\ea9a"}),l.arrowLeft=new l("arrow-left",{fontCharacter:"\\ea9b"}),l.arrowRight=new l("arrow-right",{fontCharacter:"\\ea9c"}),l.arrowSmallDown=new l("arrow-small-down",{fontCharacter:"\\ea9d"}),l.arrowSmallLeft=new l("arrow-small-left",{fontCharacter:"\\ea9e"}),l.arrowSmallRight=new l("arrow-small-right",{fontCharacter:"\\ea9f"}),l.arrowSmallUp=new l("arrow-small-up",{fontCharacter:"\\eaa0"}),l.arrowUp=new l("arrow-up",{fontCharacter:"\\eaa1"}),l.bell=new l("bell",{fontCharacter:"\\eaa2"}),l.bold=new l("bold",{fontCharacter:"\\eaa3"}),l.book=new l("book",{fontCharacter:"\\eaa4"}),l.bookmark=new l("bookmark",{fontCharacter:"\\eaa5"}),l.debugBreakpointConditionalUnverified=new l("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),l.debugBreakpointConditional=new l("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),l.debugBreakpointConditionalDisabled=new l("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),l.debugBreakpointDataUnverified=new l("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),l.debugBreakpointData=new l("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),l.debugBreakpointDataDisabled=new l("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),l.debugBreakpointLogUnverified=new l("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),l.debugBreakpointLog=new l("debug-breakpoint-log",{fontCharacter:"\\eaab"}),l.debugBreakpointLogDisabled=new l("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),l.briefcase=new l("briefcase",{fontCharacter:"\\eaac"}),l.broadcast=new l("broadcast",{fontCharacter:"\\eaad"}),l.browser=new l("browser",{fontCharacter:"\\eaae"}),l.bug=new l("bug",{fontCharacter:"\\eaaf"}),l.calendar=new l("calendar",{fontCharacter:"\\eab0"}),l.caseSensitive=new l("case-sensitive",{fontCharacter:"\\eab1"}),l.check=new l("check",{fontCharacter:"\\eab2"}),l.checklist=new l("checklist",{fontCharacter:"\\eab3"}),l.chevronDown=new l("chevron-down",{fontCharacter:"\\eab4"}),l.dropDownButton=new l("drop-down-button",l.chevronDown.definition),l.chevronLeft=new l("chevron-left",{fontCharacter:"\\eab5"}),l.chevronRight=new l("chevron-right",{fontCharacter:"\\eab6"}),l.chevronUp=new l("chevron-up",{fontCharacter:"\\eab7"}),l.chromeClose=new l("chrome-close",{fontCharacter:"\\eab8"}),l.chromeMaximize=new l("chrome-maximize",{fontCharacter:"\\eab9"}),l.chromeMinimize=new l("chrome-minimize",{fontCharacter:"\\eaba"}),l.chromeRestore=new l("chrome-restore",{fontCharacter:"\\eabb"}),l.circleOutline=new l("circle-outline",{fontCharacter:"\\eabc"}),l.debugBreakpointUnverified=new l("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),l.circleSlash=new l("circle-slash",{fontCharacter:"\\eabd"}),l.circuitBoard=new l("circuit-board",{fontCharacter:"\\eabe"}),l.clearAll=new l("clear-all",{fontCharacter:"\\eabf"}),l.clippy=new l("clippy",{fontCharacter:"\\eac0"}),l.closeAll=new l("close-all",{fontCharacter:"\\eac1"}),l.cloudDownload=new l("cloud-download",{fontCharacter:"\\eac2"}),l.cloudUpload=new l("cloud-upload",{fontCharacter:"\\eac3"}),l.code=new l("code",{fontCharacter:"\\eac4"}),l.collapseAll=new l("collapse-all",{fontCharacter:"\\eac5"}),l.colorMode=new l("color-mode",{fontCharacter:"\\eac6"}),l.commentDiscussion=new l("comment-discussion",{fontCharacter:"\\eac7"}),l.compareChanges=new l("compare-changes",{fontCharacter:"\\eafd"}),l.creditCard=new l("credit-card",{fontCharacter:"\\eac9"}),l.dash=new l("dash",{fontCharacter:"\\eacc"}),l.dashboard=new l("dashboard",{fontCharacter:"\\eacd"}),l.database=new l("database",{fontCharacter:"\\eace"}),l.debugContinue=new l("debug-continue",{fontCharacter:"\\eacf"}),l.debugDisconnect=new l("debug-disconnect",{fontCharacter:"\\ead0"}),l.debugPause=new l("debug-pause",{fontCharacter:"\\ead1"}),l.debugRestart=new l("debug-restart",{fontCharacter:"\\ead2"}),l.debugStart=new l("debug-start",{fontCharacter:"\\ead3"}),l.debugStepInto=new l("debug-step-into",{fontCharacter:"\\ead4"}),l.debugStepOut=new l("debug-step-out",{fontCharacter:"\\ead5"}),l.debugStepOver=new l("debug-step-over",{fontCharacter:"\\ead6"}),l.debugStop=new l("debug-stop",{fontCharacter:"\\ead7"}),l.debug=new l("debug",{fontCharacter:"\\ead8"}),l.deviceCameraVideo=new l("device-camera-video",{fontCharacter:"\\ead9"}),l.deviceCamera=new l("device-camera",{fontCharacter:"\\eada"}),l.deviceMobile=new l("device-mobile",{fontCharacter:"\\eadb"}),l.diffAdded=new l("diff-added",{fontCharacter:"\\eadc"}),l.diffIgnored=new l("diff-ignored",{fontCharacter:"\\eadd"}),l.diffModified=new l("diff-modified",{fontCharacter:"\\eade"}),l.diffRemoved=new l("diff-removed",{fontCharacter:"\\eadf"}),l.diffRenamed=new l("diff-renamed",{fontCharacter:"\\eae0"}),l.diff=new l("diff",{fontCharacter:"\\eae1"}),l.discard=new l("discard",{fontCharacter:"\\eae2"}),l.editorLayout=new l("editor-layout",{fontCharacter:"\\eae3"}),l.emptyWindow=new l("empty-window",{fontCharacter:"\\eae4"}),l.exclude=new l("exclude",{fontCharacter:"\\eae5"}),l.extensions=new l("extensions",{fontCharacter:"\\eae6"}),l.eyeClosed=new l("eye-closed",{fontCharacter:"\\eae7"}),l.fileBinary=new l("file-binary",{fontCharacter:"\\eae8"}),l.fileCode=new l("file-code",{fontCharacter:"\\eae9"}),l.fileMedia=new l("file-media",{fontCharacter:"\\eaea"}),l.filePdf=new l("file-pdf",{fontCharacter:"\\eaeb"}),l.fileSubmodule=new l("file-submodule",{fontCharacter:"\\eaec"}),l.fileSymlinkDirectory=new l("file-symlink-directory",{fontCharacter:"\\eaed"}),l.fileSymlinkFile=new l("file-symlink-file",{fontCharacter:"\\eaee"}),l.fileZip=new l("file-zip",{fontCharacter:"\\eaef"}),l.files=new l("files",{fontCharacter:"\\eaf0"}),l.filter=new l("filter",{fontCharacter:"\\eaf1"}),l.flame=new l("flame",{fontCharacter:"\\eaf2"}),l.foldDown=new l("fold-down",{fontCharacter:"\\eaf3"}),l.foldUp=new l("fold-up",{fontCharacter:"\\eaf4"}),l.fold=new l("fold",{fontCharacter:"\\eaf5"}),l.folderActive=new l("folder-active",{fontCharacter:"\\eaf6"}),l.folderOpened=new l("folder-opened",{fontCharacter:"\\eaf7"}),l.gear=new l("gear",{fontCharacter:"\\eaf8"}),l.gift=new l("gift",{fontCharacter:"\\eaf9"}),l.gistSecret=new l("gist-secret",{fontCharacter:"\\eafa"}),l.gist=new l("gist",{fontCharacter:"\\eafb"}),l.gitCommit=new l("git-commit",{fontCharacter:"\\eafc"}),l.gitCompare=new l("git-compare",{fontCharacter:"\\eafd"}),l.gitMerge=new l("git-merge",{fontCharacter:"\\eafe"}),l.githubAction=new l("github-action",{fontCharacter:"\\eaff"}),l.githubAlt=new l("github-alt",{fontCharacter:"\\eb00"}),l.globe=new l("globe",{fontCharacter:"\\eb01"}),l.grabber=new l("grabber",{fontCharacter:"\\eb02"}),l.graph=new l("graph",{fontCharacter:"\\eb03"}),l.gripper=new l("gripper",{fontCharacter:"\\eb04"}),l.heart=new l("heart",{fontCharacter:"\\eb05"}),l.home=new l("home",{fontCharacter:"\\eb06"}),l.horizontalRule=new l("horizontal-rule",{fontCharacter:"\\eb07"}),l.hubot=new l("hubot",{fontCharacter:"\\eb08"}),l.inbox=new l("inbox",{fontCharacter:"\\eb09"}),l.issueClosed=new l("issue-closed",{fontCharacter:"\\eba4"}),l.issueReopened=new l("issue-reopened",{fontCharacter:"\\eb0b"}),l.issues=new l("issues",{fontCharacter:"\\eb0c"}),l.italic=new l("italic",{fontCharacter:"\\eb0d"}),l.jersey=new l("jersey",{fontCharacter:"\\eb0e"}),l.json=new l("json",{fontCharacter:"\\eb0f"}),l.kebabVertical=new l("kebab-vertical",{fontCharacter:"\\eb10"}),l.key=new l("key",{fontCharacter:"\\eb11"}),l.law=new l("law",{fontCharacter:"\\eb12"}),l.lightbulbAutofix=new l("lightbulb-autofix",{fontCharacter:"\\eb13"}),l.linkExternal=new l("link-external",{fontCharacter:"\\eb14"}),l.link=new l("link",{fontCharacter:"\\eb15"}),l.listOrdered=new l("list-ordered",{fontCharacter:"\\eb16"}),l.listUnordered=new l("list-unordered",{fontCharacter:"\\eb17"}),l.liveShare=new l("live-share",{fontCharacter:"\\eb18"}),l.loading=new l("loading",{fontCharacter:"\\eb19"}),l.location=new l("location",{fontCharacter:"\\eb1a"}),l.mailRead=new l("mail-read",{fontCharacter:"\\eb1b"}),l.mail=new l("mail",{fontCharacter:"\\eb1c"}),l.markdown=new l("markdown",{fontCharacter:"\\eb1d"}),l.megaphone=new l("megaphone",{fontCharacter:"\\eb1e"}),l.mention=new l("mention",{fontCharacter:"\\eb1f"}),l.milestone=new l("milestone",{fontCharacter:"\\eb20"}),l.mortarBoard=new l("mortar-board",{fontCharacter:"\\eb21"}),l.move=new l("move",{fontCharacter:"\\eb22"}),l.multipleWindows=new l("multiple-windows",{fontCharacter:"\\eb23"}),l.mute=new l("mute",{fontCharacter:"\\eb24"}),l.noNewline=new l("no-newline",{fontCharacter:"\\eb25"}),l.note=new l("note",{fontCharacter:"\\eb26"}),l.octoface=new l("octoface",{fontCharacter:"\\eb27"}),l.openPreview=new l("open-preview",{fontCharacter:"\\eb28"}),l.package_=new l("package",{fontCharacter:"\\eb29"}),l.paintcan=new l("paintcan",{fontCharacter:"\\eb2a"}),l.pin=new l("pin",{fontCharacter:"\\eb2b"}),l.play=new l("play",{fontCharacter:"\\eb2c"}),l.run=new l("run",{fontCharacter:"\\eb2c"}),l.plug=new l("plug",{fontCharacter:"\\eb2d"}),l.preserveCase=new l("preserve-case",{fontCharacter:"\\eb2e"}),l.preview=new l("preview",{fontCharacter:"\\eb2f"}),l.project=new l("project",{fontCharacter:"\\eb30"}),l.pulse=new l("pulse",{fontCharacter:"\\eb31"}),l.question=new l("question",{fontCharacter:"\\eb32"}),l.quote=new l("quote",{fontCharacter:"\\eb33"}),l.radioTower=new l("radio-tower",{fontCharacter:"\\eb34"}),l.reactions=new l("reactions",{fontCharacter:"\\eb35"}),l.references=new l("references",{fontCharacter:"\\eb36"}),l.refresh=new l("refresh",{fontCharacter:"\\eb37"}),l.regex=new l("regex",{fontCharacter:"\\eb38"}),l.remoteExplorer=new l("remote-explorer",{fontCharacter:"\\eb39"}),l.remote=new l("remote",{fontCharacter:"\\eb3a"}),l.remove=new l("remove",{fontCharacter:"\\eb3b"}),l.replaceAll=new l("replace-all",{fontCharacter:"\\eb3c"}),l.replace=new l("replace",{fontCharacter:"\\eb3d"}),l.repoClone=new l("repo-clone",{fontCharacter:"\\eb3e"}),l.repoForcePush=new l("repo-force-push",{fontCharacter:"\\eb3f"}),l.repoPull=new l("repo-pull",{fontCharacter:"\\eb40"}),l.repoPush=new l("repo-push",{fontCharacter:"\\eb41"}),l.report=new l("report",{fontCharacter:"\\eb42"}),l.requestChanges=new l("request-changes",{fontCharacter:"\\eb43"}),l.rocket=new l("rocket",{fontCharacter:"\\eb44"}),l.rootFolderOpened=new l("root-folder-opened",{fontCharacter:"\\eb45"}),l.rootFolder=new l("root-folder",{fontCharacter:"\\eb46"}),l.rss=new l("rss",{fontCharacter:"\\eb47"}),l.ruby=new l("ruby",{fontCharacter:"\\eb48"}),l.saveAll=new l("save-all",{fontCharacter:"\\eb49"}),l.saveAs=new l("save-as",{fontCharacter:"\\eb4a"}),l.save=new l("save",{fontCharacter:"\\eb4b"}),l.screenFull=new l("screen-full",{fontCharacter:"\\eb4c"}),l.screenNormal=new l("screen-normal",{fontCharacter:"\\eb4d"}),l.searchStop=new l("search-stop",{fontCharacter:"\\eb4e"}),l.server=new l("server",{fontCharacter:"\\eb50"}),l.settingsGear=new l("settings-gear",{fontCharacter:"\\eb51"}),l.settings=new l("settings",{fontCharacter:"\\eb52"}),l.shield=new l("shield",{fontCharacter:"\\eb53"}),l.smiley=new l("smiley",{fontCharacter:"\\eb54"}),l.sortPrecedence=new l("sort-precedence",{fontCharacter:"\\eb55"}),l.splitHorizontal=new l("split-horizontal",{fontCharacter:"\\eb56"}),l.splitVertical=new l("split-vertical",{fontCharacter:"\\eb57"}),l.squirrel=new l("squirrel",{fontCharacter:"\\eb58"}),l.starFull=new l("star-full",{fontCharacter:"\\eb59"}),l.starHalf=new l("star-half",{fontCharacter:"\\eb5a"}),l.symbolClass=new l("symbol-class",{fontCharacter:"\\eb5b"}),l.symbolColor=new l("symbol-color",{fontCharacter:"\\eb5c"}),l.symbolConstant=new l("symbol-constant",{fontCharacter:"\\eb5d"}),l.symbolEnumMember=new l("symbol-enum-member",{fontCharacter:"\\eb5e"}),l.symbolField=new l("symbol-field",{fontCharacter:"\\eb5f"}),l.symbolFile=new l("symbol-file",{fontCharacter:"\\eb60"}),l.symbolInterface=new l("symbol-interface",{fontCharacter:"\\eb61"}),l.symbolKeyword=new l("symbol-keyword",{fontCharacter:"\\eb62"}),l.symbolMisc=new l("symbol-misc",{fontCharacter:"\\eb63"}),l.symbolOperator=new l("symbol-operator",{fontCharacter:"\\eb64"}),l.symbolProperty=new l("symbol-property",{fontCharacter:"\\eb65"}),l.wrench=new l("wrench",{fontCharacter:"\\eb65"}),l.wrenchSubaction=new l("wrench-subaction",{fontCharacter:"\\eb65"}),l.symbolSnippet=new l("symbol-snippet",{fontCharacter:"\\eb66"}),l.tasklist=new l("tasklist",{fontCharacter:"\\eb67"}),l.telescope=new l("telescope",{fontCharacter:"\\eb68"}),l.textSize=new l("text-size",{fontCharacter:"\\eb69"}),l.threeBars=new l("three-bars",{fontCharacter:"\\eb6a"}),l.thumbsdown=new l("thumbsdown",{fontCharacter:"\\eb6b"}),l.thumbsup=new l("thumbsup",{fontCharacter:"\\eb6c"}),l.tools=new l("tools",{fontCharacter:"\\eb6d"}),l.triangleDown=new l("triangle-down",{fontCharacter:"\\eb6e"}),l.triangleLeft=new l("triangle-left",{fontCharacter:"\\eb6f"}),l.triangleRight=new l("triangle-right",{fontCharacter:"\\eb70"}),l.triangleUp=new l("triangle-up",{fontCharacter:"\\eb71"}),l.twitter=new l("twitter",{fontCharacter:"\\eb72"}),l.unfold=new l("unfold",{fontCharacter:"\\eb73"}),l.unlock=new l("unlock",{fontCharacter:"\\eb74"}),l.unmute=new l("unmute",{fontCharacter:"\\eb75"}),l.unverified=new l("unverified",{fontCharacter:"\\eb76"}),l.verified=new l("verified",{fontCharacter:"\\eb77"}),l.versions=new l("versions",{fontCharacter:"\\eb78"}),l.vmActive=new l("vm-active",{fontCharacter:"\\eb79"}),l.vmOutline=new l("vm-outline",{fontCharacter:"\\eb7a"}),l.vmRunning=new l("vm-running",{fontCharacter:"\\eb7b"}),l.watch=new l("watch",{fontCharacter:"\\eb7c"}),l.whitespace=new l("whitespace",{fontCharacter:"\\eb7d"}),l.wholeWord=new l("whole-word",{fontCharacter:"\\eb7e"}),l.window=new l("window",{fontCharacter:"\\eb7f"}),l.wordWrap=new l("word-wrap",{fontCharacter:"\\eb80"}),l.zoomIn=new l("zoom-in",{fontCharacter:"\\eb81"}),l.zoomOut=new l("zoom-out",{fontCharacter:"\\eb82"}),l.listFilter=new l("list-filter",{fontCharacter:"\\eb83"}),l.listFlat=new l("list-flat",{fontCharacter:"\\eb84"}),l.listSelection=new l("list-selection",{fontCharacter:"\\eb85"}),l.selection=new l("selection",{fontCharacter:"\\eb85"}),l.listTree=new l("list-tree",{fontCharacter:"\\eb86"}),l.debugBreakpointFunctionUnverified=new l("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),l.debugBreakpointFunction=new l("debug-breakpoint-function",{fontCharacter:"\\eb88"}),l.debugBreakpointFunctionDisabled=new l("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),l.debugStackframeActive=new l("debug-stackframe-active",{fontCharacter:"\\eb89"}),l.debugStackframeDot=new l("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),l.debugStackframe=new l("debug-stackframe",{fontCharacter:"\\eb8b"}),l.debugStackframeFocused=new l("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),l.debugBreakpointUnsupported=new l("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),l.symbolString=new l("symbol-string",{fontCharacter:"\\eb8d"}),l.debugReverseContinue=new l("debug-reverse-continue",{fontCharacter:"\\eb8e"}),l.debugStepBack=new l("debug-step-back",{fontCharacter:"\\eb8f"}),l.debugRestartFrame=new l("debug-restart-frame",{fontCharacter:"\\eb90"}),l.callIncoming=new l("call-incoming",{fontCharacter:"\\eb92"}),l.callOutgoing=new l("call-outgoing",{fontCharacter:"\\eb93"}),l.menu=new l("menu",{fontCharacter:"\\eb94"}),l.expandAll=new l("expand-all",{fontCharacter:"\\eb95"}),l.feedback=new l("feedback",{fontCharacter:"\\eb96"}),l.groupByRefType=new l("group-by-ref-type",{fontCharacter:"\\eb97"}),l.ungroupByRefType=new l("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),l.account=new l("account",{fontCharacter:"\\eb99"}),l.bellDot=new l("bell-dot",{fontCharacter:"\\eb9a"}),l.debugConsole=new l("debug-console",{fontCharacter:"\\eb9b"}),l.library=new l("library",{fontCharacter:"\\eb9c"}),l.output=new l("output",{fontCharacter:"\\eb9d"}),l.runAll=new l("run-all",{fontCharacter:"\\eb9e"}),l.syncIgnored=new l("sync-ignored",{fontCharacter:"\\eb9f"}),l.pinned=new l("pinned",{fontCharacter:"\\eba0"}),l.githubInverted=new l("github-inverted",{fontCharacter:"\\eba1"}),l.debugAlt=new l("debug-alt",{fontCharacter:"\\eb91"}),l.serverProcess=new l("server-process",{fontCharacter:"\\eba2"}),l.serverEnvironment=new l("server-environment",{fontCharacter:"\\eba3"}),l.pass=new l("pass",{fontCharacter:"\\eba4"}),l.stopCircle=new l("stop-circle",{fontCharacter:"\\eba5"}),l.playCircle=new l("play-circle",{fontCharacter:"\\eba6"}),l.record=new l("record",{fontCharacter:"\\eba7"}),l.debugAltSmall=new l("debug-alt-small",{fontCharacter:"\\eba8"}),l.vmConnect=new l("vm-connect",{fontCharacter:"\\eba9"}),l.cloud=new l("cloud",{fontCharacter:"\\ebaa"}),l.merge=new l("merge",{fontCharacter:"\\ebab"}),l.exportIcon=new l("export",{fontCharacter:"\\ebac"}),l.graphLeft=new l("graph-left",{fontCharacter:"\\ebad"}),l.magnet=new l("magnet",{fontCharacter:"\\ebae"}),l.notebook=new l("notebook",{fontCharacter:"\\ebaf"}),l.redo=new l("redo",{fontCharacter:"\\ebb0"}),l.checkAll=new l("check-all",{fontCharacter:"\\ebb1"}),l.pinnedDirty=new l("pinned-dirty",{fontCharacter:"\\ebb2"}),l.passFilled=new l("pass-filled",{fontCharacter:"\\ebb3"}),l.circleLargeFilled=new l("circle-large-filled",{fontCharacter:"\\ebb4"}),l.circleLargeOutline=new l("circle-large-outline",{fontCharacter:"\\ebb5"}),l.combine=new l("combine",{fontCharacter:"\\ebb6"}),l.gather=new l("gather",{fontCharacter:"\\ebb6"}),l.table=new l("table",{fontCharacter:"\\ebb7"}),l.variableGroup=new l("variable-group",{fontCharacter:"\\ebb8"}),l.typeHierarchy=new l("type-hierarchy",{fontCharacter:"\\ebb9"}),l.typeHierarchySub=new l("type-hierarchy-sub",{fontCharacter:"\\ebba"}),l.typeHierarchySuper=new l("type-hierarchy-super",{fontCharacter:"\\ebbb"}),l.gitPullRequestCreate=new l("git-pull-request-create",{fontCharacter:"\\ebbc"}),l.runAbove=new l("run-above",{fontCharacter:"\\ebbd"}),l.runBelow=new l("run-below",{fontCharacter:"\\ebbe"}),l.notebookTemplate=new l("notebook-template",{fontCharacter:"\\ebbf"}),l.debugRerun=new l("debug-rerun",{fontCharacter:"\\ebc0"}),l.workspaceTrusted=new l("workspace-trusted",{fontCharacter:"\\ebc1"}),l.workspaceUntrusted=new l("workspace-untrusted",{fontCharacter:"\\ebc2"}),l.workspaceUnspecified=new l("workspace-unspecified",{fontCharacter:"\\ebc3"}),l.terminalCmd=new l("terminal-cmd",{fontCharacter:"\\ebc4"}),l.terminalDebian=new l("terminal-debian",{fontCharacter:"\\ebc5"}),l.terminalLinux=new l("terminal-linux",{fontCharacter:"\\ebc6"}),l.terminalPowershell=new l("terminal-powershell",{fontCharacter:"\\ebc7"}),l.terminalTmux=new l("terminal-tmux",{fontCharacter:"\\ebc8"}),l.terminalUbuntu=new l("terminal-ubuntu",{fontCharacter:"\\ebc9"}),l.terminalBash=new l("terminal-bash",{fontCharacter:"\\ebca"}),l.arrowSwap=new l("arrow-swap",{fontCharacter:"\\ebcb"}),l.copy=new l("copy",{fontCharacter:"\\ebcc"}),l.personAdd=new l("person-add",{fontCharacter:"\\ebcd"}),l.filterFilled=new l("filter-filled",{fontCharacter:"\\ebce"}),l.wand=new l("wand",{fontCharacter:"\\ebcf"}),l.debugLineByLine=new l("debug-line-by-line",{fontCharacter:"\\ebd0"}),l.inspect=new l("inspect",{fontCharacter:"\\ebd1"}),l.layers=new l("layers",{fontCharacter:"\\ebd2"}),l.layersDot=new l("layers-dot",{fontCharacter:"\\ebd3"}),l.layersActive=new l("layers-active",{fontCharacter:"\\ebd4"}),l.compass=new l("compass",{fontCharacter:"\\ebd5"}),l.compassDot=new l("compass-dot",{fontCharacter:"\\ebd6"}),l.compassActive=new l("compass-active",{fontCharacter:"\\ebd7"}),l.azure=new l("azure",{fontCharacter:"\\ebd8"}),l.issueDraft=new l("issue-draft",{fontCharacter:"\\ebd9"}),l.gitPullRequestClosed=new l("git-pull-request-closed",{fontCharacter:"\\ebda"}),l.gitPullRequestDraft=new l("git-pull-request-draft",{fontCharacter:"\\ebdb"}),l.debugAll=new l("debug-all",{fontCharacter:"\\ebdc"}),l.debugCoverage=new l("debug-coverage",{fontCharacter:"\\ebdd"}),l.runErrors=new l("run-errors",{fontCharacter:"\\ebde"}),l.folderLibrary=new l("folder-library",{fontCharacter:"\\ebdf"}),l.debugContinueSmall=new l("debug-continue-small",{fontCharacter:"\\ebe0"}),l.beakerStop=new l("beaker-stop",{fontCharacter:"\\ebe1"}),l.graphLine=new l("graph-line",{fontCharacter:"\\ebe2"}),l.graphScatter=new l("graph-scatter",{fontCharacter:"\\ebe3"}),l.pieChart=new l("pie-chart",{fontCharacter:"\\ebe4"}),l.bracket=new l("bracket",l.json.definition),l.bracketDot=new l("bracket-dot",{fontCharacter:"\\ebe5"}),l.bracketError=new l("bracket-error",{fontCharacter:"\\ebe6"}),l.lockSmall=new l("lock-small",{fontCharacter:"\\ebe7"}),l.azureDevops=new l("azure-devops",{fontCharacter:"\\ebe8"}),l.verifiedFilled=new l("verified-filled",{fontCharacter:"\\ebe9"})}(me||(me={}))},79881:function(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 j}});class U{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(_){setTimeout(()=>{throw _.stack?new Error(_.message+`
`+_.stack):_},0)}}emit(_){this.listeners.forEach(E=>{E(_)})}onUnexpectedError(_){this.unexpectedErrorHandler(_),this.emit(_)}onUnexpectedExternalError(_){this.unexpectedErrorHandler(_)}}const de=new U;function Se(g){me(g)||de.onUnexpectedError(g)}function he(g){me(g)||de.onUnexpectedExternalError(g)}function j(g){if(g instanceof Error){let{name:_,message:E}=g;const A=g.stacktrace||g.stack;return{$isError:!0,name:_,message:E,stack:A}}return g}const p="Canceled";function me(g){return g instanceof Error&&g.name===p&&g.message===p}function ce(){const g=new Error(p);return g.name=g.message,g}function l(g){return g?new Error(`Illegal argument: ${g}`):new Error("Illegal argument")}function X(g){return g?new Error(`Illegal state: ${g}`):new Error("Illegal state")}class P extends Error{constructor(_){super("NotSupported"),_&&(this.message=_)}}},4348:function(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 j}});var U=K(79881),de=K(69323),Se=K(34502),he=K(95830),j;(function(E){E.None=()=>de.JT.None;function A(F){return(M,oe=null,te)=>{let S=!1,v;return v=F(Y=>{if(!S)return v?v.dispose():S=!0,M.call(oe,Y)},null,te),S&&v.dispose(),v}}E.once=A;function B(F,M){return R((oe,te=null,S)=>F(v=>oe.call(te,M(v)),null,S))}E.map=B;function H(F,M){return R((oe,te=null,S)=>F(v=>{M(v),oe.call(te,v)},null,S))}E.forEach=H;function V(F,M){return R((oe,te=null,S)=>F(v=>M(v)&&oe.call(te,v),null,S))}E.filter=V;function L(F){return F}E.signal=L;function I(...F){return(M,oe=null,te)=>(0,de.F8)(...F.map(S=>S(v=>M.call(oe,v),null,te)))}E.any=I;function w(F,M,oe){let te=oe;return B(F,S=>(te=M(te,S),te))}E.reduce=w;function R(F){let M;const oe=new l({onFirstListenerAdd(){M=F(oe.fire,oe)},onLastListenerRemove(){M.dispose()}});return oe.event}function q(F,M,oe=100,te=!1,S){let v,Y,ae,xe=0;const Fe=new l({leakWarningThreshold:S,onFirstListenerAdd(){v=F(Xe=>{xe++,Y=M(Y,Xe),te&&!ae&&(Fe.fire(Y),Y=void 0),clearTimeout(ae),ae=setTimeout(()=>{const yt=Y;Y=void 0,ae=void 0,(!te||xe>1)&&Fe.fire(yt),xe=0},oe)})},onLastListenerRemove(){v.dispose()}});return Fe.event}E.debounce=q;function ne(F,M=(oe,te)=>oe===te){let oe=!0,te;return V(F,S=>{const v=oe||!M(S,te);return oe=!1,te=S,v})}E.latch=ne;function ee(F,M){return[E.filter(F,M),E.filter(F,oe=>!M(oe))]}E.split=ee;function ye(F,M=!1,oe=[]){let te=oe.slice(),S=F(ae=>{te?te.push(ae):Y.fire(ae)});const v=()=>{te&&te.forEach(ae=>Y.fire(ae)),te=null},Y=new l({onFirstListenerAdd(){S||(S=F(ae=>Y.fire(ae)))},onFirstListenerDidAdd(){te&&(M?setTimeout(v):v())},onLastListenerRemove(){S&&S.dispose(),S=null}});return Y.event}E.buffer=ye;class Le{constructor(M){this.event=M}map(M){return new Le(B(this.event,M))}forEach(M){return new Le(H(this.event,M))}filter(M){return new Le(V(this.event,M))}reduce(M,oe){return new Le(w(this.event,M,oe))}latch(){return new Le(ne(this.event))}debounce(M,oe=100,te=!1,S){return new Le(q(this.event,M,oe,te,S))}on(M,oe,te){return this.event(M,oe,te)}once(M,oe,te){return A(this.event)(M,oe,te)}}function Te(F){return new Le(F)}E.chain=Te;function $e(F,M,oe=te=>te){const te=(...ae)=>Y.fire(oe(...ae)),S=()=>F.on(M,te),v=()=>F.removeListener(M,te),Y=new l({onFirstListenerAdd:S,onLastListenerRemove:v});return Y.event}E.fromNodeEventEmitter=$e;function J(F,M,oe=te=>te){const te=(...ae)=>Y.fire(oe(...ae)),S=()=>F.addEventListener(M,te),v=()=>F.removeEventListener(M,te),Y=new l({onFirstListenerAdd:S,onLastListenerRemove:v});return Y.event}E.fromDOMEventEmitter=J;function D(F){return new Promise(M=>A(F)(M))}E.toPromise=D})(j||(j={}));class p{constructor(A){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${A}_${p._idPool++}`}start(A){this._stopWatch=new he.G(!0),this._listenerCount=A}stop(){if(this._stopWatch){const A=this._stopWatch.elapsed();this._elapsedOverall+=A,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${A.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let me=-1;class ce{constructor(A,B=Math.random().toString(18).slice(2,5)){this.customThreshold=A,this.name=B,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(A){let B=me;if(typeof this.customThreshold=="number"&&(B=this.customThreshold),B<=0||A<B)return;this._stacks||(this._stacks=new Map);const H=new Error().stack.split(`
`).slice(3).join(`
`),V=this._stacks.get(H)||0;if(this._stacks.set(H,V+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=B*.5;let L,I=0;for(const[w,R]of this._stacks)(!L||I<R)&&(L=w,I=R);console.warn(`[${this.name}] potential listener LEAK detected, having ${A} listeners already. MOST frequent listener (${I}):`),console.warn(L)}return()=>{const L=this._stacks.get(H)||0;this._stacks.set(H,L-1)}}}class l{constructor(A){var B;this._disposed=!1,this._options=A,this._leakageMon=me>0?new ce(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((B=this._options)===null||B===void 0)&&B._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(A,B,H)=>{var V;this._listeners||(this._listeners=new Se.S);const L=this._listeners.isEmpty();L&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const I=this._listeners.push(B?[A,B]:A);L&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,A,B);const w=(V=this._leakageMon)===null||V===void 0?void 0:V.check(this._listeners.size),R=(0,de.OF)(()=>{w&&w(),this._disposed||(I(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return H instanceof de.SL?H.add(R):Array.isArray(H)&&H.push(R),R}),this._event}fire(A){var B,H;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Se.S);for(let V of this._listeners)this._deliveryQueue.push([V,A]);for((B=this._perfMon)===null||B===void 0||B.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[V,L]=this._deliveryQueue.shift();try{typeof V=="function"?V.call(void 0,L):V[0].call(V[1],L)}catch(I){(0,U.dL)(I)}}(H=this._perfMon)===null||H===void 0||H.stop()}}dispose(){var A,B,H,V,L;this._disposed||(this._disposed=!0,(A=this._listeners)===null||A===void 0||A.clear(),(B=this._deliveryQueue)===null||B===void 0||B.clear(),(V=(H=this._options)===null||H===void 0?void 0:H.onLastListenerRemove)===null||V===void 0||V.call(H),(L=this._leakageMon)===null||L===void 0||L.dispose())}}class X extends l{constructor(A){super(A),this._isPaused=0,this._eventQueue=new Se.S,this._mergeFn=A==null?void 0:A.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const A=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(A))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(A){this._listeners&&(this._isPaused!==0?this._eventQueue.push(A):super.fire(A))}}class P extends X{constructor(A){var B;super(A),this._delay=(B=A.delay)!==null&&B!==void 0?B: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(B,H,V)=>A(L=>{const I=this.buffers[this.buffers.length-1];I?I.push(()=>B.call(H,L)):B.call(H,L)},void 0,V)}bufferEvents(A){const B=[];this.buffers.push(B);const H=A();return this.buffers.pop(),B.forEach(V=>V()),H}}class _{constructor(){this.listening=!1,this.inputEvent=j.None,this.inputEventListener=de.JT.None,this.emitter=new l({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(A){this.inputEvent=A,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=A(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Yt,st,K){"use strict";K.d(st,{I:function(){return U}});function U(de){const Se=this;let he=!1,j;return function(){return he||(he=!0,j=de.apply(Se,arguments)),j}}},88226:function(Yt,st,K){"use strict";K.d(st,{$:function(){return U}});var U;(function(de){function Se(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}de.is=Se;const he=Object.freeze([]);function j(){return he}de.empty=j;function*p(I){yield I}de.single=p;function me(I){return I||he}de.from=me;function ce(I){return!I||I[Symbol.iterator]().next().done===!0}de.isEmpty=ce;function l(I){return I[Symbol.iterator]().next().value}de.first=l;function X(I,w){for(const R of I)if(w(R))return!0;return!1}de.some=X;function P(I,w){for(const R of I)if(w(R))return R}de.find=P;function*g(I,w){for(const R of I)w(R)&&(yield R)}de.filter=g;function*_(I,w){let R=0;for(const q of I)yield w(q,R++)}de.map=_;function*E(...I){for(const w of I)for(const R of w)yield R}de.concat=E;function*A(I){for(const w of I)for(const R of w)yield R}de.concatNested=A;function B(I,w,R){let q=R;for(const ne of I)q=w(q,ne);return q}de.reduce=B;function*H(I,w,R=I.length){for(w<0&&(w+=I.length),R<0?R+=I.length:R>I.length&&(R=I.length);w<R;w++)yield I[w]}de.slice=H;function V(I,w=Number.POSITIVE_INFINITY){const R=[];if(w===0)return[R,I];const q=I[Symbol.iterator]();for(let ne=0;ne<w;ne++){const ee=q.next();if(ee.done)return[R,de.empty()];R.push(ee.value)}return[R,{[Symbol.iterator](){return q}}]}de.consume=V;function L(I,w,R=(q,ne)=>q===ne){const q=I[Symbol.iterator](),ne=w[Symbol.iterator]();for(;;){const ee=q.next(),ye=ne.next();if(ee.done!==ye.done)return!1;if(ee.done)return!0;if(!R(ee.value,ye.value))return!1}}de.equals=L})(U||(U={}))},69323:function(Yt,st,K){"use strict";K.d(st,{B9:function(){return _},F8:function(){return E},JT:function(){return H},Jz:function(){return L},OF:function(){return A},SL:function(){return B},Wf:function(){return g},XK:function(){return V},dk:function(){return X}});var U=K(17845),de=K(88226);const Se=!1;let he=null;function j(I){he=I}if(Se){const I="__is_disposable_tracked__";j(new class{trackDisposable(w){const R=new Error("Potentially leaked disposable").stack;setTimeout(()=>{w[I]||console.log(R)},3e3)}setParent(w,R){if(w&&w!==H.None)try{w[I]=!0}catch(q){}}markAsDisposed(w){if(w&&w!==H.None)try{w[I]=!0}catch(R){}}markAsSingleton(w){}})}function p(I){return he==null||he.trackDisposable(I),I}function me(I){he==null||he.markAsDisposed(I)}function ce(I,w){he==null||he.setParent(I,w)}function l(I,w){if(he)for(const R of I)he.setParent(R,w)}function X(I){return he==null||he.markAsSingleton(I),I}class P extends Error{constructor(w){super(`Encountered errors while disposing of store. Errors: [${w.join(", ")}]`),this.errors=w}}function g(I){return typeof I.dispose=="function"&&I.dispose.length===0}function _(I){if(de.$.is(I)){let w=[];for(const R of I)if(R)try{R.dispose()}catch(q){w.push(q)}if(w.length===1)throw w[0];if(w.length>1)throw new P(w);return Array.isArray(I)?[]:I}else if(I)return I.dispose(),I}function E(...I){const w=A(()=>_(I));return l(I,w),w}function A(I){const w=p({dispose:(0,U.I)(()=>{me(w),I()})});return w}class B{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?B.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}}B.DISABLE_DISPOSED_WARNING=!1;class H{constructor(){this._store=new B,p(this),ce(this._store,this)}dispose(){me(this),this._store.dispose()}_register(w){if(w===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(w)}}H.None=Object.freeze({dispose(){}});class V{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(w){var R;this._isDisposed||w===this._value||((R=this._value)===null||R===void 0||R.dispose(),w&&ce(w,this),this._value=w)}clear(){this.value=void 0}dispose(){var w;this._isDisposed=!0,me(this),(w=this._value)===null||w===void 0||w.dispose(),this._value=void 0}clearAndLeak(){const w=this._value;return this._value=void 0,w&&ce(w,null),w}}class L{constructor(w){this.object=w}dispose(){}}},34502:function(Yt,st,K){"use strict";K.d(st,{S:function(){return de}});class U{constructor(he){this.element=he,this.next=U.Undefined,this.prev=U.Undefined}}U.Undefined=new U(void 0);class de{constructor(){this._first=U.Undefined,this._last=U.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===U.Undefined}clear(){let he=this._first;for(;he!==U.Undefined;){const j=he.next;he.prev=U.Undefined,he.next=U.Undefined,he=j}this._first=U.Undefined,this._last=U.Undefined,this._size=0}unshift(he){return this._insert(he,!1)}push(he){return this._insert(he,!0)}_insert(he,j){const p=new U(he);if(this._first===U.Undefined)this._first=p,this._last=p;else if(j){const ce=this._last;this._last=p,p.prev=ce,ce.next=p}else{const ce=this._first;this._first=p,p.next=ce,ce.prev=p}this._size+=1;let me=!1;return()=>{me||(me=!0,this._remove(p))}}shift(){if(this._first!==U.Undefined){const he=this._first.element;return this._remove(this._first),he}}pop(){if(this._last!==U.Undefined){const he=this._last.element;return this._remove(this._last),he}}_remove(he){if(he.prev!==U.Undefined&&he.next!==U.Undefined){const j=he.prev;j.next=he.next,he.next.prev=j}else he.prev===U.Undefined&&he.next===U.Undefined?(this._first=U.Undefined,this._last=U.Undefined):he.next===U.Undefined?(this._last=this._last.prev,this._last.next=U.Undefined):he.prev===U.Undefined&&(this._first=this._first.next,this._first.prev=U.Undefined);this._size-=1}*[Symbol.iterator](){let he=this._first;for(;he!==U.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 Le},WE:function(){return ee},dz:function(){return I},gn:function(){return ne},li:function(){return A},r:function(){return J},tY:function(){return R},xS:function(){return ye}});var U=K(97671),de;const Se="en";let he=!1,j=!1,p=!1,me=!1,ce=!1,l=!1,X=!1,P,g=null,_=null,E;const A=typeof self=="object"?self:typeof K.g=="object"?K.g:{};let B;typeof A.vscode!="undefined"&&typeof A.vscode.process!="undefined"?B=A.vscode.process:typeof U!="undefined"&&(B=U);const H=typeof((de=B==null?void 0:B.versions)===null||de===void 0?void 0:de.electron)=="string"&&B.type==="renderer";if(typeof navigator=="object"&&!H)E=navigator.userAgent,he=E.indexOf("Windows")>=0,j=E.indexOf("Macintosh")>=0,X=(E.indexOf("Macintosh")>=0||E.indexOf("iPad")>=0||E.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=E.indexOf("Linux")>=0,l=!0,P=navigator.language,g=P;else if(typeof B=="object"){he=B.platform==="win32",j=B.platform==="darwin",p=B.platform==="linux",me=p&&!!B.env.SNAP&&!!B.env.SNAP_REVISION,P=Se,g=Se;const D=B.env.VSCODE_NLS_CONFIG;if(D)try{const F=JSON.parse(D),M=F.availableLanguages["*"];P=F.locale,g=M||Se,_=F._translationsConfigFile}catch(F){}ce=!0}else console.error("Unable to resolve platform.");let V=0;j?V=1:he?V=3:p&&(V=2);const L=he,I=j,w=p,R=ce,q=l,ne=X,ee=E,ye=function(){if(A.setImmediate)return A.setImmediate.bind(A);if(typeof A.postMessage=="function"&&!A.importScripts){let M=[];A.addEventListener("message",te=>{if(te.data&&te.data.vscodeSetImmediateId)for(let S=0,v=M.length;S<v;S++){const Y=M[S];if(Y.id===te.data.vscodeSetImmediateId){M.splice(S,1),Y.callback();return}}});let oe=0;return te=>{const S=++oe;M.push({id:S,callback:te}),A.postMessage({vscodeSetImmediateId:S},"*")}}if(typeof(B==null?void 0:B.nextTick)=="function")return B.nextTick.bind(B);const F=Promise.resolve();return M=>F.then(M)}(),Le=j||X?2:he?1:3;let Te=!0,$e=!1;function J(){if(!$e){$e=!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 U=K(23345);const de=U.li.performance&&typeof U.li.performance.now=="function";class Se{constructor(j){this._highResolution=de&&j,this._startTime=this._now(),this._stopTime=-1}static create(j=!0){return new Se(j)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?U.li.performance.now():Date.now()}}},82983:function(Yt,st,K){"use strict";K.d(st,{$i:function(){return xe},C8:function(){return ti},GF:function(){return P},HO:function(){return oe},IO:function(){return g},K7:function(){return $t},Kw:function(){return Wt},LC:function(){return A},Mh:function(){return ye},P1:function(){return Le},PJ:function(){return ht},Qe:function(){return Fe},R1:function(){return X},RP:function(){return Y},S6:function(){return li},TT:function(){return L},Ut:function(){return S},V8:function(){return B},WU:function(){return Se},YK:function(){return $e},YU:function(){return he},ZG:function(){return Te},ZH:function(){return D},ab:function(){return Xe},c1:function(){return je},df:function(){return q},ec:function(){return j},fi:function(){return Ge},fy:function(){return p},j3:function(){return me},j_:function(){return w},m5:function(){return U},mK:function(){return R},mr:function(){return _},oH:function(){return se},oL:function(){return ce},ok:function(){return ee},ow:function(){return H},qq:function(){return ne},qu:function(){return V},rL:function(){return J},uS:function(){return mt},un:function(){return l},uq:function(){return E},vH:function(){return M},xe:function(){return yt},zY:function(){return I}});function U(C){return!C||typeof C!="string"?!0:C.trim().length===0}const de=/{(\d+)}/g;function Se(C,...O){return O.length===0?C:C.replace(de,function(Q,z){const N=parseInt(z,10);return isNaN(N)||N<0||N>=O.length?Q:O[N]})}function he(C){return C.replace(/[<>&]/g,function(O){switch(O){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return O}})}function j(C){return C.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(C,O=" "){const Q=me(C,O);return ce(Q,O)}function me(C,O){if(!C||!O)return C;const Q=O.length;if(Q===0||C.length===0)return C;let z=0;for(;C.indexOf(O,z)===z;)z=z+Q;return C.substring(z)}function ce(C,O){if(!C||!O)return C;const Q=O.length,z=C.length;if(Q===0||z===0)return C;let N=z,Z=-1;for(;Z=C.lastIndexOf(O,N-1),!(Z===-1||Z+Q!==N);){if(Z===0)return"";N=Z}return C.substring(0,N)}function l(C){return C.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function X(C){return C.replace(/\*/g,"")}function P(C,O,Q={}){if(!C)throw new Error("Cannot create regex from empty string");O||(C=j(C)),Q.wholeWord&&(/\B/.test(C.charAt(0))||(C="\\b"+C),/\B/.test(C.charAt(C.length-1))||(C=C+"\\b"));let z="";return Q.global&&(z+="g"),Q.matchCase||(z+="i"),Q.multiline&&(z+="m"),Q.unicode&&(z+="u"),new RegExp(C,z)}function g(C){return C.source==="^"||C.source==="^$"||C.source==="$"||C.source==="^\\s*$"?!1:!!(C.exec("")&&C.lastIndex===0)}function _(C){return(C.global?"g":"")+(C.ignoreCase?"i":"")+(C.multiline?"m":"")+(C.unicode?"u":"")}function E(C){return C.split(/\r\n|\r|\n/)}function A(C){for(let O=0,Q=C.length;O<Q;O++){const z=C.charCodeAt(O);if(z!==32&&z!==9)return O}return-1}function B(C,O=0,Q=C.length){for(let z=O;z<Q;z++){const N=C.charCodeAt(z);if(N!==32&&N!==9)return C.substring(O,z)}return C.substring(O,Q)}function H(C,O=C.length-1){for(let Q=O;Q>=0;Q--){const z=C.charCodeAt(Q);if(z!==32&&z!==9)return Q}return-1}function V(C,O){return C<O?-1:C>O?1:0}function L(C,O,Q=0,z=C.length,N=0,Z=O.length){for(;Q<z&&N<Z;Q++,N++){let _e=C.charCodeAt(Q),Ae=O.charCodeAt(N);if(_e<Ae)return-1;if(_e>Ae)return 1}const re=z-Q,le=Z-N;return re<le?-1:re>le?1:0}function I(C,O){return w(C,O,0,C.length,0,O.length)}function w(C,O,Q=0,z=C.length,N=0,Z=O.length){for(;Q<z&&N<Z;Q++,N++){let _e=C.charCodeAt(Q),Ae=O.charCodeAt(N);if(_e===Ae)continue;if(_e>=128||Ae>=128)return L(C.toLowerCase(),O.toLowerCase(),Q,z,N,Z);R(_e)&&(_e-=32),R(Ae)&&(Ae-=32);const We=_e-Ae;if(We!==0)return We}const re=z-Q,le=Z-N;return re<le?-1:re>le?1:0}function R(C){return C>=97&&C<=122}function q(C){return C>=65&&C<=90}function ne(C,O){return C.length===O.length&&w(C,O)===0}function ee(C,O){const Q=O.length;return O.length>C.length?!1:w(C,O,0,Q)===0}function ye(C,O){let Q,z=Math.min(C.length,O.length);for(Q=0;Q<z;Q++)if(C.charCodeAt(Q)!==O.charCodeAt(Q))return Q;return z}function Le(C,O){let Q,z=Math.min(C.length,O.length);const N=C.length-1,Z=O.length-1;for(Q=0;Q<z;Q++)if(C.charCodeAt(N-Q)!==O.charCodeAt(Z-Q))return Q;return z}function Te(C){return 55296<=C&&C<=56319}function $e(C){return 56320<=C&&C<=57343}function J(C,O){return(C-55296<<10)+(O-56320)+65536}function D(C,O,Q){const z=C.charCodeAt(Q);if(Te(z)&&Q+1<O){const N=C.charCodeAt(Q+1);if($e(N))return J(z,N)}return z}function F(C,O){const Q=C.charCodeAt(O-1);if($e(Q)&&O>1){const z=C.charCodeAt(O-2);if(Te(z))return J(z,Q)}return Q}function M(C,O){const Q=ve.getInstance(),z=O,N=C.length,Z=D(C,N,O);O+=Z>=65536?2:1;let re=Q.getGraphemeBreakType(Z);for(;O<N;){const le=D(C,N,O),_e=Q.getGraphemeBreakType(le);if(Ge(re,_e))break;O+=le>=65536?2:1,re=_e}return O-z}function oe(C,O){const Q=ve.getInstance(),z=O,N=F(C,O);O-=N>=65536?2:1;let Z=Q.getGraphemeBreakType(N);for(;O>0;){const re=F(C,O),le=Q.getGraphemeBreakType(re);if(Ge(le,Z))break;O-=re>=65536?2:1,Z=le}return z-O}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(C){return te.test(C)}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 Y(C){return v.test(C)}const ae=/^[\t\n\r\x20-\x7E]*$/;function xe(C){return ae.test(C)}const Fe=/[\u2028\u2029]/;function Xe(C){return Fe.test(C)}function yt(C){for(let O=0,Q=C.length;O<Q;O++)if($t(C.charCodeAt(O)))return!0;return!1}function $t(C){return C=+C,C>=11904&&C<=55215||C>=63744&&C<=64255||C>=65281&&C<=65374}function ti(C){return C>=127462&&C<=127487||C===8986||C===8987||C===9200||C===9203||C>=9728&&C<=10175||C===11088||C===11093||C>=127744&&C<=128591||C>=128640&&C<=128764||C>=128992&&C<=129003||C>=129280&&C<=129535||C>=129648&&C<=129750}const je="\uFEFF";function mt(C){return!!(C&&C.length>0&&C.charCodeAt(0)===65279)}function Wt(C,O=!1){return C?(O&&(C=C.replace(/\\./g,"")),C.toLowerCase()!==C):!1}function ht(C){return C=C%(2*26),C<26?String.fromCharCode(97+C):String.fromCharCode(65+C-26)}function li(C){return ve.getInstance().getGraphemeBreakType(C)}function Ge(C,O){return C===0?O!==5&&O!==7:C===2&&O===3?!1:C===4||C===2||C===3||O===4||O===2||O===3?!0:!(C===8&&(O===8||O===9||O===11||O===12)||(C===11||C===9)&&(O===9||O===10)||(C===12||C===10)&&O===10||O===5||O===13||O===7||C===1||C===13&&O===14||C===6&&O===6)}class ve{constructor(){this._data=we()}static getInstance(){return ve._INSTANCE||(ve._INSTANCE=new ve),ve._INSTANCE}getGraphemeBreakType(O){if(O<32)return O===10?3:O===13?2:4;if(O<127)return 0;const Q=this._data,z=Q.length/3;let N=1;for(;N<=z;)if(O<Q[3*N])N=2*N;else if(O>Q[3*N+1])N=2*N+1;else return Q[3*N+2];return 0}}ve._INSTANCE=null;function we(){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 se(C,O){if(C===0)return 0;const Q=Re(C,O);if(Q!==void 0)return Q;const z=F(O,C);return C-=Oe(z),C}function Re(C,O){let Q=F(O,C);for(C-=Oe(Q);ie(Q)||Q===65039||Q===8419;){if(C===0)return;Q=F(O,C),C-=Oe(Q)}if(ti(Q)){if(C>=0){const z=F(O,C);z===8205&&(C-=Oe(z))}return C}}function Oe(C){return C>=65536?2:1}function ie(C){return 127995<=C&&C<=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 de},IU:function(){return B},Jp:function(){return ce},Kn:function(){return Se},cW:function(){return X},f6:function(){return H},hj:function(){return he},jn:function(){return j},kJ:function(){return U},mf:function(){return P},o8:function(){return p},p_:function(){return l},vE:function(){return V}});function U(L){return Array.isArray(L)}function de(L){return typeof L=="string"}function Se(L){return typeof L=="object"&&L!==null&&!Array.isArray(L)&&!(L instanceof RegExp)&&!(L instanceof Date)}function he(L){return typeof L=="number"&&!isNaN(L)}function j(L){return L===!0||L===!1}function p(L){return typeof L=="undefined"}function me(L){return!ce(L)}function ce(L){return p(L)||L===null}function l(L,I){if(!L)throw new Error(I?`Unexpected type, expected '${I}'`:"Unexpected type")}function X(L){if(ce(L))throw new Error("Assertion Failed: argument is undefined or null");return L}function P(L){return typeof L=="function"}function g(L,I){const w=Math.min(L.length,I.length);for(let R=0;R<w;R++)_(L[R],I[R])}function _(L,I){if(de(I)){if(typeof L!==I)throw new Error(`argument does not match constraint: typeof ${I}`)}else if(P(I)){try{if(L instanceof I)return}catch(w){}if(!ce(L)&&L.constructor===I||I.length===1&&I.call(void 0,L)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function E(L){let I=[],w=Object.getPrototypeOf(L);for(;Object.prototype!==w;)I=I.concat(Object.getOwnPropertyNames(w)),w=Object.getPrototypeOf(w);return I}function A(L){const I=[];for(const w of E(L))typeof L[w]=="function"&&I.push(w);return I}function B(L,I){const w=q=>function(){const ne=Array.prototype.slice.call(arguments,0);return I(q,ne)};let R={};for(const q of L)R[q]=w(q);return R}function H(L){return L===null?void 0:L}function V(L,I="Unreachable"){throw new Error(I)}},13268:function(Yt,st,K){"use strict";K.d(st,{N:function(){return de}});function U(Se,he){let j;return he.length===0?j=Se:j=Se.replace(/\{(\d+)\}/g,function(p,me){const ce=me[0];return typeof he[ce]!="undefined"?he[ce]:p}),j}function de(Se,he,...j){return U(he,j)}},96236:function(Yt,st,K){"use strict";K.d(st,{BH:function(){return B},NZ:function(){return H},U8:function(){return V},co:function(){return A},eH:function(){return E},vr:function(){return _}});var U=K(75918),de=K(52615),Se=K(4348),he=K(88226),j=K(69323),p=K(34502),me=K(35884),ce=K(90689),l=K(16925),X=K(49055),P=function(L,I,w,R){var q=arguments.length,ne=q<3?I:R===null?R=Object.getOwnPropertyDescriptor(I,w):R,ee;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(L,I,w,R);else for(var ye=L.length-1;ye>=0;ye--)(ee=L[ye])&&(ne=(q<3?ee(ne):q>3?ee(I,w,ne):ee(I,w))||ne);return q>3&&ne&&Object.defineProperty(I,w,ne),ne},g=function(L,I){return function(w,R){I(w,R,L)}};function _(L){return L.command!==void 0}class E{constructor(I){this.id=E._idPool++,this._debugName=I}}E._idPool=0,E.CommandPalette=new E("CommandPalette"),E.EditorContext=new E("EditorContext"),E.SimpleEditorContext=new E("SimpleEditorContext"),E.EditorContextCopy=new E("EditorContextCopy"),E.EditorContextPeek=new E("EditorContextPeek"),E.MenubarEditMenu=new E("MenubarEditMenu"),E.MenubarCopy=new E("MenubarCopy"),E.MenubarGoMenu=new E("MenubarGoMenu"),E.MenubarSelectionMenu=new E("MenubarSelectionMenu"),E.InlineCompletionsActions=new E("InlineCompletionsActions");const A=(0,l.yh)("menuService"),B=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Se.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:L=>L===E.CommandPalette}}addCommand(L){return this.addCommands(he.$.single(L))}addCommands(L){for(const I of L)this._commands.set(I.id,I);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,j.OF)(()=>{let I=!1;for(const w of L)I=this._commands.delete(w.id)||I;I&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(L){return this._commands.get(L)}getCommands(){const L=new Map;return this._commands.forEach((I,w)=>L.set(w,I)),L}appendMenuItem(L,I){return this.appendMenuItems(he.$.single({id:L,item:I}))}appendMenuItems(L){const I=new Set,w=new p.S;for(const{id:R,item:q}of L){let ne=this._menuItems.get(R);ne||(ne=new p.S,this._menuItems.set(R,ne)),w.push(ne.push(q)),I.add(R)}return this._onDidChangeMenu.fire(I),(0,j.OF)(()=>{if(w.size>0){for(let R of w)R();this._onDidChangeMenu.fire(I),w.clear()}})}getMenuItems(L){let I;return this._menuItems.has(L)?I=[...this._menuItems.get(L)]:I=[],L===E.CommandPalette&&this._appendImplicitItems(I),I}_appendImplicitItems(L){const I=new Set;for(const w of L)_(w)&&(I.add(w.command.id),w.alt&&I.add(w.alt.id));this._commands.forEach((w,R)=>{I.has(R)||L.push({command:w})})}};class H extends U.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 U.Z0));return I.length&&I.pop(),I}}let V=class Qo{constructor(I,w,R,q,ne){var ee,ye;if(this._commandService=ne,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=(ye=typeof I.tooltip=="string"?I.tooltip:(ee=I.tooltip)===null||ee===void 0?void 0:ee.value)!==null&&ye!==void 0?ye:"",this.enabled=!I.precondition||q.contextMatchesRules(I.precondition),this.checked=void 0,I.toggled){const Le=I.toggled.condition?I.toggled:{condition:I.toggled};this.checked=q.contextMatchesRules(Le.condition),this.checked&&Le.tooltip&&(this.tooltip=typeof Le.tooltip=="string"?Le.tooltip:Le.tooltip.value),Le.title&&(this.label=typeof Le.title=="string"?Le.title:Le.title.value)}this.item=I,this.alt=w?new Qo(w,void 0,R,q,ne):void 0,this._options=R,X.kS.isThemeIcon(I.icon)&&(this.class=de.dT.asClassName(I.icon))}dispose(){}run(...I){var w,R;let q=[];return!((w=this._options)===null||w===void 0)&&w.arg&&(q=[...q,this._options.arg]),!((R=this._options)===null||R===void 0)&&R.shouldForwardArgs&&(q=[...q,...I]),this._commandService.executeCommand(this.id,...q)}};V=P([g(3,ce.i6),g(4,me.H)],V)},35884:function(Yt,st,K){"use strict";K.d(st,{H:function(){return me},P:function(){return ce}});var U=K(4348),de=K(88226),Se=K(69323),he=K(34502),j=K(72999),p=K(16925);const me=(0,p.yh)("commandService"),ce=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new U.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,X){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!X)throw new Error("invalid command");return this.registerCommand({id:l,handler:X})}if(l.description){const A=[];for(let H of l.description.args)A.push(H.constraint);const B=l.handler;l.handler=function(H,...V){return(0,j.D8)(V,A),B(H,...V)}}const{id:P}=l;let g=this._commands.get(P);g||(g=new he.S,this._commands.set(P,g));let _=g.unshift(l),E=(0,Se.OF)(()=>{_();const A=this._commands.get(P);A!=null&&A.isEmpty()&&this._commands.delete(P)});return this._onDidRegisterCommand.fire(P),E}registerCommandAlias(l,X){return ce.registerCommand(l,(P,...g)=>P.get(me).executeCommand(X,...g))}getCommand(l){const X=this._commands.get(l);if(!(!X||X.isEmpty()))return de.$.first(X)}getCommands(){const l=new Map;for(const X of this._commands.keys()){const P=this.getCommand(X);P&&l.set(X,P)}return l}};ce.registerCommand("noop",()=>{})},90689:function(Yt,st,K){"use strict";K.d(st,{Ao:function(){return me},Eq:function(){return J},Fb:function(){return ce},K8:function(){return M},i6:function(){return $e},uy:function(){return Te}});var U=K(23345),de=K(82983),Se=K(16925);let he=U.WE||"";const j=new Map;j.set("false",!1),j.set("true",!0),j.set("isMac",U.dz),j.set("isLinux",U.IJ),j.set("isWindows",U.ED),j.set("isWeb",U.$L),j.set("isMacNative",U.dz&&!U.$L),j.set("isEdge",he.indexOf("Edg/")>=0),j.set("isFirefox",he.indexOf("Firefox")>=0),j.set("isChrome",he.indexOf("Chrome")>=0),j.set("isSafari",he.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class me{static has(S){return g.create(S)}static equals(S,v){return _.create(S,v)}static regex(S,v){return q.create(S,v)}static not(S){return H.create(S)}static and(...S){return ye.create(S,null)}static or(...S){return Le.create(S,null,!0)}static deserialize(S,v=!1){if(S)return this._deserializeOrExpression(S,v)}static _deserializeOrExpression(S,v){let Y=S.split("||");return Le.create(Y.map(ae=>this._deserializeAndExpression(ae,v)),null,!0)}static _deserializeAndExpression(S,v){let Y=S.split("&&");return ye.create(Y.map(ae=>this._deserializeOne(ae,v)),null)}static _deserializeOne(S,v){if(S=S.trim(),S.indexOf("!=")>=0){let Y=S.split("!=");return B.create(Y[0].trim(),this._deserializeValue(Y[1],v))}if(S.indexOf("==")>=0){let Y=S.split("==");return _.create(Y[0].trim(),this._deserializeValue(Y[1],v))}if(S.indexOf("=~")>=0){let Y=S.split("=~");return q.create(Y[0].trim(),this._deserializeRegexValue(Y[1],v))}if(S.indexOf(" in ")>=0){let Y=S.split(" in ");return E.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(S)){const Y=S.split(">=");return I.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(S)){const Y=S.split(">");return L.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(S)){const Y=S.split("<=");return R.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(S)){const Y=S.split("<");return w.create(Y[0].trim(),Y[1].trim())}return/^\!\s*/.test(S)?H.create(S.substr(1).trim()):g.create(S)}static _deserializeValue(S,v){if(S=S.trim(),S==="true")return!0;if(S==="false")return!1;let Y=/^'([^']*)'$/.exec(S);return Y?Y[1].trim():S}static _deserializeRegexValue(S,v){if((0,de.m5)(S)){if(v)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let Y=S.indexOf("/"),ae=S.lastIndexOf("/");if(Y===ae||Y<0){if(v)throw new Error(`bad regexp-value '${S}', missing /-enclosure`);return console.warn(`bad regexp-value '${S}', missing /-enclosure`),null}let xe=S.slice(Y+1,ae),Fe=S[ae+1]==="i"?"i":"";try{return new RegExp(xe,Fe)}catch(Xe){if(v)throw new Error(`bad regexp-value '${S}', parse error: ${Xe}`);return console.warn(`bad regexp-value '${S}', parse error: ${Xe}`),null}}}function ce(te,S){const v=te?te.substituteConstants():void 0,Y=S?S.substituteConstants():void 0;return!v&&!Y?!0:!v||!Y?!1:v.equals(Y)}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 Y=j.get(S);return typeof Y=="boolean"?Y?P.INSTANCE:X.INSTANCE:new g(S,v)}cmp(S){return S.type!==this.type?this.type-S.type:D(this.key,S.key)}equals(S){return S.type===this.type?this.key===S.key:!1}substituteConstants(){const S=j.get(this.key);return typeof S=="boolean"?S?P.INSTANCE:X.INSTANCE:this}evaluate(S){return!!S.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=H.create(this.key,this)),this.negated}}class _{constructor(S,v,Y){this.key=S,this.value=v,this.negated=Y,this.type=4}static create(S,v,Y=null){if(typeof v=="boolean")return v?g.create(S,Y):H.create(S,Y);const ae=j.get(S);return typeof ae=="boolean"?v===(ae?"true":"false")?P.INSTANCE:X.INSTANCE:new _(S,v,Y)}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=j.get(this.key);if(typeof S=="boolean"){const v=S?"true":"false";return this.value===v?P.INSTANCE:X.INSTANCE}return this}evaluate(S){return S.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=B.create(this.key,this.value,this)),this.negated}}class E{constructor(S,v){this.key=S,this.valueKey=v,this.type=10,this.negated=null}static create(S,v){return new E(S,v)}cmp(S){return S.type!==this.type?this.type-S.type: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),Y=S.getValue(this.key);return Array.isArray(v)?v.indexOf(Y)>=0:typeof Y=="string"&&typeof v=="object"&&v!==null?p.call(v,Y):!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 B{constructor(S,v,Y){this.key=S,this.value=v,this.negated=Y,this.type=5}static create(S,v,Y=null){if(typeof v=="boolean")return v?H.create(S,Y):g.create(S,Y);const ae=j.get(S);return typeof ae=="boolean"?v===(ae?"true":"false")?X.INSTANCE:P.INSTANCE:new B(S,v,Y)}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=j.get(this.key);if(typeof S=="boolean"){const v=S?"true":"false";return this.value===v?X.INSTANCE:P.INSTANCE}return this}evaluate(S){return S.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class H{constructor(S,v){this.key=S,this.negated=v,this.type=3}static create(S,v=null){const Y=j.get(S);return typeof Y=="boolean"?Y?X.INSTANCE:P.INSTANCE:new H(S,v)}cmp(S){return S.type!==this.type?this.type-S.type:D(this.key,S.key)}equals(S){return S.type===this.type?this.key===S.key:!1}substituteConstants(){const S=j.get(this.key);return typeof S=="boolean"?S?X.INSTANCE:P.INSTANCE:this}evaluate(S){return!S.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this)),this.negated}}function V(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,Y){this.key=S,this.value=v,this.negated=Y,this.type=12}static create(S,v,Y=null){return V(v,ae=>new L(S,ae,Y))}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,Y){this.key=S,this.value=v,this.negated=Y,this.type=13}static create(S,v,Y=null){return V(v,ae=>new I(S,ae,Y))}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,Y){this.key=S,this.value=v,this.negated=Y,this.type=14}static create(S,v,Y=null){return V(v,ae=>new w(S,ae,Y))}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,Y){this.key=S,this.value=v,this.negated=Y,this.type=15}static create(S,v,Y=null){return V(v,ae=>new R(S,ae,Y))}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:"",Y=S.regexp?S.regexp.source:"";return v<Y?-1:v>Y?1:0}equals(S){if(S.type===this.type){const v=this.regexp?this.regexp.source:"",Y=S.regexp?S.regexp.source:"";return this.key===S.key&&v===Y}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=ne.create(this)),this.negated}}class ne{constructor(S){this._actual=S,this.type=8}static create(S){return new ne(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 ee(te){let S=null;for(let v=0,Y=te.length;v<Y;v++){const ae=te[v].substituteConstants();if(te[v]!==ae&&S===null){S=[];for(let xe=0;xe<v;xe++)S[xe]=te[xe]}S!==null&&(S[v]=ae)}return S===null?te:S}class ye{constructor(S,v){this.expr=S,this.negated=v,this.type=6}static create(S,v){return ye._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,Y=this.expr.length;v<Y;v++){const ae=l(this.expr[v],S.expr[v]);if(ae!==0)return ae}return 0}equals(S){if(S.type===this.type){if(this.expr.length!==S.expr.length)return!1;for(let v=0,Y=this.expr.length;v<Y;v++)if(!this.expr[v].equals(S.expr[v]))return!1;return!0}return!1}substituteConstants(){const S=ee(this.expr);return S===this.expr?this:ye.create(S,this.negated)}evaluate(S){for(let v=0,Y=this.expr.length;v<Y;v++)if(!this.expr[v].evaluate(S))return!1;return!0}static _normalizeArr(S,v){const Y=[];let ae=!1;for(const xe of S)if(xe){if(xe.type===1){ae=!0;continue}if(xe.type===0)return X.INSTANCE;if(xe.type===6){Y.push(...xe.expr);continue}Y.push(xe)}if(Y.length===0&&ae)return P.INSTANCE;if(Y.length!==0){if(Y.length===1)return Y[0];Y.sort(l);for(let xe=1;xe<Y.length;xe++)Y[xe-1].equals(Y[xe])&&(Y.splice(xe,1),xe--);if(Y.length===1)return Y[0];for(;Y.length>1;){const xe=Y[Y.length-1];if(xe.type!==9)break;Y.pop();const Fe=Y.pop(),Xe=Y.length===0,yt=Le.create(xe.expr.map($t=>ye.create([$t,Fe],null)),null,Xe);yt&&(Y.push(yt),Y.sort(l))}return Y.length===1?Y[0]:new ye(Y,v)}}serialize(){return this.expr.map(S=>S.serialize()).join(" && ")}keys(){const S=[];for(let v of this.expr)S.push(...v.keys());return S}negate(){if(!this.negated){const S=[];for(let v of this.expr)S.push(v.negate());this.negated=Le.create(S,this,!0)}return this.negated}}class Le{constructor(S,v){this.expr=S,this.negated=v,this.type=9}static create(S,v,Y){return Le._normalizeArr(S,v,Y)}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,Y=this.expr.length;v<Y;v++){const ae=l(this.expr[v],S.expr[v]);if(ae!==0)return ae}return 0}equals(S){if(S.type===this.type){if(this.expr.length!==S.expr.length)return!1;for(let v=0,Y=this.expr.length;v<Y;v++)if(!this.expr[v].equals(S.expr[v]))return!1;return!0}return!1}substituteConstants(){const S=ee(this.expr);return S===this.expr?this:Le.create(S,this.negated,!1)}evaluate(S){for(let v=0,Y=this.expr.length;v<Y;v++)if(this.expr[v].evaluate(S))return!0;return!1}static _normalizeArr(S,v,Y){let ae=[],xe=!1;if(S){for(let Fe=0,Xe=S.length;Fe<Xe;Fe++){const yt=S[Fe];if(yt){if(yt.type===0){xe=!0;continue}if(yt.type===1)return P.INSTANCE;if(yt.type===9){ae=ae.concat(yt.expr);continue}ae.push(yt)}}if(ae.length===0&&xe)return X.INSTANCE;ae.sort(l)}if(ae.length!==0){if(ae.length===1)return ae[0];for(let Fe=1;Fe<ae.length;Fe++)ae[Fe-1].equals(ae[Fe])&&(ae.splice(Fe,1),Fe--);if(ae.length===1)return ae[0];if(Y){for(let Fe=0;Fe<ae.length;Fe++)for(let Xe=Fe+1;Xe<ae.length;Xe++)M(ae[Fe],ae[Xe])&&(ae.splice(Xe,1),Xe--);if(ae.length===1)return ae[0]}return new Le(ae,v)}}serialize(){return this.expr.map(S=>S.serialize()).join(" || ")}keys(){const S=[];for(let v of this.expr)S.push(...v.keys());return S}negate(){if(!this.negated){let S=[];for(let v of this.expr)S.push(v.negate());for(;S.length>1;){const v=S.shift(),Y=S.shift(),ae=[];for(const Fe of oe(v))for(const Xe of oe(Y))ae.push(ye.create([Fe,Xe],null));const xe=S.length===0;S.unshift(Le.create(ae,null,xe))}this.negated=S[0]}return this.negated}}class Te extends g{constructor(S,v,Y){super(S,null),this._defaultValue=v,typeof Y=="object"?Te._info.push(Object.assign(Object.assign({},Y),{key:S})):Y!==!0&&Te._info.push({key:S,description:Y,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 $e=(0,Se.yh)("contextKeyService"),J="setContext";function D(te,S){return te<S?-1:te>S?1:0}function F(te,S,v,Y){return te<v?-1:te>v?1:S<Y?-1:S>Y?1:0}function M(te,S){if(S.type===6&&te.type!==9&&te.type!==6){for(const ae of S.expr)if(te.equals(ae))return!0}const v=te.negate(),Y=oe(v).concat(oe(S));Y.sort(l);for(let ae=0;ae<Y.length;ae++){const Fe=Y[ae].negate();for(let Xe=ae+1;Xe<Y.length;Xe++){const yt=Y[Xe];if(Fe.equals(yt))return!0}}return!1}function oe(te){return te.type===9?te.expr:[te]}},16925:function(Yt,st,K){"use strict";K.d(st,{I8:function(){return U},TG:function(){return de},jt:function(){return j},yh:function(){return he}});var U;(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})(U||(U={}));const de=he("instantiationService");function Se(p,me,ce,l){me[U.DI_TARGET]===me?me[U.DI_DEPENDENCIES].push({id:p,index:ce,optional:l}):(me[U.DI_DEPENDENCIES]=[{id:p,index:ce,optional:l}],me[U.DI_TARGET]=me)}function he(p){if(U.serviceIds.has(p))return U.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,U.serviceIds.set(p,me),me}function j(p){return function(me,ce,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Se(p,me,l,!0)}}},44650:function(Yt,st,K){"use strict";K.d(st,{B:function(){return he}});var U=K(76068),de=K(72999);class Se{constructor(){this.data=new Map}add(p,me){U.ok(de.HD(p)),U.ok(de.Kn(me)),U.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 U}});var U;(function(de){de.DARK="dark",de.LIGHT="light",de.HIGH_CONTRAST="hc"})(U||(U={}))},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 B},kS:function(){return X},m6:function(){return P}});var U=K(52615),de=K(4348),Se=K(69323),he=K(16925),j=K(44650),p=K(66213);const me=(0,he.yh)("themeService");var ce;(function(H){function V(L){return L&&typeof L=="object"&&typeof L.id=="string"}H.isThemeColor=V})(ce||(ce={}));function l(H){return{id:H}}var X;(function(H){function V(ne){return ne&&typeof ne=="object"&&typeof ne.id=="string"&&(typeof ne.color=="undefined"||ce.isThemeColor(ne.color))}H.isThemeIcon=V;const L=new RegExp(`^\\$\\((${U.dT.iconNameExpression}(?:${U.dT.iconModifierExpression})?)\\)$`);function I(ne){const ee=L.exec(ne);if(!ee)return;let[,ye]=ee;return{id:ye}}H.fromString=I;function w(ne,ee){let ye=ne.id;const Le=ye.lastIndexOf("~");return Le!==-1&&(ye=ye.substring(0,Le)),ee&&(ye=`${ye}~${ee}`),{id:ye}}H.modify=w;function R(ne,ee){var ye,Le;return ne.id===ee.id&&((ye=ne.color)===null||ye===void 0?void 0:ye.id)===((Le=ee.color)===null||Le===void 0?void 0:Le.id)}H.isEqual=R;function q(ne,ee){return{id:ne.id,color:ee?l(ee):void 0}}H.asThemeIcon=q,H.asClassNameArray=U.dT.asClassNameArray,H.asClassName=U.dT.asClassName,H.asCSSSelector=U.dT.asCSSSelector})(X||(X={}));function P(H){switch(H){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const g={ThemingContribution:"base.contributions.theming"};class _{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new de.Q5}onColorThemeChange(V){return this.themingParticipants.push(V),this.onThemingParticipantAddedEmitter.fire(V),(0,Se.OF)(()=>{const L=this.themingParticipants.indexOf(V);this.themingParticipants.splice(L,1)})}getThemingParticipants(){return this.themingParticipants}}let E=new _;j.B.add(g.ThemingContribution,E);function A(H){return E.onColorThemeChange(H)}class B extends Se.JT{constructor(V){super(),this.themeService=V,this.theme=V.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(L=>this.onThemeChange(L)))}onThemeChange(V){this.theme=V,this.updateStyles()}updateStyles(){}}},96478:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return ne}});var U=K(72308),de=K(49618),Se=K(52487),he=K(74416),j=K(65352),p=K(92310),me=K.n(p),ce=K(8654),l=K(59301),X=K(10228),P=K(16089),g=X.Z.ESC,_=X.Z.TAB;function E(ee){var ye=ee.visible,Le=ee.triggerRef,Te=ee.onVisibleChange,$e=ee.autoFocus,J=ee.overlayRef,D=l.useRef(!1),F=function(){if(ye){var S,v;(S=Le.current)===null||S===void 0||(v=S.focus)===null||v===void 0||v.call(S),Te==null||Te(!1)}},M=function(){var S;return(S=J.current)!==null&&S!==void 0&&S.focus?(J.current.focus(),D.current=!0,!0):!1},oe=function(S){switch(S.keyCode){case g:F();break;case _:{var v=!1;D.current||(v=M()),v?S.preventDefault():F();break}}};l.useEffect(function(){return ye?(window.addEventListener("keydown",oe),$e&&(0,P.Z)(M,3),function(){window.removeEventListener("keydown",oe),D.current=!1}):function(){D.current=!1}},[ye])}var A=(0,l.forwardRef)(function(ee,ye){var Le=ee.overlay,Te=ee.arrow,$e=ee.prefixCls,J=(0,l.useMemo)(function(){var F;return typeof Le=="function"?F=Le():F=Le,F},[Le]),D=(0,ce.sQ)(ye,(0,ce.C4)(J));return l.createElement(l.Fragment,null,Te&&l.createElement("div",{className:"".concat($e,"-arrow")}),l.cloneElement(J,{ref:(0,ce.Yr)(J)?D:void 0}))}),B=A,H={adjustX:1,adjustY:1},V=[0,0],L={topLeft:{points:["bl","tl"],overflow:H,offset:[0,-4],targetOffset:V},top:{points:["bc","tc"],overflow:H,offset:[0,-4],targetOffset:V},topRight:{points:["br","tr"],overflow:H,offset:[0,-4],targetOffset:V},bottomLeft:{points:["tl","bl"],overflow:H,offset:[0,4],targetOffset:V},bottom:{points:["tc","bc"],overflow:H,offset:[0,4],targetOffset:V},bottomRight:{points:["tr","br"],overflow:H,offset:[0,4],targetOffset:V}},I=L,w=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function R(ee,ye){var Le,Te=ee.arrow,$e=Te===void 0?!1:Te,J=ee.prefixCls,D=J===void 0?"rc-dropdown":J,F=ee.transitionName,M=ee.animation,oe=ee.align,te=ee.placement,S=te===void 0?"bottomLeft":te,v=ee.placements,Y=v===void 0?I:v,ae=ee.getPopupContainer,xe=ee.showAction,Fe=ee.hideAction,Xe=ee.overlayClassName,yt=ee.overlayStyle,$t=ee.visible,ti=ee.trigger,je=ti===void 0?["hover"]:ti,mt=ee.autoFocus,Wt=ee.overlay,ht=ee.children,li=ee.onVisibleChange,Ge=(0,he.Z)(ee,w),ve=l.useState(),we=(0,Se.Z)(ve,2),se=we[0],Re=we[1],Oe="visible"in ee?$t:se,ie=l.useRef(null),C=l.useRef(null),O=l.useRef(null);l.useImperativeHandle(ye,function(){return ie.current});var Q=function(He){Re(He),li==null||li(He)};E({visible:Oe,triggerRef:O,onVisibleChange:Q,autoFocus:mt,overlayRef:C});var z=function(He){var Be=ee.onOverlayClick;Re(!1),Be&&Be(He)},N=function(){return l.createElement(B,{ref:C,overlay:Wt,prefixCls:D,arrow:$e})},Z=function(){return typeof Wt=="function"?N:N()},re=function(){var He=ee.minOverlayWidthMatchTrigger,Be=ee.alignPoint;return"minOverlayWidthMatchTrigger"in ee?He:!Be},le=function(){var He=ee.openClassName;return He!==void 0?He:"".concat(D,"-open")},_e=l.cloneElement(ht,{className:me()((Le=ht.props)===null||Le===void 0?void 0:Le.className,Oe&&le()),ref:(0,ce.Yr)(ht)?(0,ce.sQ)(O,(0,ce.C4)(ht)):void 0}),Ae=Fe;return!Ae&&je.indexOf("contextMenu")!==-1&&(Ae=["click"]),l.createElement(j.Z,(0,U.Z)({builtinPlacements:Y},Ge,{prefixCls:D,ref:ie,popupClassName:me()(Xe,(0,de.Z)({},"".concat(D,"-show-arrow"),$e)),popupStyle:yt,action:je,showAction:xe,hideAction:Ae,popupPlacement:S,popupAlign:oe,popupTransitionName:F,popupAnimation:M,popupVisible:Oe,stretch:re()?"minWidth":"",popup:Z(),onPopupVisibleChange:Q,onPopupClick:z,getPopupContainer:ae}),_e)}var q=l.forwardRef(R),ne=q},28321:function(Yt,st,K){"use strict";K.d(st,{iz:function(){return zt},ck:function(){return ft},BW:function(){return tt},sN:function(){return ft},Wd:function(){return _t},ZP:function(){return Nt},Xl:function(){return Le}});var U=K(72308),de=K(49618),Se=K(77321),he=K(80702),j=K(52487),p=K(74416),me=K(92310),ce=K.n(me),l=K(11780),X=K(18929),P=K(13697),g=K(48736),_=K(59301),E=K(4676),A=_.createContext(null);function B(Ee,De){return Ee===void 0?null:"".concat(Ee,"-").concat(De)}function H(Ee){var De=_.useContext(A);return B(De,Ee)}var V=K(80547),L=["children","locked"],I=_.createContext(null);function w(Ee,De){var qe=(0,Se.Z)({},Ee);return Object.keys(De).forEach(function(Ye){var ot=De[Ye];ot!==void 0&&(qe[Ye]=ot)}),qe}function R(Ee){var De=Ee.children,qe=Ee.locked,Ye=(0,p.Z)(Ee,L),ot=_.useContext(I),Qe=(0,V.Z)(function(){return w(ot,Ye)},[ot,Ye],function(ct,Et){return!qe&&(ct[0]!==Et[0]||!(0,P.Z)(ct[1],Et[1],!0))});return _.createElement(I.Provider,{value:Qe},De)}var q=[],ne=_.createContext(null);function ee(){return _.useContext(ne)}var ye=_.createContext(q);function Le(Ee){var De=_.useContext(ye);return _.useMemo(function(){return Ee!==void 0?[].concat((0,he.Z)(De),[Ee]):De},[De,Ee])}var Te=_.createContext(null),$e=_.createContext({}),J=$e,D=K(29194);function F(Ee){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,D.Z)(Ee)){var qe=Ee.nodeName.toLowerCase(),Ye=["input","select","textarea","button"].includes(qe)||Ee.isContentEditable||qe==="a"&&!!Ee.getAttribute("href"),ot=Ee.getAttribute("tabindex"),Qe=Number(ot),ct=null;return ot&&!Number.isNaN(Qe)?ct=Qe:Ye&&ct===null&&(ct=0),Ye&&Ee.disabled&&(ct=null),ct!==null&&(ct>=0||De&&ct<0)}return!1}function M(Ee){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,qe=(0,he.Z)(Ee.querySelectorAll("*")).filter(function(Ye){return F(Ye,De)});return F(Ee,De)&&qe.unshift(Ee),qe}var oe=null;function te(){oe=document.activeElement}function S(){oe=null}function v(){if(oe)try{oe.focus()}catch(Ee){}}function Y(Ee,De){if(De.keyCode===9){var qe=M(Ee),Ye=qe[De.shiftKey?0:qe.length-1],ot=Ye===document.activeElement||Ee===document.activeElement;if(ot){var Qe=qe[De.shiftKey?qe.length-1:0];Qe.focus(),De.preventDefault()}}}var ae=K(10228),xe=K(16089),Fe=ae.Z.LEFT,Xe=ae.Z.RIGHT,yt=ae.Z.UP,$t=ae.Z.DOWN,ti=ae.Z.ENTER,je=ae.Z.ESC,mt=ae.Z.HOME,Wt=ae.Z.END,ht=[yt,$t,Fe,Xe];function li(Ee,De,qe,Ye){var ot,Qe="prev",ct="next",Et="children",ni="parent";if(Ee==="inline"&&Ye===ti)return{inlineTrigger:!0};var Ot=(0,de.Z)((0,de.Z)({},yt,Qe),$t,ct),Qt=(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},Fe,qe?ct:Qe),Xe,qe?Qe:ct),$t,Et),ti,Et),oi=(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},yt,Qe),$t,ct),ti,Et),je,ni),Fe,qe?Et:ni),Xe,qe?ni:Et),mi={inline:Ot,horizontal:Qt,vertical:oi,inlineSub:Ot,horizontalSub:oi,verticalSub:oi},Ei=(ot=mi["".concat(Ee).concat(De?"":"Sub")])===null||ot===void 0?void 0:ot[Ye];switch(Ei){case Qe:return{offset:-1,sibling:!0};case ct:return{offset:1,sibling:!0};case ni:return{offset:-1,sibling:!1};case Et:return{offset:1,sibling:!1};default:return null}}function Ge(Ee){for(var De=Ee;De;){if(De.getAttribute("data-menu-list"))return De;De=De.parentElement}return null}function ve(Ee,De){for(var qe=Ee||document.activeElement;qe;){if(De.has(qe))return qe;qe=qe.parentElement}return null}function we(Ee,De){var qe=M(Ee,!0);return qe.filter(function(Ye){return De.has(Ye)})}function se(Ee,De,qe){var Ye=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Ee)return null;var ot=we(Ee,De),Qe=ot.length,ct=ot.findIndex(function(Et){return qe===Et});return Ye<0?ct===-1?ct=Qe-1:ct-=1:Ye>0&&(ct+=1),ct=(ct+Qe)%Qe,ot[ct]}var Re=function(De,qe){var Ye=new Set,ot=new Map,Qe=new Map;return De.forEach(function(ct){var Et=document.querySelector("[data-menu-id='".concat(B(qe,ct),"']"));Et&&(Ye.add(Et),Qe.set(Et,ct),ot.set(ct,Et))}),{elements:Ye,key2element:ot,element2key:Qe}};function Oe(Ee,De,qe,Ye,ot,Qe,ct,Et,ni,Ot){var Qt=_.useRef(),oi=_.useRef();oi.current=De;var mi=function(){xe.Z.cancel(Qt.current)};return _.useEffect(function(){return function(){mi()}},[]),function(Ei){var Ti=Ei.which;if([].concat(ht,[ti,je,mt,Wt]).includes(Ti)){var gi=Qe(),ui=Re(gi,Ye),Li=ui,Pi=Li.elements,wi=Li.key2element,bi=Li.element2key,Mi=wi.get(De),Ri=ve(Mi,Pi),Ni=bi.get(Ri),Ci=li(Ee,ct(Ni,!0).length===1,qe,Ti);if(!Ci&&Ti!==mt&&Ti!==Wt)return;(ht.includes(Ti)||[mt,Wt].includes(Ti))&&Ei.preventDefault();var Ii=function(Ki){if(Ki){var Jt=Ki,It=Ki.querySelector("a");It!=null&&It.getAttribute("href")&&(Jt=It);var _i=bi.get(Ki);Et(_i),mi(),Qt.current=(0,xe.Z)(function(){oi.current===_i&&Jt.focus()})}};if([mt,Wt].includes(Ti)||Ci.sibling||!Ri){var on;!Ri||Ee==="inline"?on=ot.current:on=Ge(Ri);var Vi,Ai=we(on,Pi);Ti===mt?Vi=Ai[0]:Ti===Wt?Vi=Ai[Ai.length-1]:Vi=se(on,Pi,Ri,Ci.offset),Ii(Vi)}else if(Ci.inlineTrigger)ni(Ni);else if(Ci.offset>0)ni(Ni,!0),mi(),Qt.current=(0,xe.Z)(function(){ui=Re(gi,Ye);var Qi=Ri.getAttribute("aria-controls"),Ki=document.getElementById(Qi),Jt=se(Ki,ui.elements);Ii(Jt)},5);else if(Ci.offset<0){var nn=ct(Ni,!0),Yi=nn[nn.length-2],Zi=wi.get(Yi);ni(Yi,!1),Ii(Zi)}}Ot==null||Ot(Ei)}}function ie(Ee){Promise.resolve().then(Ee)}var C="__RC_UTIL_PATH_SPLIT__",O=function(De){return De.join(C)},Q=function(De){return De.split(C)},z="rc-menu-more";function N(){var Ee=_.useState({}),De=(0,j.Z)(Ee,2),qe=De[1],Ye=(0,_.useRef)(new Map),ot=(0,_.useRef)(new Map),Qe=_.useState([]),ct=(0,j.Z)(Qe,2),Et=ct[0],ni=ct[1],Ot=(0,_.useRef)(0),Qt=(0,_.useRef)(!1),oi=function(){Qt.current||qe({})},mi=(0,_.useCallback)(function(wi,bi){var Mi=O(bi);ot.current.set(Mi,wi),Ye.current.set(wi,Mi),Ot.current+=1;var Ri=Ot.current;ie(function(){Ri===Ot.current&&oi()})},[]),Ei=(0,_.useCallback)(function(wi,bi){var Mi=O(bi);ot.current.delete(Mi),Ye.current.delete(wi)},[]),Ti=(0,_.useCallback)(function(wi){ni(wi)},[]),gi=(0,_.useCallback)(function(wi,bi){var Mi=Ye.current.get(wi)||"",Ri=Q(Mi);return bi&&Et.includes(Ri[0])&&Ri.unshift(z),Ri},[Et]),ui=(0,_.useCallback)(function(wi,bi){return wi.filter(function(Mi){return Mi!==void 0}).some(function(Mi){var Ri=gi(Mi,!0);return Ri.includes(bi)})},[gi]),Li=function(){var bi=(0,he.Z)(Ye.current.keys());return Et.length&&bi.push(z),bi},Pi=(0,_.useCallback)(function(wi){var bi="".concat(Ye.current.get(wi)).concat(C),Mi=new Set;return(0,he.Z)(ot.current.keys()).forEach(function(Ri){Ri.startsWith(bi)&&Mi.add(ot.current.get(Ri))}),Mi},[]);return _.useEffect(function(){return function(){Qt.current=!0}},[]),{registerPath:mi,unregisterPath:Ei,refreshOverflowKeys:Ti,isSubPathKey:ui,getKeyPath:gi,getKeys:Li,getSubPathKeys:Pi}}function Z(Ee){var De=_.useRef(Ee);De.current=Ee;var qe=_.useCallback(function(){for(var Ye,ot=arguments.length,Qe=new Array(ot),ct=0;ct<ot;ct++)Qe[ct]=arguments[ct];return(Ye=De.current)===null||Ye===void 0?void 0:Ye.call.apply(Ye,[De].concat(Qe))},[]);return Ee?qe:void 0}var re=Math.random().toFixed(5).toString().slice(2),le=0;function _e(Ee){var De=(0,X.Z)(Ee,{value:Ee}),qe=(0,j.Z)(De,2),Ye=qe[0],ot=qe[1];return _.useEffect(function(){le+=1;var Qe="".concat(re,"-").concat(le);ot("rc-menu-uuid-".concat(Qe))},[]),Ye}var Ae=K(96949),We=K(55090),He=K(77205),Be=K(38793),Ke=K(2738),lt=K(8654);function Ie(Ee,De,qe,Ye){var ot=_.useContext(I),Qe=ot.activeKey,ct=ot.onActive,Et=ot.onInactive,ni={active:Qe===Ee};return De||(ni.onMouseEnter=function(Ot){qe==null||qe({key:Ee,domEvent:Ot}),ct(Ee)},ni.onMouseLeave=function(Ot){Ye==null||Ye({key:Ee,domEvent:Ot}),Et(Ee)}),ni}function et(Ee){var De=_.useContext(I),qe=De.mode,Ye=De.rtl,ot=De.inlineIndent;if(qe!=="inline")return null;var Qe=Ee;return Ye?{paddingRight:Qe*ot}:{paddingLeft:Qe*ot}}function Kt(Ee){var De=Ee.icon,qe=Ee.props,Ye=Ee.children,ot;return De===null||De===!1?null:(typeof De=="function"?ot=_.createElement(De,(0,Se.Z)({},qe)):typeof De!="boolean"&&(ot=De),ot||Ye||null)}var bt=["item"];function Mt(Ee){var De=Ee.item,qe=(0,p.Z)(Ee,bt);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."),De}}),qe}var Zt=["title","attribute","elementRef"],ii=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],ei=["active"],Ft=function(Ee){(0,He.Z)(qe,Ee);var De=(0,Be.Z)(qe);function qe(){return(0,Ae.Z)(this,qe),De.apply(this,arguments)}return(0,We.Z)(qe,[{key:"render",value:function(){var ot=this.props,Qe=ot.title,ct=ot.attribute,Et=ot.elementRef,ni=(0,p.Z)(ot,Zt),Ot=(0,Ke.Z)(ni,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,g.ZP)(!ct,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),_.createElement(l.Z.Item,(0,U.Z)({},ct,{title:typeof Qe=="string"?Qe:void 0},Ot,{ref:Et}))}}]),qe}(_.Component),ri=_.forwardRef(function(Ee,De){var qe=Ee.style,Ye=Ee.className,ot=Ee.eventKey,Qe=Ee.warnKey,ct=Ee.disabled,Et=Ee.itemIcon,ni=Ee.children,Ot=Ee.role,Qt=Ee.onMouseEnter,oi=Ee.onMouseLeave,mi=Ee.onClick,Ei=Ee.onKeyDown,Ti=Ee.onFocus,gi=(0,p.Z)(Ee,ii),ui=H(ot),Li=_.useContext(I),Pi=Li.prefixCls,wi=Li.onItemClick,bi=Li.disabled,Mi=Li.overflowDisabled,Ri=Li.itemIcon,Ni=Li.selectedKeys,Ci=Li.onActive,Ii=_.useContext(J),on=Ii._internalRenderMenuItem,Vi="".concat(Pi,"-item"),Ai=_.useRef(),nn=_.useRef(),Yi=bi||ct,Zi=(0,lt.x1)(De,nn),Qi=Le(ot),Ki=function(Ui){return{key:ot,keyPath:(0,he.Z)(Qi).reverse(),item:Ai.current,domEvent:Ui}},Jt=Et||Ri,It=Ie(ot,Yi,Qt,oi),_i=It.active,Fi=(0,p.Z)(It,ei),Bi=Ni.includes(ot),gn=et(Qi.length),ln=function(Ui){if(!Yi){var vn=Ki(Ui);mi==null||mi(Mt(vn)),wi(vn)}},sn=function(Ui){if(Ei==null||Ei(Ui),Ui.which===ae.Z.ENTER){var vn=Ki(Ui);mi==null||mi(Mt(vn)),wi(vn)}},hn=function(Ui){Ci(ot),Ti==null||Ti(Ui)},fn={};Ee.role==="option"&&(fn["aria-selected"]=Bi);var _n=_.createElement(Ft,(0,U.Z)({ref:Ai,elementRef:Zi,role:Ot===null?"none":Ot||"menuitem",tabIndex:ct?null:-1,"data-menu-id":Mi&&ui?null:ui},(0,Ke.Z)(gi,["extra"]),Fi,fn,{component:"li","aria-disabled":ct,style:(0,Se.Z)((0,Se.Z)({},gn),qe),className:ce()(Vi,(0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(Vi,"-active"),_i),"".concat(Vi,"-selected"),Bi),"".concat(Vi,"-disabled"),Yi),Ye),onClick:ln,onKeyDown:sn,onFocus:hn}),ni,_.createElement(Kt,{props:(0,Se.Z)((0,Se.Z)({},Ee),{},{isSelected:Bi}),icon:Jt}));return on&&(_n=on(_n,Ee,{selected:Bi})),_n});function St(Ee,De){var qe=Ee.eventKey,Ye=ee(),ot=Le(qe);return _.useEffect(function(){if(Ye)return Ye.registerPath(qe,ot),function(){Ye.unregisterPath(qe,ot)}},[ot]),Ye?null:_.createElement(ri,(0,U.Z)({},Ee,{ref:De}))}var ft=_.forwardRef(St),gt=["className","children"],Ht=function(De,qe){var Ye=De.className,ot=De.children,Qe=(0,p.Z)(De,gt),ct=_.useContext(I),Et=ct.prefixCls,ni=ct.mode,Ot=ct.rtl;return _.createElement("ul",(0,U.Z)({className:ce()(Et,Ot&&"".concat(Et,"-rtl"),"".concat(Et,"-sub"),"".concat(Et,"-").concat(ni==="inline"?"inline":"vertical"),Ye),role:"menu"},Qe,{"data-menu-list":!0,ref:qe}),ot)},pt=_.forwardRef(Ht);pt.displayName="SubMenuList";var dt=pt,vt=K(11592);function Bt(Ee,De){return(0,vt.Z)(Ee).map(function(qe,Ye){if(_.isValidElement(qe)){var ot,Qe,ct=qe.key,Et=(ot=(Qe=qe.props)===null||Qe===void 0?void 0:Qe.eventKey)!==null&&ot!==void 0?ot:ct,ni=Et==null;ni&&(Et="tmp_key-".concat([].concat((0,he.Z)(De),[Ye]).join("-")));var Ot={key:Et,eventKey:Et};return _.cloneElement(qe,Ot)}return qe})}var ai=K(65352),xt={adjustX:1,adjustY:1},Xt={topLeft:{points:["bl","tl"],overflow:xt},topRight:{points:["br","tr"],overflow:xt},bottomLeft:{points:["tl","bl"],overflow:xt},bottomRight:{points:["tr","br"],overflow:xt},leftTop:{points:["tr","tl"],overflow:xt},leftBottom:{points:["br","bl"],overflow:xt},rightTop:{points:["tl","tr"],overflow:xt},rightBottom:{points:["bl","br"],overflow:xt}},Lt={topLeft:{points:["bl","tl"],overflow:xt},topRight:{points:["br","tr"],overflow:xt},bottomLeft:{points:["tl","bl"],overflow:xt},bottomRight:{points:["tr","br"],overflow:xt},rightTop:{points:["tr","tl"],overflow:xt},rightBottom:{points:["br","bl"],overflow:xt},leftTop:{points:["tl","tr"],overflow:xt},leftBottom:{points:["bl","br"],overflow:xt}},Ne=null;function h(Ee,De,qe){if(De)return De;if(qe)return qe[Ee]||qe.other}var m={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function y(Ee){var De=Ee.prefixCls,qe=Ee.visible,Ye=Ee.children,ot=Ee.popup,Qe=Ee.popupStyle,ct=Ee.popupClassName,Et=Ee.popupOffset,ni=Ee.disabled,Ot=Ee.mode,Qt=Ee.onVisibleChange,oi=_.useContext(I),mi=oi.getPopupContainer,Ei=oi.rtl,Ti=oi.subMenuOpenDelay,gi=oi.subMenuCloseDelay,ui=oi.builtinPlacements,Li=oi.triggerSubMenuAction,Pi=oi.forceSubMenuRender,wi=oi.rootClassName,bi=oi.motion,Mi=oi.defaultMotions,Ri=_.useState(!1),Ni=(0,j.Z)(Ri,2),Ci=Ni[0],Ii=Ni[1],on=Ei?(0,Se.Z)((0,Se.Z)({},Lt),ui):(0,Se.Z)((0,Se.Z)({},Xt),ui),Vi=m[Ot],Ai=h(Ot,bi,Mi),nn=_.useRef(Ai);Ot!=="inline"&&(nn.current=Ai);var Yi=(0,Se.Z)((0,Se.Z)({},nn.current),{},{leavedClassName:"".concat(De,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Zi=_.useRef();return _.useEffect(function(){return Zi.current=(0,xe.Z)(function(){Ii(qe)}),function(){xe.Z.cancel(Zi.current)}},[qe]),_.createElement(ai.Z,{prefixCls:De,popupClassName:ce()("".concat(De,"-popup"),(0,de.Z)({},"".concat(De,"-rtl"),Ei),ct,wi),stretch:Ot==="horizontal"?"minWidth":null,getPopupContainer:mi,builtinPlacements:on,popupPlacement:Vi,popupVisible:Ci,popup:ot,popupStyle:Qe,popupAlign:Et&&{offset:Et},action:ni?[]:[Li],mouseEnterDelay:Ti,mouseLeaveDelay:gi,onPopupVisibleChange:Qt,forceRender:Pi,popupMotion:Yi,fresh:!0},Ye)}var k=K(77900);function W(Ee){var De=Ee.id,qe=Ee.open,Ye=Ee.keyPath,ot=Ee.children,Qe="inline",ct=_.useContext(I),Et=ct.prefixCls,ni=ct.forceSubMenuRender,Ot=ct.motion,Qt=ct.defaultMotions,oi=ct.mode,mi=_.useRef(!1);mi.current=oi===Qe;var Ei=_.useState(!mi.current),Ti=(0,j.Z)(Ei,2),gi=Ti[0],ui=Ti[1],Li=mi.current?qe:!1;_.useEffect(function(){mi.current&&ui(!1)},[oi]);var Pi=(0,Se.Z)({},h(Qe,Ot,Qt));Ye.length>1&&(Pi.motionAppear=!1);var wi=Pi.onVisibleChanged;return Pi.onVisibleChanged=function(bi){return!mi.current&&!bi&&ui(!0),wi==null?void 0:wi(bi)},gi?null:_.createElement(R,{mode:Qe,locked:!mi.current},_.createElement(k.default,(0,U.Z)({visible:Li},Pi,{forceRender:ni,removeOnLeave:!1,leavedClassName:"".concat(Et,"-hidden")}),function(bi){var Mi=bi.className,Ri=bi.style;return _.createElement(dt,{id:De,className:Mi,style:Ri},ot)}))}var pe=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],be=["active"],rt=_.forwardRef(function(Ee,De){var qe=Ee.style,Ye=Ee.className,ot=Ee.title,Qe=Ee.eventKey,ct=Ee.warnKey,Et=Ee.disabled,ni=Ee.internalPopupClose,Ot=Ee.children,Qt=Ee.itemIcon,oi=Ee.expandIcon,mi=Ee.popupClassName,Ei=Ee.popupOffset,Ti=Ee.popupStyle,gi=Ee.onClick,ui=Ee.onMouseEnter,Li=Ee.onMouseLeave,Pi=Ee.onTitleClick,wi=Ee.onTitleMouseEnter,bi=Ee.onTitleMouseLeave,Mi=(0,p.Z)(Ee,pe),Ri=H(Qe),Ni=_.useContext(I),Ci=Ni.prefixCls,Ii=Ni.mode,on=Ni.openKeys,Vi=Ni.disabled,Ai=Ni.overflowDisabled,nn=Ni.activeKey,Yi=Ni.selectedKeys,Zi=Ni.itemIcon,Qi=Ni.expandIcon,Ki=Ni.onItemClick,Jt=Ni.onOpenChange,It=Ni.onActive,_i=_.useContext(J),Fi=_i._internalRenderSubMenuItem,Bi=_.useContext(Te),gn=Bi.isSubPathKey,ln=Le(),sn="".concat(Ci,"-submenu"),hn=Vi||Et,fn=_.useRef(),_n=_.useRef(),xn=Qt!=null?Qt:Zi,Ui=oi!=null?oi:Qi,vn=on.includes(Qe),yn=!Ai&&vn,pn=gn(Yi,Qe),dn=Ie(Qe,hn,wi,bi),fi=dn.active,Pn=(0,p.Z)(dn,be),Tn=_.useState(!1),Gn=(0,j.Z)(Tn,2),On=Gn[0],qn=Gn[1],Mn=function(en){hn||qn(en)},Qn=function(en){Mn(!0),ui==null||ui({key:Qe,domEvent:en})},Wi=function(en){Mn(!1),Li==null||Li({key:Qe,domEvent:en})},Vn=_.useMemo(function(){return fi||(Ii!=="inline"?On||gn([nn],Qe):!1)},[Ii,fi,nn,On,Qe,gn]),An=et(ln.length),as=function(en){hn||(Pi==null||Pi({key:Qe,domEvent:en}),Ii==="inline"&&Jt(Qe,!vn))},Jn=Z(function(Ji){gi==null||gi(Mt(Ji)),Ki(Ji)}),jn=function(en){Ii!=="inline"&&Jt(Qe,en)},es=function(){It(Qe)},wn=Ri&&"".concat(Ri,"-popup"),Rn=_.useMemo(function(){return _.createElement(Kt,{icon:Ii!=="horizontal"?Ui:void 0,props:(0,Se.Z)((0,Se.Z)({},Ee),{},{isOpen:yn,isSubMenu:!0})},_.createElement("i",{className:"".concat(sn,"-arrow")}))},[Ii,Ui,Ee,yn,sn]),un=_.createElement("div",(0,U.Z)({role:"menuitem",style:An,className:"".concat(sn,"-title"),tabIndex:hn?null:-1,ref:fn,title:typeof ot=="string"?ot:null,"data-menu-id":Ai&&Ri?null:Ri,"aria-expanded":yn,"aria-haspopup":!0,"aria-controls":wn,"aria-disabled":hn,onClick:as,onFocus:es},Pn),ot,Rn),In=_.useRef(Ii);if(Ii!=="inline"&&ln.length>1?In.current="vertical":In.current=Ii,!Ai){var mn=In.current;un=_.createElement(y,{mode:mn,prefixCls:sn,visible:!ni&&yn&&Ii!=="inline",popupClassName:mi,popupOffset:Ei,popupStyle:Ti,popup:_.createElement(R,{mode:mn==="horizontal"?"vertical":mn},_.createElement(dt,{id:wn,ref:_n},Ot)),disabled:hn,onVisibleChange:jn},un)}var Nn=_.createElement(l.Z.Item,(0,U.Z)({ref:De,role:"none"},Mi,{component:"li",style:qe,className:ce()(sn,"".concat(sn,"-").concat(Ii),Ye,(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(sn,"-open"),yn),"".concat(sn,"-active"),Vn),"".concat(sn,"-selected"),pn),"".concat(sn,"-disabled"),hn)),onMouseEnter:Qn,onMouseLeave:Wi}),un,!Ai&&_.createElement(W,{id:wn,open:yn,keyPath:ln},Ot));return Fi&&(Nn=Fi(Nn,Ee,{selected:pn,active:Vn,open:yn,disabled:hn})),_.createElement(R,{onItemClick:Jn,mode:Ii==="horizontal"?"vertical":Ii,itemIcon:xn,expandIcon:Ui},Nn)}),ut=_.forwardRef(function(Ee,De){var qe=Ee.eventKey,Ye=Ee.children,ot=Le(qe),Qe=Bt(Ye,ot),ct=ee();_.useEffect(function(){if(ct)return ct.registerPath(qe,ot),function(){ct.unregisterPath(qe,ot)}},[ot]);var Et;return ct?Et=Qe:Et=_.createElement(rt,(0,U.Z)({ref:De},Ee),Qe),_.createElement(ye.Provider,{value:ot},Et)}),_t=ut,Ut=K(62853);function zt(Ee){var De=Ee.className,qe=Ee.style,Ye=_.useContext(I),ot=Ye.prefixCls,Qe=ee();return Qe?null:_.createElement("li",{role:"separator",className:ce()("".concat(ot,"-item-divider"),De),style:qe})}var Tt=["className","title","eventKey","children"],Gt=_.forwardRef(function(Ee,De){var qe=Ee.className,Ye=Ee.title,ot=Ee.eventKey,Qe=Ee.children,ct=(0,p.Z)(Ee,Tt),Et=_.useContext(I),ni=Et.prefixCls,Ot="".concat(ni,"-item-group");return _.createElement("li",(0,U.Z)({ref:De,role:"presentation"},ct,{onClick:function(oi){return oi.stopPropagation()},className:ce()(Ot,qe)}),_.createElement("div",{role:"presentation",className:"".concat(Ot,"-title"),title:typeof Ye=="string"?Ye:void 0},Ye),_.createElement("ul",{role:"group",className:"".concat(Ot,"-list")},Qe))}),Pt=_.forwardRef(function(Ee,De){var qe=Ee.eventKey,Ye=Ee.children,ot=Le(qe),Qe=Bt(Ye,ot),ct=ee();return ct?Qe:_.createElement(Gt,(0,U.Z)({ref:De},(0,Ke.Z)(Ee,["warnKey"])),Qe)}),tt=Pt,ze=["label","children","key","type","extra"];function Ve(Ee,De,qe){var Ye=De.item,ot=De.group,Qe=De.submenu,ct=De.divider;return(Ee||[]).map(function(Et,ni){if(Et&&(0,Ut.Z)(Et)==="object"){var Ot=Et,Qt=Ot.label,oi=Ot.children,mi=Ot.key,Ei=Ot.type,Ti=Ot.extra,gi=(0,p.Z)(Ot,ze),ui=mi!=null?mi:"tmp-".concat(ni);return oi||Ei==="group"?Ei==="group"?_.createElement(ot,(0,U.Z)({key:ui},gi,{title:Qt}),Ve(oi,De,qe)):_.createElement(Qe,(0,U.Z)({key:ui},gi,{title:Qt}),Ve(oi,De,qe)):Ei==="divider"?_.createElement(ct,(0,U.Z)({key:ui},gi)):_.createElement(Ye,(0,U.Z)({key:ui},gi,{extra:Ti}),Qt,(!!Ti||Ti===0)&&_.createElement("span",{className:"".concat(qe,"-item-extra")},Ti))}return null}).filter(function(Et){return Et})}function at(Ee,De,qe,Ye,ot){var Qe=Ee,ct=(0,Se.Z)({divider:zt,item:ft,group:tt,submenu:_t},Ye);return De&&(Qe=Ve(De,ct,ot)),Bt(Qe,qe)}var Vt=["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"],Ct=[],pi=_.forwardRef(function(Ee,De){var qe,Ye=Ee,ot=Ye.prefixCls,Qe=ot===void 0?"rc-menu":ot,ct=Ye.rootClassName,Et=Ye.style,ni=Ye.className,Ot=Ye.tabIndex,Qt=Ot===void 0?0:Ot,oi=Ye.items,mi=Ye.children,Ei=Ye.direction,Ti=Ye.id,gi=Ye.mode,ui=gi===void 0?"vertical":gi,Li=Ye.inlineCollapsed,Pi=Ye.disabled,wi=Ye.disabledOverflow,bi=Ye.subMenuOpenDelay,Mi=bi===void 0?.1:bi,Ri=Ye.subMenuCloseDelay,Ni=Ri===void 0?.1:Ri,Ci=Ye.forceSubMenuRender,Ii=Ye.defaultOpenKeys,on=Ye.openKeys,Vi=Ye.activeKey,Ai=Ye.defaultActiveFirst,nn=Ye.selectable,Yi=nn===void 0?!0:nn,Zi=Ye.multiple,Qi=Zi===void 0?!1:Zi,Ki=Ye.defaultSelectedKeys,Jt=Ye.selectedKeys,It=Ye.onSelect,_i=Ye.onDeselect,Fi=Ye.inlineIndent,Bi=Fi===void 0?24:Fi,gn=Ye.motion,ln=Ye.defaultMotions,sn=Ye.triggerSubMenuAction,hn=sn===void 0?"hover":sn,fn=Ye.builtinPlacements,_n=Ye.itemIcon,xn=Ye.expandIcon,Ui=Ye.overflowedIndicator,vn=Ui===void 0?"...":Ui,yn=Ye.overflowedIndicatorPopupClassName,pn=Ye.getPopupContainer,dn=Ye.onClick,fi=Ye.onOpenChange,Pn=Ye.onKeyDown,Tn=Ye.openAnimation,Gn=Ye.openTransitionName,On=Ye._internalRenderMenuItem,qn=Ye._internalRenderSubMenuItem,Mn=Ye._internalComponents,Qn=(0,p.Z)(Ye,Vt),Wi=_.useMemo(function(){return[at(mi,oi,Ct,Mn,Qe),at(mi,oi,Ct,{},Qe)]},[mi,oi,Mn]),Vn=(0,j.Z)(Wi,2),An=Vn[0],as=Vn[1],Jn=_.useState(!1),jn=(0,j.Z)(Jn,2),es=jn[0],wn=jn[1],Rn=_.useRef(),un=_e(Ti),In=Ei==="rtl",mn=(0,X.Z)(Ii,{value:on,postState:function($i){return $i||Ct}}),Nn=(0,j.Z)(mn,2),Ji=Nn[0],en=Nn[1],Di=function($i){var tn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function it(){en($i),fi==null||fi($i)}tn?(0,E.flushSync)(it):it()},cn=_.useState(Ji),Wn=(0,j.Z)(cn,2),ts=Wn[0],os=Wn[1],Hn=_.useRef(!1),qt=_.useMemo(function(){return(ui==="inline"||ui==="vertical")&&Li?["vertical",Li]:[ui,!1]},[ui,Li]),vi=(0,j.Z)(qt,2),Hi=vi[0],rn=vi[1],Xi=Hi==="inline",ls=_.useState(Hi),Zn=(0,j.Z)(ls,2),bn=Zn[0],ds=Zn[1],or=_.useState(rn),Ks=(0,j.Z)(or,2),Mr=Ks[0],$s=Ks[1];_.useEffect(function(){ds(Hi),$s(rn),Hn.current&&(Xi?en(ts):Di(Ct))},[Hi,rn]);var Nr=_.useState(0),Fn=(0,j.Z)(Nr,2),vs=Fn[0],Fr=Fn[1],Rs=vs>=An.length-1||bn!=="horizontal"||wi;_.useEffect(function(){Xi&&os(Ji)},[Ji]),_.useEffect(function(){return Hn.current=!0,function(){Hn.current=!1}},[]);var is=N(),Gs=is.registerPath,Vs=is.unregisterPath,Br=is.refreshOverflowKeys,Ls=is.isSubPathKey,lr=is.getKeyPath,js=is.getKeys,zn=is.getSubPathKeys,ur=_.useMemo(function(){return{registerPath:Gs,unregisterPath:Vs}},[Gs,Vs]),Ws=_.useMemo(function(){return{isSubPathKey:Ls}},[Ls]);_.useEffect(function(){Br(Rs?Ct:An.slice(vs+1).map(function(an){return an.key}))},[vs,Rs]);var cr=(0,X.Z)(Vi||Ai&&((qe=An[0])===null||qe===void 0?void 0:qe.key),{value:Vi}),hr=(0,j.Z)(cr,2),ys=hr[0],Hs=hr[1],Ur=Z(function(an){Hs(an)}),dr=Z(function(){Hs(void 0)});(0,_.useImperativeHandle)(De,function(){return{list:Rn.current,focus:function($i){var tn,it=js(),Sn=Re(it,un),Ss=Sn.elements,Ds=Sn.key2element,Gr=Sn.element2key,Cs=we(Rn.current,Ss),zs=ys!=null?ys:Cs[0]?Gr.get(Cs[0]):(tn=An.find(function(Xs){return!Xs.props.disabled}))===null||tn===void 0?void 0:tn.key,xs=Ds.get(zs);if(zs&&xs){var Ys;xs==null||(Ys=xs.focus)===null||Ys===void 0||Ys.call(xs,$i)}}}});var fr=(0,X.Z)(Ki||[],{value:Jt,postState:function($i){return Array.isArray($i)?$i:$i==null?Ct:[$i]}}),Is=(0,j.Z)(fr,2),Es=Is[0],pr=Is[1],mr=function($i){if(Yi){var tn=$i.key,it=Es.includes(tn),Sn;Qi?it?Sn=Es.filter(function(Ds){return Ds!==tn}):Sn=[].concat((0,he.Z)(Es),[tn]):Sn=[tn],pr(Sn);var Ss=(0,Se.Z)((0,Se.Z)({},$i),{},{selectedKeys:Sn});it?_i==null||_i(Ss):It==null||It(Ss)}!Qi&&Ji.length&&bn!=="inline"&&Di(Ct)},gr=Z(function(an){dn==null||dn(Mt(an)),mr(an)}),Zs=Z(function(an,$i){var tn=Ji.filter(function(Sn){return Sn!==an});if($i)tn.push(an);else if(bn!=="inline"){var it=zn(an);tn=tn.filter(function(Sn){return!it.has(Sn)})}(0,P.Z)(Ji,tn,!0)||Di(tn,!0)}),bs=function($i,tn){var it=tn!=null?tn:!Ji.includes($i);Zs($i,it)},Kr=Oe(bn,ys,In,un,Rn,js,lr,Hs,bs,Pn);_.useEffect(function(){wn(!0)},[]);var _r=_.useMemo(function(){return{_internalRenderMenuItem:On,_internalRenderSubMenuItem:qn}},[On,qn]),vr=bn!=="horizontal"||wi?An:An.map(function(an,$i){return _.createElement(R,{key:an.key,overflowDisabled:$i>vs},an)}),$r=_.createElement(l.Z,(0,U.Z)({id:Ti,ref:Rn,prefixCls:"".concat(Qe,"-overflow"),component:"ul",itemComponent:ft,className:ce()(Qe,"".concat(Qe,"-root"),"".concat(Qe,"-").concat(bn),ni,(0,de.Z)((0,de.Z)({},"".concat(Qe,"-inline-collapsed"),Mr),"".concat(Qe,"-rtl"),In),ct),dir:Ei,style:Et,role:"menu",tabIndex:Qt,data:vr,renderRawItem:function($i){return $i},renderRawRest:function($i){var tn=$i.length,it=tn?An.slice(-tn):null;return _.createElement(_t,{eventKey:z,title:vn,disabled:Rs,internalPopupClose:tn===0,popupClassName:yn},it)},maxCount:bn!=="horizontal"||wi?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function($i){Fr($i)},onKeyDown:Kr},Qn));return _.createElement(J.Provider,{value:_r},_.createElement(A.Provider,{value:un},_.createElement(R,{prefixCls:Qe,rootClassName:ct,mode:bn,openKeys:Ji,rtl:In,disabled:Pi,motion:es?gn:null,defaultMotions:es?ln:null,activeKey:ys,onActive:Ur,onInactive:dr,selectedKeys:Es,inlineIndent:Bi,subMenuOpenDelay:Mi,subMenuCloseDelay:Ni,forceSubMenuRender:Ci,builtinPlacements:fn,triggerSubMenuAction:hn,getPopupContainer:pn,itemIcon:_n,expandIcon:xn,onItemClick:gr,onOpenChange:Zs},_.createElement(Te.Provider,{value:Ws},$r),_.createElement("div",{style:{display:"none"},"aria-hidden":!0},_.createElement(ne.Provider,{value:ur},as)))))}),Dt=pi,Rt=Dt;Rt.Item=ft,Rt.SubMenu=_t,Rt.ItemGroup=tt,Rt.Divider=zt;var Nt=Rt},11780:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return te}});var U=K(72308),de=K(77321),Se=K(52487),he=K(74416),j=K(59301),p=K(92310),me=K.n(p),ce=K(29301),l=K(34280),X=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],P=void 0;function g(S,v){var Y=S.prefixCls,ae=S.invalidate,xe=S.item,Fe=S.renderItem,Xe=S.responsive,yt=S.responsiveDisabled,$t=S.registerSize,ti=S.itemKey,je=S.className,mt=S.style,Wt=S.children,ht=S.display,li=S.order,Ge=S.component,ve=Ge===void 0?"div":Ge,we=(0,he.Z)(S,X),se=Xe&&!ht;function Re(Q){$t(ti,Q)}j.useEffect(function(){return function(){Re(null)}},[]);var Oe=Fe&&xe!==P?Fe(xe,{index:li}):Wt,ie;ae||(ie={opacity:se?0:1,height:se?0:P,overflowY:se?"hidden":P,order:Xe?li:P,pointerEvents:se?"none":P,position:se?"absolute":P});var C={};se&&(C["aria-hidden"]=!0);var O=j.createElement(ve,(0,U.Z)({className:me()(!ae&&Y,je),style:(0,de.Z)((0,de.Z)({},ie),mt)},C,we,{ref:v}),Oe);return Xe&&(O=j.createElement(ce.Z,{onResize:function(z){var N=z.offsetWidth;Re(N)},disabled:yt},O)),O}var _=j.forwardRef(g);_.displayName="Item";var E=_,A=K(6089),B=K(4676),H=K(16089);function V(S){if(typeof MessageChannel=="undefined")(0,H.Z)(S);else{var v=new MessageChannel;v.port1.onmessage=function(){return S()},v.port2.postMessage(void 0)}}function L(){var S=j.useRef(null),v=function(ae){S.current||(S.current=[],V(function(){(0,B.unstable_batchedUpdates)(function(){S.current.forEach(function(xe){xe()}),S.current=null})})),S.current.push(ae)};return v}function I(S,v){var Y=j.useState(v),ae=(0,Se.Z)(Y,2),xe=ae[0],Fe=ae[1],Xe=(0,A.Z)(function(yt){S(function(){Fe(yt)})});return[xe,Xe]}var w=j.createContext(null),R=["component"],q=["className"],ne=["className"],ee=function(v,Y){var ae=j.useContext(w);if(!ae){var xe=v.component,Fe=xe===void 0?"div":xe,Xe=(0,he.Z)(v,R);return j.createElement(Fe,(0,U.Z)({},Xe,{ref:Y}))}var yt=ae.className,$t=(0,he.Z)(ae,q),ti=v.className,je=(0,he.Z)(v,ne);return j.createElement(w.Provider,{value:null},j.createElement(E,(0,U.Z)({ref:Y,className:me()(yt,ti)},$t,je)))},ye=j.forwardRef(ee);ye.displayName="RawItem";var Le=ye,Te=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],$e="responsive",J="invalidate";function D(S){return"+ ".concat(S.length," ...")}function F(S,v){var Y=S.prefixCls,ae=Y===void 0?"rc-overflow":Y,xe=S.data,Fe=xe===void 0?[]:xe,Xe=S.renderItem,yt=S.renderRawItem,$t=S.itemKey,ti=S.itemWidth,je=ti===void 0?10:ti,mt=S.ssr,Wt=S.style,ht=S.className,li=S.maxCount,Ge=S.renderRest,ve=S.renderRawRest,we=S.suffix,se=S.component,Re=se===void 0?"div":se,Oe=S.itemComponent,ie=S.onVisibleChange,C=(0,he.Z)(S,Te),O=mt==="full",Q=L(),z=I(Q,null),N=(0,Se.Z)(z,2),Z=N[0],re=N[1],le=Z||0,_e=I(Q,new Map),Ae=(0,Se.Z)(_e,2),We=Ae[0],He=Ae[1],Be=I(Q,0),Ke=(0,Se.Z)(Be,2),lt=Ke[0],Ie=Ke[1],et=I(Q,0),Kt=(0,Se.Z)(et,2),bt=Kt[0],Mt=Kt[1],Zt=I(Q,0),ii=(0,Se.Z)(Zt,2),ei=ii[0],Ft=ii[1],ri=(0,j.useState)(null),St=(0,Se.Z)(ri,2),ft=St[0],gt=St[1],Ht=(0,j.useState)(null),pt=(0,Se.Z)(Ht,2),dt=pt[0],vt=pt[1],Bt=j.useMemo(function(){return dt===null&&O?Number.MAX_SAFE_INTEGER:dt||0},[dt,Z]),ai=(0,j.useState)(!1),xt=(0,Se.Z)(ai,2),Xt=xt[0],Lt=xt[1],Ne="".concat(ae,"-item"),h=Math.max(lt,bt),m=li===$e,y=Fe.length&&m,k=li===J,W=y||typeof li=="number"&&Fe.length>li,pe=(0,j.useMemo)(function(){var Rt=Fe;return y?Z===null&&O?Rt=Fe:Rt=Fe.slice(0,Math.min(Fe.length,le/je)):typeof li=="number"&&(Rt=Fe.slice(0,li)),Rt},[Fe,je,Z,li,y]),be=(0,j.useMemo)(function(){return y?Fe.slice(Bt+1):Fe.slice(pe.length)},[Fe,pe,y,Bt]),rt=(0,j.useCallback)(function(Rt,Nt){var Ee;return typeof $t=="function"?$t(Rt):(Ee=$t&&(Rt==null?void 0:Rt[$t]))!==null&&Ee!==void 0?Ee:Nt},[$t]),ut=(0,j.useCallback)(Xe||function(Rt){return Rt},[Xe]);function _t(Rt,Nt,Ee){dt===Rt&&(Nt===void 0||Nt===ft)||(vt(Rt),Ee||(Lt(Rt<Fe.length-1),ie==null||ie(Rt)),Nt!==void 0&&gt(Nt))}function Ut(Rt,Nt){re(Nt.clientWidth)}function zt(Rt,Nt){He(function(Ee){var De=new Map(Ee);return Nt===null?De.delete(Rt):De.set(Rt,Nt),De})}function Tt(Rt,Nt){Mt(Nt),Ie(bt)}function Gt(Rt,Nt){Ft(Nt)}function Pt(Rt){return We.get(rt(pe[Rt],Rt))}(0,l.Z)(function(){if(le&&typeof h=="number"&&pe){var Rt=ei,Nt=pe.length,Ee=Nt-1;if(!Nt){_t(0,null);return}for(var De=0;De<Nt;De+=1){var qe=Pt(De);if(O&&(qe=qe||0),qe===void 0){_t(De-1,void 0,!0);break}if(Rt+=qe,Ee===0&&Rt<=le||De===Ee-1&&Rt+Pt(Ee)<=le){_t(Ee,null);break}else if(Rt+h>le){_t(De-1,Rt-qe-ei+bt);break}}we&&Pt(0)+ei>le&&gt(null)}},[le,We,bt,ei,rt,pe]);var tt=Xt&&!!be.length,ze={};ft!==null&&y&&(ze={position:"absolute",left:ft,top:0});var Ve={prefixCls:Ne,responsive:y,component:Oe,invalidate:k},at=yt?function(Rt,Nt){var Ee=rt(Rt,Nt);return j.createElement(w.Provider,{key:Ee,value:(0,de.Z)((0,de.Z)({},Ve),{},{order:Nt,item:Rt,itemKey:Ee,registerSize:zt,display:Nt<=Bt})},yt(Rt,Nt))}:function(Rt,Nt){var Ee=rt(Rt,Nt);return j.createElement(E,(0,U.Z)({},Ve,{order:Nt,key:Ee,item:Rt,renderItem:ut,itemKey:Ee,registerSize:zt,display:Nt<=Bt}))},Vt={order:tt?Bt:Number.MAX_SAFE_INTEGER,className:"".concat(Ne,"-rest"),registerSize:Tt,display:tt},Ct=Ge||D,pi=ve?j.createElement(w.Provider,{value:(0,de.Z)((0,de.Z)({},Ve),Vt)},ve(be)):j.createElement(E,(0,U.Z)({},Ve,Vt),typeof Ct=="function"?Ct(be):Ct),Dt=j.createElement(Re,(0,U.Z)({className:me()(!k&&ae,ht),style:Wt,ref:v},C),pe.map(at),W?pi:null,we&&j.createElement(E,(0,U.Z)({},Ve,{responsive:m,responsiveDisabled:!y,order:Bt,className:"".concat(Ne,"-suffix"),registerSize:Gt,display:!0,style:ze}),we));return m?j.createElement(ce.Z,{onResize:Ut,disabled:!y},Dt):Dt}var M=j.forwardRef(F);M.displayName="Overflow",M.Item=Le,M.RESPONSIVE=$e,M.INVALIDATE=J;var oe=M,te=oe},738:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return I}});var U=K(72308),de=K(49618),Se=K(52487),he=K(74416),j=K(92310),p=K.n(j),me=K(18929),ce=K(10228),l=K(26112),X=K(59301);function P(w,R){var q=w.disabled,ne=w.prefixCls,ee=w.character,ye=w.characterRender,Le=w.index,Te=w.count,$e=w.value,J=w.allowHalf,D=w.focused,F=w.onHover,M=w.onClick,oe=function(Xe){F(Xe,Le)},te=function(Xe){M(Xe,Le)},S=function(Xe){Xe.keyCode===ce.Z.ENTER&&M(Xe,Le)},v=Le+1,Y=new Set([ne]);$e===0&&Le===0&&D?Y.add("".concat(ne,"-focused")):J&&$e+.5>=v&&$e<v?(Y.add("".concat(ne,"-half")),Y.add("".concat(ne,"-active")),D&&Y.add("".concat(ne,"-focused"))):(v<=$e?Y.add("".concat(ne,"-full")):Y.add("".concat(ne,"-zero")),v===$e&&D&&Y.add("".concat(ne,"-focused")));var ae=typeof ee=="function"?ee(w):ee,xe=X.createElement("li",{className:p()(Array.from(Y)),ref:R},X.createElement("div",{onClick:q?null:te,onKeyDown:q?null:S,onMouseMove:q?null:oe,role:"radio","aria-checked":$e>Le?"true":"false","aria-posinset":Le+1,"aria-setsize":Te,tabIndex:q?-1:0},X.createElement("div",{className:"".concat(ne,"-first")},ae),X.createElement("div",{className:"".concat(ne,"-second")},ae)));return ye&&(xe=ye(xe,w)),xe}var g=X.forwardRef(P);function _(){var w=X.useRef({});function R(ne){return w.current[ne]}function q(ne){return function(ee){w.current[ne]=ee}}return[R,q]}function E(w){var R=w.pageXOffset,q="scrollLeft";if(typeof R!="number"){var ne=w.document;R=ne.documentElement[q],typeof R!="number"&&(R=ne.body[q])}return R}function A(w){var R,q,ne=w.ownerDocument,ee=ne.body,ye=ne&&ne.documentElement,Le=w.getBoundingClientRect();return R=Le.left,q=Le.top,R-=ye.clientLeft||ee.clientLeft||0,q-=ye.clientTop||ee.clientTop||0,{left:R,top:q}}function B(w){var R=A(w),q=w.ownerDocument,ne=q.defaultView||q.parentWindow;return R.left+=E(ne),R.left}var H=["prefixCls","className","defaultValue","value","count","allowHalf","allowClear","keyboard","character","characterRender","disabled","direction","tabIndex","autoFocus","onHoverChange","onChange","onFocus","onBlur","onKeyDown","onMouseLeave"];function V(w,R){var q=w.prefixCls,ne=q===void 0?"rc-rate":q,ee=w.className,ye=w.defaultValue,Le=w.value,Te=w.count,$e=Te===void 0?5:Te,J=w.allowHalf,D=J===void 0?!1:J,F=w.allowClear,M=F===void 0?!0:F,oe=w.keyboard,te=oe===void 0?!0:oe,S=w.character,v=S===void 0?"\u2605":S,Y=w.characterRender,ae=w.disabled,xe=w.direction,Fe=xe===void 0?"ltr":xe,Xe=w.tabIndex,yt=Xe===void 0?0:Xe,$t=w.autoFocus,ti=w.onHoverChange,je=w.onChange,mt=w.onFocus,Wt=w.onBlur,ht=w.onKeyDown,li=w.onMouseLeave,Ge=(0,he.Z)(w,H),ve=_(),we=(0,Se.Z)(ve,2),se=we[0],Re=we[1],Oe=X.useRef(null),ie=function(){if(!ae){var gt;(gt=Oe.current)===null||gt===void 0||gt.focus()}};X.useImperativeHandle(R,function(){return{focus:ie,blur:function(){if(!ae){var gt;(gt=Oe.current)===null||gt===void 0||gt.blur()}}}});var C=(0,me.Z)(ye||0,{value:Le}),O=(0,Se.Z)(C,2),Q=O[0],z=O[1],N=(0,me.Z)(null),Z=(0,Se.Z)(N,2),re=Z[0],le=Z[1],_e=function(gt,Ht){var pt=Fe==="rtl",dt=gt+1;if(D){var vt=se(gt),Bt=B(vt),ai=vt.clientWidth;(pt&&Ht-Bt>ai/2||!pt&&Ht-Bt<ai/2)&&(dt-=.5)}return dt},Ae=function(gt){z(gt),je==null||je(gt)},We=X.useState(!1),He=(0,Se.Z)(We,2),Be=He[0],Ke=He[1],lt=function(){Ke(!0),mt==null||mt()},Ie=function(){Ke(!1),Wt==null||Wt()},et=X.useState(null),Kt=(0,Se.Z)(et,2),bt=Kt[0],Mt=Kt[1],Zt=function(gt,Ht){var pt=_e(Ht,gt.pageX);pt!==re&&(Mt(pt),le(null)),ti==null||ti(pt)},ii=function(gt){ae||(Mt(null),le(null),ti==null||ti(void 0)),gt&&(li==null||li(gt))},ei=function(gt,Ht){var pt=_e(Ht,gt.pageX),dt=!1;M&&(dt=pt===Q),ii(),Ae(dt?0:pt),le(dt?pt:null)},Ft=function(gt){var Ht=gt.keyCode,pt=Fe==="rtl",dt=D?.5:1;te&&(Ht===ce.Z.RIGHT&&Q<$e&&!pt?(Ae(Q+dt),gt.preventDefault()):Ht===ce.Z.LEFT&&Q>0&&!pt||Ht===ce.Z.RIGHT&&Q>0&&pt?(Ae(Q-dt),gt.preventDefault()):Ht===ce.Z.LEFT&&Q<$e&&pt&&(Ae(Q+dt),gt.preventDefault())),ht==null||ht(gt)};X.useEffect(function(){$t&&!ae&&ie()},[]);var ri=new Array($e).fill(0).map(function(ft,gt){return X.createElement(g,{ref:Re(gt),index:gt,count:$e,disabled:ae,prefixCls:"".concat(ne,"-star"),allowHalf:D,value:bt===null?Q:bt,onClick:ei,onHover:Zt,key:ft||gt,character:v,characterRender:Y,focused:Be})}),St=p()(ne,ee,(0,de.Z)((0,de.Z)({},"".concat(ne,"-disabled"),ae),"".concat(ne,"-rtl"),Fe==="rtl"));return X.createElement("ul",(0,U.Z)({className:St,onMouseLeave:ii,tabIndex:ae?-1:yt,onFocus:ae?null:lt,onBlur:ae?null:Ie,onKeyDown:ae?null:Ft,ref:Oe},(0,l.Z)(Ge,{aria:!0,data:!0,attr:!0})),ri)}var L=X.forwardRef(V),I=L},29301:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return J}});var U=K(72308),de=K(59301),Se=K(11592),he=K(48736),j=K(77321),p=K(62853),me=K(76846),ce=K(8654),l=de.createContext(null);function X(D){var F=D.children,M=D.onBatchResize,oe=de.useRef(0),te=de.useRef([]),S=de.useContext(l),v=de.useCallback(function(Y,ae,xe){oe.current+=1;var Fe=oe.current;te.current.push({size:Y,element:ae,data:xe}),Promise.resolve().then(function(){Fe===oe.current&&(M==null||M(te.current),te.current=[])}),S==null||S(Y,ae,xe)},[M,S]);return de.createElement(l.Provider,{value:v},F)}var P=K(76374),g=new Map;function _(D){D.forEach(function(F){var M,oe=F.target;(M=g.get(oe))===null||M===void 0||M.forEach(function(te){return te(oe)})})}var E=new P.Z(_),A=null,B=null;function H(D,F){g.has(D)||(g.set(D,new Set),E.observe(D)),g.get(D).add(F)}function V(D,F){g.has(D)&&(g.get(D).delete(F),g.get(D).size||(E.unobserve(D),g.delete(D)))}var L=K(96949),I=K(55090),w=K(77205),R=K(38793),q=function(D){(0,w.Z)(M,D);var F=(0,R.Z)(M);function M(){return(0,L.Z)(this,M),F.apply(this,arguments)}return(0,I.Z)(M,[{key:"render",value:function(){return this.props.children}}]),M}(de.Component);function ne(D,F){var M=D.children,oe=D.disabled,te=de.useRef(null),S=de.useRef(null),v=de.useContext(l),Y=typeof M=="function",ae=Y?M(te):M,xe=de.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Fe=!Y&&de.isValidElement(ae)&&(0,ce.Yr)(ae),Xe=Fe?(0,ce.C4)(ae):null,yt=(0,ce.x1)(Xe,te),$t=function(){var Wt;return(0,me.ZP)(te.current)||(te.current&&(0,p.Z)(te.current)==="object"?(0,me.ZP)((Wt=te.current)===null||Wt===void 0?void 0:Wt.nativeElement):null)||(0,me.ZP)(S.current)};de.useImperativeHandle(F,function(){return $t()});var ti=de.useRef(D);ti.current=D;var je=de.useCallback(function(mt){var Wt=ti.current,ht=Wt.onResize,li=Wt.data,Ge=mt.getBoundingClientRect(),ve=Ge.width,we=Ge.height,se=mt.offsetWidth,Re=mt.offsetHeight,Oe=Math.floor(ve),ie=Math.floor(we);if(xe.current.width!==Oe||xe.current.height!==ie||xe.current.offsetWidth!==se||xe.current.offsetHeight!==Re){var C={width:Oe,height:ie,offsetWidth:se,offsetHeight:Re};xe.current=C;var O=se===Math.round(ve)?ve:se,Q=Re===Math.round(we)?we:Re,z=(0,j.Z)((0,j.Z)({},C),{},{offsetWidth:O,offsetHeight:Q});v==null||v(z,mt,li),ht&&Promise.resolve().then(function(){ht(z,mt)})}},[]);return de.useEffect(function(){var mt=$t();return mt&&!oe&&H(mt,je),function(){return V(mt,je)}},[te.current,oe]),de.createElement(q,{ref:S},Fe?de.cloneElement(ae,{ref:yt}):ae)}var ee=de.forwardRef(ne),ye=ee,Le="rc-observer-key";function Te(D,F){var M=D.children,oe=typeof M=="function"?[M]:(0,Se.Z)(M);return oe.map(function(te,S){var v=(te==null?void 0:te.key)||"".concat(Le,"-").concat(S);return de.createElement(ye,(0,U.Z)({},D,{key:v,ref:S===0?F:void 0}),te)})}var $e=de.forwardRef(Te);$e.Collection=X;var J=$e},63158:function(Yt,st,K){"use strict";var U=K(72308),de=K(49618),Se=K(52487),he=K(74416),j=K(59301),p=K(92310),me=K.n(p),ce=K(18929),l=K(10228),X=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],P=j.forwardRef(function(g,_){var E,A=g.prefixCls,B=A===void 0?"rc-switch":A,H=g.className,V=g.checked,L=g.defaultChecked,I=g.disabled,w=g.loadingIcon,R=g.checkedChildren,q=g.unCheckedChildren,ne=g.onClick,ee=g.onChange,ye=g.onKeyDown,Le=(0,he.Z)(g,X),Te=(0,ce.Z)(!1,{value:V,defaultValue:L}),$e=(0,Se.Z)(Te,2),J=$e[0],D=$e[1];function F(S,v){var Y=J;return I||(Y=S,D(Y),ee==null||ee(Y,v)),Y}function M(S){S.which===l.Z.LEFT?F(!1,S):S.which===l.Z.RIGHT&&F(!0,S),ye==null||ye(S)}function oe(S){var v=F(!J,S);ne==null||ne(v,S)}var te=me()(B,H,(E={},(0,de.Z)(E,"".concat(B,"-checked"),J),(0,de.Z)(E,"".concat(B,"-disabled"),I),E));return j.createElement("button",(0,U.Z)({},Le,{type:"button",role:"switch","aria-checked":J,disabled:I,className:te,ref:_,onKeyDown:M,onClick:oe}),w,j.createElement("span",{className:"".concat(B,"-inner")},j.createElement("span",{className:"".concat(B,"-inner-checked")},R),j.createElement("span",{className:"".concat(B,"-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 V}});var U=K(92310),de=K.n(U),Se=K(59301);function he(L){var I=L.children,w=L.prefixCls,R=L.id,q=L.overlayInnerStyle,ne=L.bodyClassName,ee=L.className,ye=L.style;return Se.createElement("div",{className:de()("".concat(w,"-content"),ee),style:ye},Se.createElement("div",{className:de()("".concat(w,"-inner"),ne),id:R,role:"tooltip",style:q},typeof I=="function"?I():I))}var j=K(72308),p=K(77321),me=K(74416),ce=K(65352),l={shiftX:64,adjustY:1},X={adjustX:1,shiftY:!0},P=[0,0],g={left:{points:["cr","cl"],overflow:X,offset:[-4,0],targetOffset:P},right:{points:["cl","cr"],overflow:X,offset:[4,0],targetOffset:P},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:P},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:P},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:P},leftTop:{points:["tr","tl"],overflow:X,offset:[-4,0],targetOffset:P},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:P},rightTop:{points:["tl","tr"],overflow:X,offset:[4,0],targetOffset:P},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:P},rightBottom:{points:["bl","br"],overflow:X,offset:[4,0],targetOffset:P},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:P},leftBottom:{points:["br","bl"],overflow:X,offset:[-4,0],targetOffset:P}},_=null,E=K(80402),A=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],B=function(I,w){var R=I.overlayClassName,q=I.trigger,ne=q===void 0?["hover"]:q,ee=I.mouseEnterDelay,ye=ee===void 0?0:ee,Le=I.mouseLeaveDelay,Te=Le===void 0?.1:Le,$e=I.overlayStyle,J=I.prefixCls,D=J===void 0?"rc-tooltip":J,F=I.children,M=I.onVisibleChange,oe=I.afterVisibleChange,te=I.transitionName,S=I.animation,v=I.motion,Y=I.placement,ae=Y===void 0?"right":Y,xe=I.align,Fe=xe===void 0?{}:xe,Xe=I.destroyTooltipOnHide,yt=Xe===void 0?!1:Xe,$t=I.defaultVisible,ti=I.getTooltipContainer,je=I.overlayInnerStyle,mt=I.arrowContent,Wt=I.overlay,ht=I.id,li=I.showArrow,Ge=li===void 0?!0:li,ve=I.classNames,we=I.styles,se=(0,me.Z)(I,A),Re=(0,E.Z)(ht),Oe=(0,Se.useRef)(null);(0,Se.useImperativeHandle)(w,function(){return Oe.current});var ie=(0,p.Z)({},se);"visible"in I&&(ie.popupVisible=I.visible);var C=function(){return Se.createElement(he,{key:"content",prefixCls:D,id:Re,bodyClassName:ve==null?void 0:ve.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},je),we==null?void 0:we.body)},Wt)},O=function(){var z=Se.Children.only(F),N=(z==null?void 0:z.props)||{},Z=(0,p.Z)((0,p.Z)({},N),{},{"aria-describedby":Wt?Re:null});return Se.cloneElement(F,Z)};return Se.createElement(ce.Z,(0,j.Z)({popupClassName:de()(R,ve==null?void 0:ve.root),prefixCls:D,popup:C,action:ne,builtinPlacements:g,popupPlacement:ae,ref:Oe,popupAlign:Fe,getPopupContainer:ti,onPopupVisibleChange:M,afterPopupVisibleChange:oe,popupTransitionName:te,popupAnimation:S,popupMotion:v,defaultPopupVisible:$t,autoDestroy:yt,mouseLeaveDelay:Te,popupStyle:(0,p.Z)((0,p.Z)({},$e),we==null?void 0:we.root),mouseEnterDelay:ye,arrow:Ge},ie),O())},H=(0,Se.forwardRef)(B),V=H},639:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return I}});var U=K(72308),de=K(49618),Se=K(77321),he=K(52487),j=K(74416),p=K(59301),me=K(92310),ce=K.n(me),l=K(26112),X=K(30699),P=function(R){for(var q=R.prefixCls,ne=R.level,ee=R.isStart,ye=R.isEnd,Le="".concat(q,"-indent-unit"),Te=[],$e=0;$e<ne;$e+=1)Te.push(p.createElement("span",{key:$e,className:ce()(Le,(0,de.Z)((0,de.Z)({},"".concat(Le,"-start"),ee[$e]),"".concat(Le,"-end"),ye[$e]))}));return p.createElement("span",{"aria-hidden":"true",className:"".concat(q,"-indent")},Te)},g=p.memo(P),_=K(65065),E=K(34061),A=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],B="open",H="close",V="---",L=function(R){var q,ne,ee,ye=R.eventKey,Le=R.className,Te=R.style,$e=R.dragOver,J=R.dragOverGapTop,D=R.dragOverGapBottom,F=R.isLeaf,M=R.isStart,oe=R.isEnd,te=R.expanded,S=R.selected,v=R.checked,Y=R.halfChecked,ae=R.loading,xe=R.domRef,Fe=R.active,Xe=R.data,yt=R.onMouseMove,$t=R.selectable,ti=(0,j.Z)(R,A),je=p.useContext(X.k),mt=p.useContext(X.y),Wt=p.useRef(null),ht=p.useState(!1),li=(0,he.Z)(ht,2),Ge=li[0],ve=li[1],we=!!(je.disabled||R.disabled||(q=mt.nodeDisabled)!==null&&q!==void 0&&q.call(mt,Xe)),se=p.useMemo(function(){return!je.checkable||R.checkable===!1?!1:je.checkable},[je.checkable,R.checkable]),Re=function(vt){we||je.onNodeSelect(vt,(0,E.F)(R))},Oe=function(vt){we||!se||R.disableCheckbox||je.onNodeCheck(vt,(0,E.F)(R),!v)},ie=p.useMemo(function(){return typeof $t=="boolean"?$t:je.selectable},[$t,je.selectable]),C=function(vt){je.onNodeClick(vt,(0,E.F)(R)),ie?Re(vt):Oe(vt)},O=function(vt){je.onNodeDoubleClick(vt,(0,E.F)(R))},Q=function(vt){je.onNodeMouseEnter(vt,(0,E.F)(R))},z=function(vt){je.onNodeMouseLeave(vt,(0,E.F)(R))},N=function(vt){je.onNodeContextMenu(vt,(0,E.F)(R))},Z=p.useMemo(function(){return!!(je.draggable&&(!je.draggable.nodeDraggable||je.draggable.nodeDraggable(Xe)))},[je.draggable,Xe]),re=function(vt){vt.stopPropagation(),ve(!0),je.onNodeDragStart(vt,R);try{vt.dataTransfer.setData("text/plain","")}catch(Bt){}},le=function(vt){vt.preventDefault(),vt.stopPropagation(),je.onNodeDragEnter(vt,R)},_e=function(vt){vt.preventDefault(),vt.stopPropagation(),je.onNodeDragOver(vt,R)},Ae=function(vt){vt.stopPropagation(),je.onNodeDragLeave(vt,R)},We=function(vt){vt.stopPropagation(),ve(!1),je.onNodeDragEnd(vt,R)},He=function(vt){vt.preventDefault(),vt.stopPropagation(),ve(!1),je.onNodeDrop(vt,R)},Be=function(vt){ae||je.onNodeExpand(vt,(0,E.F)(R))},Ke=p.useMemo(function(){var dt=(0,_.Z)(je.keyEntities,ye)||{},vt=dt.children;return!!(vt||[]).length},[je.keyEntities,ye]),lt=p.useMemo(function(){return F===!1?!1:F||!je.loadData&&!Ke||je.loadData&&R.loaded&&!Ke},[F,je.loadData,Ke,R.loaded]);p.useEffect(function(){ae||typeof je.loadData=="function"&&te&&!lt&&!R.loaded&&je.onNodeLoad((0,E.F)(R))},[ae,je.loadData,je.onNodeLoad,te,lt,R]);var Ie=p.useMemo(function(){var dt;return(dt=je.draggable)!==null&&dt!==void 0&&dt.icon?p.createElement("span",{className:"".concat(je.prefixCls,"-draggable-icon")},je.draggable.icon):null},[je.draggable]),et=function(vt){var Bt=R.switcherIcon||je.switcherIcon;return typeof Bt=="function"?Bt((0,Se.Z)((0,Se.Z)({},R),{},{isLeaf:vt})):Bt},Kt=function(){if(lt){var vt=et(!0);return vt!==!1?p.createElement("span",{className:ce()("".concat(je.prefixCls,"-switcher"),"".concat(je.prefixCls,"-switcher-noop"))},vt):null}var Bt=et(!1);return Bt!==!1?p.createElement("span",{onClick:Be,className:ce()("".concat(je.prefixCls,"-switcher"),"".concat(je.prefixCls,"-switcher_").concat(te?B:H))},Bt):null},bt=p.useMemo(function(){if(!se)return null;var dt=typeof se!="boolean"?se:null;return p.createElement("span",{className:ce()("".concat(je.prefixCls,"-checkbox"),(0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(je.prefixCls,"-checkbox-checked"),v),"".concat(je.prefixCls,"-checkbox-indeterminate"),!v&&Y),"".concat(je.prefixCls,"-checkbox-disabled"),we||R.disableCheckbox)),onClick:Oe,role:"checkbox","aria-checked":Y?"mixed":v,"aria-disabled":we||R.disableCheckbox,"aria-label":"Select ".concat(typeof R.title=="string"?R.title:"tree node")},dt)},[se,v,Y,we,R.disableCheckbox,R.title]),Mt=p.useMemo(function(){return lt?null:te?B:H},[lt,te]),Zt=p.useMemo(function(){return p.createElement("span",{className:ce()("".concat(je.prefixCls,"-iconEle"),"".concat(je.prefixCls,"-icon__").concat(Mt||"docu"),(0,de.Z)({},"".concat(je.prefixCls,"-icon_loading"),ae))})},[je.prefixCls,Mt,ae]),ii=p.useMemo(function(){var dt=!!je.draggable,vt=!R.disabled&&dt&&je.dragOverNodeKey===ye;return vt?je.dropIndicatorRender({dropPosition:je.dropPosition,dropLevelOffset:je.dropLevelOffset,indent:je.indent,prefixCls:je.prefixCls,direction:je.direction}):null},[je.dropPosition,je.dropLevelOffset,je.indent,je.prefixCls,je.direction,je.draggable,je.dragOverNodeKey,je.dropIndicatorRender]),ei=p.useMemo(function(){var dt=R.title,vt=dt===void 0?V:dt,Bt="".concat(je.prefixCls,"-node-content-wrapper"),ai;if(je.showIcon){var xt=R.icon||je.icon;ai=xt?p.createElement("span",{className:ce()("".concat(je.prefixCls,"-iconEle"),"".concat(je.prefixCls,"-icon__customize"))},typeof xt=="function"?xt(R):xt):Zt}else je.loadData&&ae&&(ai=Zt);var Xt;return typeof vt=="function"?Xt=vt(Xe):je.titleRender?Xt=je.titleRender(Xe):Xt=vt,p.createElement("span",{ref:Wt,title:typeof vt=="string"?vt:"",className:ce()(Bt,"".concat(Bt,"-").concat(Mt||"normal"),(0,de.Z)({},"".concat(je.prefixCls,"-node-selected"),!we&&(S||Ge))),onMouseEnter:Q,onMouseLeave:z,onContextMenu:N,onClick:C,onDoubleClick:O},ai,p.createElement("span",{className:"".concat(je.prefixCls,"-title")},Xt),ii)},[je.prefixCls,je.showIcon,R,je.icon,Zt,je.titleRender,Xe,Mt,Q,z,N,C,O]),Ft=(0,l.Z)(ti,{aria:!0,data:!0}),ri=(0,_.Z)(je.keyEntities,ye)||{},St=ri.level,ft=oe[oe.length-1],gt=!we&&Z,Ht=je.draggingNodeKey===ye,pt=$t!==void 0?{"aria-selected":!!$t}:void 0;return p.createElement("div",(0,U.Z)({ref:xe,role:"treeitem","aria-expanded":F?void 0:te,className:ce()(Le,"".concat(je.prefixCls,"-treenode"),(ee={},(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)(ee,"".concat(je.prefixCls,"-treenode-disabled"),we),"".concat(je.prefixCls,"-treenode-switcher-").concat(te?"open":"close"),!F),"".concat(je.prefixCls,"-treenode-checkbox-checked"),v),"".concat(je.prefixCls,"-treenode-checkbox-indeterminate"),Y),"".concat(je.prefixCls,"-treenode-selected"),S),"".concat(je.prefixCls,"-treenode-loading"),ae),"".concat(je.prefixCls,"-treenode-active"),Fe),"".concat(je.prefixCls,"-treenode-leaf-last"),ft),"".concat(je.prefixCls,"-treenode-draggable"),Z),"dragging",Ht),(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)(ee,"drop-target",je.dropTargetKey===ye),"drop-container",je.dropContainerKey===ye),"drag-over",!we&&$e),"drag-over-gap-top",!we&&J),"drag-over-gap-bottom",!we&&D),"filter-node",(ne=je.filterTreeNode)===null||ne===void 0?void 0:ne.call(je,(0,E.F)(R))),"".concat(je.prefixCls,"-treenode-leaf"),lt))),style:Te,draggable:gt,onDragStart:gt?re:void 0,onDragEnter:Z?le:void 0,onDragOver:Z?_e:void 0,onDragLeave:Z?Ae:void 0,onDrop:Z?He:void 0,onDragEnd:Z?We:void 0,onMouseMove:yt},pt,Ft),p.createElement(g,{prefixCls:je.prefixCls,level:St,isStart:M,isEnd:oe}),Ie,Kt(),bt,ei)};L.isTreeNode=1;var I=L},30699:function(Yt,st,K){"use strict";K.d(st,{k:function(){return de},y:function(){return Se}});var U=K(59301),de=U.createContext(null),Se=U.createContext({})},15018:function(Yt,st,K){"use strict";K.d(st,{OF:function(){return ye.Z},y6:function(){return H.y},ZP:function(){return we}});var U=K(72308),de=K(62853),Se=K(77321),he=K(80702),j=K(96949),p=K(55090),me=K(80237),ce=K(77205),l=K(38793),X=K(49618),P=K(92310),g=K.n(P),_=K(10228),E=K(26112),A=K(48736),B=K(59301),H=K(30699),V=function(Re){var Oe=Re.dropPosition,ie=Re.dropLevelOffset,C=Re.indent,O={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(Oe){case-1:O.top=0,O.left=-ie*C;break;case 1:O.bottom=0,O.left=-ie*C;break;case 0:O.bottom=0,O.left=C;break}return B.createElement("div",{style:O})},L=V;function I(se){if(se==null)throw new TypeError("Cannot destructure "+se)}var w=K(52487),R=K(74416),q=K(34280),ne=K(45680),ee=K(77900),ye=K(639);function Le(se,Re){var Oe=B.useState(!1),ie=(0,w.Z)(Oe,2),C=ie[0],O=ie[1];(0,q.Z)(function(){if(C)return se(),function(){Re()}},[C]),(0,q.Z)(function(){return O(!0),function(){O(!1)}},[])}var Te=Le,$e=K(34061),J=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],D=B.forwardRef(function(se,Re){var Oe=se.className,ie=se.style,C=se.motion,O=se.motionNodes,Q=se.motionType,z=se.onMotionStart,N=se.onMotionEnd,Z=se.active,re=se.treeNodeRequiredProps,le=(0,R.Z)(se,J),_e=B.useState(!0),Ae=(0,w.Z)(_e,2),We=Ae[0],He=Ae[1],Be=B.useContext(H.k),Ke=Be.prefixCls,lt=O&&Q!=="hide";(0,q.Z)(function(){O&&lt!==We&&He(lt)},[O]);var Ie=function(){O&&z()},et=B.useRef(!1),Kt=function(){O&&!et.current&&(et.current=!0,N())};Te(Ie,Kt);var bt=function(Zt){lt===Zt&&Kt()};return O?B.createElement(ee.default,(0,U.Z)({ref:Re,visible:We},C,{motionAppear:Q==="show",onVisibleChanged:bt}),function(Mt,Zt){var ii=Mt.className,ei=Mt.style;return B.createElement("div",{ref:Zt,className:g()("".concat(Ke,"-treenode-motion"),ii),style:ei},O.map(function(Ft){var ri=Object.assign({},(I(Ft.data),Ft.data)),St=Ft.title,ft=Ft.key,gt=Ft.isStart,Ht=Ft.isEnd;delete ri.children;var pt=(0,$e.H8)(ft,re);return B.createElement(ye.Z,(0,U.Z)({},ri,pt,{title:St,active:Z,data:Ft.data,key:ft,isStart:gt,isEnd:Ht}))}))}):B.createElement(ye.Z,(0,U.Z)({domRef:Re,className:Oe,style:ie},le,{active:Z}))}),F=D;function M(){var se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Oe=se.length,ie=Re.length;if(Math.abs(Oe-ie)!==1)return{add:!1,key:null};function C(O,Q){var z=new Map;O.forEach(function(Z){z.set(Z,!0)});var N=Q.filter(function(Z){return!z.has(Z)});return N.length===1?N[0]:null}return Oe<ie?{add:!0,key:C(se,Re)}:{add:!1,key:C(Re,se)}}function oe(se,Re,Oe){var ie=se.findIndex(function(z){return z.key===Oe}),C=se[ie+1],O=Re.findIndex(function(z){return z.key===Oe});if(C){var Q=Re.findIndex(function(z){return z.key===C.key});return Re.slice(O+1,Q)}return Re.slice(O+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(){},Y="RC_TREE_MOTION_".concat(Math.random()),ae={key:Y},xe={key:Y,level:0,index:0,pos:"0",node:ae,nodes:[ae]},Fe={parent:null,children:[],pos:xe.pos,data:ae,title:null,key:Y,isStart:[],isEnd:[]};function Xe(se,Re,Oe,ie){return Re===!1||!Oe?se:se.slice(0,Math.ceil(Oe/ie)+1)}function yt(se){var Re=se.key,Oe=se.pos;return(0,$e.km)(Re,Oe)}function $t(se){for(var Re=String(se.data.key),Oe=se;Oe.parent;)Oe=Oe.parent,Re="".concat(Oe.data.key," > ").concat(Re);return Re}var ti=B.forwardRef(function(se,Re){var Oe=se.prefixCls,ie=se.data,C=se.selectable,O=se.checkable,Q=se.expandedKeys,z=se.selectedKeys,N=se.checkedKeys,Z=se.loadedKeys,re=se.loadingKeys,le=se.halfCheckedKeys,_e=se.keyEntities,Ae=se.disabled,We=se.dragging,He=se.dragOverNodeKey,Be=se.dropPosition,Ke=se.motion,lt=se.height,Ie=se.itemHeight,et=se.virtual,Kt=se.scrollWidth,bt=se.focusable,Mt=se.activeItem,Zt=se.focused,ii=se.tabIndex,ei=se.onKeyDown,Ft=se.onFocus,ri=se.onBlur,St=se.onActiveChange,ft=se.onListChangeStart,gt=se.onListChangeEnd,Ht=(0,R.Z)(se,te),pt=B.useRef(null),dt=B.useRef(null);B.useImperativeHandle(Re,function(){return{scrollTo:function(at){pt.current.scrollTo(at)},getIndentWidth:function(){return dt.current.offsetWidth}}});var vt=B.useState(Q),Bt=(0,w.Z)(vt,2),ai=Bt[0],xt=Bt[1],Xt=B.useState(ie),Lt=(0,w.Z)(Xt,2),Ne=Lt[0],h=Lt[1],m=B.useState(ie),y=(0,w.Z)(m,2),k=y[0],W=y[1],pe=B.useState([]),be=(0,w.Z)(pe,2),rt=be[0],ut=be[1],_t=B.useState(null),Ut=(0,w.Z)(_t,2),zt=Ut[0],Tt=Ut[1],Gt=B.useRef(ie);Gt.current=ie;function Pt(){var Ve=Gt.current;h(Ve),W(Ve),ut([]),Tt(null),gt()}(0,q.Z)(function(){xt(Q);var Ve=M(ai,Q);if(Ve.key!==null)if(Ve.add){var at=Ne.findIndex(function(Nt){var Ee=Nt.key;return Ee===Ve.key}),Vt=Xe(oe(Ne,ie,Ve.key),et,lt,Ie),Ct=Ne.slice();Ct.splice(at+1,0,Fe),W(Ct),ut(Vt),Tt("show")}else{var pi=ie.findIndex(function(Nt){var Ee=Nt.key;return Ee===Ve.key}),Dt=Xe(oe(ie,Ne,Ve.key),et,lt,Ie),Rt=ie.slice();Rt.splice(pi+1,0,Fe),W(Rt),ut(Dt),Tt("hide")}else Ne!==ie&&(h(ie),W(ie))},[Q,ie]),B.useEffect(function(){We||Pt()},[We]);var tt=Ke?k:ie,ze={expandedKeys:Q,selectedKeys:z,loadedKeys:Z,loadingKeys:re,checkedKeys:N,halfCheckedKeys:le,dragOverNodeKey:He,dropPosition:Be,keyEntities:_e};return B.createElement(B.Fragment,null,Zt&&Mt&&B.createElement("span",{style:S,"aria-live":"assertive"},$t(Mt)),B.createElement("div",null,B.createElement("input",{style:S,disabled:bt===!1||Ae,tabIndex:bt!==!1?ii:null,onKeyDown:ei,onFocus:Ft,onBlur:ri,value:"",onChange:v,"aria-label":"for screen reader"})),B.createElement("div",{className:"".concat(Oe,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},B.createElement("div",{className:"".concat(Oe,"-indent")},B.createElement("div",{ref:dt,className:"".concat(Oe,"-indent-unit")}))),B.createElement(ne.Z,(0,U.Z)({},Ht,{data:tt,itemKey:yt,height:lt,fullHeight:!1,virtual:et,itemHeight:Ie,scrollWidth:Kt,prefixCls:"".concat(Oe,"-list"),ref:pt,role:"tree",onVisibleChange:function(at){at.every(function(Vt){return yt(Vt)!==Y})&&Pt()}}),function(Ve){var at=Ve.pos,Vt=Object.assign({},(I(Ve.data),Ve.data)),Ct=Ve.title,pi=Ve.key,Dt=Ve.isStart,Rt=Ve.isEnd,Nt=(0,$e.km)(pi,at);delete Vt.key,delete Vt.children;var Ee=(0,$e.H8)(Nt,ze);return B.createElement(F,(0,U.Z)({},Vt,Ee,{title:Ct,active:!!Mt&&pi===Mt.key,pos:at,data:Ve.data,isStart:Dt,isEnd:Rt,motion:Ke,motionNodes:pi===Y?rt:null,motionType:zt,onMotionStart:ft,onMotionEnd:Pt,treeNodeRequiredProps:ze,onMouseMove:function(){St(null)}}))}))}),je=ti,mt=K(82661),Wt=K(34643),ht=K(65065),li=10,Ge=function(se){(0,ce.Z)(Oe,se);var Re=(0,l.Z)(Oe);function Oe(){var ie;(0,j.Z)(this,Oe);for(var C=arguments.length,O=new Array(C),Q=0;Q<C;Q++)O[Q]=arguments[Q];return ie=Re.call.apply(Re,[this].concat(O)),(0,X.Z)((0,me.Z)(ie),"destroyed",!1),(0,X.Z)((0,me.Z)(ie),"delayedDragEnterLogic",void 0),(0,X.Z)((0,me.Z)(ie),"loadingRetryTimes",{}),(0,X.Z)((0,me.Z)(ie),"state",{keyEntities:{},indent:null,selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null,fieldNames:(0,$e.w$)()}),(0,X.Z)((0,me.Z)(ie),"dragStartMousePosition",null),(0,X.Z)((0,me.Z)(ie),"dragNodeProps",null),(0,X.Z)((0,me.Z)(ie),"currentMouseOverDroppableNodeKey",null),(0,X.Z)((0,me.Z)(ie),"listRef",B.createRef()),(0,X.Z)((0,me.Z)(ie),"onNodeDragStart",function(z,N){var Z=ie.state,re=Z.expandedKeys,le=Z.keyEntities,_e=ie.props.onDragStart,Ae=N.eventKey;ie.dragNodeProps=N,ie.dragStartMousePosition={x:z.clientX,y:z.clientY};var We=(0,mt._5)(re,Ae);ie.setState({draggingNodeKey:Ae,dragChildrenKeys:(0,mt.wA)(Ae,le),indent:ie.listRef.current.getIndentWidth()}),ie.setExpandedKeys(We),window.addEventListener("dragend",ie.onWindowDragEnd),_e==null||_e({event:z,node:(0,$e.F)(N)})}),(0,X.Z)((0,me.Z)(ie),"onNodeDragEnter",function(z,N){var Z=ie.state,re=Z.expandedKeys,le=Z.keyEntities,_e=Z.dragChildrenKeys,Ae=Z.flattenNodes,We=Z.indent,He=ie.props,Be=He.onDragEnter,Ke=He.onExpand,lt=He.allowDrop,Ie=He.direction,et=N.pos,Kt=N.eventKey;if(ie.currentMouseOverDroppableNodeKey!==Kt&&(ie.currentMouseOverDroppableNodeKey=Kt),!ie.dragNodeProps){ie.resetDragState();return}var bt=(0,mt.OM)(z,ie.dragNodeProps,N,We,ie.dragStartMousePosition,lt,Ae,le,re,Ie),Mt=bt.dropPosition,Zt=bt.dropLevelOffset,ii=bt.dropTargetKey,ei=bt.dropContainerKey,Ft=bt.dropTargetPos,ri=bt.dropAllowed,St=bt.dragOverNodeKey;if(_e.includes(ii)||!ri){ie.resetDragState();return}if(ie.delayedDragEnterLogic||(ie.delayedDragEnterLogic={}),Object.keys(ie.delayedDragEnterLogic).forEach(function(ft){clearTimeout(ie.delayedDragEnterLogic[ft])}),ie.dragNodeProps.eventKey!==N.eventKey&&(z.persist(),ie.delayedDragEnterLogic[et]=window.setTimeout(function(){if(ie.state.draggingNodeKey!==null){var ft=(0,he.Z)(re),gt=(0,ht.Z)(le,N.eventKey);gt&&(gt.children||[]).length&&(ft=(0,mt.L0)(re,N.eventKey)),ie.props.hasOwnProperty("expandedKeys")||ie.setExpandedKeys(ft),Ke==null||Ke(ft,{node:(0,$e.F)(N),expanded:!0,nativeEvent:z.nativeEvent})}},800)),ie.dragNodeProps.eventKey===ii&&Zt===0){ie.resetDragState();return}ie.setState({dragOverNodeKey:St,dropPosition:Mt,dropLevelOffset:Zt,dropTargetKey:ii,dropContainerKey:ei,dropTargetPos:Ft,dropAllowed:ri}),Be==null||Be({event:z,node:(0,$e.F)(N),expandedKeys:re})}),(0,X.Z)((0,me.Z)(ie),"onNodeDragOver",function(z,N){var Z=ie.state,re=Z.dragChildrenKeys,le=Z.flattenNodes,_e=Z.keyEntities,Ae=Z.expandedKeys,We=Z.indent,He=ie.props,Be=He.onDragOver,Ke=He.allowDrop,lt=He.direction;if(ie.dragNodeProps){var Ie=(0,mt.OM)(z,ie.dragNodeProps,N,We,ie.dragStartMousePosition,Ke,le,_e,Ae,lt),et=Ie.dropPosition,Kt=Ie.dropLevelOffset,bt=Ie.dropTargetKey,Mt=Ie.dropContainerKey,Zt=Ie.dropTargetPos,ii=Ie.dropAllowed,ei=Ie.dragOverNodeKey;re.includes(bt)||!ii||(ie.dragNodeProps.eventKey===bt&&Kt===0?ie.state.dropPosition===null&&ie.state.dropLevelOffset===null&&ie.state.dropTargetKey===null&&ie.state.dropContainerKey===null&&ie.state.dropTargetPos===null&&ie.state.dropAllowed===!1&&ie.state.dragOverNodeKey===null||ie.resetDragState():et===ie.state.dropPosition&&Kt===ie.state.dropLevelOffset&&bt===ie.state.dropTargetKey&&Mt===ie.state.dropContainerKey&&Zt===ie.state.dropTargetPos&&ii===ie.state.dropAllowed&&ei===ie.state.dragOverNodeKey||ie.setState({dropPosition:et,dropLevelOffset:Kt,dropTargetKey:bt,dropContainerKey:Mt,dropTargetPos:Zt,dropAllowed:ii,dragOverNodeKey:ei}),Be==null||Be({event:z,node:(0,$e.F)(N)}))}}),(0,X.Z)((0,me.Z)(ie),"onNodeDragLeave",function(z,N){ie.currentMouseOverDroppableNodeKey===N.eventKey&&!z.currentTarget.contains(z.relatedTarget)&&(ie.resetDragState(),ie.currentMouseOverDroppableNodeKey=null);var Z=ie.props.onDragLeave;Z==null||Z({event:z,node:(0,$e.F)(N)})}),(0,X.Z)((0,me.Z)(ie),"onWindowDragEnd",function(z){ie.onNodeDragEnd(z,null,!0),window.removeEventListener("dragend",ie.onWindowDragEnd)}),(0,X.Z)((0,me.Z)(ie),"onNodeDragEnd",function(z,N){var Z=ie.props.onDragEnd;ie.setState({dragOverNodeKey:null}),ie.cleanDragState(),Z==null||Z({event:z,node:(0,$e.F)(N)}),ie.dragNodeProps=null,window.removeEventListener("dragend",ie.onWindowDragEnd)}),(0,X.Z)((0,me.Z)(ie),"onNodeDrop",function(z,N){var Z,re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,le=ie.state,_e=le.dragChildrenKeys,Ae=le.dropPosition,We=le.dropTargetKey,He=le.dropTargetPos,Be=le.dropAllowed;if(Be){var Ke=ie.props.onDrop;if(ie.setState({dragOverNodeKey:null}),ie.cleanDragState(),We!==null){var lt=(0,Se.Z)((0,Se.Z)({},(0,$e.H8)(We,ie.getTreeNodeRequiredProps())),{},{active:((Z=ie.getActiveItem())===null||Z===void 0?void 0:Z.key)===We,data:(0,ht.Z)(ie.state.keyEntities,We).node}),Ie=_e.includes(We);(0,A.ZP)(!Ie,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var et=(0,mt.yx)(He),Kt={event:z,node:(0,$e.F)(lt),dragNode:ie.dragNodeProps?(0,$e.F)(ie.dragNodeProps):null,dragNodesKeys:[ie.dragNodeProps.eventKey].concat(_e),dropToGap:Ae!==0,dropPosition:Ae+Number(et[et.length-1])};re||Ke==null||Ke(Kt),ie.dragNodeProps=null}}}),(0,X.Z)((0,me.Z)(ie),"cleanDragState",function(){var z=ie.state.draggingNodeKey;z!==null&&ie.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),ie.dragStartMousePosition=null,ie.currentMouseOverDroppableNodeKey=null}),(0,X.Z)((0,me.Z)(ie),"triggerExpandActionExpand",function(z,N){var Z=ie.state,re=Z.expandedKeys,le=Z.flattenNodes,_e=N.expanded,Ae=N.key,We=N.isLeaf;if(!(We||z.shiftKey||z.metaKey||z.ctrlKey)){var He=le.filter(function(Ke){return Ke.key===Ae})[0],Be=(0,$e.F)((0,Se.Z)((0,Se.Z)({},(0,$e.H8)(Ae,ie.getTreeNodeRequiredProps())),{},{data:He.data}));ie.setExpandedKeys(_e?(0,mt._5)(re,Ae):(0,mt.L0)(re,Ae)),ie.onNodeExpand(z,Be)}}),(0,X.Z)((0,me.Z)(ie),"onNodeClick",function(z,N){var Z=ie.props,re=Z.onClick,le=Z.expandAction;le==="click"&&ie.triggerExpandActionExpand(z,N),re==null||re(z,N)}),(0,X.Z)((0,me.Z)(ie),"onNodeDoubleClick",function(z,N){var Z=ie.props,re=Z.onDoubleClick,le=Z.expandAction;le==="doubleClick"&&ie.triggerExpandActionExpand(z,N),re==null||re(z,N)}),(0,X.Z)((0,me.Z)(ie),"onNodeSelect",function(z,N){var Z=ie.state.selectedKeys,re=ie.state,le=re.keyEntities,_e=re.fieldNames,Ae=ie.props,We=Ae.onSelect,He=Ae.multiple,Be=N.selected,Ke=N[_e.key],lt=!Be;lt?He?Z=(0,mt.L0)(Z,Ke):Z=[Ke]:Z=(0,mt._5)(Z,Ke);var Ie=Z.map(function(et){var Kt=(0,ht.Z)(le,et);return Kt?Kt.node:null}).filter(Boolean);ie.setUncontrolledState({selectedKeys:Z}),We==null||We(Z,{event:"select",selected:lt,node:N,selectedNodes:Ie,nativeEvent:z.nativeEvent})}),(0,X.Z)((0,me.Z)(ie),"onNodeCheck",function(z,N,Z){var re=ie.state,le=re.keyEntities,_e=re.checkedKeys,Ae=re.halfCheckedKeys,We=ie.props,He=We.checkStrictly,Be=We.onCheck,Ke=N.key,lt,Ie={event:"check",node:N,checked:Z,nativeEvent:z.nativeEvent};if(He){var et=Z?(0,mt.L0)(_e,Ke):(0,mt._5)(_e,Ke),Kt=(0,mt._5)(Ae,Ke);lt={checked:et,halfChecked:Kt},Ie.checkedNodes=et.map(function(Ft){return(0,ht.Z)(le,Ft)}).filter(Boolean).map(function(Ft){return Ft.node}),ie.setUncontrolledState({checkedKeys:et})}else{var bt=(0,Wt.S)([].concat((0,he.Z)(_e),[Ke]),!0,le),Mt=bt.checkedKeys,Zt=bt.halfCheckedKeys;if(!Z){var ii=new Set(Mt);ii.delete(Ke);var ei=(0,Wt.S)(Array.from(ii),{checked:!1,halfCheckedKeys:Zt},le);Mt=ei.checkedKeys,Zt=ei.halfCheckedKeys}lt=Mt,Ie.checkedNodes=[],Ie.checkedNodesPositions=[],Ie.halfCheckedKeys=Zt,Mt.forEach(function(Ft){var ri=(0,ht.Z)(le,Ft);if(ri){var St=ri.node,ft=ri.pos;Ie.checkedNodes.push(St),Ie.checkedNodesPositions.push({node:St,pos:ft})}}),ie.setUncontrolledState({checkedKeys:Mt},!1,{halfCheckedKeys:Zt})}Be==null||Be(lt,Ie)}),(0,X.Z)((0,me.Z)(ie),"onNodeLoad",function(z){var N,Z=z.key,re=ie.state.keyEntities,le=(0,ht.Z)(re,Z);if(!(le!=null&&(N=le.children)!==null&&N!==void 0&&N.length)){var _e=new Promise(function(Ae,We){ie.setState(function(He){var Be=He.loadedKeys,Ke=Be===void 0?[]:Be,lt=He.loadingKeys,Ie=lt===void 0?[]:lt,et=ie.props,Kt=et.loadData,bt=et.onLoad;if(!Kt||Ke.includes(Z)||Ie.includes(Z))return null;var Mt=Kt(z);return Mt.then(function(){var Zt=ie.state.loadedKeys,ii=(0,mt.L0)(Zt,Z);bt==null||bt(ii,{event:"load",node:z}),ie.setUncontrolledState({loadedKeys:ii}),ie.setState(function(ei){return{loadingKeys:(0,mt._5)(ei.loadingKeys,Z)}}),Ae()}).catch(function(Zt){if(ie.setState(function(ei){return{loadingKeys:(0,mt._5)(ei.loadingKeys,Z)}}),ie.loadingRetryTimes[Z]=(ie.loadingRetryTimes[Z]||0)+1,ie.loadingRetryTimes[Z]>=li){var ii=ie.state.loadedKeys;(0,A.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),ie.setUncontrolledState({loadedKeys:(0,mt.L0)(ii,Z)}),Ae()}We(Zt)}),{loadingKeys:(0,mt.L0)(Ie,Z)}})});return _e.catch(function(){}),_e}}),(0,X.Z)((0,me.Z)(ie),"onNodeMouseEnter",function(z,N){var Z=ie.props.onMouseEnter;Z==null||Z({event:z,node:N})}),(0,X.Z)((0,me.Z)(ie),"onNodeMouseLeave",function(z,N){var Z=ie.props.onMouseLeave;Z==null||Z({event:z,node:N})}),(0,X.Z)((0,me.Z)(ie),"onNodeContextMenu",function(z,N){var Z=ie.props.onRightClick;Z&&(z.preventDefault(),Z({event:z,node:N}))}),(0,X.Z)((0,me.Z)(ie),"onFocus",function(){var z=ie.props.onFocus;ie.setState({focused:!0});for(var N=arguments.length,Z=new Array(N),re=0;re<N;re++)Z[re]=arguments[re];z==null||z.apply(void 0,Z)}),(0,X.Z)((0,me.Z)(ie),"onBlur",function(){var z=ie.props.onBlur;ie.setState({focused:!1}),ie.onActiveChange(null);for(var N=arguments.length,Z=new Array(N),re=0;re<N;re++)Z[re]=arguments[re];z==null||z.apply(void 0,Z)}),(0,X.Z)((0,me.Z)(ie),"getTreeNodeRequiredProps",function(){var z=ie.state,N=z.expandedKeys,Z=z.selectedKeys,re=z.loadedKeys,le=z.loadingKeys,_e=z.checkedKeys,Ae=z.halfCheckedKeys,We=z.dragOverNodeKey,He=z.dropPosition,Be=z.keyEntities;return{expandedKeys:N||[],selectedKeys:Z||[],loadedKeys:re||[],loadingKeys:le||[],checkedKeys:_e||[],halfCheckedKeys:Ae||[],dragOverNodeKey:We,dropPosition:He,keyEntities:Be}}),(0,X.Z)((0,me.Z)(ie),"setExpandedKeys",function(z){var N=ie.state,Z=N.treeData,re=N.fieldNames,le=(0,$e.oH)(Z,z,re);ie.setUncontrolledState({expandedKeys:z,flattenNodes:le},!0)}),(0,X.Z)((0,me.Z)(ie),"onNodeExpand",function(z,N){var Z=ie.state.expandedKeys,re=ie.state,le=re.listChanging,_e=re.fieldNames,Ae=ie.props,We=Ae.onExpand,He=Ae.loadData,Be=N.expanded,Ke=N[_e.key];if(!le){var lt=Z.includes(Ke),Ie=!Be;if((0,A.ZP)(Be&&lt||!Be&&!lt,"Expand state not sync with index check"),Z=Ie?(0,mt.L0)(Z,Ke):(0,mt._5)(Z,Ke),ie.setExpandedKeys(Z),We==null||We(Z,{node:N,expanded:Ie,nativeEvent:z.nativeEvent}),Ie&&He){var et=ie.onNodeLoad(N);et&&et.then(function(){var Kt=(0,$e.oH)(ie.state.treeData,Z,_e);ie.setUncontrolledState({flattenNodes:Kt})}).catch(function(){var Kt=ie.state.expandedKeys,bt=(0,mt._5)(Kt,Ke);ie.setExpandedKeys(bt)})}}}),(0,X.Z)((0,me.Z)(ie),"onListChangeStart",function(){ie.setUncontrolledState({listChanging:!0})}),(0,X.Z)((0,me.Z)(ie),"onListChangeEnd",function(){setTimeout(function(){ie.setUncontrolledState({listChanging:!1})})}),(0,X.Z)((0,me.Z)(ie),"onActiveChange",function(z){var N=ie.state.activeKey,Z=ie.props,re=Z.onActiveChange,le=Z.itemScrollOffset,_e=le===void 0?0:le;N!==z&&(ie.setState({activeKey:z}),z!==null&&ie.scrollTo({key:z,offset:_e}),re==null||re(z))}),(0,X.Z)((0,me.Z)(ie),"getActiveItem",function(){var z=ie.state,N=z.activeKey,Z=z.flattenNodes;return N===null?null:Z.find(function(re){var le=re.key;return le===N})||null}),(0,X.Z)((0,me.Z)(ie),"offsetActiveKey",function(z){var N=ie.state,Z=N.flattenNodes,re=N.activeKey,le=Z.findIndex(function(We){var He=We.key;return He===re});le===-1&&z<0&&(le=Z.length),le=(le+z+Z.length)%Z.length;var _e=Z[le];if(_e){var Ae=_e.key;ie.onActiveChange(Ae)}else ie.onActiveChange(null)}),(0,X.Z)((0,me.Z)(ie),"onKeyDown",function(z){var N=ie.state,Z=N.activeKey,re=N.expandedKeys,le=N.checkedKeys,_e=N.fieldNames,Ae=ie.props,We=Ae.onKeyDown,He=Ae.checkable,Be=Ae.selectable;switch(z.which){case _.Z.UP:{ie.offsetActiveKey(-1),z.preventDefault();break}case _.Z.DOWN:{ie.offsetActiveKey(1),z.preventDefault();break}}var Ke=ie.getActiveItem();if(Ke&&Ke.data){var lt=ie.getTreeNodeRequiredProps(),Ie=Ke.data.isLeaf===!1||!!(Ke.data[_e.children]||[]).length,et=(0,$e.F)((0,Se.Z)((0,Se.Z)({},(0,$e.H8)(Z,lt)),{},{data:Ke.data,active:!0}));switch(z.which){case _.Z.LEFT:{Ie&&re.includes(Z)?ie.onNodeExpand({},et):Ke.parent&&ie.onActiveChange(Ke.parent.key),z.preventDefault();break}case _.Z.RIGHT:{Ie&&!re.includes(Z)?ie.onNodeExpand({},et):Ke.children&&Ke.children.length&&ie.onActiveChange(Ke.children[0].key),z.preventDefault();break}case _.Z.ENTER:case _.Z.SPACE:{He&&!et.disabled&&et.checkable!==!1&&!et.disableCheckbox?ie.onNodeCheck({},et,!le.includes(Z)):!He&&Be&&!et.disabled&&et.selectable!==!1&&ie.onNodeSelect({},et);break}}}We==null||We(z)}),(0,X.Z)((0,me.Z)(ie),"setUncontrolledState",function(z){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!ie.destroyed){var re=!1,le=!0,_e={};Object.keys(z).forEach(function(Ae){if(ie.props.hasOwnProperty(Ae)){le=!1;return}re=!0,_e[Ae]=z[Ae]}),re&&(!N||le)&&ie.setState((0,Se.Z)((0,Se.Z)({},_e),Z))}}),(0,X.Z)((0,me.Z)(ie),"scrollTo",function(z){ie.listRef.current.scrollTo(z)}),ie}return(0,p.Z)(Oe,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var C=this.props,O=C.activeKey,Q=C.itemScrollOffset,z=Q===void 0?0:Q;O!==void 0&&O!==this.state.activeKey&&(this.setState({activeKey:O}),O!==null&&this.scrollTo({key:O,offset:z}))}},{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 C=this.state,O=C.focused,Q=C.flattenNodes,z=C.keyEntities,N=C.draggingNodeKey,Z=C.activeKey,re=C.dropLevelOffset,le=C.dropContainerKey,_e=C.dropTargetKey,Ae=C.dropPosition,We=C.dragOverNodeKey,He=C.indent,Be=this.props,Ke=Be.prefixCls,lt=Be.className,Ie=Be.style,et=Be.showLine,Kt=Be.focusable,bt=Be.tabIndex,Mt=bt===void 0?0:bt,Zt=Be.selectable,ii=Be.showIcon,ei=Be.icon,Ft=Be.switcherIcon,ri=Be.draggable,St=Be.checkable,ft=Be.checkStrictly,gt=Be.disabled,Ht=Be.motion,pt=Be.loadData,dt=Be.filterTreeNode,vt=Be.height,Bt=Be.itemHeight,ai=Be.scrollWidth,xt=Be.virtual,Xt=Be.titleRender,Lt=Be.dropIndicatorRender,Ne=Be.onContextMenu,h=Be.onScroll,m=Be.direction,y=Be.rootClassName,k=Be.rootStyle,W=(0,E.Z)(this.props,{aria:!0,data:!0}),pe;ri&&((0,de.Z)(ri)==="object"?pe=ri:typeof ri=="function"?pe={nodeDraggable:ri}:pe={});var be={prefixCls:Ke,selectable:Zt,showIcon:ii,icon:ei,switcherIcon:Ft,draggable:pe,draggingNodeKey:N,checkable:St,checkStrictly:ft,disabled:gt,keyEntities:z,dropLevelOffset:re,dropContainerKey:le,dropTargetKey:_e,dropPosition:Ae,dragOverNodeKey:We,indent:He,direction:m,dropIndicatorRender:Lt,loadData:pt,filterTreeNode:dt,titleRender:Xt,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 B.createElement(H.k.Provider,{value:be},B.createElement("div",{className:g()(Ke,lt,y,(0,X.Z)((0,X.Z)((0,X.Z)({},"".concat(Ke,"-show-line"),et),"".concat(Ke,"-focused"),O),"".concat(Ke,"-active-focused"),Z!==null)),style:k},B.createElement(je,(0,U.Z)({ref:this.listRef,prefixCls:Ke,style:Ie,data:Q,disabled:gt,selectable:Zt,checkable:!!St,motion:Ht,dragging:N!==null,height:vt,itemHeight:Bt,virtual:xt,focusable:Kt,focused:O,tabIndex:Mt,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:Ne,onScroll:h,scrollWidth:ai},this.getTreeNodeRequiredProps(),W))))}}],[{key:"getDerivedStateFromProps",value:function(C,O){var Q=O.prevProps,z={prevProps:C};function N(Mt){return!Q&&C.hasOwnProperty(Mt)||Q&&Q[Mt]!==C[Mt]}var Z,re=O.fieldNames;if(N("fieldNames")&&(re=(0,$e.w$)(C.fieldNames),z.fieldNames=re),N("treeData")?Z=C.treeData:N("children")&&((0,A.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Z=(0,$e.zn)(C.children)),Z){z.treeData=Z;var le=(0,$e.I8)(Z,{fieldNames:re});z.keyEntities=(0,Se.Z)((0,X.Z)({},Y,xe),le.keyEntities)}var _e=z.keyEntities||O.keyEntities;if(N("expandedKeys")||Q&&N("autoExpandParent"))z.expandedKeys=C.autoExpandParent||!Q&&C.defaultExpandParent?(0,mt.r7)(C.expandedKeys,_e):C.expandedKeys;else if(!Q&&C.defaultExpandAll){var Ae=(0,Se.Z)({},_e);delete Ae[Y];var We=[];Object.keys(Ae).forEach(function(Mt){var Zt=Ae[Mt];Zt.children&&Zt.children.length&&We.push(Zt.key)}),z.expandedKeys=We}else!Q&&C.defaultExpandedKeys&&(z.expandedKeys=C.autoExpandParent||C.defaultExpandParent?(0,mt.r7)(C.defaultExpandedKeys,_e):C.defaultExpandedKeys);if(z.expandedKeys||delete z.expandedKeys,Z||z.expandedKeys){var He=(0,$e.oH)(Z||O.treeData,z.expandedKeys||O.expandedKeys,re);z.flattenNodes=He}if(C.selectable&&(N("selectedKeys")?z.selectedKeys=(0,mt.BT)(C.selectedKeys,C):!Q&&C.defaultSelectedKeys&&(z.selectedKeys=(0,mt.BT)(C.defaultSelectedKeys,C))),C.checkable){var Be;if(N("checkedKeys")?Be=(0,mt.E6)(C.checkedKeys)||{}:!Q&&C.defaultCheckedKeys?Be=(0,mt.E6)(C.defaultCheckedKeys)||{}:Z&&(Be=(0,mt.E6)(C.checkedKeys)||{checkedKeys:O.checkedKeys,halfCheckedKeys:O.halfCheckedKeys}),Be){var Ke=Be,lt=Ke.checkedKeys,Ie=lt===void 0?[]:lt,et=Ke.halfCheckedKeys,Kt=et===void 0?[]:et;if(!C.checkStrictly){var bt=(0,Wt.S)(Ie,!0,_e);Ie=bt.checkedKeys,Kt=bt.halfCheckedKeys}z.checkedKeys=Ie,z.halfCheckedKeys=Kt}}return N("loadedKeys")&&(z.loadedKeys=C.loadedKeys),z}}]),Oe}(B.Component);(0,X.Z)(Ge,"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)(Ge,"TreeNode",ye.Z);var ve=Ge,we=ve},82661:function(Yt,st,K){"use strict";K.d(st,{BT:function(){return B},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 U=K(80702),de=K(62853),Se=K(48736),he=K(59301),j=K(639),p=K(65065),me=K(34061),ce=null;function l(w,R){if(!w)return[];var q=w.slice(),ne=q.indexOf(R);return ne>=0&&q.splice(ne,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=[],ne=(0,p.Z)(R,w);function ee(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];ye.forEach(function(Le){var Te=Le.key,$e=Le.children;q.push(Te),ee($e)})}return ee(ne.children),q}function _(w){if(w.parent){var R=P(w.pos);return Number(R[R.length-1])===w.parent.children.length-1}return!1}function E(w){var R=P(w.pos);return Number(R[R.length-1])===0}function A(w,R,q,ne,ee,ye,Le,Te,$e,J){var D,F=w.clientX,M=w.clientY,oe=w.target.getBoundingClientRect(),te=oe.top,S=oe.height,v=(J==="rtl"?-1:1)*(((ee==null?void 0:ee.x)||0)-F),Y=(v-12)/ne,ae=$e.filter(function(we){var se;return(se=Te[we])===null||se===void 0||(se=se.children)===null||se===void 0?void 0:se.length}),xe=(0,p.Z)(Te,q.eventKey);if(M<te+S/2){var Fe=Le.findIndex(function(we){return we.key===xe.key}),Xe=Fe<=0?0:Fe-1,yt=Le[Xe].key;xe=(0,p.Z)(Te,yt)}var $t=xe.key,ti=xe,je=xe.key,mt=0,Wt=0;if(!ae.includes($t))for(var ht=0;ht<Y&&_(xe);ht+=1)xe=xe.parent,Wt+=1;var li=R.data,Ge=xe.node,ve=!0;return E(xe)&&xe.level===0&&M<te+S/2&&ye({dragNode:li,dropNode:Ge,dropPosition:-1})&&xe.key===q.eventKey?mt=-1:(ti.children||[]).length&&ae.includes(je)?ye({dragNode:li,dropNode:Ge,dropPosition:0})?mt=0:ve=!1:Wt===0?Y>-1.5?ye({dragNode:li,dropNode:Ge,dropPosition:1})?mt=1:ve=!1:ye({dragNode:li,dropNode:Ge,dropPosition:0})?mt=0:ye({dragNode:li,dropNode:Ge,dropPosition:1})?mt=1:ve=!1:ye({dragNode:li,dropNode:Ge,dropPosition:1})?mt=1:ve=!1,{dropPosition:mt,dropLevelOffset:Wt,dropTargetKey:xe.key,dropTargetPos:xe.pos,dragOverNodeKey:je,dropContainerKey:mt===0?null:((D=xe.parent)===null||D===void 0?void 0:D.key)||null,dropAllowed:ve}}function B(w,R){if(w){var q=R.multiple;return q?w.slice():w.length?[w[0]]:w}}var H=function(R){return R};function V(w,R){if(!w)return[];var q=R||{},ne=q.processProps,ee=ne===void 0?H:ne,ye=Array.isArray(w)?w:[w];return ye.map(function(Le){var Te=Le.children,$e=_objectWithoutProperties(Le,ce),J=V(Te,R);return React.createElement(TreeNode,_extends({key:$e.key},ee($e)),J)})}function L(w){if(!w)return null;var R;if(Array.isArray(w))R={checkedKeys:w,halfCheckedKeys:void 0};else if((0,de.Z)(w)==="object")R={checkedKeys:w.checked||void 0,halfCheckedKeys:w.halfChecked||void 0};else return(0,Se.ZP)(!1,"`checkedKeys` is not an array or an object"),null;return R}function I(w,R){var q=new Set;function ne(ee){if(!q.has(ee)){var ye=(0,p.Z)(R,ee);if(ye){q.add(ee);var Le=ye.parent,Te=ye.node;Te.disabled||Le&&ne(Le.key)}}}return(w||[]).forEach(function(ee){ne(ee)}),(0,U.Z)(q)}},34643:function(Yt,st,K){"use strict";K.d(st,{S:function(){return me}});var U=K(48736),de=K(65065);function Se(ce,l){var X=new Set;return ce.forEach(function(P){l.has(P)||X.add(P)}),X}function he(ce){var l=ce||{},X=l.disabled,P=l.disableCheckbox,g=l.checkable;return!!(X||P)||g===!1}function j(ce,l,X,P){for(var g=new Set(ce),_=new Set,E=0;E<=X;E+=1){var A=l.get(E)||new Set;A.forEach(function(L){var I=L.key,w=L.node,R=L.children,q=R===void 0?[]:R;g.has(I)&&!P(w)&&q.filter(function(ne){return!P(ne.node)}).forEach(function(ne){g.add(ne.key)})})}for(var B=new Set,H=X;H>=0;H-=1){var V=l.get(H)||new Set;V.forEach(function(L){var I=L.parent,w=L.node;if(!(P(w)||!L.parent||B.has(L.parent.key))){if(P(L.parent.node)){B.add(I.key);return}var R=!0,q=!1;(I.children||[]).filter(function(ne){return!P(ne.node)}).forEach(function(ne){var ee=ne.key,ye=g.has(ee);R&&!ye&&(R=!1),!q&&(ye||_.has(ee))&&(q=!0)}),R&&g.add(I.key),q&&_.add(I.key),B.add(I.key)}})}return{checkedKeys:Array.from(g),halfCheckedKeys:Array.from(Se(_,g))}}function p(ce,l,X,P,g){for(var _=new Set(ce),E=new Set(l),A=0;A<=P;A+=1){var B=X.get(A)||new Set;B.forEach(function(I){var w=I.key,R=I.node,q=I.children,ne=q===void 0?[]:q;!_.has(w)&&!E.has(w)&&!g(R)&&ne.filter(function(ee){return!g(ee.node)}).forEach(function(ee){_.delete(ee.key)})})}E=new Set;for(var H=new Set,V=P;V>=0;V-=1){var L=X.get(V)||new Set;L.forEach(function(I){var w=I.parent,R=I.node;if(!(g(R)||!I.parent||H.has(I.parent.key))){if(g(I.parent.node)){H.add(w.key);return}var q=!0,ne=!1;(w.children||[]).filter(function(ee){return!g(ee.node)}).forEach(function(ee){var ye=ee.key,Le=_.has(ye);q&&!Le&&(q=!1),!ne&&(Le||E.has(ye))&&(ne=!0)}),q||_.delete(w.key),ne&&E.add(w.key),H.add(w.key)}})}return{checkedKeys:Array.from(_),halfCheckedKeys:Array.from(Se(E,_))}}function me(ce,l,X,P){var g=[],_;P?_=P:_=he;var E=new Set(ce.filter(function(V){var L=!!(0,de.Z)(X,V);return L||g.push(V),L})),A=new Map,B=0;Object.keys(X).forEach(function(V){var L=X[V],I=L.level,w=A.get(I);w||(w=new Set,A.set(I,w)),w.add(L),B=Math.max(B,I)}),(0,U.ZP)(!g.length,"Tree missing follow keys: ".concat(g.slice(0,100).map(function(V){return"'".concat(V,"'")}).join(", ")));var H;return l===!0?H=j(E,A,B,_):H=p(E,l.halfCheckedKeys,A,B,_),H}},65065:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return U}});function U(de,Se){return de[Se]}},34061:function(Yt,st,K){"use strict";K.d(st,{F:function(){return I},H8:function(){return L},I8:function(){return V},km:function(){return g},oH:function(){return B},w$:function(){return _},zn:function(){return A}});var U=K(62853),de=K(80702),Se=K(77321),he=K(74416),j=K(11592),p=K(2738),me=K(48736),ce=K(65065),l=["children"];function X(w,R){return"".concat(w,"-").concat(R)}function P(w){return w&&w.type&&w.type.isTreeNode}function g(w,R){return w!=null?w:R}function _(w){var R=w||{},q=R.title,ne=R._title,ee=R.key,ye=R.children,Le=q||"title";return{title:Le,_title:ne||[Le],key:ee||"key",children:ye||"children"}}function E(w,R){var q=new Map;function ne(ee){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(ee||[]).forEach(function(Le){var Te=Le[R.key],$e=Le[R.children];warning(Te!=null,"Tree node must have a certain key: [".concat(ye).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),ne($e,"".concat(ye).concat(J," > "))})}ne(w)}function A(w){function R(q){var ne=(0,j.Z)(q);return ne.map(function(ee){if(!P(ee))return(0,me.ZP)(!ee,"Tree/TreeNode can only accept TreeNode as children."),null;var ye=ee.key,Le=ee.props,Te=Le.children,$e=(0,he.Z)(Le,l),J=(0,Se.Z)({key:ye},$e),D=R(Te);return D.length&&(J.children=D),J}).filter(function(ee){return ee})}return R(w)}function B(w,R,q){var ne=_(q),ee=ne._title,ye=ne.key,Le=ne.children,Te=new Set(R===!0?[]:R),$e=[];function J(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return D.map(function(M,oe){for(var te=X(F?F.pos:"0",oe),S=g(M[ye],te),v,Y=0;Y<ee.length;Y+=1){var ae=ee[Y];if(M[ae]!==void 0){v=M[ae];break}}var xe=Object.assign((0,p.Z)(M,[].concat((0,de.Z)(ee),[ye,Le])),{title:v,key:S,parent:F,pos:te,children:null,data:M,isStart:[].concat((0,de.Z)(F?F.isStart:[]),[oe===0]),isEnd:[].concat((0,de.Z)(F?F.isEnd:[]),[oe===D.length-1])});return $e.push(xe),R===!0||Te.has(S)?xe.children=J(M[Le]||[],xe):xe.children=[],xe})}return J(w),$e}function H(w,R,q){var ne={};(0,U.Z)(q)==="object"?ne=q:ne={externalGetKey:q},ne=ne||{};var ee=ne,ye=ee.childrenPropName,Le=ee.externalGetKey,Te=ee.fieldNames,$e=_(Te),J=$e.key,D=$e.children,F=ye||D,M;Le?typeof Le=="string"?M=function(S){return S[Le]}:typeof Le=="function"&&(M=function(S){return Le(S)}):M=function(S,v){return g(S[J],v)};function oe(te,S,v,Y){var ae=te?te[F]:w,xe=te?X(v.pos,S):"0",Fe=te?[].concat((0,de.Z)(Y),[te]):[];if(te){var Xe=M(te,xe),yt={node:te,index:S,pos:xe,key:Xe,parentPos:v.node?v.pos:null,level:v.level+1,nodes:Fe};R(yt)}ae&&ae.forEach(function($t,ti){oe($t,ti,{node:te,pos:xe,level:v?v.level+1:-1},Fe)})}oe(null)}function V(w){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=R.initWrapper,ne=R.processEntity,ee=R.onProcessFinished,ye=R.externalGetKey,Le=R.childrenPropName,Te=R.fieldNames,$e=arguments.length>2?arguments[2]:void 0,J=ye||$e,D={},F={},M={posEntities:D,keyEntities:F};return q&&(M=q(M)||M),H(w,function(oe){var te=oe.node,S=oe.index,v=oe.pos,Y=oe.key,ae=oe.parentPos,xe=oe.level,Fe=oe.nodes,Xe={node:te,nodes:Fe,index:S,key:Y,pos:v,level:xe},yt=g(Y,v);D[v]=Xe,F[yt]=Xe,Xe.parent=D[ae],Xe.parent&&(Xe.parent.children=Xe.parent.children||[],Xe.parent.children.push(Xe)),ne&&ne(Xe,M)},{externalGetKey:J,childrenPropName:Le,fieldNames:Te}),ee&&ee(M),M}function L(w,R){var q=R.expandedKeys,ne=R.selectedKeys,ee=R.loadedKeys,ye=R.loadingKeys,Le=R.checkedKeys,Te=R.halfCheckedKeys,$e=R.dragOverNodeKey,J=R.dropPosition,D=R.keyEntities,F=(0,ce.Z)(D,w),M={eventKey:w,expanded:q.indexOf(w)!==-1,selected:ne.indexOf(w)!==-1,loaded:ee.indexOf(w)!==-1,loading:ye.indexOf(w)!==-1,checked:Le.indexOf(w)!==-1,halfChecked:Te.indexOf(w)!==-1,pos:String(F?F.pos:""),dragOver:$e===w&&J===0,dragOverGapTop:$e===w&&J===-1,dragOverGapBottom:$e===w&&J===1};return M}function I(w){var R=w.data,q=w.expanded,ne=w.selected,ee=w.checked,ye=w.loaded,Le=w.loading,Te=w.halfChecked,$e=w.dragOver,J=w.dragOverGapTop,D=w.dragOverGapBottom,F=w.pos,M=w.active,oe=w.eventKey,te=(0,Se.Z)((0,Se.Z)({},R),{},{expanded:q,selected:ne,checked:ee,loaded:ye,loading:Le,halfChecked:Te,dragOver:$e,dragOverGapTop:J,dragOverGapBottom:D,pos:F,active:M,key:oe});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))}},45680:function(Yt,st,K){"use strict";K.d(st,{Z:function(){return li}});var U=K(72308),de=K(62853),Se=K(77321),he=K(49618),j=K(52487),p=K(74416),me=K(92310),ce=K.n(me),l=K(29301),X=K(70425),P=K(34280),g=K(59301),_=K(4676),E=g.forwardRef(function(Ge,ve){var we=Ge.height,se=Ge.offsetY,Re=Ge.offsetX,Oe=Ge.children,ie=Ge.prefixCls,C=Ge.onInnerResize,O=Ge.innerProps,Q=Ge.rtl,z=Ge.extra,N={},Z={display:"flex",flexDirection:"column"};return se!==void 0&&(N={height:we,position:"relative",overflow:"hidden"},Z=(0,Se.Z)((0,Se.Z)({},Z),{},(0,he.Z)((0,he.Z)((0,he.Z)((0,he.Z)((0,he.Z)({transform:"translateY(".concat(se,"px)")},Q?"marginRight":"marginLeft",-Re),"position","absolute"),"left",0),"right",0),"top",0))),g.createElement("div",{style:N},g.createElement(l.Z,{onResize:function(le){var _e=le.offsetHeight;_e&&C&&C()}},g.createElement("div",(0,U.Z)({style:Z,className:ce()((0,he.Z)({},"".concat(ie,"-holder-inner"),ie)),ref:ve},O),Oe,z)))});E.displayName="Filler";var A=E;function B(Ge){var ve=Ge.children,we=Ge.setRef,se=g.useCallback(function(Re){we(Re)},[]);return g.cloneElement(ve,{ref:se})}function H(Ge,ve,we,se,Re,Oe,ie,C){var O=C.getKey;return Ge.slice(ve,we+1).map(function(Q,z){var N=ve+z,Z=ie(Q,N,{style:{width:se},offsetX:Re}),re=O(Q);return g.createElement(B,{key:re,setRef:function(_e){return Oe(Q,_e)}},Z)})}function V(Ge,ve,we,se){var Re=we-Ge,Oe=ve-we,ie=Math.min(Re,Oe)*2;if(se<=ie){var C=Math.floor(se/2);return se%2?we+C+1:we-C}return Re>Oe?we-(se-Oe):we+(se-Re)}function L(Ge,ve,we){var se=Ge.length,Re=ve.length,Oe,ie;if(se===0&&Re===0)return null;se<Re?(Oe=Ge,ie=ve):(Oe=ve,ie=Ge);var C={__EMPTY_ITEM__:!0};function O(le){return le!==void 0?we(le):C}for(var Q=null,z=Math.abs(se-Re)!==1,N=0;N<ie.length;N+=1){var Z=O(Oe[N]),re=O(ie[N]);if(Z!==re){Q=N,z=z||Z!==O(ie[N+1]);break}}return Q===null?null:{index:Q,multiple:z}}function I(Ge,ve,we){var se=g.useState(Ge),Re=(0,j.Z)(se,2),Oe=Re[0],ie=Re[1],C=g.useState(null),O=(0,j.Z)(C,2),Q=O[0],z=O[1];return g.useEffect(function(){var N=L(Oe||[],Ge||[],ve);(N==null?void 0:N.index)!==void 0&&(we==null||we(N.index),z(Ge[N.index])),ie(Ge)},[Ge]),[Q]}var w=K(16089),R=(typeof navigator=="undefined"?"undefined":(0,de.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),q=R,ne=function(Ge,ve,we,se){var Re=(0,g.useRef)(!1),Oe=(0,g.useRef)(null);function ie(){clearTimeout(Oe.current),Re.current=!0,Oe.current=setTimeout(function(){Re.current=!1},50)}var C=(0,g.useRef)({top:Ge,bottom:ve,left:we,right:se});return C.current.top=Ge,C.current.bottom=ve,C.current.left=we,C.current.right=se,function(O,Q){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,N=O?Q<0&&C.current.left||Q>0&&C.current.right:Q<0&&C.current.top||Q>0&&C.current.bottom;return z&&N?(clearTimeout(Oe.current),Re.current=!1):(!N||Re.current)&&ie(),!Re.current&&N}};function ee(Ge,ve,we,se,Re,Oe,ie){var C=(0,g.useRef)(0),O=(0,g.useRef)(null),Q=(0,g.useRef)(null),z=(0,g.useRef)(!1),N=ne(ve,we,se,Re);function Z(He,Be){if(w.Z.cancel(O.current),!N(!1,Be)){var Ke=He;if(!Ke._virtualHandled)Ke._virtualHandled=!0;else return;C.current+=Be,Q.current=Be,q||Ke.preventDefault(),O.current=(0,w.Z)(function(){var lt=z.current?10:1;ie(C.current*lt,!1),C.current=0})}}function re(He,Be){ie(Be,!0),q||He.preventDefault()}var le=(0,g.useRef)(null),_e=(0,g.useRef)(null);function Ae(He){if(Ge){w.Z.cancel(_e.current),_e.current=(0,w.Z)(function(){le.current=null},2);var Be=He.deltaX,Ke=He.deltaY,lt=He.shiftKey,Ie=Be,et=Ke;(le.current==="sx"||!le.current&&lt&&Ke&&!Be)&&(Ie=Ke,et=0,le.current="sx");var Kt=Math.abs(Ie),bt=Math.abs(et);le.current===null&&(le.current=Oe&&Kt>bt?"x":"y"),le.current==="y"?Z(He,et):re(He,Ie)}}function We(He){Ge&&(z.current=He.detail===Q.current)}return[Ae,We]}function ye(Ge,ve,we,se){var Re=g.useMemo(function(){return[new Map,[]]},[Ge,we.id,se]),Oe=(0,j.Z)(Re,2),ie=Oe[0],C=Oe[1],O=function(z){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:z,Z=ie.get(z),re=ie.get(N);if(Z===void 0||re===void 0)for(var le=Ge.length,_e=C.length;_e<le;_e+=1){var Ae,We=Ge[_e],He=ve(We);ie.set(He,_e);var Be=(Ae=we.get(He))!==null&&Ae!==void 0?Ae:se;if(C[_e]=(C[_e-1]||0)+Be,He===z&&(Z=_e),He===N&&(re=_e),Z!==void 0&&re!==void 0)break}return{top:C[Z-1]||0,bottom:C[re]}};return O}var Le=K(96949),Te=K(55090),$e=function(){function Ge(){(0,Le.Z)(this,Ge),(0,he.Z)(this,"maps",void 0),(0,he.Z)(this,"id",0),(0,he.Z)(this,"diffKeys",new Set),this.maps=Object.create(null)}return(0,Te.Z)(Ge,[{key:"set",value:function(we,se){this.maps[we]=se,this.id+=1,this.diffKeys.add(we)}},{key:"get",value:function(we){return this.maps[we]}},{key:"resetRecord",value:function(){this.diffKeys.clear()}},{key:"getRecord",value:function(){return this.diffKeys}}]),Ge}(),J=$e;function D(Ge){var ve=parseFloat(Ge);return isNaN(ve)?0:ve}function F(Ge,ve,we){var se=g.useState(0),Re=(0,j.Z)(se,2),Oe=Re[0],ie=Re[1],C=(0,g.useRef)(new Map),O=(0,g.useRef)(new J),Q=(0,g.useRef)(0);function z(){Q.current+=1}function N(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;z();var le=function(){var We=!1;C.current.forEach(function(He,Be){if(He&&He.offsetParent){var Ke=He.offsetHeight,lt=getComputedStyle(He),Ie=lt.marginTop,et=lt.marginBottom,Kt=D(Ie),bt=D(et),Mt=Ke+Kt+bt;O.current.get(Be)!==Mt&&(O.current.set(Be,Mt),We=!0)}}),We&&ie(function(He){return He+1})};if(re)le();else{Q.current+=1;var _e=Q.current;Promise.resolve().then(function(){_e===Q.current&&le()})}}function Z(re,le){var _e=Ge(re),Ae=C.current.get(_e);le?(C.current.set(_e,le),N()):C.current.delete(_e),!Ae!=!le&&(le?ve==null||ve(re):we==null||we(re))}return(0,g.useEffect)(function(){return z},[]),[Z,N,O.current,Oe]}var M=14/15;function oe(Ge,ve,we){var se=(0,g.useRef)(!1),Re=(0,g.useRef)(0),Oe=(0,g.useRef)(0),ie=(0,g.useRef)(null),C=(0,g.useRef)(null),O,Q=function(re){if(se.current){var le=Math.ceil(re.touches[0].pageX),_e=Math.ceil(re.touches[0].pageY),Ae=Re.current-le,We=Oe.current-_e,He=Math.abs(Ae)>Math.abs(We);He?Re.current=le:Oe.current=_e;var Be=we(He,He?Ae:We,!1,re);Be&&re.preventDefault(),clearInterval(C.current),Be&&(C.current=setInterval(function(){He?Ae*=M:We*=M;var Ke=Math.floor(He?Ae:We);(!we(He,Ke,!0)||Math.abs(Ke)<=.1)&&clearInterval(C.current)},16))}},z=function(){se.current=!1,O()},N=function(re){O(),re.touches.length===1&&!se.current&&(se.current=!0,Re.current=Math.ceil(re.touches[0].pageX),Oe.current=Math.ceil(re.touches[0].pageY),ie.current=re.target,ie.current.addEventListener("touchmove",Q,{passive:!1}),ie.current.addEventListener("touchend",z,{passive:!0}))};O=function(){ie.current&&(ie.current.removeEventListener("touchmove",Q),ie.current.removeEventListener("touchend",z))},(0,P.Z)(function(){return Ge&&ve.current.addEventListener("touchstart",N,{passive:!0}),function(){var Z;(Z=ve.current)===null||Z===void 0||Z.removeEventListener("touchstart",N),O(),clearInterval(C.current)}},[Ge])}function te(Ge){return Math.floor(Math.pow(Ge,.5))}function S(Ge,ve){var we="touches"in Ge?Ge.touches[0]:Ge;return we[ve?"pageX":"pageY"]-window[ve?"scrollX":"scrollY"]}function v(Ge,ve,we){g.useEffect(function(){var se=ve.current;if(Ge&&se){var Re=!1,Oe,ie,C=function(){w.Z.cancel(Oe)},O=function Z(){C(),Oe=(0,w.Z)(function(){we(ie),Z()})},Q=function(re){if(!(re.target.draggable||re.button!==0)){var le=re;le._virtualHandled||(le._virtualHandled=!0,Re=!0)}},z=function(){Re=!1,C()},N=function(re){if(Re){var le=S(re,!1),_e=se.getBoundingClientRect(),Ae=_e.top,We=_e.bottom;if(le<=Ae){var He=Ae-le;ie=-te(He),O()}else if(le>=We){var Be=le-We;ie=te(Be),O()}else C()}};return se.addEventListener("mousedown",Q),se.ownerDocument.addEventListener("mouseup",z),se.ownerDocument.addEventListener("mousemove",N),function(){se.removeEventListener("mousedown",Q),se.ownerDocument.removeEventListener("mouseup",z),se.ownerDocument.removeEventListener("mousemove",N),C()}}},[Ge])}var Y=10;function ae(Ge,ve,we,se,Re,Oe,ie,C){var O=g.useRef(),Q=g.useState(null),z=(0,j.Z)(Q,2),N=z[0],Z=z[1];return(0,P.Z)(function(){if(N&&N.times<Y){if(!Ge.current){Z(function(Ht){return(0,Se.Z)({},Ht)});return}Oe();var re=N.targetAlign,le=N.originAlign,_e=N.index,Ae=N.offset,We=Ge.current.clientHeight,He=!1,Be=re,Ke=null;if(We){for(var lt=re||le,Ie=0,et=0,Kt=0,bt=Math.min(ve.length-1,_e),Mt=0;Mt<=bt;Mt+=1){var Zt=Re(ve[Mt]);et=Ie;var ii=we.get(Zt);Kt=et+(ii===void 0?se:ii),Ie=Kt}for(var ei=lt==="top"?Ae:We-Ae,Ft=bt;Ft>=0;Ft-=1){var ri=Re(ve[Ft]),St=we.get(ri);if(St===void 0){He=!0;break}if(ei-=St,ei<=0)break}switch(lt){case"top":Ke=et-Ae;break;case"bottom":Ke=Kt-We+Ae;break;default:{var ft=Ge.current.scrollTop,gt=ft+We;et<ft?Be="top":Kt>gt&&(Be="bottom")}}Ke!==null&&ie(Ke),Ke!==N.lastTop&&(He=!0)}He&&Z((0,Se.Z)((0,Se.Z)({},N),{},{times:N.times+1,targetAlign:Be,lastTop:Ke}))}},[N,Ge.current]),function(re){if(re==null){C();return}if(w.Z.cancel(O.current),typeof re=="number")ie(re);else if(re&&(0,de.Z)(re)==="object"){var le,_e=re.align;"index"in re?le=re.index:le=ve.findIndex(function(He){return Re(He)===re.key});var Ae=re.offset,We=Ae===void 0?0:Ae;Z({times:0,index:le,offset:We,originAlign:_e})}}}var xe=g.forwardRef(function(Ge,ve){var we=Ge.prefixCls,se=Ge.rtl,Re=Ge.scrollOffset,Oe=Ge.scrollRange,ie=Ge.onStartMove,C=Ge.onStopMove,O=Ge.onScroll,Q=Ge.horizontal,z=Ge.spinSize,N=Ge.containerSize,Z=Ge.style,re=Ge.thumbStyle,le=Ge.showScrollBar,_e=g.useState(!1),Ae=(0,j.Z)(_e,2),We=Ae[0],He=Ae[1],Be=g.useState(null),Ke=(0,j.Z)(Be,2),lt=Ke[0],Ie=Ke[1],et=g.useState(null),Kt=(0,j.Z)(et,2),bt=Kt[0],Mt=Kt[1],Zt=!se,ii=g.useRef(),ei=g.useRef(),Ft=g.useState(le),ri=(0,j.Z)(Ft,2),St=ri[0],ft=ri[1],gt=g.useRef(),Ht=function(){le===!0||le===!1||(clearTimeout(gt.current),ft(!0),gt.current=setTimeout(function(){ft(!1)},3e3))},pt=Oe-N||0,dt=N-z||0,vt=g.useMemo(function(){if(Re===0||pt===0)return 0;var y=Re/pt;return y*dt},[Re,pt,dt]),Bt=function(k){k.stopPropagation(),k.preventDefault()},ai=g.useRef({top:vt,dragging:We,pageY:lt,startTop:bt});ai.current={top:vt,dragging:We,pageY:lt,startTop:bt};var xt=function(k){He(!0),Ie(S(k,Q)),Mt(ai.current.top),ie(),k.stopPropagation(),k.preventDefault()};g.useEffect(function(){var y=function(be){be.preventDefault()},k=ii.current,W=ei.current;return k.addEventListener("touchstart",y,{passive:!1}),W.addEventListener("touchstart",xt,{passive:!1}),function(){k.removeEventListener("touchstart",y),W.removeEventListener("touchstart",xt)}},[]);var Xt=g.useRef();Xt.current=pt;var Lt=g.useRef();Lt.current=dt,g.useEffect(function(){if(We){var y,k=function(be){var rt=ai.current,ut=rt.dragging,_t=rt.pageY,Ut=rt.startTop;w.Z.cancel(y);var zt=ii.current.getBoundingClientRect(),Tt=N/(Q?zt.width:zt.height);if(ut){var Gt=(S(be,Q)-_t)*Tt,Pt=Ut;!Zt&&Q?Pt-=Gt:Pt+=Gt;var tt=Xt.current,ze=Lt.current,Ve=ze?Pt/ze:0,at=Math.ceil(Ve*tt);at=Math.max(at,0),at=Math.min(at,tt),y=(0,w.Z)(function(){O(at,Q)})}},W=function(){He(!1),C()};return window.addEventListener("mousemove",k,{passive:!0}),window.addEventListener("touchmove",k,{passive:!0}),window.addEventListener("mouseup",W,{passive:!0}),window.addEventListener("touchend",W,{passive:!0}),function(){window.removeEventListener("mousemove",k),window.removeEventListener("touchmove",k),window.removeEventListener("mouseup",W),window.removeEventListener("touchend",W),w.Z.cancel(y)}}},[We]),g.useEffect(function(){return Ht(),function(){clearTimeout(gt.current)}},[Re]),g.useImperativeHandle(ve,function(){return{delayHidden:Ht}});var Ne="".concat(we,"-scrollbar"),h={position:"absolute",visibility:St?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=z,Zt?m.left=vt:m.right=vt):(h.width=8,h.top=0,h.bottom=0,Zt?h.right=0:h.left=0,m.width="100%",m.height=z,m.top=vt),g.createElement("div",{ref:ii,className:ce()(Ne,(0,he.Z)((0,he.Z)((0,he.Z)({},"".concat(Ne,"-horizontal"),Q),"".concat(Ne,"-vertical"),!Q),"".concat(Ne,"-visible"),St)),style:(0,Se.Z)((0,Se.Z)({},h),Z),onMouseDown:Bt,onMouseMove:Ht},g.createElement("div",{ref:ei,className:ce()("".concat(Ne,"-thumb"),(0,he.Z)({},"".concat(Ne,"-thumb-moving"),We)),style:(0,Se.Z)((0,Se.Z)({},m),re),onMouseDown:xt}))}),Fe=xe,Xe=20;function yt(){var Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,we=Ge/ve*Ge;return isNaN(we)&&(we=0),we=Math.max(we,Xe),Math.floor(we)}var $t=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],ti=[],je={overflowY:"auto",overflowAnchor:"none"};function mt(Ge,ve){var we=Ge.prefixCls,se=we===void 0?"rc-virtual-list":we,Re=Ge.className,Oe=Ge.height,ie=Ge.itemHeight,C=Ge.fullHeight,O=C===void 0?!0:C,Q=Ge.style,z=Ge.data,N=Ge.children,Z=Ge.itemKey,re=Ge.virtual,le=Ge.direction,_e=Ge.scrollWidth,Ae=Ge.component,We=Ae===void 0?"div":Ae,He=Ge.onScroll,Be=Ge.onVirtualScroll,Ke=Ge.onVisibleChange,lt=Ge.innerProps,Ie=Ge.extraRender,et=Ge.styles,Kt=Ge.showScrollBar,bt=Kt===void 0?"optional":Kt,Mt=(0,p.Z)(Ge,$t),Zt=g.useCallback(function(Jt){return typeof Z=="function"?Z(Jt):Jt==null?void 0:Jt[Z]},[Z]),ii=F(Zt,null,null),ei=(0,j.Z)(ii,4),Ft=ei[0],ri=ei[1],St=ei[2],ft=ei[3],gt=!!(re!==!1&&Oe&&ie),Ht=g.useMemo(function(){return Object.values(St.maps).reduce(function(Jt,It){return Jt+It},0)},[St.id,St.maps]),pt=gt&&z&&(Math.max(ie*z.length,Ht)>Oe||!!_e),dt=le==="rtl",vt=ce()(se,(0,he.Z)({},"".concat(se,"-rtl"),dt),Re),Bt=z||ti,ai=(0,g.useRef)(),xt=(0,g.useRef)(),Xt=(0,g.useRef)(),Lt=(0,g.useState)(0),Ne=(0,j.Z)(Lt,2),h=Ne[0],m=Ne[1],y=(0,g.useState)(0),k=(0,j.Z)(y,2),W=k[0],pe=k[1],be=(0,g.useState)(!1),rt=(0,j.Z)(be,2),ut=rt[0],_t=rt[1],Ut=function(){_t(!0)},zt=function(){_t(!1)},Tt={getKey:Zt};function Gt(Jt){m(function(It){var _i;typeof Jt=="function"?_i=Jt(It):_i=Jt;var Fi=Qt(_i);return ai.current.scrollTop=Fi,Fi})}var Pt=(0,g.useRef)({start:0,end:Bt.length}),tt=(0,g.useRef)(),ze=I(Bt,Zt),Ve=(0,j.Z)(ze,1),at=Ve[0];tt.current=at;var Vt=g.useMemo(function(){if(!gt)return{scrollHeight:void 0,start:0,end:Bt.length-1,offset:void 0};if(!pt){var Jt;return{scrollHeight:((Jt=xt.current)===null||Jt===void 0?void 0:Jt.offsetHeight)||0,start:0,end:Bt.length-1,offset:void 0}}for(var It=0,_i,Fi,Bi,gn=Bt.length,ln=0;ln<gn;ln+=1){var sn=Bt[ln],hn=Zt(sn),fn=St.get(hn),_n=It+(fn===void 0?ie:fn);_n>=h&&_i===void 0&&(_i=ln,Fi=It),_n>h+Oe&&Bi===void 0&&(Bi=ln),It=_n}return _i===void 0&&(_i=0,Fi=0,Bi=Math.ceil(Oe/ie)),Bi===void 0&&(Bi=Bt.length-1),Bi=Math.min(Bi+1,Bt.length-1),{scrollHeight:It,start:_i,end:Bi,offset:Fi}},[pt,gt,h,Bt,ft,Oe]),Ct=Vt.scrollHeight,pi=Vt.start,Dt=Vt.end,Rt=Vt.offset;Pt.current.start=pi,Pt.current.end=Dt,g.useLayoutEffect(function(){var Jt=St.getRecord();if(Jt.size===1){var It=Array.from(Jt)[0],_i=Bt[pi];if(_i){var Fi=Zt(_i);if(Fi===It){var Bi=St.get(It),gn=Bi-ie;Gt(function(ln){return ln+gn})}}}St.resetRecord()},[Ct]);var Nt=g.useState({width:0,height:Oe}),Ee=(0,j.Z)(Nt,2),De=Ee[0],qe=Ee[1],Ye=function(It){qe({width:It.offsetWidth,height:It.offsetHeight})},ot=(0,g.useRef)(),Qe=(0,g.useRef)(),ct=g.useMemo(function(){return yt(De.width,_e)},[De.width,_e]),Et=g.useMemo(function(){return yt(De.height,Ct)},[De.height,Ct]),ni=Ct-Oe,Ot=(0,g.useRef)(ni);Ot.current=ni;function Qt(Jt){var It=Jt;return Number.isNaN(Ot.current)||(It=Math.min(It,Ot.current)),It=Math.max(It,0),It}var oi=h<=0,mi=h>=ni,Ei=W<=0,Ti=W>=_e,gi=ne(oi,mi,Ei,Ti),ui=function(){return{x:dt?-W:W,y:h}},Li=(0,g.useRef)(ui()),Pi=(0,X.zX)(function(Jt){if(Be){var It=(0,Se.Z)((0,Se.Z)({},ui()),Jt);(Li.current.x!==It.x||Li.current.y!==It.y)&&(Be(It),Li.current=It)}});function wi(Jt,It){var _i=Jt;It?((0,_.flushSync)(function(){pe(_i)}),Pi()):Gt(_i)}function bi(Jt){var It=Jt.currentTarget.scrollTop;It!==h&&Gt(It),He==null||He(Jt),Pi()}var Mi=function(It){var _i=It,Fi=_e?_e-De.width:0;return _i=Math.max(_i,0),_i=Math.min(_i,Fi),_i},Ri=(0,X.zX)(function(Jt,It){It?((0,_.flushSync)(function(){pe(function(_i){var Fi=_i+(dt?-Jt:Jt);return Mi(Fi)})}),Pi()):Gt(function(_i){var Fi=_i+Jt;return Fi})}),Ni=ee(gt,oi,mi,Ei,Ti,!!_e,Ri),Ci=(0,j.Z)(Ni,2),Ii=Ci[0],on=Ci[1];oe(gt,ai,function(Jt,It,_i,Fi){var Bi=Fi;return gi(Jt,It,_i)?!1:!Bi||!Bi._virtualHandled?(Bi&&(Bi._virtualHandled=!0),Ii({preventDefault:function(){},deltaX:Jt?It:0,deltaY:Jt?0:It}),!0):!1}),v(pt,ai,function(Jt){Gt(function(It){return It+Jt})}),(0,P.Z)(function(){function Jt(_i){var Fi=oi&&_i.detail<0,Bi=mi&&_i.detail>0;gt&&!Fi&&!Bi&&_i.preventDefault()}var It=ai.current;return It.addEventListener("wheel",Ii,{passive:!1}),It.addEventListener("DOMMouseScroll",on,{passive:!0}),It.addEventListener("MozMousePixelScroll",Jt,{passive:!1}),function(){It.removeEventListener("wheel",Ii),It.removeEventListener("DOMMouseScroll",on),It.removeEventListener("MozMousePixelScroll",Jt)}},[gt,oi,mi]),(0,P.Z)(function(){if(_e){var Jt=Mi(W);pe(Jt),Pi({x:Jt})}},[De.width,_e]);var Vi=function(){var It,_i;(It=ot.current)===null||It===void 0||It.delayHidden(),(_i=Qe.current)===null||_i===void 0||_i.delayHidden()},Ai=ae(ai,Bt,St,ie,Zt,function(){return ri(!0)},Gt,Vi);g.useImperativeHandle(ve,function(){return{nativeElement:Xt.current,getScrollInfo:ui,scrollTo:function(It){function _i(Fi){return Fi&&(0,de.Z)(Fi)==="object"&&("left"in Fi||"top"in Fi)}_i(It)?(It.left!==void 0&&pe(Mi(It.left)),Ai(It.top)):Ai(It)}}}),(0,P.Z)(function(){if(Ke){var Jt=Bt.slice(pi,Dt+1);Ke(Jt,Bt)}},[pi,Dt,Bt]);var nn=ye(Bt,Zt,St,ie),Yi=Ie==null?void 0:Ie({start:pi,end:Dt,virtual:pt,offsetX:W,offsetY:Rt,rtl:dt,getSize:nn}),Zi=H(Bt,pi,Dt,_e,W,Ft,N,Tt),Qi=null;Oe&&(Qi=(0,Se.Z)((0,he.Z)({},O?"height":"maxHeight",Oe),je),gt&&(Qi.overflowY="hidden",_e&&(Qi.overflowX="hidden"),ut&&(Qi.pointerEvents="none")));var Ki={};return dt&&(Ki.dir="rtl"),g.createElement("div",(0,U.Z)({ref:Xt,style:(0,Se.Z)((0,Se.Z)({},Q),{},{position:"relative"}),className:vt},Ki,Mt),g.createElement(l.Z,{onResize:Ye},g.createElement(We,{className:"".concat(se,"-holder"),style:Qi,ref:ai,onScroll:bi,onMouseEnter:Vi},g.createElement(A,{prefixCls:se,height:Ct,offsetX:W,offsetY:Rt,scrollWidth:_e,onInnerResize:ri,ref:xt,innerProps:lt,rtl:dt,extra:Yi},Zi))),pt&&Ct>Oe&&g.createElement(Fe,{ref:ot,prefixCls:se,scrollOffset:h,scrollRange:Ct,rtl:dt,onScroll:wi,onStartMove:Ut,onStopMove:zt,spinSize:Et,containerSize:De.height,style:et==null?void 0:et.verticalScrollBar,thumbStyle:et==null?void 0:et.verticalScrollBarThumb,showScrollBar:bt}),pt&&_e>De.width&&g.createElement(Fe,{ref:Qe,prefixCls:se,scrollOffset:W,scrollRange:_e,rtl:dt,onScroll:wi,onStartMove:Ut,onStopMove:zt,spinSize:ct,containerSize:De.width,horizontal:!0,style:et==null?void 0:et.horizontalScrollBar,thumbStyle:et==null?void 0:et.horizontalScrollBarThumb,showScrollBar:bt}))}var Wt=g.forwardRef(mt);Wt.displayName="List";var ht=Wt,li=ht},83145:function(Yt,st,K){"use strict";Object.defineProperty(st,"__esModule",{value:!0}),st.CopyToClipboard=void 0;var U=Se(K(59301)),de=Se(K(25769));function Se(L){return L&&L.__esModule?L:{default:L}}function he(L){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?he=function(w){return typeof w}:he=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},he(L)}function j(L,I){var w=Object.keys(L);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(L);I&&(R=R.filter(function(q){return Object.getOwnPropertyDescriptor(L,q).enumerable})),w.push.apply(w,R)}return w}function p(L){for(var I=1;I<arguments.length;I++){var w=arguments[I]!=null?arguments[I]:{};I%2?j(w,!0).forEach(function(R){H(L,R,w[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(L,Object.getOwnPropertyDescriptors(w)):j(w).forEach(function(R){Object.defineProperty(L,R,Object.getOwnPropertyDescriptor(w,R))})}return L}function me(L,I){if(L==null)return{};var w=ce(L,I),R,q;if(Object.getOwnPropertySymbols){var ne=Object.getOwnPropertySymbols(L);for(q=0;q<ne.length;q++)R=ne[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,ne;for(ne=0;ne<R.length;ne++)q=R[ne],!(I.indexOf(q)>=0)&&(w[q]=L[q]);return w}function l(L,I){if(!(L instanceof I))throw new TypeError("Cannot call a class as a function")}function X(L,I){for(var w=0;w<I.length;w++){var R=I[w];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(L,R.key,R)}}function P(L,I,w){return I&&X(L.prototype,I),w&&X(L,w),L}function g(L,I){return I&&(he(I)==="object"||typeof I=="function")?I:E(L)}function _(L){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},_(L)}function E(L){if(L===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return L}function A(L,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function");L.prototype=Object.create(I&&I.prototype,{constructor:{value:L,writable:!0,configurable:!0}}),I&&B(L,I)}function B(L,I){return B=Object.setPrototypeOf||function(R,q){return R.__proto__=q,R},B(L,I)}function H(L,I,w){return I in L?Object.defineProperty(L,I,{value:w,enumerable:!0,configurable:!0,writable:!0}):L[I]=w,L}var V=function(L){A(I,L);function I(){var w,R;l(this,I);for(var q=arguments.length,ne=new Array(q),ee=0;ee<q;ee++)ne[ee]=arguments[ee];return R=g(this,(w=_(I)).call.apply(w,[this].concat(ne))),H(E(R),"onClick",function(ye){var Le=R.props,Te=Le.text,$e=Le.onCopy,J=Le.children,D=Le.options,F=U.default.Children.only(J),M=(0,de.default)(Te,D);$e&&$e(Te,M),F&&F.props&&typeof F.props.onClick=="function"&&F.props.onClick(ye)}),R}return P(I,[{key:"render",value:function(){var R=this.props,q=R.text,ne=R.onCopy,ee=R.options,ye=R.children,Le=me(R,["text","onCopy","options","children"]),Te=U.default.Children.only(ye);return U.default.cloneElement(Te,p({},Le,{onClick:this.onClick}))}}]),I}(U.default.PureComponent);st.CopyToClipboard=V,H(V,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Yt,st,K){"use strict";var U=K(83145),de=U.CopyToClipboard;de.CopyToClipboard=de,Yt.exports=de},76374:function(Yt,st,K){"use strict";var U=function(){if(typeof Map!="undefined")return Map;function J(D,F){var M=-1;return D.some(function(oe,te){return oe[0]===F?(M=te,!0):!1}),M}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 M=J(this.__entries__,F),oe=this.__entries__[M];return oe&&oe[1]},D.prototype.set=function(F,M){var oe=J(this.__entries__,F);~oe?this.__entries__[oe][1]=M:this.__entries__.push([F,M])},D.prototype.delete=function(F){var M=this.__entries__,oe=J(M,F);~oe&&M.splice(oe,1)},D.prototype.has=function(F){return!!~J(this.__entries__,F)},D.prototype.clear=function(){this.__entries__.splice(0)},D.prototype.forEach=function(F,M){M===void 0&&(M=null);for(var oe=0,te=this.__entries__;oe<te.length;oe++){var S=te[oe];F.call(M,S[1],S[0])}},D}()}(),de=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Se=function(){return typeof K.g!="undefined"&&K.g.Math===Math?K.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),he=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Se):function(J){return setTimeout(function(){return J(Date.now())},1e3/60)}}(),j=2;function p(J,D){var F=!1,M=!1,oe=0;function te(){F&&(F=!1,J()),M&&v()}function S(){he(te)}function v(){var Y=Date.now();if(F){if(Y-oe<j)return;M=!0}else F=!0,M=!1,setTimeout(S,D);oe=Y}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_,M=F.indexOf(D);~M&&F.splice(M,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(){!de||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},J.prototype.disconnect_=function(){!de||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},J.prototype.onTransitionEnd_=function(D){var F=D.propertyName,M=F===void 0?"":F,oe=ce.some(function(te){return!!~M.indexOf(te)});oe&&this.refresh()},J.getInstance=function(){return this.instance_||(this.instance_=new J),this.instance_},J.instance_=null,J}(),P=function(J,D){for(var F=0,M=Object.keys(D);F<M.length;F++){var oe=M[F];Object.defineProperty(J,oe,{value:D[oe],enumerable:!1,writable:!1,configurable:!0})}return J},g=function(J){var D=J&&J.ownerDocument&&J.ownerDocument.defaultView;return D||Se},_=q(0,0,0,0);function E(J){return parseFloat(J)||0}function A(J){for(var D=[],F=1;F<arguments.length;F++)D[F-1]=arguments[F];return D.reduce(function(M,oe){var te=J["border-"+oe+"-width"];return M+E(te)},0)}function B(J){for(var D=["top","right","bottom","left"],F={},M=0,oe=D;M<oe.length;M++){var te=oe[M],S=J["padding-"+te];F[te]=E(S)}return F}function H(J){var D=J.getBBox();return q(0,0,D.width,D.height)}function V(J){var D=J.clientWidth,F=J.clientHeight;if(!D&&!F)return _;var M=g(J).getComputedStyle(J),oe=B(M),te=oe.left+oe.right,S=oe.top+oe.bottom,v=E(M.width),Y=E(M.height);if(M.boxSizing==="border-box"&&(Math.round(v+te)!==D&&(v-=A(M,"left","right")+te),Math.round(Y+S)!==F&&(Y-=A(M,"top","bottom")+S)),!I(J)){var ae=Math.round(v+te)-D,xe=Math.round(Y+S)-F;Math.abs(ae)!==1&&(v-=ae),Math.abs(xe)!==1&&(Y-=xe)}return q(oe.left,oe.top,v,Y)}var L=function(){return typeof SVGGraphicsElement!="undefined"?function(J){return J instanceof g(J).SVGGraphicsElement}:function(J){return J instanceof g(J).SVGElement&&typeof J.getBBox=="function"}}();function I(J){return J===g(J).document.documentElement}function w(J){return de?L(J)?H(J):V(J):_}function R(J){var D=J.x,F=J.y,M=J.width,oe=J.height,te=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,S=Object.create(te.prototype);return P(S,{x:D,y:F,width:M,height:oe,top:F,right:D+M,bottom:oe+F,left:D}),S}function q(J,D,F,M){return{x:J,y:D,width:F,height:M}}var ne=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}(),ee=function(){function J(D,F){var M=R(F);P(this,{target:D,contentRect:M})}return J}(),ye=function(){function J(D,F,M){if(this.activeObservations_=[],this.observations_=new U,typeof D!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=D,this.controller_=F,this.callbackCtx_=M}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 ne(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(M){return new ee(M.target,M.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}(),Le=typeof WeakMap!="undefined"?new WeakMap:new U,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(),M=new ye(D,F,this);Le.set(this,M)}return J}();["observe","unobserve","disconnect"].forEach(function(J){Te.prototype[J]=function(){var D;return(D=Le.get(this))[J].apply(D,arguments)}});var $e=function(){return typeof Se.ResizeObserver!="undefined"?Se.ResizeObserver:Te}();st.Z=$e},98040:function(Yt){Yt.exports=function(){var st=document.getSelection();if(!st.rangeCount)return function(){};for(var K=document.activeElement,U=[],de=0;de<st.rangeCount;de++)U.push(st.getRangeAt(de));switch(K.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":K.blur();break;default:K=null;break}return st.removeAllRanges(),function(){st.type==="Caret"&&st.removeAllRanges(),st.rangeCount||U.forEach(function(Se){st.addRange(Se)}),K&&K.focus()}}},82059:function(Yt){var st=arguments[3],K=arguments[4],U=arguments[5],de=JSON.stringify;Yt.exports=function(Se,he){for(var j,p=Object.keys(U),me=0,ce=p.length;me<ce;me++){var l=p[me],X=U[l].exports;if(X===Se||X&&X.default===Se){j=l;break}}if(!j){j=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var P={},me=0,ce=p.length;me<ce;me++){var l=p[me];P[l]=l}K[j]=["function(require,module,exports){"+Se+"(self); }",P]}var g=Math.floor(Math.pow(16,8)*Math.random()).toString(16),_={};_[j]=j,K[g]=["function(require,module,exports){var f = require("+de(j)+");(f.default ? f.default : f)(self);}",_];var E={};A(g);function A(w){E[w]=!0;for(var R in K[w][1]){var q=K[w][1][R];E[q]||A(q)}}var B="("+st+")({"+Object.keys(E).map(function(w){return de(w)+":["+K[w][0]+","+de(K[w][1])+"]"}).join(",")+"},{},["+de(g)+"])",H=window.URL||window.webkitURL||window.mozURL||window.msURL,V=new Blob([B],{type:"text/javascript"});if(he&&he.bare)return V;var L=H.createObjectURL(V),I=new Worker(L);return I.objectURL=L,I}},93314:function(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=="},79710:function(Yt,st,K){"use strict";K.d(st,{ZP:function(){return gs}});const U=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},de=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Se},Se=Number.MAX_SAFE_INTEGER||9007199254740991;let he=function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a}({}),j=function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a}({}),p=function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a}({});var me={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ce={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class X{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l(e),this.fast_=new l(t),this.defaultTTFB_=n,this.ttfb_=new l(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new l(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new l(t,n.getEstimate(),n.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new l(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,s=i/n;this.fast_.sample(n,s),this.slow_.sample(n,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function P(a,e,t){return(e=B(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function g(){return g=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(a[i]=t[i])}return a},g.apply(null,arguments)}function _(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,i)}return t}function E(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_(Object(t),!0).forEach(function(i){P(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):_(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function A(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var i=t.call(a,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function B(a){var e=A(a,"string");return typeof e=="symbol"?e:e+""}class H{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=V,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const V=function(){},L={trace:V,debug:V,log:V,warn:V,info:V,error:V};function I(){return g({},L)}function w(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):V}function R(a,e,t){return e[a]?e[a].bind(e):w(a,t)}const q=I();function ne(a,e,t){const i=I();if(typeof console=="object"&&a===!0||typeof a=="object"){const n=["debug","log","info","warn","error"];n.forEach(s=>{i[s]=R(s,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.2`)}catch(s){return I()}n.forEach(s=>{q[s]=R(s,a)})}else g(q,i);return i}const ee=q;function ye(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Le(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function 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 $e(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const d=u.indexOf("\0");return d!==-1?u.substring(0,d):u}return u.replace(/\0/g,"")}const t=a.length;let i,n,s,r="",o=0;for(;o<t;){if(i=a[o++],i===0&&e)return r;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(i);break;case 12:case 13:n=a[o++],r+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=a[o++],s=a[o++],r+=String.fromCharCode((i&15)<<12|(n&63)<<6|(s&63)<<0);break}}return r}const J={hexDump:function(a){let e="";for(let t=0;t<a.length;t++){let i=a[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}};function D(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var F={exports:{}},M;function oe(){return M||(M=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,u,d){if(d=d||{},c=c.trim(),u=u.trim(),!u){if(!d.alwaysNormalize)return c;var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");return f.path=o.normalizePath(f.path),o.buildURLFromParts(f)}var b=o.parseURL(u);if(!b)throw new Error("Error trying to parse relative URL.");if(b.scheme)return d.alwaysNormalize?(b.path=o.normalizePath(b.path),o.buildURLFromParts(b)):u;var x=o.parseURL(c);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var T=n.exec(x.path);x.netLoc=T[1],x.path=T[2]}x.netLoc&&!x.path&&(x.path="/");var G={scheme:x.scheme,netLoc:b.netLoc,path:null,params:b.params,query:b.query,fragment:b.fragment};if(!b.netLoc&&(G.netLoc=x.netLoc,b.path[0]!=="/"))if(!b.path)G.path=x.path,b.params||(G.params=x.params,b.query||(G.query=x.query));else{var $=x.path,ue=$.substring(0,$.lastIndexOf("/")+1)+b.path;G.path=o.normalizePath(ue)}return G.path===null&&(G.path=d.alwaysNormalize?o.normalizePath(b.path):b.path),o.buildURLFromParts(G)},parseURL:function(c){var u=i.exec(c);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(s,"");c.length!==(c=c.replace(r,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};a.exports=o})()}(F)),F.exports}var te=oe();class S{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var v={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Y{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,yt(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 ae(a){return a.sn!=="initSegment"}class xe extends Y{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(U(e)&&U(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=U(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(!U(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return ae(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,s,r=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:s,partial:r};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,s)}}class Fe extends Y{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 Xe(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Xe(t,e)}}function yt(a,e){const t=Xe(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const $t=Math.pow(2,32)-1,ti=[].push,je={video:1,audio:2,id3:3,text:4};function mt(a){return String.fromCharCode.apply(null,a)}function Wt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function ht(a,e){const t=Ge(a,e);return t<0?4294967296+t:t}function li(a,e){let t=ht(a,e);return t*=Math.pow(2,32),t+=ht(a,e+4),t}function Ge(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function ve(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 we(a){const e=a.byteLength;for(let t=0;t<e;){const i=ht(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 se(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=ht(a,n),r=mt(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=se(a.subarray(n+8,o),e.slice(1));c.length&&ti.apply(t,c)}n=o}return t}function Re(a){const e=[],t=a[0];let i=8;const n=ht(a,i);i+=4;let s=0,r=0;t===0?(s=ht(a,i),r=ht(a,i+4),i+=8):(s=li(a,i),r=li(a,i+8),i+=16),i+=2;let o=a.length+r;const c=Wt(a,i);i+=2;for(let u=0;u<c;u++){let d=i;const f=ht(a,d);d+=4;const b=f&2147483647;if((f&2147483648)>>>31===1)return ee.warn("SIDX has hierarchical references (not supported)"),null;const T=ht(a,d);d+=4,e.push({referenceSize:b,subsegmentDuration:T,info:{duration:T/n,start:o,end:o+b-1}}),o+=b,d+=4,i=d}return{earliestPresentationTime:s,timescale:n,version:t,referencesCount:c,references:e}}function Oe(a){const e=[],t=se(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=se(s,["tkhd"])[0];if(r){let o=r[0];const c=ht(r,o===0?12:20),u=se(s,["mdia","mdhd"])[0];if(u){o=u[0];const d=ht(u,o===0?12:20),f=se(s,["mdia","hdlr"])[0];if(f){const b=mt(f.subarray(8,12)),x={soun:v.AUDIO,vide:v.VIDEO}[b],T=se(s,["mdia","minf","stbl","stsd"])[0],G=ie(T);x?(e[c]={timescale:d,type:x,stsd:G},e[x]=E({timescale:d,id:c},G)):e[c]={timescale:d,type:b,stsd:G}}}}}return se(a,["moov","mvex","trex"]).forEach(n=>{const s=ht(n,4),r=e[s];r&&(r.default={duration:ht(n,12),flags:ht(n,20)})}),e}function ie(a){const e=a.subarray(8),t=e.subarray(86),i=mt(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const u=se(e,[i])[0].subarray(i==="enca"?28:78);se(u,["sinf"]).forEach(f=>{const b=se(f,["schm"])[0];if(b){const x=mt(b.subarray(4,8));if(x==="cbcs"||x==="cenc"){const T=se(f,["frma"])[0];T&&(n=mt(T))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=se(t,["avcC"])[0];c&&c.length>3&&(n+="."+Q(c[1])+Q(c[2])+Q(c[3]),s=C(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=se(e,[i])[0],u=se(c.subarray(28),["esds"])[0];if(u&&u.length>7){let d=4;if(u[d++]!==3)break;d=O(u,d),d+=2;const f=u[d++];if(f&128&&(d+=2),f&64&&(d+=u[d++]),u[d++]!==4)break;d=O(u,d);const b=u[d++];if(b===64)n+="."+Q(b);else break;if(d+=12,u[d++]!==5)break;d=O(u,d);const x=u[d++];let T=(x&248)>>3;T===31&&(T+=1+((x&7)<<3)+((u[d]&224)>>5)),n+="."+T}break}case"hvc1":case"hev1":{const c=se(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],d=["","A","B","C"][u>>6],f=u&31,b=ht(c,2),x=(u&32)>>5?"H":"L",T=c[12],G=c.subarray(6,12);n+="."+d+f,n+="."+b.toString(16).toUpperCase(),n+="."+x+T;let $="";for(let ue=G.length;ue--;){const ge=G[ue];(ge||$)&&($="."+ge.toString(16).toUpperCase()+$)}n+=$}s=C(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=C(n,t)||n;break}case"vp09":{const c=se(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],d=c[5],f=c[6]>>4&15;n+="."+z(u)+"."+z(d)+"."+z(f)}break}case"av01":{const c=se(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,d=c[1]&31,f=c[2]>>>7?"H":"M",b=(c[2]&64)>>6,x=(c[2]&32)>>5,T=u===2&&b?x?12:10:b?10:8,G=(c[2]&16)>>4,$=(c[2]&8)>>3,ue=(c[2]&4)>>2,ge=c[2]&3;n+="."+u+"."+z(d)+f+"."+z(T)+"."+G+"."+$+ue+ge+"."+z(1)+"."+z(1)+"."+z(1)+"."+0,s=C("dav1",t)}break}}return{codec:n,encrypted:r,supplemental:s}}function C(a,e){const t=se(e,["dvvC"]),i=t.length?t[0]:se(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+z(n)+"."+z(s)}}function O(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function Q(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function z(a){return(a<10?"0":"")+a}function N(a,e){if(!a||!e)return a;const t=e.keyId;return t&&e.isCommonEncryption&&se(a,["moov","trak"]).forEach(n=>{const r=se(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=se(r,["enca"]);const c=o.length>0;c||(o=se(r,["encv"])),o.forEach(u=>{const d=c?u.subarray(28):u.subarray(78);se(d,["sinf"]).forEach(b=>{const x=Z(b);if(x){const T=x.subarray(8,24);T.some(G=>G!==0)||(ee.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${J.hexDump(T)} -> ${J.hexDump(t)}`),x.set(t,8))}})})}),a}function Z(a){const e=se(a,["schm"])[0];if(e){const t=mt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return se(a,["schi","tenc"])[0]}return null}function re(a,e){return se(e,["moof","traf"]).reduce((t,i)=>{const n=se(i,["tfdt"])[0],s=n[0],r=se(i,["tfhd"]).reduce((o,c)=>{const u=ht(c,4),d=a[u];if(d){let f=ht(n,4);if(s===1){if(f===$t)return ee.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;f*=$t+1,f+=ht(n,8)}const b=d.timescale||9e4,x=f/b;if(U(x)&&(o===null||x<o))return x}return o},null);return r!==null&&U(r)&&(t===null||r<t)?r:t},null)}function le(a,e){let t=0,i=0,n=0;const s=se(a,["moof","traf"]);for(let r=0;r<s.length;r++){const o=s[r],c=se(o,["tfhd"])[0],u=ht(c,4),d=e[u];if(!d)continue;const f=d.default,b=ht(c,0)|(f==null?void 0:f.flags);let x=f==null?void 0:f.duration;b&8&&(b&2?x=ht(c,12):x=ht(c,8));const T=d.timescale||9e4,G=se(o,["trun"]);for(let $=0;$<G.length;$++){if(t=_e(G[$]),!t&&x){const ue=ht(G[$],4);t=x*ue}d.type===v.VIDEO?i+=t/T:d.type===v.AUDIO&&(n+=t/T)}}if(i===0&&n===0){let r=1/0,o=0,c=0;const u=se(a,["sidx"]);for(let d=0;d<u.length;d++){const f=Re(u[d]);if(f!=null&&f.references){r=Math.min(r,f.earliestPresentationTime/f.timescale);const b=f.references.reduce((x,T)=>x+T.info.duration||0,0);o=Math.max(o,b+f.earliestPresentationTime/f.timescale),c=o-r}}if(c&&U(c))return c}return i||n}function _e(a){const e=ht(a,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const n=ht(a,4);for(let s=0;s<n;s++){if(e&256){const r=ht(a,t);i+=r,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function Ae(a,e,t){se(e,["moof","traf"]).forEach(i=>{se(i,["tfhd"]).forEach(n=>{const s=ht(n,4),r=a[s];if(!r)return;const o=r.timescale||9e4;se(i,["tfdt"]).forEach(c=>{const u=c[0],d=t*o;if(d){let f=ht(c,4);if(u===0)f-=d,f=Math.max(f,0),ve(c,4,f);else{f*=Math.pow(2,32),f+=ht(c,8),f-=d,f=Math.max(f,0);const b=Math.floor(f/($t+1)),x=Math.floor(f%($t+1));ve(c,4,b),ve(c,8,x)}}})})})}function We(a){const e={valid:null,remainder:null},t=se(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 He(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Be(a,e){const t=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return se(i,["moof"]).map(c=>{const u=c.byteOffset-8;se(c,["traf"]).map(f=>{const b=se(f,["tfdt"]).map(x=>{const T=x[0];let G=ht(x,4);return T===1&&(G*=Math.pow(2,32),G+=ht(x,8)),G/n})[0];return b!==void 0&&(a=b),se(f,["tfhd"]).map(x=>{const T=ht(x,4),G=ht(x,0)&16777215,$=(G&1)!==0,ue=(G&2)!==0,ge=(G&8)!==0;let fe=0;const Ce=(G&16)!==0;let ke=0;const Je=(G&32)!==0;let Pe=8;T===s&&($&&(Pe+=8),ue&&(Pe+=4),ge&&(fe=ht(x,Pe),Pe+=4),Ce&&(ke=ht(x,Pe),Pe+=4),Je&&(Pe+=4),e.type==="video"&&(r=Ke(e.codec)),se(f,["trun"]).map(Ze=>{const nt=Ze[0],Me=ht(Ze,0)&16777215,At=(Me&1)!==0;let jt=0;const Oi=(Me&4)!==0,yi=(Me&256)!==0;let hi=0;const si=(Me&512)!==0;let di=0;const ci=(Me&1024)!==0,wt=(Me&2048)!==0;let kt=0;const xi=ht(Ze,4);let Si=8;At&&(jt=ht(Ze,Si),Si+=4),Oi&&(Si+=4);let ki=jt+u;for(let Gi=0;Gi<xi;Gi++){if(yi?(hi=ht(Ze,Si),Si+=4):hi=fe,si?(di=ht(Ze,Si),Si+=4):di=ke,ci&&(Si+=4),wt&&(nt===0?kt=ht(Ze,Si):kt=Ge(Ze,Si),Si+=4),e.type===v.VIDEO){let zi=0;for(;zi<di;){const qi=ht(i,ki);if(ki+=4,lt(r,i[ki])){const Dn=i.subarray(ki,ki+qi);Ie(Dn,r?2:1,a+kt/n,t)}ki+=qi,zi+=qi+4}}a+=hi/n}}))})})}),t}function Ke(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function lt(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Ie(a,e,t,i){const n=et(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){ee.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[d++]===181){const b=Wt(n,d);if(d+=2,b===49){const x=ht(n,d);if(d+=4,x===1195456820){const T=n[d++];if(T===3){const G=n[d++],$=31&G,ue=64&G,ge=ue?2+$*3:0,fe=new Uint8Array(ge);if(ue){fe[0]=G;for(let Ce=1;Ce<ge;Ce++)fe[Ce]=n[d++]}i.push({type:T,payloadType:r,pts:t,bytes:fe})}}}}}else if(r===5&&o>16){const f=[];for(let T=0;T<16;T++){const G=n[d++].toString(16);f.push(G.length==1?"0"+G:G),(T===3||T===5||T===7||T===9)&&f.push("-")}const b=o-16,x=new Uint8Array(b);for(let T=0;T<b;T++)x[T]=n[d++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:$e(x),userDataBytes:x})}}}function et(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 Kt(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;mt(a.subarray(u,u+1))!=="\0";)t+=mt(a.subarray(u,u+1)),u+=1;for(t+=mt(a.subarray(u,u+1)),u+=1;mt(a.subarray(u,u+1))!=="\0";)i+=mt(a.subarray(u,u+1)),u+=1;i+=mt(a.subarray(u,u+1)),u+=1,n=ht(a,12),s=ht(a,16),o=ht(a,20),c=ht(a,24),u=28}else if(e===1){u+=4,n=ht(a,u),u+=4;const f=ht(a,u);u+=4;const b=ht(a,u);for(u+=4,r=Xo(2,32)*f+b,de(r)||(r=Number.MAX_SAFE_INTEGER,ee.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ht(a,u),u+=4,c=ht(a,u),u+=4;mt(a.subarray(u,u+1))!=="\0";)t+=mt(a.subarray(u,u+1)),u+=1;for(t+=mt(a.subarray(u,u+1)),u+=1;mt(a.subarray(u,u+1))!=="\0";)i+=mt(a.subarray(u,u+1)),u+=1;i+=mt(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 bt(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 Mt(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),bt([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t||new Uint8Array)}function Zt(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=ii(n);e.push(s),i+=s.size}}return e}function ii(a){const e=a.getUint32(0),t=a.byteOffset,i=a.byteLength;if(i<e)return{offset:t,size:i};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const s=a.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const r=a.buffer,o=J.hexDump(new Uint8Array(r,t+12,16)),c=a.getUint32(28);let u=null,d=null;if(s===0){if(e-32<c||c<22)return{offset:t,size:e};d=new Uint8Array(r,t+32,c)}else if(s===1){if(!c||i<t+32+c*16+16)return{offset:t,size:e};u=[];for(let f=0;f<c;f++)u.push(new Uint8Array(r,t+32+f*16,16))}return{version:s,systemId:o,kids:u,data:d,offset:t,size:e}}const ei=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ft={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 ri(a,e){const t=Ft[e];return!!t&&!!t[a.slice(0,4)]}function St(a,e,t=!0){return!a.split(",").some(i=>!ft(i,e,t))}function ft(a,e,t=!0){var i;const n=ye(t);return(i=n==null?void 0:n.isTypeSupported(gt(a,e)))!=null?i:!1}function gt(a,e){return`${e}/mp4;codecs=${a}`}function Ht(a){if(a){const e=a.substring(0,4);return Ft.video[e]}return 2}function pt(a){const e=ei();return a.split(",").reduce((t,i)=>{const s=e&&Ke(i)?9:Ft.video[i];return s?(s*2+t)/(t?3:2):(Ft.audio[i]+t)/(t?2:1)},0)}const dt={};function vt(a,e=!0){if(dt[a])return dt[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(ft(t[n],"audio",e))return dt[a]=t[n],t[n];if(t[n]==="mp3"&&(i=ye(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const Bt=/flac|opus|mp4a\.40\.34/i;function ai(a,e=!0){return a.replace(Bt,t=>vt(t.toLowerCase(),e))}function xt(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)ri(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function Xt(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 Lt(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");if(i.length>2){let n=i.shift()+".";n+=parseInt(i.shift()).toString(16),n+=("000"+parseInt(i.shift()).toString(16)).slice(-4),e[t]=n}}return e.join(",")}function Ne(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return a}function h(a){const e=ye(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function m(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const y={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function k(a,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const W={};function pe(a,e,t,i,n,s){const r=a.audioCodec?a.audioGroups:null,o=s==null?void 0:s.audioCodec,c=s==null?void 0:s.channels,u=c?parseInt(c):o?1/0:2;let d=null;if(r!=null&&r.length)try{r.length===1&&r[0]?d=e.groups[r[0]].channels:d=r.reduce((f,b)=>{if(b){const x=e.groups[b];if(!x)throw new Error(`Audio track group ${b} not found`);Object.keys(x.channels).forEach(T=>{f[T]=(f[T]||0)+x.channels[T]})}return f},{2:0})}catch(f){return!0}return a.videoCodec!==void 0&&(a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(i,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(n,8e6))||!!d&&U(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function be(a,e,t){const i=a.videoCodec,n=a.audioCodec;if(!i&&!n||!t)return Promise.resolve(y);const s=[];if(i){const r={width:a.width,height:a.height,bitrate:Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)),framerate:a.frameRate||30},o=a.videoRange;o!=="SDR"&&(r.transferFunction=o.toLowerCase());const c=i.split(","),u=navigator.userAgent;if(c.some(d=>Ke(d))&&ei())return Promise.resolve(k(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${u})`),s));s.push.apply(s,c.map(d=>({type:"media-source",video:E(E({},r),{},{contentType:gt(Ne(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);U(d)&&d>2&&s.push.apply(s,n.split(",").map(f=>({type:"media-source",audio:{contentType:gt(f,"audio"),channels:""+d}})))}}))}),Promise.all(s.map(r=>{const o=rt(r);return W[o]||(W[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 rt(a){const{audio:e,video:t}=a,i=t||e;if(i){const n=m(i.contentType);if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${n}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${n}`}return""}const ut=["NONE","TYPE-0","TYPE-1",null];function _t(a){return ut.indexOf(a)>-1}const Ut=["SDR","PQ","HLG"];function zt(a){return!!a&&Ut.indexOf(a)>-1}var Tt={No:"",Yes:"YES",v2:"v2"};function Gt(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?Tt.v2:Tt.Yes:Tt.No}class Pt{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 tt{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 ze(this._audioGroups,e)}hasSubtitleGroup(e){return ze(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 ze(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Ve(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function at(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||Ut.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&Ve(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Vt=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}},Ct=(a,e)=>JSON.stringify(a,Vt(e));function pi(a,e,t,i,n){const s=Object.keys(a),r=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,c=n==null?void 0:n.videoCodec,u=r&&parseInt(r)===2;let d=!1,f=!1,b=1/0,x=1/0,T=1/0,G=1/0,$=0,ue=[];const{preferHDR:ge,allowedVideoRanges:fe}=at(e,n);for(let Ze=s.length;Ze--;){const nt=a[s[Ze]];d||(d=nt.channels[2]>0),b=Math.min(b,nt.minHeight),x=Math.min(x,nt.minFramerate),T=Math.min(T,nt.minBitrate),fe.filter(At=>nt.videoRanges[At]>0).length>0&&(f=!0)}b=U(b)?b:0,x=U(x)?x:0;const Ce=Math.max(1080,b),ke=Math.max(30,x);T=U(T)?T:t,t=Math.max(T,t),f||(e=void 0);const Je=s.length>1;return{codecSet:s.reduce((Ze,nt)=>{const Me=a[nt];if(nt===Ze)return Ze;if(ue=f?fe.filter(At=>Me.videoRanges[At]>0):[],Je){if(Me.minBitrate>t)return Dt(nt,`min bitrate of ${Me.minBitrate} > current estimate of ${t}`),Ze;if(!Me.hasDefaultAudio)return Dt(nt,"no renditions with default or auto-select sound found"),Ze;if(o&&nt.indexOf(o.substring(0,4))%5!==0)return Dt(nt,`audio codec preference "${o}" not found`),Ze;if(r&&!u){if(!Me.channels[r])return Dt(nt,`no renditions with ${r} channel sound found (channels options: ${Object.keys(Me.channels)})`),Ze}else if((!o||u)&&d&&Me.channels[2]===0)return Dt(nt,"no renditions with stereo sound found"),Ze;if(Me.minHeight>Ce)return Dt(nt,`min resolution of ${Me.minHeight} > maximum of ${Ce}`),Ze;if(Me.minFramerate>ke)return Dt(nt,`min framerate of ${Me.minFramerate} > maximum of ${ke}`),Ze;if(!ue.some(At=>Me.videoRanges[At]>0))return Dt(nt,`no variants with VIDEO-RANGE of ${Ct(ue)} found`),Ze;if(c&&nt.indexOf(c.substring(0,4))%5!==0)return Dt(nt,`video codec preference "${c}" not found`),Ze;if(Me.maxScore<$)return Dt(nt,`max score of ${Me.maxScore} < selected max of ${$}`),Ze}return Ze&&(pt(nt)>=pt(Ze)||Me.fragmentError>a[Ze].fragmentError)?Ze:(G=Me.minIndex,$=Me.maxScore,nt)},void 0),videoRanges:ue,preferHDR:ge,minFramerate:x,minBitrate:T,minIndex:G}}function Dt(a,e){ee.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Rt(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 Nt(a,e,t,i){return a.slice(t,i+1).reduce((n,s,r)=>{if(!s.codecSet)return n;const o=s.audioGroups;let c=n[s.codecSet];c||(n[s.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,s.bitrate);const u=Math.min(s.height,s.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,s.frameRate),c.minIndex=Math.min(c.minIndex,r),c.maxScore=Math.max(c.maxScore,s.score),c.fragmentError+=s.fragmentError,c.videoRanges[s.videoRange]=(c.videoRanges[s.videoRange]||0)+1,o&&o.forEach(d=>{if(!d)return;const f=e.groups[d];f&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(b=>{c.channels[b]=(c.channels[b]||0)+f.channels[b]}))}),n},{})}function Ee(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 De(a,e,t){if("attrs"in a){const i=e.indexOf(a);if(i!==-1)return i}for(let i=0;i<e.length;i++){const n=e[i];if(qe(a,n,t))return i}return-1}function qe(a,e,t){const{groupId:i,name:n,lang:s,assocLang:r,default:o}=a,c=a.forced;return(i===void 0||e.groupId===i)&&(n===void 0||e.name===n)&&(s===void 0||Ye(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||ot(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function Ye(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function ot(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function Qe(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 ct(a,e,t,i,n){const s=e[i],o=e.reduce((b,x,T)=>{const G=x.uri;return(b[G]||(b[G]=[])).push(T),b},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,d=s.codecSet.substring(0,4),f=Et(e,i,b=>{if(b.videoRange!==c||b.frameRate!==u||b.codecSet.substring(0,4)!==d)return!1;const x=b.audioGroups,T=t.filter(G=>!x||x.indexOf(G.groupId)!==-1);return De(a,T,n)>-1});return f>-1?f:Et(e,i,b=>{const x=b.audioGroups,T=t.filter(G=>!x||x.indexOf(G.groupId)!==-1);return De(a,T,n)>-1})}function Et(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 ni(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Ot extends H{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:n,partCurrent:s,hls:r}=this,{autoLevelEnabled:o,media:c}=r;if(!n||!c)return;const u=performance.now(),d=s?s.stats:n.stats,f=s?s.duration:n.duration,b=u-d.loading.start,x=r.minAutoLevel,T=n.level,G=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||T<=x){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const $=G>-1&&G!==T,ue=!!t||$;if(!ue&&(c.paused||!c.playbackRate||!c.readyState))return;const ge=r.mainForwardBufferInfo;if(!ue&&ge===null)return;const fe=this.bwEstimator.getEstimateTTFB(),Ce=Math.abs(c.playbackRate);if(b<=Math.max(fe,1e3*(f/(Ce*2))))return;const ke=ge?ge.len/Ce:0,Je=d.loading.first?d.loading.first-d.loading.start:-1,Pe=d.loaded&&Je>-1,Ze=this.getBwEstimate(),nt=r.levels,Me=nt[T],At=Math.max(d.loaded,Math.round(f*(n.bitrate||Me.averageBitrate)/8));let jt=Pe?b-Je:b;jt<1&&Pe&&(jt=Math.min(b,d.loaded*8/Ze));const Oi=Pe?d.loaded*1e3/jt:0,yi=fe/1e3,hi=Oi?(At-d.loaded)/Oi:At*8/Ze+yi;if(hi<=ke)return;const si=Oi?Oi*8:Ze,di=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,ci=this.hls.config.abrBandWidthUpFactor;let wt=Number.POSITIVE_INFINITY,kt;for(kt=T-1;kt>x;kt--){const Gi=nt[kt].maxBitrate,zi=!nt[kt].details||di;if(wt=this.getTimeToLoadFrag(yi,si,f*Gi,zi),wt<Math.min(ke,f+yi))break}if(wt>=hi||wt>f*10)return;Pe?this.bwEstimator.sample(b-Math.min(fe,Je),d.loaded):this.bwEstimator.sampleTTFB(b);const xi=nt[kt].maxBitrate;this.getBwEstimate()*ci>xi&&this.resetEstimator(xi);const Si=this.findBestLevel(xi,x,kt,0,ke,1,1);Si>-1&&(kt=Si),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${T} is loading too slowly;
Fragment duration: ${n.duration.toFixed(3)}
Time to underbuffer: ${ke.toFixed(3)} s
Estimated load time for current fragment: ${hi.toFixed(3)} s
Estimated load time for down switch fragment: ${wt.toFixed(3)} s
TTFB estimate: ${Je|0} ms
Current BW estimate: ${U(Ze)?Ze|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${kt} @ ${xi|0} bps`),r.nextLoadLevel=r.nextAutoLevel=kt,this.clearTimer();const ki=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===kt&&kt>0){const Gi=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${kt>0?"and switching down":""}
Fragment duration: ${n.duration.toFixed(3)} s
Time to underbuffer: ${Gi.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,kt>x){let zi=this.findBestLevel(this.hls.levels[x].bitrate,x,kt,0,Gi,1,1);zi===-1&&(zi=x),this.hls.nextLoadLevel=this.hls.nextAutoLevel=zi,this.resetEstimator(this.hls.levels[zi].bitrate)}}};$||hi>wt*2?ki():this.timer=self.setInterval(ki,wt*1e3),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:s,stats:d})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new X(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(p.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case j.BUFFER_ADD_CODEC_ERROR:case j.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case j.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:s}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const r=performance.now(),o=s?s.stats:i.stats,c=r-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,i,n){const s=e+i/t,r=n?e+this.lastLevelLoadSec:0;return s+r}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,s=n.end-n.first;U(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===ce.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+n.loaded,c=(r.loaded?r.loaded.duration:0)+s;r.loaded={bytes:o,duration:c},r.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const s={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,s=n!=null&&n.stats.loaded?n.stats:i.stats;if(s.aborted||this.ignoreFragment(i))return;const r=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,s.loaded),s.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ce.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,s=this.findBestLevel(i,t,e,0,n,1,1);if(s>-1)return s;const r=this.hls.firstLevel,o=Math.min(Math.max(r,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${r} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=i&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,s)&&r[e].loadError<=r[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:s,minAutoLevel:r}=i,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let d=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const $=this.findBestLevel(c,r,n,u,0,d,f);if($>=0)return this.rebufferNotice=-1,$}let b=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const $=this.bitrateTestDelay;$&&(b=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-$,this.info(`bitrate test took ${Math.round(1e3*$)}ms, set first fragment max fetchDuration to ${Math.round(1e3*b)} ms`),d=f=1)}const x=this.findBestLevel(c,r,n,u,b,d,f);if(this.rebufferNotice!==x&&(this.rebufferNotice=x,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${x}`)),x>-1)return x;const T=i.levels[r],G=i.loadLevelObj;return G&&(T==null?void 0:T.bitrate)<G.bitrate?r:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,n,s,r,o){var c;const u=n+s,d=this.lastLoadedFragLevel,f=d===-1?this.hls.firstLevel:d,{fragCurrent:b,partCurrent:x}=this,{levels:T,allAudioTracks:G,loadLevel:$,config:ue}=this.hls;if(T.length===1)return 0;const ge=T[f],fe=!!((c=this.hls.latestLevelDetails)!=null&&c.live),Ce=$===-1||d===-1;let ke,Je="SDR",Pe=(ge==null?void 0:ge.frameRate)||0;const{audioPreference:Ze,videoPreference:nt}=ue,Me=this.audioTracksByGroup||(this.audioTracksByGroup=Rt(G));let At=-1;if(Ce){if(this.firstSelection!==-1)return this.firstSelection;const si=this.codecTiers||(this.codecTiers=Nt(T,Me,t,i)),di=pi(si,Je,e,Ze,nt),{codecSet:ci,videoRanges:wt,minFramerate:kt,minBitrate:xi,minIndex:Si,preferHDR:ki}=di;At=Si,ke=ci,Je=ki?wt[wt.length-1]:wt[0],Pe=kt,e=Math.max(e,xi),this.log(`picked start tier ${Ct(di)}`)}else ke=ge==null?void 0:ge.codecSet,Je=ge==null?void 0:ge.videoRange;const jt=x?x.duration:b?b.duration:0,Oi=this.bwEstimator.getEstimateTTFB()/1e3,yi=[];for(let si=i;si>=t;si--){var hi;const di=T[si],ci=si>f;if(!di)continue;if(ue.useMediaCapabilities&&!di.supportedResult&&!di.supportedPromise){const zi=navigator.mediaCapabilities;typeof(zi==null?void 0:zi.decodingInfo)=="function"&&(pe(di,Me,Je,Pe,e,Ze)||Ke(di.videoCodec))?(di.supportedPromise=be(di,Me,zi),di.supportedPromise.then(qi=>{if(!this.hls)return;di.supportedResult=qi;const Dn=this.hls.levels,kn=Dn.indexOf(di);qi.error?this.warn(`MediaCapabilities decodingInfo error: "${qi.error}" for level ${kn} ${Ct(qi)}`):qi.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${kn} ${Ct(qi)}`),kn>-1&&Dn.length>1&&(this.log(`Removing unsupported level ${kn}`),this.hls.removeLevel(kn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):di.supportedResult=y}if((ke&&di.codecSet!==ke||Je&&di.videoRange!==Je||ci&&Pe>di.frameRate||!ci&&Pe>0&&Pe<di.frameRate||di.supportedResult&&!((hi=di.supportedResult.decodingInfoResults)!=null&&hi[0].smooth))&&(!Ce||si!==At)){yi.push(si);continue}const wt=di.details,kt=(x?wt==null?void 0:wt.partTarget:wt==null?void 0:wt.averagetargetduration)||jt;let xi;ci?xi=o*e:xi=r*e;const Si=jt&&n>=jt*2&&s===0?di.averageBitrate:di.maxBitrate,ki=this.getTimeToLoadFrag(Oi,xi,Si*kt,wt===void 0);if(xi>=Si&&(si===d||di.loadError===0&&di.fragmentError===0)&&(ki<=Oi||!U(ki)||fe&&!this.bitrateTestDelay||ki<u)){const zi=this.forcedAutoLevel;return si!==$&&(zi===-1||zi!==$)&&(yi.length&&this.trace(`Skipped level(s) ${yi.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${T[yi[0]].codecs}" ${T[yi[0]].videoRange}; not compatible with "${ke}" ${Je}`),this.info(`switch candidate:${f}->${si} adjustedbw(${Math.round(xi)})-bitrate=${Math.round(xi-Si)} ttfb:${Oi.toFixed(1)} avgDuration:${kt.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${ki.toFixed(1)} firstSelection:${Ce} codecSet:${di.codecSet} videoRange:${di.videoRange} hls.loadLevel:${$}`)),Ce&&(this.firstSelection=si),si}}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 Qt={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 oi(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!U(e))return null;const i=a[0].programDateTime;if(e<(i||0))return null;const n=a[a.length-1].endProgramDateTime;if(e>=(n||0))return null;t=t||0;for(let s=0;s<a.length;++s){const r=a[s];if(gi(e,t,r))return r}return null}function mi(a,e,t=0,i=0,n=.005){let s=null;if(a){s=e[1+a.sn-e[0].sn]||null;const o=a.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),s&&a.level!==s.level&&s.end<=a.end&&(s=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!a||a.level===s.level)&&Ti(t,i,s)===0||Ei(s,a,Math.min(n,i))))return s;const r=Qt.search(e,Ti.bind(null,t,i));return r&&(r!==a||!s)?r:s}function Ei(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((n,s)=>(s[0]==="INF"&&(n+=parseFloat(s[1])),n),t);return a.start<=i}return!1}function Ti(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=a?1:t.start-i>a&&t.start?-1:0}function gi(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function ui(a,e){return Qt.search(a,t=>t.cc<e?1:t.cc>e?-1:0)}function Li(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){const i=t.start,n=t.end;let s=a.fragments;if(!t.relurl){const{fragmentHint:r}=a;r&&(s=s.concat(r))}return Qt.search(s,r=>r.cc<e||r.end<=i?1:r.cc>e||r.start>=n?-1:0)}return null}function Pi(a){switch(a.details){case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_TIMEOUT:case j.LEVEL_LOAD_TIMEOUT:case j.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function wi(a,e){const t=Pi(e);return a.default[`${t?"timeout":"error"}Retry`]}function bi(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Mi(a){return E(E({},a),{errorRetry:null,timeoutRetry:null})}function Ri(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(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 Ci={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ii={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class on extends H{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ce.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,s=t.context;switch(t.details){case j.FRAG_LOAD_ERROR:case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_ERROR:case j.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case j.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Vi();return}case j.FRAG_GAP:case j.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ci.SendAlternateToPenaltyBox;return}case j.LEVEL_EMPTY_ERROR:case j.LEVEL_PARSING_ERROR:{var r,o;const u=t.parent===ce.MAIN?t.level:n.loadLevel;t.details===j.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(o=r.levelDetails)!=null&&o.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u))}return;case j.LEVEL_LOAD_ERROR:case j.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case j.AUDIO_TRACK_LOAD_ERROR:case j.AUDIO_TRACK_LOAD_TIMEOUT:case j.SUBTITLE_LOAD_ERROR:case j.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const u=n.loadLevelObj;if(u&&(s.type===me.AUDIO_TRACK&&u.hasAudioGroup(s.groupId)||s.type===me.SUBTITLE_TRACK&&u.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=Ci.SendAlternateToPenaltyBox,t.errorAction.flags=Ii.MoveAllAlternatesMatchingHost;return}}return;case j.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.loadLevelObj,d=u==null?void 0:u.attrs["HDCP-LEVEL"];d?t.errorAction={action:Ci.SendAlternateToPenaltyBox,flags:Ii.MoveAllAlternatesMatchingHDCP,hdcpLevel:d}:this.keySystemError(t)}return;case j.BUFFER_ADD_CODEC_ERROR:case j.REMUX_ALLOC_ERROR:case j.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case j.INTERNAL_EXCEPTION:case j.BUFFER_APPENDING_ERROR:case j.BUFFER_FULL_ERROR:case j.LEVEL_SWITCH_ERROR:case j.BUFFER_STALLED_ERROR:case j.BUFFER_SEEK_OVER_HOLE:case j.BUFFER_NUDGE_ON_STALL:t.errorAction=Vi();return}t.type===he.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=wi(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Ri(n,s,Pi(e),e.response))return{action:Ci.RetryRequest,flags:Ii.None,retryConfig:n,retryCount:s};const o=this.getLevelSwitchAction(e,t);return n&&(o.retryConfig=n,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,o=wi(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((d,f)=>d+f.fragmentError,0);if(n&&(e.details!==j.FRAG_GAP&&n.fragmentError++,Ri(o,c,Pi(e),e.response)))return{action:Ci.RetryRequest,flags:Ii.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,i);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var s,r;const u=e.details;n.loadError++,u===j.BUFFER_APPEND_ERROR&&n.fragmentError++;let d=-1;const{levels:f,loadLevel:b,minAutoLevel:x,maxAutoLevel:T}=i;i.autoLevelEnabled||(i.loadLevel=-1);const G=(s=e.frag)==null?void 0:s.type,ue=(G===ce.AUDIO&&u===j.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===j.BUFFER_ADD_CODEC_ERROR||u===j.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:Je})=>n.audioCodec!==Je),fe=e.sourceBufferName==="video"&&(u===j.BUFFER_ADD_CODEC_ERROR||u===j.BUFFER_APPEND_ERROR)&&f.some(({codecSet:Je,audioCodec:Pe})=>n.codecSet!==Je&&n.audioCodec===Pe),{type:Ce,groupId:ke}=(r=e.context)!=null?r:{};for(let Je=f.length;Je--;){const Pe=(Je+b)%f.length;if(Pe!==b&&Pe>=x&&Pe<=T&&f[Pe].loadError===0){var o,c;const Ze=f[Pe];if(u===j.FRAG_GAP&&G===ce.MAIN&&e.frag){const nt=f[Pe].details;if(nt){const Me=mi(e.frag,nt.fragments,e.frag.start);if(Me!=null&&Me.gap)continue}}else{if(Ce===me.AUDIO_TRACK&&Ze.hasAudioGroup(ke)||Ce===me.SUBTITLE_TRACK&&Ze.hasSubtitleGroup(ke))continue;if(G===ce.AUDIO&&(o=n.audioGroups)!=null&&o.some(nt=>Ze.hasAudioGroup(nt))||G===ce.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(nt=>Ze.hasSubtitleGroup(nt))||ue&&n.audioCodec===Ze.audioCodec||!ue&&n.audioCodec!==Ze.audioCodec||fe&&n.codecSet===Ze.codecSet)continue}d=Pe;break}}if(d>-1&&i.loadLevel!==d)return e.levelRetry=!0,this.playlistError=0,{action:Ci.SendAlternateToPenaltyBox,flags:Ii.None,nextAutoLevel:d}}return{action:Ci.SendAlternateToPenaltyBox,flags:Ii.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case Ci.DoNothing:break;case Ci.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==j.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case Ci.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n,hdcpLevel:s,nextAutoLevel:r}=i;switch(n){case Ii.None:this.switchLevel(e,r);break;case Ii.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=ut[ut.indexOf(s)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,r)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===j.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=m(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function Vi(a){const e={action:Ci.DoNothing,flags:Ii.None};return a&&(e.resolved=!0),e}var Ai={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class nn{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let n=i.length;n--;){const s=i[n];if(!s)break;const r=s.end;if(s.start<=e&&r!==null&&e<=r)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:n}=this,s=Object.keys(n);for(let r=s.length;r--;){const o=n[s[r]];if((o==null?void 0:o.body.type)===t&&(!i||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,i,n,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(n==null?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const c=this.fragments[o];if(!c||r>=c.body.sn)return;if(!c.buffered&&(!c.loaded||s)){c.body.type===i&&this.removeFragment(c.body);return}const u=c.range[e];if(u){if(u.time.length===0){this.removeFragment(c.body);return}u.time.some(d=>{const f=!this.isTimeBuffered(d.startPTS,d.endPTS,t);return f&&this.removeFragment(c.body),f})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,n=Zi(i),s=this.fragments[n];if(!s||s.buffered&&i.gap)return;const r=!i.relurl;Object.keys(t).forEach(o=>{const c=i.elementaryStreams[o];if(!c)return;const u=t[o],d=r||c.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,d,u)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=i.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),Yi(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=Qi(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=Zi(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,i,n){const s={time:[],partial:i},r=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||r;for(let d=0;d<n.length;d++){const f=n.start(d)-this.bufferPadding,b=n.end(d)+this.bufferPadding;if(u>=f&&c<=b){s.time.push({startPTS:Math.max(r,n.start(d)),endPTS:Math.min(o,n.end(d))});break}else if(r<b&&o>f){const x=Math.max(r,n.start(d)),T=Math.min(o,n.end(d));T>x&&(s.partial=!0,s.time.push({startPTS:x,endPTS:T}))}else if(o<=f)break}return s}getPartialFragment(e){let t=null,i,n,s,r=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const d=c[u];d&&Yi(d)&&(n=d.body.start-o,s=d.body.end+o,e>=n&&e<=s&&(i=Math.min(e-n,s-e),r<=i&&(t=d.body,r=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Yi(t))}getState(e){const t=Zi(e),i=this.fragments[t];return i?i.buffered?Yi(i)?Ai.PARTIAL:Ai.OK:Ai.APPENDING:Ai.NOT_LOADED}isTimeBuffered(e,t,i){let n,s;for(let r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,s=i.end(r)+this.bufferPadding,e>=n&&t<=s)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,s=Zi(i);this.fragments[s]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:s,type:r}=t;if(i.sn==="initSegment")return;const o=i.type;if(n){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(n)}this.timeRanges=s;const c=s[r];this.detectEvictedFragments(r,c,o,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Zi(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const s=t[i[n]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,s){n&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const o=this.fragments[r];if(!o)return;const c=o.body;c.type!==i||n&&!c.gap||c.start<t&&c.end>e&&(o.buffered||s)&&this.removeFragment(c)})}removeFragment(e){const t=Zi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=Qi(i,s=>s.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const i=(e=this.hls)==null||(t=e.latestLevelDetails)==null?void 0:t.partList;i&&i.forEach(n=>n.clearElementaryStreamInfo())}}function Yi(a){var e,t,i;return a.buffered&&(a.body.gap||((e=a.range.video)==null?void 0:e.partial)||((t=a.range.audio)==null?void 0:t.partial)||((i=a.range.audiovideo)==null?void 0:i.partial))}function Zi(a){return`${a.type}_${a.level}_${a.sn}`}function Qi(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Ki={cbc:0,ctr:1};class Jt{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Ki.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Ki.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function It(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class _i{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(n*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],s=i[1],r=i[2],o=i[3],c=this.invSubMix,u=c[0],d=c[1],f=c[2],b=c[3],x=new Uint32Array(256);let T=0,G=0,$=0;for($=0;$<256;$++)$<128?x[$]=$<<1:x[$]=$<<1^283;for($=0;$<256;$++){let ue=G^G<<1^G<<2^G<<3^G<<4;ue=ue>>>8^ue&255^99,e[T]=ue,t[ue]=T;const ge=x[T],fe=x[ge],Ce=x[fe];let ke=x[ue]*257^ue*16843008;n[T]=ke<<24|ke>>>8,s[T]=ke<<16|ke>>>16,r[T]=ke<<8|ke>>>24,o[T]=ke,ke=Ce*16843009^fe*65537^ge*257^T*16843008,u[ue]=ke<<24|ke>>>8,d[ue]=ke<<16|ke>>>16,f[ue]=ke<<8|ke>>>24,b[ue]=ke,T?(T=ge^x[x[x[Ce^ge]]],G^=x[x[G]]):T=G=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n<t.length&&i;)i=t[n]===this.key[n],n++;if(i)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const r=this.ksRows=(s+6+1)*4;let o,c;const u=this.keySchedule=new Uint32Array(r),d=this.invKeySchedule=new Uint32Array(r),f=this.sBox,b=this.rcon,x=this.invSubMix,T=x[0],G=x[1],$=x[2],ue=x[3];let ge,fe;for(o=0;o<r;o++){if(o<s){ge=u[o]=t[o];continue}fe=ge,o%s===0?(fe=fe<<8|fe>>>24,fe=f[fe>>>24]<<24|f[fe>>>16&255]<<16|f[fe>>>8&255]<<8|f[fe&255],fe^=b[o/s|0]<<24):s>6&&o%s===4&&(fe=f[fe>>>24]<<24|f[fe>>>16&255]<<16|f[fe>>>8&255]<<8|f[fe&255]),u[o]=ge=(u[o-s]^fe)>>>0}for(c=0;c<r;c++)o=r-c,c&3?fe=u[o]:fe=u[o-4],c<4||o<=4?d[c]=fe:d[c]=T[f[fe>>>24]]^G[f[fe>>>16&255]]^$[f[fe>>>8&255]]^ue[f[fe&255]],d[c]=d[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const n=this.keySize+6,s=this.invKeySchedule,r=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],d=o[2],f=o[3],b=this.uint8ArrayToUint32Array_(i);let x=b[0],T=b[1],G=b[2],$=b[3];const ue=new Int32Array(e),ge=new Int32Array(ue.length);let fe,Ce,ke,Je,Pe,Ze,nt,Me,At,jt,Oi,yi,hi,si;const di=this.networkToHostOrderSwap;for(;t<ue.length;){for(At=di(ue[t]),jt=di(ue[t+1]),Oi=di(ue[t+2]),yi=di(ue[t+3]),Pe=At^s[0],Ze=yi^s[1],nt=Oi^s[2],Me=jt^s[3],hi=4,si=1;si<n;si++)fe=c[Pe>>>24]^u[Ze>>16&255]^d[nt>>8&255]^f[Me&255]^s[hi],Ce=c[Ze>>>24]^u[nt>>16&255]^d[Me>>8&255]^f[Pe&255]^s[hi+1],ke=c[nt>>>24]^u[Me>>16&255]^d[Pe>>8&255]^f[Ze&255]^s[hi+2],Je=c[Me>>>24]^u[Pe>>16&255]^d[Ze>>8&255]^f[nt&255]^s[hi+3],Pe=fe,Ze=Ce,nt=ke,Me=Je,hi=hi+4;fe=r[Pe>>>24]<<24^r[Ze>>16&255]<<16^r[nt>>8&255]<<8^r[Me&255]^s[hi],Ce=r[Ze>>>24]<<24^r[nt>>16&255]<<16^r[Me>>8&255]<<8^r[Pe&255]^s[hi+1],ke=r[nt>>>24]<<24^r[Me>>16&255]<<16^r[Pe>>8&255]<<8^r[Ze&255]^s[hi+2],Je=r[Me>>>24]<<24^r[Pe>>16&255]<<16^r[Ze>>8&255]<<8^r[nt&255]^s[hi+3],ge[t]=di(fe^x),ge[t+1]=di(Je^T),ge[t+2]=di(ke^G),ge[t+3]=di(Ce^$),x=At,T=jt,G=Oi,$=yi,t=t+4}return ge.buffer}}class Fi{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=Bi(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Bi(a){switch(a){case Ki.cbc:return"AES-CBC";case Ki.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const gn=16;class ln{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(i){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?It(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,n){return this.useSoftware?new Promise((s,r)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,n);const c=this.flush();c?s(c.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:s,currentResult:r,remainderData:o}=this;if(n!==Ki.cbc||t.byteLength!==16)return ee.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=He(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(i=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new _i),u.expandKey(t);const d=r;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,d||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new Fi(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Jt(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(ee.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%gn;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(ee.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const sn=Math.pow(2,17);class hn{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(T=>T[0]==="GAP")){c(_n(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),d=fn(e);e.loader=u;const f=Mi(n.fragLoadPolicy.default),b={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:sn};e.stats=u.stats;const x={onSuccess:(T,G,$,ue)=>{this.resetLoader(e,u);let ge=T.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:ue})},onError:(T,G,$,ue)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:i,data:void 0},T),error:new Error(`HTTP Error ${T.code} ${T.text}`),networkDetails:$,stats:ue}))},onAbort:(T,G,$)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:$,stats:T}))},onTimeout:(T,G,$)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${b.timeout}ms`),networkDetails:$,stats:T}))}};t&&(x.onProgress=(T,G,$,ue)=>t({frag:e,part:null,payload:$,networkDetails:ue})),u.load(d,b,x)})}loadPart(e,t,i){this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(_n(e,t));return}const u=this.loader=s?new s(n):new r(n),d=fn(e,t);e.loader=u;const f=Mi(n.fragLoadPolicy.default),b={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:sn};t.stats=u.stats,u.load(d,b,{onSuccess:(x,T,G,$)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const ue={frag:e,part:t,payload:x.data,networkDetails:$};i(ue),o(ue)},onError:(x,T,G,$)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:d.url,data:void 0},x),error:new Error(`HTTP Error ${x.code} ${x.text}`),networkDetails:G,stats:$}))},onAbort:(x,T,G)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:G,stats:x}))},onTimeout:(x,T,G)=>{this.resetLoader(e,u),c(new Ui({type:he.NETWORK_ERROR,details:j.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${b.timeout}ms`),networkDetails:G,stats:x}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,s=n.total;if(i.loaded+=n.loaded,s){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(i.loaded/s),c),f=(c-u)*Math.round(i.loaded/u);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);const r=i.loading,o=n.loading;r.start?r.first+=o.first-o.start:(r.start=o.start,r.first=o.first),r.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function fn(a,e=null){const t=e||a,i={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(U(n)&&U(s)){var r;let o=n,c=s;if(a.sn==="initSegment"&&xn((r=a.decryptdata)==null?void 0:r.method)){const u=s-n;u%16&&(c=s+(16-u%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=c}return i}function _n(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:he.MEDIA_ERROR,details:j.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new Ui(i)}function xn(a){return a==="AES-128"||a==="AES-256"}class Ui extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class vn extends H{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class yn{constructor(e,t,i,n=0,s=-1,r=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=pn(),this.buffering={audio:pn(),video:pn(),audiovideo:pn()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function pn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const dn={length:0,start:()=>0,end:()=>0};class fi{static isBuffered(e,t){if(e){const i=fi.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=fi.getBuffered(e);return fi.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=fi.bufferedRanges(e);if(n.length)return fi.bufferedInfo(n,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((d,f)=>d.start-f.start||f.end-d.end);let n=-1,s=[];if(i)for(let d=0;d<e.length;d++){t>=e[d].start&&t<=e[d].end&&(n=d);const f=s.length;if(f){const b=s[f-1].end;e[d].start-b<i?e[d].end>b&&(s[f-1].end=e[d].end):s.push(e[d])}else s.push(e[d])}else s=e;let r=0,o,c=t,u=t;for(let d=0;d<s.length;d++){const f=s[d].start,b=s[d].end;if(n===-1&&t>=f&&t<=b&&(n=d),t+i>=f&&t<b)c=f,u=b,r=u-t;else if(t+i<f){o=f;break}}return{len:r,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||dn}catch(t){return ee.log("failed to get media.buffered",t),dn}}}const Pn=/\{\$([a-zA-Z0-9-_]+)\}/g;function Tn(a){return Pn.test(a)}function Gn(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Pn,i=>{const n=i.substring(2,i.length-1),s=t==null?void 0:t[n];return s===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):s})}return e}function On(a,e,t){let i=a.variableList;i||(a.variableList=i={});let n,s;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(n))s=r.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(r){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else n=e.NAME,s=e.VALUE;n in i?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=s||""}function qn(a,e,t){const i=e.IMPORT;if(t&&i in t){let n=a.variableList;n||(a.variableList=n={}),n[i]=t[i]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const Mn=/^(\d+)x(\d+)$/,Qn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Wi{constructor(e,t){typeof e=="string"&&(e=Wi.parseAttrList(e,t)),g(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let n=0;n<t.length/2;n++)i[n]=parseInt(t.slice(n*2,n*2+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((n,s)=>(n[s.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Mn.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={},s='"';for(Qn.lastIndex=0;(i=Qn.exec(e))!==null;){const r=i[1].trim();let o=i[2];const c=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let u=!1;if(c)o=o.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))o=Gn(t,o);else if(!u&&!c)switch(r){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":ee.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const Vn="com.apple.hls.interstitial";function An(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function as(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class Jn{constructor(e,t,i=0){var n;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(n=t==null?void 0:t.tagOrder)!=null?n:i,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){ee.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=g(new Wi({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);U(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?(ee.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(U(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Vn}get isValid(){return!!this.id&&!this._badValueForSameId&&U(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const jn=10;class es{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?U(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||jn}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function wn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Rn(a){switch(a){case"AES-128":case"AES-256":return Ki.cbc;case"AES-256-CTR":return Ki.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function un(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function In(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function mn(a){const e=In(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Nn(a){const e=function(i,n,s){const r=i[n];i[n]=i[s],i[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function Ji(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const s=n[0]==="base64",r=n[1];s?(i.splice(-1,1),t=un(r)):t=mn(r)}}return t}const en=typeof self!="undefined"?self:void 0;var Di={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},cn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Wn(a){switch(a){case cn.FAIRPLAY:return Di.FAIRPLAY;case cn.PLAYREADY:return Di.PLAYREADY;case cn.WIDEVINE:return Di.WIDEVINE;case cn.CLEARKEY:return Di.CLEARKEY}}var ts={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function os(a){if(a===ts.WIDEVINE)return Di.WIDEVINE;if(a===ts.PLAYREADY)return Di.PLAYREADY;if(a===ts.CENC||a===ts.CLEARKEY)return Di.CLEARKEY}function Hn(a){switch(a){case Di.FAIRPLAY:return cn.FAIRPLAY;case Di.PLAYREADY:return cn.PLAYREADY;case Di.WIDEVINE:return cn.WIDEVINE;case Di.CLEARKEY:return cn.CLEARKEY}}function qt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[Di.FAIRPLAY,Di.WIDEVINE,Di.PLAYREADY,Di.CLEARKEY].filter(n=>!!e[n]):[];return!i[Di.WIDEVINE]&&t&&i.push(Di.WIDEVINE),i}const vi=function(a){return en!=null&&(a=en.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Hi(a,e,t,i){let n;switch(a){case Di.FAIRPLAY:n=["cenc","sinf"];break;case Di.WIDEVINE:case Di.PLAYREADY:n=["cenc"];break;case Di.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return rn(n,e,t,i)}function rn(a,e,t,i){return[{initDataTypes:a,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Xi(a){var e;return a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function ls(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=un(o).subarray(0,16);return Nn(c),c}}return null}let Zn={};class bn{static clearKeyUriToKeyIdMap(){Zn={}}constructor(e,t,i,n=[1],s=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!wn(e)}isSupported(){if(this.method){if(wn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case cn.FAIRPLAY:case cn.WIDEVINE:case cn.PLAYREADY:case cn.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(wn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(ee.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=ds(e);return new bn(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=Ji(this.uri);if(t)switch(this.keyFormat){case cn.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case cn.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Mt(i,null,t),this.keyId=ls(t);break}default:{let i=t.subarray(0,16);if(i.length!==16){const n=new Uint8Array(16);n.set(i,16-i.length),i=n}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=Zn[this.uri];if(!i){const n=Object.keys(Zn).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),Zn[this.uri]=i}this.keyId=i}return this}}function ds(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const or=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Ks=/#EXT-X-MEDIA:(.*)/g,Mr=/^#EXT(?:INF|-X-TARGETDURATION):/m,$s=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Nr=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Fn{static findGroup(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}}static resolve(e,t){return te.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Mr.test(e)}static parseMasterPlaylist(e,t){const i=Tn(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];or.lastIndex=0;let r;for(;(r=or.exec(e))!=null;)if(r[1]){var o;const u=new Wi(r[1],n),d=Gn(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Fn.resolve(d,t)},b=u.decimalResolution("RESOLUTION");b&&(f.width=b.width,f.height=b.height),Gs(u.CODECS,f);const x=u["SUPPLEMENTAL-CODECS"];x&&(f.supplemental={},Gs(x,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),n.levels.push(f)}else if(r[3]){const u=r[3],d=r[4];switch(u){case"SESSION-DATA":{const f=new Wi(d,n),b=f["DATA-ID"];b&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[b]=f);break}case"SESSION-KEY":{const f=Rs(d,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):ee.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const f=new Wi(d,n);On(n,f,t)}break}case"CONTENT-STEERING":{const f=new Wi(d,n);n.contentSteering={uri:Fn.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=is(d);break}}}const c=s.length>0&&s.length<n.levels.length;return n.levels=c?s:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,i){let n;const s={},r=i.levels,o={AUDIO:r.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:r.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(Ks.lastIndex=0;(n=Ks.exec(e))!==null;){const u=new Wi(n[1],i),d=u.TYPE;if(d){const f=o[d],b=s[d]||[];s[d]=b;const x=u.LANGUAGE,T=u["ASSOC-LANGUAGE"],G=u.CHANNELS,$=u.CHARACTERISTICS,ue=u["INSTREAM-ID"],ge={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||x||"",type:d,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:x,url:u.URI?Fn.resolve(u.URI,t):""};if(T&&(ge.assocLang=T),G&&(ge.channels=G),$&&(ge.characteristics=$),ue&&(ge.instreamId=ue),f!=null&&f.length){const fe=Fn.findGroup(f,ge.groupId)||f[0];Vs(ge,fe,"audioCodec"),Vs(ge,fe,"textCodec")}b.push(ge)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new es(t),d=u.fragments,f=[];let b=null,x=0,T=0,G=0,$=0,ue=0,ge=null,fe=new xe(n,c),Ce,ke,Je,Pe=-1,Ze=!1,nt=null,Me;if($s.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Tn(e),((o=$s.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(Ce=$s.exec(e))!==null;){Ze&&(Ze=!1,fe=new xe(n,c),fe.playlistOffset=G,fe.start=G,fe.sn=x,fe.cc=$,ue&&(fe.bitrate=ue),fe.level=i,b&&(fe.initSegment=b,b.rawProgramDateTime&&(fe.rawProgramDateTime=b.rawProgramDateTime,b.rawProgramDateTime=null),nt&&(fe.setByteRange(nt),nt=null)));const yi=Ce[1];if(yi){fe.duration=parseFloat(yi);const hi=(" "+Ce[2]).slice(1);fe.title=hi||null,fe.tagList.push(hi?["INF",yi,hi]:["INF",yi])}else if(Ce[3]){if(U(fe.duration)){fe.playlistOffset=G,fe.start=G,Je&&js(fe,Je,u),fe.sn=x,fe.level=i,fe.cc=$,d.push(fe);const hi=(" "+Ce[3]).slice(1);fe.relurl=Gn(u,hi),Ls(fe,ge,f),ge=fe,G+=fe.duration,x++,T=0,Ze=!0}}else{if(Ce=Ce[0].match(Nr),!Ce){ee.warn("No matches on slow regex match for level playlist!");continue}for(ke=1;ke<Ce.length&&Ce[ke]===void 0;ke++);const hi=(" "+Ce[ke]).slice(1),si=(" "+Ce[ke+1]).slice(1),di=Ce[ke+2]?(" "+Ce[ke+2]).slice(1):null;switch(hi){case"BYTERANGE":ge?fe.setByteRange(si,ge):fe.setByteRange(si);break;case"PROGRAM-DATE-TIME":fe.rawProgramDateTime=si,fe.tagList.push(["PROGRAM-DATE-TIME",si]),Pe===-1&&(Pe=d.length);break;case"PLAYLIST-TYPE":u.type&&zn(u,hi,Ce),u.type=si.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?zn(u,hi,Ce):d.length>0&&ur(u,hi,Ce),x=u.startSN=parseInt(si);break;case"SKIP":{u.skippedSegments&&zn(u,hi,Ce);const ci=new Wi(si,u),wt=ci.decimalInteger("SKIPPED-SEGMENTS");if(U(wt)){u.skippedSegments+=wt;for(let xi=wt;xi--;)d.push(null);x+=wt}const kt=ci.enumeratedString("RECENTLY-REMOVED-DATERANGES");kt&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(kt.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&zn(u,hi,Ce),u.targetduration=Math.max(parseInt(si),1);break;case"VERSION":u.version!==null&&zn(u,hi,Ce),u.version=parseInt(si);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||zn(u,hi,Ce),u.live=!1;break;case"#":(si||di)&&fe.tagList.push(di?[si,di]:[si]);break;case"DISCONTINUITY":$++,fe.tagList.push(["DIS"]);break;case"GAP":fe.gap=!0,fe.tagList.push([hi]);break;case"BITRATE":fe.tagList.push([hi,si]),ue=parseInt(si)*1e3,U(ue)?fe.bitrate=ue:ue=0;break;case"DATERANGE":{const ci=new Wi(si,u),wt=new Jn(ci,u.dateRanges[ci.ID],u.dateRangeTagCount);u.dateRangeTagCount++,wt.isValid||u.skippedSegments?u.dateRanges[wt.id]=wt:ee.warn(`Ignoring invalid DATERANGE tag: "${si}"`),fe.tagList.push(["EXT-X-DATERANGE",si]);break}case"DEFINE":{{const ci=new Wi(si,u);"IMPORT"in ci?qn(u,ci,r):On(u,ci,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?zn(u,hi,Ce):d.length>0&&ur(u,hi,Ce),u.startCC=$=parseInt(si);break;case"KEY":{const ci=Rs(si,t,u);if(ci.isSupported()){if(ci.method==="NONE"){Je=void 0;break}Je||(Je={}),Je[ci.keyFormat]&&(Je=g({},Je)),Je[ci.keyFormat]=ci}else ee.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${si}"`);break}case"START":u.startTimeOffset=is(si);break;case"MAP":{const ci=new Wi(si,u);if(fe.duration){const wt=new xe(n,c);lr(wt,ci,i,Je),b=wt,fe.initSegment=b,b.rawProgramDateTime&&!fe.rawProgramDateTime&&(fe.rawProgramDateTime=b.rawProgramDateTime)}else{const wt=fe.byteRangeEndOffset;if(wt){const kt=fe.byteRangeStartOffset;nt=`${wt-kt}@${kt}`}else nt=null;lr(fe,ci,i,Je),b=fe,Ze=!0}b.cc=$;break}case"SERVER-CONTROL":{Me&&zn(u,hi,Ce),Me=new Wi(si),u.canBlockReload=Me.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Me.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Me.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Me.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Me.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&zn(u,hi,Ce);const ci=new Wi(si);u.partTarget=ci.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ci=u.partList;ci||(ci=u.partList=[]);const wt=T>0?ci[ci.length-1]:void 0,kt=T++,xi=new Wi(si,u),Si=new Fe(xi,fe,c,kt,wt);ci.push(Si),fe.duration+=Si.duration;break}case"PRELOAD-HINT":{const ci=new Wi(si,u);u.preloadHint=ci;break}case"RENDITION-REPORT":{const ci=new Wi(si,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(ci);break}default:ee.warn(`line parsed but not handled: ${Ce}`);break}}}ge&&!ge.relurl?(d.pop(),G-=ge.duration,u.partList&&(u.fragmentHint=ge)):u.partList&&(Ls(fe,ge,f),fe.cc=$,u.fragmentHint=fe,Je&&js(fe,Je,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const At=d.length,jt=d[0],Oi=d[At-1];if(G+=u.skippedSegments*u.targetduration,G>0&&At&&Oi){u.averagetargetduration=G/At;const yi=Oi.sn;u.endSN=yi!=="initSegment"?yi:0,u.live||(Oi.endList=!0),jt&&u.startCC===void 0&&(u.startCC=jt.cc),Pe>0&&(Br(d,Pe),jt&&f.unshift(jt))}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(G+=u.fragmentHint.duration),u.totalduration=G,f.length&&u.dateRangeTagCount&&jt&&vs(f,u),u.endCC=$,u}}function vs(a,e){const t=a.length,i=a[t-1],n=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let r=s.length;r--;){const o=e.dateRanges[s[r]],c=o.startDate.getTime();o.tagAnchor=i.ref;for(let u=t;u--;){const d=Fr(e,c,a,u,n);if(d!==-1){o.tagAnchor=e.fragments[d].ref;break}}}}function Fr(a,e,t,i,n){const s=t[i];if(s){const o=s.programDateTime;if(e>=o||i===0){var r;const c=(((r=t[i+1])==null?void 0:r.start)||n)-s.start;if(e<=o+c*1e3){const u=t[i].sn-a.startSN,d=a.fragments;if(d.length>t.length){const b=(t[i+1]||d[d.length-1]).sn-a.startSN;for(let x=b;x>u;x--){const T=d[x].programDateTime;if(e>=T&&e<T+d[x].duration*1e3)return x}}return u}}}return-1}function Rs(a,e,t){var i,n;const s=new Wi(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,d=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!c&&ee.error(`Invalid IV: ${s.IV}`);const f=o?Fn.resolve(o,e):"",b=(u||"1").split("/").map(Number).filter(Number.isFinite);return new bn(r,f,d,b,c)}function is(a){const t=new Wi(a).decimalFloatingPoint("TIME-OFFSET");return U(t)?t:null}function Gs(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>ri(s,i));n.length&&(e[`${i}Codec`]=n.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>n.indexOf(s)===-1))}),e.unknownCodecs=t}function Vs(a,e,t){const i=e[t];i&&(a[t]=i)}function Br(a,e){let t=a[e];for(let i=e;i--;){const n=a[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function Ls(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function lr(a,e,t,i){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",i&&(a.levelkeys=i),a.initSegment=null}function js(a,e,t){a.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(a)}function zn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function ur(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Ws(a,e){const t=e.startPTS;if(U(t)){let i=0,n;e.sn>a.sn?(i=t-a.start,n=a):(i=a.start-t,n=e),n.duration!==i&&n.setDuration(i)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function cr(a,e,t,i,n,s){i-t<=0&&(ee.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(U(u)){const $=Math.abs(u-t);U(e.deltaPTS)?e.deltaPTS=Math.max($,e.deltaPTS):e.deltaPTS=$,o=Math.max(t,u),t=Math.min(t,u),n=Math.min(n,e.startDTS),c=Math.min(i,d),i=Math.max(i,d),s=Math.max(s,e.endDTS)}const f=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=o,e.startDTS=n,e.endPTS=i,e.minEndPTS=c,e.endDTS=s;const b=e.sn;if(!a||b<a.startSN||b>a.endSN)return 0;let x;const T=b-a.startSN,G=a.fragments;for(G[T]=e,x=T;x>0;x--)Ws(G[x],G[x-1]);for(x=T;x<G.length-1;x++)Ws(G[x],G[x+1]);return a.fragmentHint&&Ws(G[G.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,f}function hr(a,e){if(a===e)return;let t=null;const i=a.fragments;for(let c=i.length-1;c>=0;c--){const u=i[c].initSegment;if(u){t=u;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let n;Ur(a,e,(c,u,d,f)=>{if(!e.startCC&&u.cc!==c.cc){var b,x;const T=c.cc-u.cc;for(let G=d;G<f.length;G++)f[G].cc+=T;e.startCC=(b=(x=pr(a,e.startSN-1))==null?void 0:x.cc)!=null?b:f[0].cc,e.endCC=f[f.length-1].cc}U(c.startPTS)&&U(c.endPTS)&&(u.setStart(u.startPTS=c.startPTS),u.startDTS=c.startDTS,u.maxStartPTS=c.maxStartPTS,u.endPTS=c.endPTS,u.endDTS=c.endDTS,u.minEndPTS=c.minEndPTS,u.setDuration(c.endPTS-c.startPTS),u.duration&&(n=u),e.PTSKnown=e.alignedSliding=!0),c.hasStreams&&(u.elementaryStreams=c.elementaryStreams),u.loader=c.loader,c.hasStats&&(u.stats=c.stats),c.initSegment&&(u.initSegment=c.initSegment,t=c.initSegment)});const s=e.fragments,r=e.fragmentHint?s.concat(e.fragmentHint):s;if(t&&r.forEach(c=>{var u;c&&(!c.initSegment||c.initSegment.relurl===((u=t)==null?void 0:u.relurl))&&(c.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=s.some(c=>!c),e.deltaUpdateFailed){ee.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let c=e.skippedSegments;c--;)s.shift();e.startSN=s[0].sn}else{e.endCC=s[s.length-1].cc,e.canSkipDateRanges&&(e.dateRanges=ys(a.dateRanges,e));const c=a.fragments.filter(u=>u.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<r.length;u++)r[u].programDateTime===null&&Ls(r[u],r[u-1],c);vs(c,e)}Hs(a.partList,e.partList,(c,u)=>{u.elementaryStreams=c.elementaryStreams,u.stats=c.stats}),n?cr(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):fr(a,e),s.length&&(e.totalduration=e.edge-s[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const c=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=c),e.driftEndTime=o,e.driftEnd=c}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function ys(a,e){const{dateRanges:t,recentlyRemovedDateranges:i}=e,n=g({},a);i&&i.forEach(o=>{delete n[o]});const r=Object.keys(n).length;return r&&Object.keys(t).forEach(o=>{const c=n[o],u=new Jn(t[o].attr,c);u.isValid?(n[o]=u,c||(u.tagOrder+=r)):ee.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Ct(t[o].attr)}"`)}),n}function Hs(a,e,t){if(a&&e){let i=0;for(let n=0,s=a.length;n<=s;n++){const r=a[n],o=e[n+i];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):i--}}}function Ur(a,e,t){const i=e.skippedSegments,n=Math.max(a.startSN,e.startSN)-e.startSN,s=(a.fragmentHint?1:0)+(i?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,r=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=n;u<=s;u++){const d=c[r+u];let f=o[u];if(i&&!f&&d&&(f=e.fragments[u]=d),d&&f){if(t(d,f,u,o),d.url&&d.url!==f.url){e.playlistParsingError=dr(`media sequence mismatch ${f.sn}:`,a,e,d,f);return}else if(d.cc!==f.cc){e.playlistParsingError=dr(`discontinuity sequence mismatch (${d.cc}!=${f.cc})`,a,e,d,f);return}}}}function dr(a,e,t,i,n){return new Error(`${a} ${n.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function fr(a,e,t=!0){const i=e.startSN+e.skippedSegments-a.startSN,n=a.fragments,s=i>=0;let r=0;if(s&&i<n.length)r=n[i].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)r=a.fragmentStart;else return;Is(e,r)}function Is(a,e){if(e){const t=a.fragments;for(let i=a.skippedSegments;i<t.length;i++)t[i].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function Es(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const i=a.fragments;if(i.length&&t*4>e){const s=i[i.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function pr(a,e,t){if(!a)return null;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function mr(a,e,t){return a?gr(a.partList,e,t):null}function gr(a,e,t){if(a)for(let i=a.length;i--;){const n=a[i];if(n.index===t&&n.fragment.sn===e)return n}return null}function Zs(a){a.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function bs(a,e){for(let i=0,n=a.length;i<n;i++){var t;if(((t=a[i])==null?void 0:t.cc)===e)return a[i]}return null}function Kr(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function _r(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function vr(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)_r(t[i],a);e.fragmentHint&&_r(e.fragmentHint,a),e.alignedSliding=!0}function $r(a,e){a&&(an(e,a),!e.alignedSliding&&a&&$i(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&fr(a,e,!1))}function an(a,e){if(!Kr(e,a))return;const t=Math.min(e.endCC,a.endCC),i=bs(e.fragments,t),n=bs(a.fragments,t);if(!i||!n)return;ee.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;vr(s,a)}function $i(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,i=e.fragments;if(!t.length||!i.length)return;let n,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(n=bs(i,r),s=bs(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=bs(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,c=s.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(s.start-n.start);vr(u,a)}const tn={toString:function(a){let e="";const t=a.length;for(let i=0;i<t;i++)e+=`[${a.start(i).toFixed(3)}-${a.end(i).toFixed(3)}]`;return e}},it={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Sn extends vn{constructor(e,t,i,n,s){super(n,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=it.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:r,fragCurrent:o,media:c,mediaBuffer:u,state:d}=this,f=c?c.currentTime:0,b=fi.bufferInfo(u||c,f,r.maxBufferHole);if(this.log(`media seeking to ${U(f)?f.toFixed(3):f}, state: ${d}`),this.state===it.ENDED)this.resetLoadingState();else if(o){const x=r.maxFragLookUpTolerance,T=o.start-x,G=o.start+o.duration+x;if(!b.len||G<b.start||T>b.end){const $=f>G;(f<T||$)&&($&&o.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const x=this.lastCurrentTime;if(f>x&&(this.lastCurrentTime=f),!this.loadingParts){const T=Math.max(b.end,f),G=this.shouldLoadParts(this.getLevelDetails(),T);G&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${T.toFixed(2)}`),this.loadingParts=G)}}!this.hls.hasEnoughToStart&&!b.len&&(this.log(`setting startPosition to ${f} because of seek before start`),this.nextLoadPosition=this.startPosition=f),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new hn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new ln(e.config)}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===it.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=it.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const s=e.nextStart;if(s&&s>n&&s<t.edge||this.media.currentTime<e.start)return!1;const o=t.partList;if(o!=null&&o.length){const u=o[o.length-1];return fi.isBuffered(this.media,u.start+u.duration/2)}const c=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;i.removeEventListener("seeking",this.onMediaSeeking),i.removeEventListener("ended",this.onMediaEnded),i.addEventListener("seeking",this.onMediaSeeking),i.addEventListener("ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===it.STOPPED&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(n!==null){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n.removeEventListener("seeking",this.onMediaSeeking),n.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=it.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const n=s=>{const r=s.frag;if(this.fragContextChanged(r)){this.warn(`${r.type} sn: ${r.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(r,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(r);return}r.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,i,n).then(s=>{if(!s)return;const r=this.state,o=s.frag;if(this.fragContextChanged(o)){(r===it.FRAG_LOADING||!this.fragCurrent&&r===it.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=it.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(p.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===it.STOPPED||this.state===it.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Ai.APPENDING){const s=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,r?r.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Ai.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(p.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const n=i==null?void 0:i.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{frag:s,payload:r}=i,o=s.decryptdata;if(r&&r.byteLength>0&&o!=null&&o.key&&o.iv&&wn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,Rn(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const d=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:d}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===it.STOPPED||this.state===it.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==it.STOPPED&&(this.state=it.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?tn.toString(fi.getBuffered(i)):"(detached)"})`),ae(e)){var n;if(e.type!==ce.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=it.IDLE;return}}const s=(n=this.levels)==null?void 0:n[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=it.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:s}=e,r=!s||s.length===0||s.some(c=>!c),o=new yn(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!r);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var s;this.fragCurrent=e;const r=t==null?void 0:t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let o=null;e.encrypted&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=it.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(p.KEY_LOADED,f),this.state===it.KEY_LOADING&&(this.state=it.IDLE),f}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&r.encryptedFragments.length&&this.keyLoader.loadClear(e,r.encryptedFragments);const c=this.fragPrevious;if(ae(e)&&(!c||e.sn!==c.sn)){const f=this.shouldLoadParts(t.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=f)}if(i=Math.max(e.start,i||0),this.loadingParts&&ae(e)){const f=r.partList;if(f&&n){i>e.end&&r.fragmentHint&&(e=r.fragmentHint);const b=this.getNextPart(f,e,i);if(b>-1){const x=f[b];e=this.fragCurrent=x.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${x.index} (${b}/${f.length-1}) of ${this.fragInfo(e,!1,x)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=x.start+x.duration,this.state=it.FRAG_LOADING;let T;return o?T=o.then(G=>!G||this.fragContextChanged(G.frag)?null:this.doFragPartsLoad(e,x,t,n)).catch(G=>this.handleFragLoadError(G)):T=this.doFragPartsLoad(e,x,t,n).catch(G=>this.handleFragLoadError(G)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:x,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):T}else if(!e.url||this.loadedEndOfParts(f,i))return Promise.resolve(null)}}if(ae(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${r?"["+r.startSN+"-"+r.endSN+"]":""}, target: ${parseFloat(i.toFixed(3))}`),U(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=it.FRAG_LOADING;const u=this.config.progressive;let d;return u&&o?d=o.then(f=>!f||this.fragContextChanged(f==null?void 0:f.frag)?null:this.fragmentLoader.load(e,n)).catch(f=>this.handleFragLoadError(f)):d=Promise.all([this.fragmentLoader.load(e,u?n:void 0),o]).then(([f])=>(!u&&f&&n&&n(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,i,n){return new Promise((s,r)=>{var o;const c=[],u=(o=i.details)==null?void 0:o.partList,d=f=>{this.fragmentLoader.loadPart(e,f,n).then(b=>{c[f.index]=b;const x=b.part;this.hls.trigger(p.FRAG_LOADED,b);const T=mr(i.details,e.sn,f.index+1)||gr(u,e.sn,f.index+1);if(T)d(T);else return s({frag:e,part:x,partsLoaded:c})}).catch(r)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===j.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==it.PARSING){!this.fragCurrent&&this.state!==it.STOPPED&&this.state!==it.ERROR&&(this.state=it.IDLE);return}const{frag:i,part:n,level:s}=t,r=self.performance.now();i.stats.parsing.end=r,n&&(n.stats.parsing.end=r);const o=this.getLevelDetails(),u=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(i,n,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var i;const s=e.partList[0],r=s.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=r){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:s,part:r}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const o=t[n],c=o.details,u=r>-1?mr(c,s,r):null,d=u?u.fragment:pr(c,s,i);return d?(i&&i!==d&&(d.stats=i.stats),{frag:d,part:u,level:o}):null}bufferFragmentData(e,t,i,n,s){var r;if(!e||this.state!==it.PARSING)return;const{data1:o,data2:c}=e;let u=o;if(o&&c&&(u=He(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(!fi.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=fi.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(!U(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=fi.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 fi.bufferInfo(e,t,o)}}return s}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),s=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return s>=n?(i.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=ce.MAIN){var i;const n=(i=this.fragmentTracker)==null?void 0:i.getAppendedFrag(e,t);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:s}=this,r=i[0].start,o=s.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const f=s.initialLiveManifestSize;if(n<f)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t,i);const b=this.hls.startPosition,x=this.hls.liveSyncPosition,T=c?(b!==-1&&b>=r?b:x)||c.start:e;this.log(`Setting startPosition to ${T} to match start frag at live edge. mainStart: ${b} liveSyncPosition: ${x} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=T}}else e<=r&&(c=i[0]);if(!c){const f=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,f,t)}let d=this.filterReplacedPrimary(c,t);if(!d&&c){const f=c.sn-t.startSN;d=this.filterReplacedPrimary(i[f+1]||null,t)}return this.mapToInitFragWhenRequired(d)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Ai.OK||i===Ai.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&i.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(o!==null&&i.len+o.len>=s){const c=r.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(Ss(this.hls.config)){var e,t;if((e=this.hls.interstitialsManager)==null||(t=e.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Ss(this.hls.config)&&e.type!==ce.SUBTITLE){const i=this.hls.interstitialsManager,n=i==null?void 0:i.bufferingItem;if(n){const r=n.event;if(r){if(r.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&(t==null?void 0:t.live)===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const s=i==null?void 0:i.playerQueue;if(s)for(let r=s.length;r--;){const o=s[r].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let n=-1,s=!1,r=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(r=r&&!u.independent,n>-1&&i<u.start)break;const d=u.loaded;d?n=-1:(s||u.independent||r)&&u.fragment===t&&(n=o),s=d}return n}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=oi(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=ui(t,i.cc),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:u}=n,d=i.partList,f=!!(this.loadingParts&&d!=null&&d.length&&c);f&&c&&!this.bitrateTest&&d[d.length-1].fragment.sn===c.sn&&(r=r.concat(c),o=c.sn);let b;if(e<t){var x;const G=e<this.lastCurrentTime||e>t-u||(x=this.media)!=null&&x.paused||!this.startFragRequested?0:u;b=mi(s,r,e,G)}else b=r[r.length-1];if(b){const T=b.sn-i.startSN,G=this.fragmentTracker.getState(b);if((G===Ai.OK||G===Ai.PARTIAL&&b.gap)&&(s=b),s&&b.sn===s.sn&&(!f||d[0].fragment.sn>b.sn||!i.live&&!f)&&s&&b.level===s.level){const ue=r[T+1];b.sn<o&&this.fragmentTracker.getState(ue)!==Ai.OK?b=ue:b=null}}return b}alignPlaylists(e,t,i){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,o=e.alignedSliding&&U(s);if(r||!o&&!s){$r(i,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),c}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const n=this.timelineOffset;if(i===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&U(r)?(i=t+r,r<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+n}this.nextLoadPosition=i+n}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&ae(e)&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==it.FRAG_LOADING_WAITING_RETRY)&&(this.state=it.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const T=this.getCurrentContext(t.chunkMeta);T&&(t.frag=T.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var n;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const s=t.details===j.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const r=t.errorAction,{action:o,flags:c,retryCount:u=0,retryConfig:d}=r||{},f=!!r&&!!d,b=f&&o===Ci.RetryRequest,x=f&&!r.resolved&&c===Ii.MoveAllAlternatesMatchingHost;if(!b&&x&&ae(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),r.resolved=!0;else if((b||x)&&u<d.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const T=bi(d,u);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${d.maxNumRetry} in ${T}ms`),r.resolved=!0,this.retryDate=self.performance.now()+T,this.state=it.FRAG_LOADING_WAITING_RETRY}else if(d&&r)if(this.resetFragmentErrors(e),u<d.maxNumRetry)!s&&o!==Ci.RemoveAlternatePermanently&&(r.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else o===Ci.SendAlternateToPenaltyBox?this.state=it.WAITING_LEVEL:this.state=it.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===it.PARSING||this.state===it.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),s=n&&n.len>.5;s&&this.reduceMaxBufferLength(n.len,(t==null?void 0:t.duration)||10);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===ce.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==it.STOPPED&&(this.state=it.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=fi.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===it.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==it.STOPPED&&(this.state=it.IDLE)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of ${this.playlistLabel()} ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const s=i.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,u)=>{const d=e.elementaryStreams[u];if(d){const f=d.endPTS-d.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),c||!1;const b=n?0:cr(s,e,d.startPTS,d.endPTS,d.startDTS,d.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:i,drift:b,type:u,frag:e,start:d.startPTS,end:d.endPTS}),!0}return c},!1)){var o;if(i.fragmentError===0&&this.treatAsGap(e,i),((o=this.transmuxer)==null?void 0:o.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=it.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===ce.MAIN?"level":"track"}fragInfo(e,t=!0,i){var n,s;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((n=t&&!i?e.startPTS:(i||e).start)!=null?n:NaN).toFixed(3)}-${((s=t&&!i?e.endPTS:(i||e).end)!=null?s:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Ss(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Ds{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=Gr(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Gr(a,e){const t=new Uint8Array(e);let i=0;for(let n=0;n<a.length;n++){const s=a[n];t.set(s,i),i+=s.length}return t}var Cs={exports:{}},zs;function xs(){return zs||(zs=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,b){if(typeof d!="function")throw new TypeError("The listener must be a function");var x=new n(d,f||c,b),T=t?t+u:u;return c._events[T]?c._events[T].fn?c._events[T]=[c._events[T],x]:c._events[T].push(x):(c._events[T]=x,c._eventsCount++),c}function r(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},o.prototype.listeners=function(u){var d=t?t+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var b=0,x=f.length,T=new Array(x);b<x;b++)T[b]=f[b].fn;return T},o.prototype.listenerCount=function(u){var d=t?t+u:u,f=this._events[d];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,d,f,b,x,T){var G=t?t+u:u;if(!this._events[G])return!1;var $=this._events[G],ue=arguments.length,ge,fe;if($.fn){switch($.once&&this.removeListener(u,$.fn,void 0,!0),ue){case 1:return $.fn.call($.context),!0;case 2:return $.fn.call($.context,d),!0;case 3:return $.fn.call($.context,d,f),!0;case 4:return $.fn.call($.context,d,f,b),!0;case 5:return $.fn.call($.context,d,f,b,x),!0;case 6:return $.fn.call($.context,d,f,b,x,T),!0}for(fe=1,ge=new Array(ue-1);fe<ue;fe++)ge[fe-1]=arguments[fe];$.fn.apply($.context,ge)}else{var Ce=$.length,ke;for(fe=0;fe<Ce;fe++)switch($[fe].once&&this.removeListener(u,$[fe].fn,void 0,!0),ue){case 1:$[fe].fn.call($[fe].context);break;case 2:$[fe].fn.call($[fe].context,d);break;case 3:$[fe].fn.call($[fe].context,d,f);break;case 4:$[fe].fn.call($[fe].context,d,f,b);break;default:if(!ge)for(ke=1,ge=new Array(ue-1);ke<ue;ke++)ge[ke-1]=arguments[ke];$[fe].fn.apply($[fe].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,b){var x=t?t+u:u;if(!this._events[x])return this;if(!d)return r(this,x),this;var T=this._events[x];if(T.fn)T.fn===d&&(!b||T.once)&&(!f||T.context===f)&&r(this,x);else{for(var G=0,$=[],ue=T.length;G<ue;G++)(T[G].fn!==d||b&&!T[G].once||f&&T[G].context!==f)&&$.push(T[G]);$.length?this._events[x]=$.length===1?$[0]:$:r(this,x)}return this},o.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&r(this,d)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,a.exports=o}(Cs)),Cs.exports}var Ys=xs(),Xs=D(Ys);const qs="1.6.2",ks={};function Jo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function el(){const a=ks[qs];if(a)return a.clientCount++,a;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),n={worker:new self.Worker(t),objectURL:t,clientCount:1};return ks[qs]=n,n}function tl(a){const e=ks[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,n={worker:new self.Worker(t),scriptURL:t,clientCount:1};return ks[a]=n,n}function il(a){const e=ks[a||qs];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete ks[a||qs],n&&self.URL.revokeObjectURL(n),i.terminate()}}function Aa(a,e){return e+10<=a.length&&a[e]===51&&a[e+1]===68&&a[e+2]===73&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function Vr(a,e){return e+10<=a.length&&a[e]===73&&a[e+1]===68&&a[e+2]===51&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function yr(a,e){let t=0;return t=(a[e]&127)<<21,t|=(a[e+1]&127)<<14,t|=(a[e+2]&127)<<7,t|=a[e+3]&127,t}function Qs(a,e){const t=e;let i=0;for(;Vr(a,e);){i+=10;const n=yr(a,e+6);i+=n,Aa(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function nl(a,e,t,i){const n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],r=s>>2&15;if(r>12){const x=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!0,error:x,reason:x.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,d=n[r];let f=r;(o===5||o===29)&&(f-=3);const b=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return ee.log(`manifest codec:${i}, parsed codec:${u}, channels:${c}, rate:${d} (ADTS object type:${o} sampling index:${r})`),{config:b,samplerate:d,channelCount:c,codec:u,parsedCodec:u,manifestCodec:i}}function wa(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ra(a,e){return a[e+1]&1?7:9}function jr(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function sl(a,e){return e+5<a.length}function Er(a,e){return e+1<a.length&&wa(a,e)}function rl(a,e){return sl(a,e)&&wa(a,e)&&jr(a,e)<=a.length-e}function al(a,e){if(Er(a,e)){const t=Ra(a,e);if(e+t>=a.length)return!1;const i=jr(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||Er(a,n)}return!1}function La(a,e,t,i,n){if(!a.samplerate){const s=nl(e,t,i,n);if(!s)return;g(a,s)}}function Ia(a){return 1024*9e4/a}function ol(a,e){const t=Ra(a,e);if(e+t<=a.length){const i=jr(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Da(a,e,t,i,n){const s=Ia(a.samplerate),r=i+n*s,o=ol(e,t);let c;if(o){const{frameLength:f,headerLength:b}=o,x=b+f,T=Math.max(0,t+x-e.length);T?(c=new Uint8Array(x-b),c.set(e.subarray(t+b,e.length),0)):c=e.subarray(t+b,t+x);const G={unit:c,pts:r};return T||a.samples.push(G),{sample:G,length:x,missing:T}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:r},length:u,missing:-1}}function ll(a,e){return Vr(a,e)&&yr(a,e+6)+10<=a.length-e}function ul(a){if(a.size<2)return;const e=$e(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function cl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=$e(a.data.subarray(t),!0);t+=i.length+1;const n=$e(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=$e(a.data.subarray(1));return{key:a.type,info:"",data:e}}function hl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=$e(a.data.subarray(t),!0);t+=i.length+1;const n=$e(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=$e(a.data);return{key:a.type,info:"",data:e}}function dl(a){return btoa(String.fromCharCode(...a))}function Ca(a,e){if(a<0)return-Ca(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const n=Math.floor(a*t);return(n%2===0?n:n+1)/t}else return Math.round(a*t)/t}function fl(a,e){const t=new URL(a),i=new URL(e);if(t.origin!==i.origin)return a;const n=t.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")}function pl(){try{return crypto.randomUUID()}catch(a){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?s:s&3|8).toString(16)})}}}function ml(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function Wr(a,e=0,t=1/0){return gl(a,e,t,Uint8Array)}function gl(a,e,t,i){const n=_l(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=vl(a)?a.byteOffset:0,o=(r+a.byteLength)/s,c=(r+e)/s,u=Math.floor(Math.max(0,Math.min(c,o))),d=Math.floor(Math.min(u+Math.max(t,0),o));return new i(n,u,d-u)}function _l(a){return a instanceof ArrayBuffer?a:a.buffer}function vl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function yl(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=a.data.subarray(1).indexOf(0);if(i===-1)return;const n=$e(Wr(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=$e(Wr(a.data,3+i,r));let c;return n==="-->"?c=$e(Wr(a.data,4+i+r)):c=ml(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function El(a){return a.type==="PRIV"?ul(a):a.type[0]==="W"?hl(a):a.type==="APIC"?yl(a):cl(a)}function bl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=yr(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const br=10,Sl=10;function ka(a){let e=0;const t=[];for(;Vr(a,e);){const i=yr(a,e+6);a[e+5]>>6&1&&(e+=br),e+=br;const n=e+i;for(;e+Sl<n;){const s=bl(a.subarray(e)),r=El(s);r&&t.push(r),e+=s.size+br}Aa(a,e)&&(e+=br)}return t}function Pa(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function xl(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function Hr(a){const e=ka(a);for(let t=0;t<e.length;t++){const i=e[t];if(Pa(i))return xl(i)}}let Bn=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function ns(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Zr{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=He(this.cachedData,e),this.cachedData=null);let i=Qs(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,c=i?Hr(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&U(c))&&(this.basePTS=Tl(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Bn.audioId3,duration:Number.POSITIVE_INFINITY});n<u;){if(this.canParse(e,n)){const d=this.appendFrame(r,e,n);d?(this.frameIndex++,this.lastPTS=d.sample.pts,n+=d.length,s=n):n=u}else ll(e,n)?(i=Qs(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Bn.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,s=n):n++;if(n===u&&s!==u){const d=e.slice(s);this.cachedData?this.cachedData=He(this.cachedData,d):this.cachedData=d}}return{audioTrack:r,videoTrack:ns(),id3Track:o,textTrack:ns()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:ns(),id3Track:this._id3Track,textTrack:ns()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Tl=(a,e,t)=>{if(U(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Sr=null;const Al=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],wl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Rl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ll=[0,1,1,4];function Oa(a,e,t,i,n){if(t+24>e.length)return;const s=Ma(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=i+n*r,c={unit:e.subarray(t,t+s.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=s.channelCount,a.samplerate=s.sampleRate,a.samples.push(c),{sample:c,length:s.frameLength,missing:0}}}function Ma(a,e){const t=a[e+1]>>3&3,i=a[e+1]>>1&3,n=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-i:i===3?3:4,u=Al[c*14+n-1]*1e3,f=wl[(t===3?0:t===2?1:2)*3+s],b=o===3?1:2,x=Rl[t][i],T=Ll[i],G=x*8*T,$=Math.floor(x*u/f+r)*T;if(Sr===null){const fe=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Sr=fe?parseInt(fe[1]):0}return!!Sr&&Sr<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:b,frameLength:$,samplesPerFrame:G}}}function zr(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Na(a,e){return e+1<a.length&&zr(a,e)}function Il(a,e){return zr(a,e)&&4<=a.length-e}function Fa(a,e){if(e+1<a.length&&zr(a,e)){const i=Ma(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||Na(a,s)}return!1}class Dl extends Zr{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Qs(e,0);let n=(i==null?void 0:i.length)||0;if(Fa(e,n))return!1;for(let s=e.length;n<s;n++)if(al(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return rl(e,t)}appendFrame(e,t,i){La(e,this.observer,t,i,e.manifestCodec);const n=Da(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const Ba=(a,e)=>{let t=0,i=5;e+=i;const n=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;i>0;){r[0]=a[e];const o=Math.min(i,8),c=8-o;s[0]=4278190080>>>24+c<<c,n[0]=(r[0]&s[0])>>c,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class Cl extends Zr{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=Ua(e,t,i,this.basePTS,this.frameIndex);if(n!==-1)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}static probe(e){if(!e)return!1;const t=Qs(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Ba(e,i)<16}}function Ua(a,e,t,i,n){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],c=e[t+4]&63,d=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+s]*2;if(t+d>e.length)return-1;const f=e[t+6]>>5;let b=0;f===2?b+=2:(f&1&&f!==1&&(b+=2),f&4&&(b+=2));const x=(e[t+6]<<8|e[t+7])>>12-b&1,G=[2,1,2,3,3,4,4,5][f]+x,$=e[t+5]>>3,ue=e[t+5]&7,ge=new Uint8Array([s<<6|$<<1|ue>>2,(ue&3)<<6|f<<3|x<<2|c>>4,c<<4&224]),fe=1536/o*9e4,Ce=i+n*fe,ke=e.subarray(t,t+d);return a.config=ge,a.channelCount=G,a.samplerate=o,a.samples.push({unit:ke,pts:Ce}),d}class kl extends Zr{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Qs(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Ba(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(Fa(e,i))return ee.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Il(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Oa(e,t,i,this.basePTS,this.frameIndex)}}const Pl=/\/emsg[-/]ID3/i;class Ol{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const s=this.videoTrack=ns("video",1),r=this.audioTrack=ns("audio",1),o=this.txtTrack=ns("text",1);if(this.id3Track=ns("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=Oe(e);if(c.video){const{id:u,timescale:d,codec:f,supplemental:b}=c.video;s.id=u,s.timescale=o.timescale=d,s.codec=f,s.supplemental=b}if(c.audio){const{id:u,timescale:d,codec:f}=c.audio;r.id=u,r.timescale=d,r.codec=f}o.id=je.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return we(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=He(this.remainderData,e));const o=We(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=Be(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=Be(e,t),{videoTrack:t,audioTrack:ns(),id3Track:n,textTrack:ns()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=se(e.samples,["emsg"]);n&&n.forEach(s=>{const r=Kt(s);if(Pl.test(r.schemeIdUri)){const o=Ka(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=r.payload;i.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Bn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Ka(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Bn.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function Ka(a,e){return U(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ml{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new ln(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Ki.cbc)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const s=n.subarray(16,n.length-n.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(o=>{const c=new Uint8Array(o);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)i.set(e.subarray(s,s+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)e.set(i.subarray(n,n+16),s);return e}decryptAvcSample(e,t,i,n,s){const r=et(s.data),o=this.getAvcEncryptedData(r);this.decryptBuffer(o.buffer).then(c=>{s.data=this.getAvcDecryptedUnit(r,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)})}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const s=e[t].units;for(;!(i>=s.length);i++){const r=s[i];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,i,n,r),!this.decrypter.isSync()))return}}}}class $a{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const s=i.units;n=s[s.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const s=i[n-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,u,d,f,b=-1,x=0;for(s===-1&&(b=0,x=this.getNALuType(t,0),s=0,c=1);c<n;){if(u=t[c++],!s){s=u?0:1;continue}if(s===1){s=u?0:2;continue}if(!u)s=3;else if(u===1){if(d=c-s-1,b>=0){const T={data:t.subarray(b,d),type:x};o.push(T)}else{const T=this.getLastNalUnit(e.samples);T&&(r&&c<=4-r&&T.state&&(T.data=T.data.subarray(0,T.data.byteLength-r)),d>0&&(T.data=He(T.data,t.subarray(0,d)),T.state=0))}c<n?(f=this.getNALuType(t,c),b=c,x=f,s=0):s=-1}else s=0}if(b>=0&&s>=0){const T={data:t.subarray(b,n),type:x,state:s};o.push(T)}if(o.length===0){const T=this.getLastNalUnit(e.samples);T&&(T.data=He(T.data,t))}return e.naluState=s,o}}class Js{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");n.set(e.subarray(i,i+s)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&ee.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Ga extends $a{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var d,f;switch(u.type){case 1:{let G=!1;o=!0;const $=u.data;if(c&&$.length>4){const ue=this.readSliceType($);(ue===2||ue===4||ue===7||ue===9)&&(G=!0)}if(G){var b;(b=r)!=null&&b.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.frame=!0,r.key=G;break}case 5:o=!0,(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 6:{o=!0,Ie(u.data,1,i.pts,t.samples);break}case 7:{var x,T;o=!0,c=!0;const G=u.data,$=this.readSPS(G);if(!e.sps||e.width!==$.width||e.height!==$.height||((x=e.pixelRatio)==null?void 0:x[0])!==$.pixelRatio[0]||((T=e.pixelRatio)==null?void 0:T[1])!==$.pixelRatio[1]){e.width=$.width,e.height=$.height,e.pixelRatio=$.pixelRatio,e.sps=[G];const ue=G.subarray(1,4);let ge="avc1.";for(let fe=0;fe<3;fe++){let Ce=ue[fe].toString(16);Ce.length<2&&(Ce="0"+Ce),ge+=Ce}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 Js(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,s;for(let r=0;r<e;r++)n!==0&&(s=t.readEG(),n=(i+s+256)%256),i=n===0?i:n}readSPS(e){const t=new Js(e);let i=0,n=0,s=0,r=0,o,c,u;const d=t.readUByte.bind(t),f=t.readBits.bind(t),b=t.readUEG.bind(t),x=t.readBoolean.bind(t),T=t.skipBits.bind(t),G=t.skipEG.bind(t),$=t.skipUEG.bind(t),ue=this.skipScalingList.bind(this);d();const ge=d();if(f(5),T(3),d(),$(),ge===100||ge===110||ge===122||ge===244||ge===44||ge===83||ge===86||ge===118||ge===128){const Ze=b();if(Ze===3&&T(1),$(),$(),T(1),x())for(c=Ze!==3?8:12,u=0;u<c;u++)x()&&(u<6?ue(16,t):ue(64,t))}$();const fe=b();if(fe===0)b();else if(fe===1)for(T(1),G(),G(),o=b(),u=0;u<o;u++)G();$(),T(1);const Ce=b(),ke=b(),Je=f(1);Je===0&&T(1),T(1),x()&&(i=b(),n=b(),s=b(),r=b());let Pe=[1,1];if(x()&&x())switch(d()){case 1:Pe=[1,1];break;case 2:Pe=[12,11];break;case 3:Pe=[10,11];break;case 4:Pe=[16,11];break;case 5:Pe=[40,33];break;case 6:Pe=[24,11];break;case 7:Pe=[20,11];break;case 8:Pe=[32,11];break;case 9:Pe=[80,33];break;case 10:Pe=[18,11];break;case 11:Pe=[15,11];break;case 12:Pe=[64,33];break;case 13:Pe=[160,99];break;case 14:Pe=[4,3];break;case 15:Pe=[3,2];break;case 16:Pe=[2,1];break;case 255:{Pe=[d()<<8|d(),d()<<8|d()];break}}return{width:Math.ceil((Ce+1)*16-i*2-n*2),height:(2-Je)*(ke+1)*16-(Je?2:4)*(s+r),pixelRatio:Pe}}}class Va extends $a{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var d,f;switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var b;(b=r)!=null&&b.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 19:case 20:o=!0,(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 39:o=!0,Ie(u.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=g(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const x=this.readSPS(u.data);e.width=x.width,e.height=x.height,e.pixelRatio=x.pixelRatio,e.codec=x.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const T in x.params)e.params[T]=x.params[T]}this.pushParameterSet(e.sps,u.data,e.vps),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const x=this.readPPS(u.data);for(const T in x)e.params[T]=x[T]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(f=r)!=null&&f.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Js(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new Js(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),s=t.readBoolean(),r=t.readBits(5),o=t.readUByte(),c=t.readUByte(),u=t.readUByte(),d=t.readUByte(),f=t.readUByte(),b=t.readUByte(),x=t.readUByte(),T=t.readUByte(),G=t.readUByte(),$=t.readUByte(),ue=t.readUByte(),ge=[],fe=[];for(let ji=0;ji<i;ji++)ge.push(t.readBoolean()),fe.push(t.readBoolean());if(i>0)for(let ji=i;ji<8;ji++)t.readBits(2);for(let ji=0;ji<i;ji++)ge[ji]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),fe[ji]&&t.readUByte();t.readUEG();const Ce=t.readUEG();Ce==3&&t.skipBits(1);const ke=t.readUEG(),Je=t.readUEG(),Pe=t.readBoolean();let Ze=0,nt=0,Me=0,At=0;Pe&&(Ze+=t.readUEG(),nt+=t.readUEG(),Me+=t.readUEG(),At+=t.readUEG());const jt=t.readUEG(),Oi=t.readUEG(),yi=t.readUEG(),hi=t.readBoolean();for(let ji=hi?0:i;ji<=i;ji++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let Ln=0;Ln<4;Ln++)for(let $n=0;$n<(Ln===3?2:6);$n++)if(!t.readBoolean())t.readUEG();else{const Xn=Math.min(64,1<<4+(Ln<<1));Ln>1&&t.readEG();for(let Us=0;Us<Xn;Us++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const ci=t.readUEG();let wt=0;for(let ji=0;ji<ci;ji++){let Ln=!1;if(ji!==0&&(Ln=t.readBoolean()),Ln){ji===ci&&t.readUEG(),t.readBoolean(),t.readUEG();let $n=0;for(let As=0;As<=wt;As++){const Xn=t.readBoolean();let Us=!1;Xn||(Us=t.readBoolean()),(Xn||Us)&&$n++}wt=$n}else{const $n=t.readUEG(),As=t.readUEG();wt=$n+As;for(let Xn=0;Xn<$n;Xn++)t.readUEG(),t.readBoolean();for(let Xn=0;Xn<As;Xn++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const ji=t.readUEG();for(let Ln=0;Ln<ji;Ln++){for(let $n=0;$n<yi+4;$n++)t.readBits(1);t.readBits(1)}}let xi=0,Si=1,ki=1,Gi=!0,zi=1,qi=0;t.readBoolean(),t.readBoolean();let Dn=!1;if(t.readBoolean()){if(t.readBoolean()){const ws=t.readUByte(),Wo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Or=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];ws>0&&ws<16?(Si=Wo[ws-1],ki=Or[ws-1]):ws===255&&(Si=t.readBits(16),ki=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),Dn=t.readBoolean(),Dn&&(Ze+=t.readUEG(),nt+=t.readUEG(),Me+=t.readUEG(),At+=t.readUEG()),t.readBoolean()&&(zi=t.readBits(32),qi=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Or=t.readBoolean(),Ho=t.readBoolean();let rr=!1;(Or||Ho)&&(rr=t.readBoolean(),rr&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),rr&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Zo=0;Zo<=i;Zo++){Gi=t.readBoolean();const ih=Gi||t.readBoolean();let zo=!1;ih?t.readEG():zo=t.readBoolean();const Yo=zo?1:t.readUEG()+1;if(Or)for(let ar=0;ar<Yo;ar++)t.readUEG(),t.readUEG(),rr&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Ho)for(let ar=0;ar<Yo;ar++)t.readUEG(),t.readUEG(),rr&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),xi=t.readUEG())}let _s=ke,jo=Je;if(Pe||Dn){let ji=1,Ln=1;Ce===1?ji=Ln=2:Ce==2&&(ji=2),_s=ke-ji*nt-ji*Ze,jo=Je-Ln*At-Ln*Me}const eh=n?["A","B","C"][n]:"",th=o<<24|c<<16|u<<8|d;let xa=0;for(let ji=0;ji<32;ji++)xa=(xa|(th>>ji&1)<<31-ji)>>>0;let Ta=xa.toString(16);return r===1&&Ta==="2"&&(Ta="6"),{codecString:`hvc1.${eh}${r}.${Ta}.${s?"H":"L"}${ue}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,c,u,d],general_constraint_indicator_flags:[f,b,x,T,G,$],general_level_idc:ue,bit_depth:jt+8,bit_depth_luma_minus8:jt,bit_depth_chroma_minus8:Oi,min_spatial_segmentation_idc:xi,chroma_format_idc:Ce,frame_rate:{fixed:Gi,fps:qi/zi}},width:_s,height:jo,pixelRatio:[Si,ki]}}readPPS(e){const t=new Js(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),s=t.readBoolean();let r=1;return s&&n?r=0:s?r=3:n&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const En=188;class fs{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=fs.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(En*5,t-En)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=En)if(e[c]===71&&(t-c===En||e[c+En]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+En*99,e.length-En)+1)),s||(s=Yr(e,c)===0),s&&o>1&&(r===0&&o>2||c+En>i))return r}else{if(o)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:je[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=fs.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=fs.createTrack("audio",n),this._id3Track=fs.createTrack("id3"),this._txtTrack=fs.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){i||(this.sampleAes=null);let s;const r=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let d=r.pid,f=r.pesData,b=o.pid,x=c.pid,T=o.pesData,G=c.pesData,$=null,ue=this.pmtParsed,ge=this._pmtId,fe=e.length;if(this.remainderData&&(e=He(this.remainderData,e),fe=e.length,this.remainderData=null),fe<En&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const Ce=Math.max(0,fs.syncOffset(e));fe-=(fe-Ce)%En,fe<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,fe,e.buffer.byteLength-fe));let ke=0;for(let Pe=Ce;Pe<fe;Pe+=En)if(e[Pe]===71){const Ze=!!(e[Pe+1]&64),nt=Yr(e,Pe),Me=(e[Pe+3]&48)>>4;let At;if(Me>1){if(At=Pe+5+e[Pe+4],At===Pe+En)continue}else At=Pe+4;switch(nt){case d:if(Ze){if(f&&(s=Ps(f,this.logger))){if(this.videoParser===null)switch(r.segmentCodec){case"avc":this.videoParser=new Ga;break;case"hevc":this.videoParser=new Va;break}this.videoParser!==null&&this.videoParser.parsePES(r,u,s,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray(At,Pe+En)),f.size+=Pe+En-At);break;case b:if(Ze){if(T&&(s=Ps(T,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s);break}T={data:[],size:0}}T&&(T.data.push(e.subarray(At,Pe+En)),T.size+=Pe+En-At);break;case x:Ze&&(G&&(s=Ps(G,this.logger))&&this.parseID3PES(c,s),G={data:[],size:0}),G&&(G.data.push(e.subarray(At,Pe+En)),G.size+=Pe+En-At);break;case 0:Ze&&(At+=e[At]+1),ge=this._pmtId=Nl(e,At);break;case ge:{Ze&&(At+=e[At]+1);const jt=Fl(e,At,this.typeSupported,i,this.observer,this.logger);d=jt.videoPid,d>0&&(r.pid=d,r.segmentCodec=jt.segmentVideoCodec),b=jt.audioPid,b>0&&(o.pid=b,o.segmentCodec=jt.segmentAudioCodec),x=jt.id3Pid,x>0&&(c.pid=x),$!==null&&!ue&&(this.logger.warn(`MPEG-TS PMT found at ${Pe} after unknown PID '${$}'. Backtracking to sync byte @${Ce} to parse all TS packets.`),$=null,Pe=Ce-188),ue=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=nt;break}}else ke++;ke>0&&Xr(this.observer,new Error(`Found ${ke} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=T,c.pesData=G;const Je={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(Je),Je}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:s}=e,r=i.pesData,o=t.pesData,c=n.pesData;let u;if(r&&(u=Ps(r,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new Ga;break;case"hevc":this.videoParser=new Va;break}this.videoParser!==null&&(this.videoParser.parsePES(i,s,u,!0),i.pesData=null)}else i.pesData=r;if(o&&(u=Ps(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;c&&(u=Ps(c,this.logger))?(this.parseID3PES(n,u),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Ml(this.observer,this.config,t);return this.decrypt(n,s)}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:s}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{i(e)}):i(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let s=t.data;if(n){this.aacOverFlow=null;const f=n.missing,b=n.sample.unit.byteLength;if(f===-1)s=He(n.sample.unit,s);else{const x=b-f;n.sample.unit.set(s.subarray(0,f),x),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!Er(s,r);r++);if(r!==i){let f;const b=r<o-1;if(b?f=`AAC PES did not start with ADTS header,offset:${r}`:f="No ADTS header found in AAC PES",Xr(this.observer,new Error(f),b,this.logger),!b)return}La(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const f=Ia(e.samplerate);c=n.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,d;for(;r<o;)if(d=Da(e,s,r,c,u),r+=d.length,d.missing){this.aacOverFlow=d;break}else for(u++;r<o-1&&!Er(s,r);r++);}parseMPEGPES(e,t){const i=t.data,n=i.length;let s=0,r=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<n;)if(Na(i,r)){const c=Oa(e,i,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(n===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=i.length;let r=0,o=0,c;for(;o<s&&(c=Ua(e,i,o,n,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=g({},t,{type:this._videoTrack?Bn.emsg:Bn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Yr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function Nl(a,e){return(a[e+10]&31)<<8|a[e+11]}function Fl(a,e,t,i,n,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(a[e+1]&15)<<8|a[e+2],c=e+3+o-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<c;){const d=Yr(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){qr("ADTS AAC",s);break}case 15:r.audioPid===-1&&(r.audioPid=d);break;case 21:r.id3Pid===-1&&(r.id3Pid=d);break;case 219:if(!i){qr("H.264",s);break}case 27:r.videoPid===-1&&(r.videoPid=d);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=d,r.segmentAudioCodec="mp3");break;case 193:if(!i){qr("AC-3",s);break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=d,r.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&f>0){let b=e+5,x=f;for(;x>2;){switch(a[b]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=d,r.segmentAudioCodec="ac3");break}const G=a[b+1]+2;b+=G,x-=G}}break;case 194:case 135:return Xr(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),r;case 36:r.videoPid===-1&&(r.videoPid=d,r.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=f+5}return r}function Xr(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function qr(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Ps(a,e){let t=0,i,n,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=He(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(n=(i[4]<<8)+i[5],n&&n>a.size-6)return null;const d=i[7];d&192&&(r=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,d&64?(o=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,r-o>60*9e4&&(e.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=i[8];let f=s+9;if(a.size<=f)return null;a.size-=f;const b=new Uint8Array(a.size);for(let x=0,T=c.length;x<T;x++){i=c[x];let G=i.byteLength;if(f)if(f>G){f-=G;continue}else i=i.subarray(f),G-=f,f=0;b.set(i,t),t+=G}return n&&(n-=s+3),{data:b,pts:r,dts:o,len:n}}return null}class Bl{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const ps=Math.pow(2,32)-1;class 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/(ps+1)),n=Math.floor(t%(ps+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/(ps+1)),n=Math.floor(t%(ps+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return 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/(ps+1)),o=Math.floor(i%(ps+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/(ps+1)),r=Math.floor(t%(ps+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,b;for(t+=8+s,r.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<n;o++)c=i[o],u=c.duration,d=c.size,f=c.flags,b=c.cts,r.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,b>>>24&255,b>>>16&255,b>>>8&255,b&255],12+16*o);return Ue.box(Ue.types.trun,r)}static initSegment(e){Ue.types||Ue.init();const t=Ue.moov(e);return He(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 T=0;T<i.length;T+=1){r+=3;for(let G=0;G<i[T].length;G+=1)r+=2+i[T][G].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let T=0;T<i.length;T+=1){o.set(new Uint8Array([32+T|(T===c?128:0),0,i[T].length]),r),r+=3;for(let G=0;G<i[T].length;G+=1)o.set(new Uint8Array([i[T][G].length>>8,i[T][G].length&255]),r),r+=2,o.set(i[T][G],r),r+=i[T][G].length}const u=Ue.box(Ue.types.hvcC,o),d=e.width,f=e.height,b=e.pixelRatio[0],x=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([b>>24,b>>16&255,b>>8&255,b&255,x>>24,x>>16&255,x>>8&255,x&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 ja=9e4;function Qr(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function Ul(a,e,t=1,i=!1){return Qr(a,e,1/t,i)}function er(a,e=!1){return Qr(a,1e3,1/ja,e)}function Kl(a,e=1){return Qr(a,ja,1/e)}const $l=10*1e3,Gl=1024,Vl=1152,jl=1536;let Os=null,Jr=null;function Wa(a,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class xr{constructor(e,t,i,n){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.ISGenerated=!1,Os===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Os=r?parseInt(r[1]):0}if(Jr===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Jr=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=Un(o,i),c=o-s),c>0?s:o},i);return t&&this.logger.debug("PTS rollover detected"),n}remux(e,t,i,n,s,r,o,c){let u,d,f,b,x,T,G=s,$=s;const ue=e.pid>-1,ge=t.pid>-1,fe=t.samples.length,Ce=e.samples.length>0,ke=o&&fe>0||fe>1;if((!ue||Ce)&&(!ge||ke)||this.ISGenerated||o){if(this.ISGenerated){var Pe,Ze,nt,Me;const yi=this.videoTrackConfig;(yi&&(t.width!==yi.width||t.height!==yi.height||((Pe=t.pixelRatio)==null?void 0:Pe[0])!==((Ze=yi.pixelRatio)==null?void 0:Ze[0])||((nt=t.pixelRatio)==null?void 0:nt[1])!==((Me=yi.pixelRatio)==null?void 0:Me[1]))||!yi&&ke||this.nextAudioPts===null&&Ce)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const At=this.isVideoContiguous;let jt=-1,Oi;if(ke&&(jt=Wl(t.samples),!At&&this.config.forceKeyFrameOnDiscontinuity))if(T=!0,jt>0){this.logger.warn(`[mp4-remuxer]: Dropped ${jt} out of ${fe} video samples due to a missing keyframe`);const yi=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(jt),t.dropped+=jt,$+=(t.samples[0].pts-yi)/t.inputTimeScale,Oi=$}else jt===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${fe} video samples`),T=!1);if(this.ISGenerated){if(Ce&&ke){const yi=this.getVideoStartPts(t.samples),si=(Un(e.samples[0].pts,yi)-yi)/t.inputTimeScale;G+=Math.max(0,si),$+=Math.max(0,-si)}if(Ce){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),d=this.remuxAudio(e,G,this.isAudioContiguous,r,ge||ke||c===ce.AUDIO?$:void 0),ke){const yi=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),f=this.generateIS(e,t,s,r)),u=this.remuxVideo(t,$,At,yi)}}else ke&&(u=this.remuxVideo(t,$,At,0));u&&(u.firstKeyFrame=jt,u.independent=jt!==-1,u.firstKeyFramePTS=Oi)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(x=Ha(i,s,this._initPTS,this._initDTS)),n.samples.length&&(b=Za(n,s,this._initPTS))),{audio:d,video:u,initSegment:f,independent:T,text:b,id3:x}}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let d=!u||n,f="audio/mp4",b,x,T;if(d&&(b=x=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):Ue.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(T=e.inputTimeScale,!u||T!==u.timescale?b=x=s[0].pts-Math.round(T*i):d=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Ue.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(T=t.inputTimeScale,!u||T!==u.timescale){const G=this.getVideoStartPts(r),$=Math.round(T*i);x=Math.min(x,Un(r[0].dts,G)-$),b=Math.min(b,G-$)}else d=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:b,timescale:T},this._initDTS={baseTime:x,timescale:T}):b=T=void 0,{tracks:c,initPTS:b,timescale:T}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,u=this._initPTS;let d=this.nextAvcDts,f=8,b=this.videoSampleDuration,x,T,G=Number.POSITIVE_INFINITY,$=Number.NEGATIVE_INFINITY,ue=!1;if(!i||d===null){const wt=t*s,kt=r[0].pts-Un(r[0].dts,r[0].pts);Os&&d!==null&&Math.abs(wt-kt-d)<15e3?i=!0:d=wt-kt}const ge=u.baseTime*s/u.timescale;for(let wt=0;wt<c;wt++){const kt=r[wt];kt.pts=Un(kt.pts-ge,d),kt.dts=Un(kt.dts-ge,d),kt.dts<r[wt>0?wt-1:wt].dts&&(ue=!0)}ue&&r.sort(function(wt,kt){const xi=wt.dts-kt.dts,Si=wt.pts-kt.pts;return xi||Si}),x=r[0].dts,T=r[r.length-1].dts;const fe=T-x,Ce=fe?Math.round(fe/(c-1)):b||e.inputTimeScale/30;if(i){const wt=x-d,kt=wt>Ce,xi=wt<-1;if((kt||xi)&&(kt?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${er(wt,!0)} ms (${wt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${er(-wt,!0)} ms (${wt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!xi||d>=r[0].pts||Os)){x=d;const Si=r[0].pts-wt;if(kt)r[0].dts=x,r[0].pts=Si;else{let ki=!0;for(let Gi=0;Gi<r.length&&!(r[Gi].dts>Si&&ki);Gi++){const zi=r[Gi].pts;if(r[Gi].dts-=wt,r[Gi].pts-=wt,Gi<r.length-1){const qi=r[Gi+1].pts,Dn=r[Gi].pts,kn=qi<=Dn,_s=qi<=zi;ki=kn==_s}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${er(Si,!0)}/${er(x,!0)}, delta: ${er(wt,!0)} ms`)}}x=Math.max(0,x);let ke=0,Je=0,Pe=x;for(let wt=0;wt<c;wt++){const kt=r[wt],xi=kt.units,Si=xi.length;let ki=0;for(let Gi=0;Gi<Si;Gi++)ki+=xi[Gi].data.length;Je+=ki,ke+=Si,kt.length=ki,kt.dts<Pe?(kt.dts=Pe,Pe+=Ce/4|0||1):Pe=kt.dts,G=Math.min(kt.pts,G),$=Math.max(kt.pts,$)}T=r[c-1].dts;const Ze=Je+4*ke+8;let nt;try{nt=new Uint8Array(Ze)}catch(wt){this.observer.emit(p.ERROR,p.ERROR,{type:he.MUX_ERROR,details:j.REMUX_ALLOC_ERROR,fatal:!1,error:wt,bytes:Ze,reason:`fail allocating video mdat ${Ze}`});return}const Me=new DataView(nt.buffer);Me.setUint32(0,Ze),nt.set(Ue.types.mdat,4);let At=!1,jt=Number.POSITIVE_INFINITY,Oi=Number.POSITIVE_INFINITY,yi=Number.NEGATIVE_INFINITY,hi=Number.NEGATIVE_INFINITY;for(let wt=0;wt<c;wt++){const kt=r[wt],xi=kt.units;let Si=0;for(let zi=0,qi=xi.length;zi<qi;zi++){const Dn=xi[zi],kn=Dn.data,_s=Dn.data.byteLength;Me.setUint32(f,_s),f+=4,nt.set(kn,f),f+=_s,Si+=4+_s}let ki;if(wt<c-1)b=r[wt+1].dts-kt.dts,ki=r[wt+1].pts-kt.pts;else{const zi=this.config,qi=wt>0?kt.dts-r[wt-1].dts:Ce;if(ki=wt>0?kt.pts-r[wt-1].pts:Ce,zi.stretchShortVideoTrack&&this.nextAudioPts!==null){const Dn=Math.floor(zi.maxBufferHole*s),kn=(n?G+n*s:this.nextAudioPts)-kt.pts;kn>Dn?(b=kn-qi,b<0?b=qi:At=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${kn/90} ms to the next segment; using duration ${b/90} ms for the last video frame.`)):b=qi}else b=qi}const Gi=Math.round(kt.pts-kt.dts);jt=Math.min(jt,b),yi=Math.max(yi,b),Oi=Math.min(Oi,ki),hi=Math.max(hi,ki),o.push(Wa(kt.key,b,Si,Gi))}if(o.length){if(Os){if(Os<70){const wt=o[0].flags;wt.dependsOn=2,wt.isNonSync=0}}else if(Jr&&hi-Oi<yi-jt&&Ce/yi<.025&&o[0].cts===0){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let wt=x;for(let kt=0,xi=o.length;kt<xi;kt++){const Si=wt+o[kt].duration,ki=wt+o[kt].cts;if(kt<xi-1){const Gi=Si+o[kt+1].cts;o[kt].duration=Gi-ki}else o[kt].duration=kt?o[kt-1].duration:Ce;o[kt].cts=0,wt=Si}}}b=At||!b?Ce:b,this.nextAvcDts=d=T+b,this.videoSampleDuration=b,this.isVideoContiguous=!0;const ci={data1:Ue.moof(e.sequenceNumber++,x,g(e,{samples:o})),data2:nt,startPTS:G/s,endPTS:($+b)/s,startDTS:x/s,endDTS:d/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,ci}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Vl;case"ac3":return jl;default:return Gl}}remuxAudio(e,t,i,n,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,c=r/o,u=this.getSamplesPerFrame(e),d=u*c,f=this._initPTS,b=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,x=[],T=s!==void 0;let G=e.samples,$=b?0:8,ue=this.nextAudioPts||-1;const ge=t*r,fe=f.baseTime*r/f.timescale;if(this.isAudioContiguous=i=i||G.length&&ue>0&&(n&&Math.abs(ge-ue)<9e3||Math.abs(Un(G[0].pts-fe,ge)-ue)<20*d),G.forEach(function(si){si.pts=Un(si.pts-fe,ge)}),!i||ue<0){if(G=G.filter(si=>si.pts>=0),!G.length)return;s===0?ue=0:n&&!T?ue=Math.max(0,ge):ue=G[0].pts}if(e.segmentCodec==="aac"){const si=this.config.maxAudioFramesDrift;for(let di=0,ci=ue;di<G.length;di++){const wt=G[di],kt=wt.pts,xi=kt-ci,Si=Math.abs(1e3*xi/r);if(xi<=-si*d&&T)di===0&&(this.logger.warn(`Audio frame @ ${(kt/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*xi/r)} ms.`),this.nextAudioPts=ue=ci=kt);else if(xi>=si*d&&Si<$l&&T){let ki=Math.round(xi/d);ci=kt-ki*d,ci<0&&(ki--,ci+=d),di===0&&(this.nextAudioPts=ue=ci),this.logger.warn(`[mp4-remuxer]: Injecting ${ki} audio frame @ ${(ci/r).toFixed(3)}s due to ${Math.round(1e3*xi/r)} ms gap.`);for(let Gi=0;Gi<ki;Gi++){const zi=Math.max(ci,0);let qi=Bl.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);qi||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),qi=wt.unit.subarray()),G.splice(di,0,{unit:qi,pts:zi}),ci+=d,di++}}wt.pts=ci,ci+=d}}let Ce=null,ke=null,Je,Pe=0,Ze=G.length;for(;Ze--;)Pe+=G[Ze].unit.byteLength;for(let si=0,di=G.length;si<di;si++){const ci=G[si],wt=ci.unit;let kt=ci.pts;if(ke!==null){const Si=x[si-1];Si.duration=Math.round((kt-ke)/c)}else if(i&&e.segmentCodec==="aac"&&(kt=ue),Ce=kt,Pe>0){Pe+=$;try{Je=new Uint8Array(Pe)}catch(Si){this.observer.emit(p.ERROR,p.ERROR,{type:he.MUX_ERROR,details:j.REMUX_ALLOC_ERROR,fatal:!1,error:Si,bytes:Pe,reason:`fail allocating audio mdat ${Pe}`});return}b||(new DataView(Je.buffer).setUint32(0,Pe),Je.set(Ue.types.mdat,4))}else return;Je.set(wt,$);const xi=wt.byteLength;$+=xi,x.push(Wa(!0,u,xi,0)),ke=kt}const nt=x.length;if(!nt)return;const Me=x[x.length-1];this.nextAudioPts=ue=ke+c*Me.duration;const At=b?new Uint8Array(0):Ue.moof(e.sequenceNumber++,Ce/c,g({},e,{samples:x}));e.samples=[];const jt=Ce/r,Oi=ue/r,hi={data1:At,data2:Je,startPTS:jt,endPTS:Oi,startDTS:jt,endDTS:Oi,type:"audio",hasAudio:!0,hasVideo:!1,nb:nt};return this.isAudioContiguous=!0,hi}}function Un(a,e){let t;if(e===null)return a;for(e<a?t=-8589934592:t=8589934592;Math.abs(a-e)>4294967296;)a+=t;return a}function Wl(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function Ha(a,e,t,i){const n=a.samples.length;if(!n)return;const s=a.inputTimeScale;for(let o=0;o<n;o++){const c=a.samples[o];c.pts=Un(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=Un(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function Za(a,e,t){const i=a.samples.length;if(!i)return;const n=a.inputTimeScale;for(let r=0;r<i;r++){const o=a.samples[r];o.pts=Un(o.pts-t.baseTime*n/t.timescale,e*n)/n}a.samples.sort((r,o)=>r.pts-o.pts);const s=a.samples;return a.samples=[],{samples:s}}class Hl{constructor(e,t,i,n){this.logger=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.logger=n}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(N(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=Oe(e);n.audio&&(t=za(n.audio,v.AUDIO)),n.video&&(i=za(n.video,v.VIDEO));const s={};n.audio&&n.video?s.audiovideo={container:"video/mp4",codec:t+","+i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:n.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?s.video={container:"video/mp4",codec:i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,i,n,s,r){var o,c;let{initPTS:u,lastEndTime:d}=this;const f={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};U(d)||(d=this.lastEndTime=s||0);const b=t.samples;if(!(b!=null&&b.length))return f;const x={initPTS:void 0,timescale:1};let T=this.initData;if((o=T)!=null&&o.length||(this.generateInitSegment(b),T=this.initData),!((c=T)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1);const G=le(b,T),$=re(T,b),ue=$===null?s:$;(r||!u)&&(Zl(u,ue,s,G)||x.timescale!==u.timescale)&&(x.initPTS=ue-s,u&&u.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${u.baseTime/u.timescale} to ${x.initPTS}`),this.initPTS=u={baseTime:x.initPTS,timescale:1});const ge=e?ue-u.baseTime/u.timescale:d,fe=ge+G;Ae(T,b,u.baseTime/u.timescale),G>0?this.lastEndTime=fe:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Ce=!!T.audio,ke=!!T.video;let Je="";Ce&&(Je+="audio"),ke&&(Je+="video");const Pe={data1:b,startPTS:ge,startDTS:ge,endPTS:fe,endDTS:fe,type:Je,hasAudio:Ce,hasVideo:ke,nb:1,dropped:0};return f.audio=Pe.type==="audio"?Pe:void 0,f.video=Pe.type!=="audio"?Pe:void 0,f.initSegment=x,f.id3=Ha(i,s,u,u),n.samples.length&&(f.text=Za(n,s,u)),f}}function Zl(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>n}function za(a,e){const t=a==null?void 0:a.codec;return t&&t.length>4?t:e===v.AUDIO?t==="ec-3"||t==="ac-3"||t==="alac"?t:t==="fLaC"||t==="Opus"?ai(t,!1):(ee.warn(`Unhandled audio codec "${t}" in mp4 MAP`),t||"mp4a"):(ee.warn(`Unhandled video codec "${t}" in mp4 MAP`),t||"avc1")}let us;try{us=self.performance.now.bind(self.performance)}catch(a){us=Date.now}const Tr=[{demux:Ol,remux:Hl},{demux:fs,remux:xr},{demux:Dl,remux:xr},{demux:kl,remux:xr}];Tr.splice(2,0,{demux:Cl,remux:xr});class Ya{constructor(e,t,i,n,s,r){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const s=i.transmuxing;s.executeStart=us();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:u,discontinuity:d,trackSwitch:f,accurateTimeOffset:b,timeOffset:x,initSegmentChange:T}=n||o,{audioCodec:G,videoCodec:$,defaultInitPts:ue,duration:ge,initSegmentData:fe}=c,Ce=zl(r,t);if(Ce&&wn(Ce.method)){const Ze=this.getDecrypter(),nt=Rn(Ce.method);if(Ze.isSync()){let Me=Ze.softwareDecrypt(r,Ce.key.buffer,Ce.iv.buffer,nt);if(i.part>-1){const jt=Ze.flush();Me=jt&&jt.buffer}if(!Me)return s.executeEnd=us(),ea(i);r=new Uint8Array(Me)}else return this.asyncResult=!0,this.decryptionPromise=Ze.webCryptoDecrypt(r,Ce.key.buffer,Ce.iv.buffer,nt).then(Me=>{const At=this.push(Me,null,i);return this.decryptionPromise=null,At}),this.decryptionPromise}const ke=this.needsProbing(d,f);if(ke){const Ze=this.configureTransmuxer(r);if(Ze)return this.logger.warn(`[transmuxer] ${Ze.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,fatal:!1,error:Ze,reason:Ze.message}),s.executeEnd=us(),ea(i)}(d||f||T||ke)&&this.resetInitSegment(fe,G,$,ge,t),(d||T||ke)&&this.resetInitialTimestamp(ue),u||this.resetContiguity();const Je=this.transmux(r,Ce,x,b,i);this.asyncResult=tr(Je);const Pe=this.currentTransmuxState;return Pe.contiguous=!0,Pe.discontinuity=!1,Pe.trackSwitch=!1,s.executeEnd=us(),Je}flush(e){const t=e.transmuxing;t.executeStart=us();const{decrypter:i,currentTransmuxState:n,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:o}=n;if(i){const f=i.flush();f&&r.push(this.push(f.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=us();const f=[ea(e)];return this.asyncResult?Promise.resolve(f):f}const d=c.flush(o);return tr(d)?(this.asyncResult=!0,d.then(f=>(this.flushRemux(r,f,e),r))):(this.flushRemux(r,d,e),this.asyncResult?Promise.resolve(r):r)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===ce.MAIN?"level":"track"} ${i.level}`);const d=this.remuxer.remux(n,s,r,o,u,c,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=us()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,s){const{demuxer:r,remuxer:o}=this;!r||!o||(r.resetInitSegment(e,t,i,n),o.resetInitSegment(e,t,i,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,s){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,i,n,s):r=this.transmuxUnencrypted(e,i,n,s),r}transmuxUnencrypted(e,t,i,n){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,r,o,c,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,s){return this.demuxer.demuxSampleAes(e,t,i).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,i,n,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let s;for(let f=0,b=Tr.length;f<b;f++){var r;if((r=Tr[f].demux)!=null&&r.probe(e,this.logger)){s=Tr[f];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,u=s.remux,d=s.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(i,t,n,this.logger)),(!o||!(o instanceof d))&&(this.demuxer=new d(i,t,n,this.logger),this.probe=d.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new ln(this.config)),e}}function zl(a,e){let t=null;return a.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ea=a=>({remuxResult:{},chunkMeta:a});function tr(a){return"then"in a&&a.then instanceof Function}class Yl{constructor(e,t,i,n,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=s||null}}class Xl{constructor(e,t,i,n,s,r){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=s,this.initSegmentChange=r}}let Xa=0;class qa{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Xa++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const u=c.data,d=this.hls;if(!(!d||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var f;const b=(f=this.workerContext)==null?void 0:f.objectURL;b&&self.URL.revokeObjectURL(b);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{d.logger[u.data.logType]&&d.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,d.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const r=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===p.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new Xs,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=h(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||Jo()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=tl(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=el());const{worker:d}=this.workerContext;d.addEventListener("message",this.onWorkerMessage),d.addEventListener("error",this.onWorkerError),d.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:Ct(s)})}catch(d){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,d),this.terminateWorker(),this.error=null,this.transmuxer=new Ya(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new Ya(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Xa++;const t=this.hls.config,i=h(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Ct(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),il(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,s,r,o,c,u,d){var f,b;u.transmuxing.start=self.performance.now();const{instanceNo:x,transmuxer:T}=this,G=r?r.start:s.start,$=s.decryptdata,ue=this.frag,ge=!(ue&&s.cc===ue.cc),fe=!(ue&&u.level===ue.level),Ce=ue?u.sn-ue.sn:-1,ke=this.part?u.part-this.part.index:-1,Je=Ce===0&&u.id>1&&u.id===(ue==null?void 0:ue.stats.chunkCount),Pe=!fe&&(Ce===1||Ce===0&&(ke===1||Je&&ke<=0)),Ze=self.performance.now();(fe||Ce||s.stats.parsing.start===0)&&(s.stats.parsing.start=Ze),r&&(ke||!Pe)&&(r.stats.parsing.start=Ze);const nt=!(ue&&((f=s.initSegment)==null?void 0:f.url)===((b=ue.initSegment)==null?void 0:b.url)),Me=new Xl(ge,Pe,c,fe,G,nt);if(!Pe||ge||nt){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===ce.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${ge}
trackSwitch: ${fe}
contiguous: ${Pe}
accurateTimeOffset: ${c}
timeOffset: ${G}
initSegmentChange: ${nt}`);const At=new Yl(i,n,t,o,d);this.configureTransmuxer(At)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:x,cmd:"demux",data:e,decryptdata:$,chunkMeta:u,state:Me},e instanceof ArrayBuffer?[e]:[]);else if(T){const At=T.push(e,$,u,Me);tr(At)?At.then(jt=>{this.handleTransmuxComplete(jt)}).catch(jt=>{this.transmuxerError(jt,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(At)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const n=i.flush(e);tr(n)?n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Qa=100;class ql extends Sn{constructor(e,t,i){super(e,t,i,"audio-stream-controller",ce.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s}){if(i===ce.MAIN){const r=t.cc,o=this.fragCurrent;if(this.initPTS[r]={baseTime:n,timescale:s},this.log(`InitPTS for cc: ${r} found from main: ${n}/${s}`),this.mainAnchor=t,this.state===it.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==r)&&(this.nextLoadPosition=this.findSyncFrag(t).start),this.tick()}else!this.hls.hasEnoughToStart&&o&&o.cc!==r?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(t).start,o.abortRequests(),this.resetLoadingState()):this.state===it.IDLE&&this.tick()}}findSyncFrag(e){const t=this.getLevelDetails(),i=e.cc;return Li(t,i,e)||t&&ui(t.fragments,i)||e}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=it.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Qa),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=it.IDLE):this.state=it.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case it.IDLE:this.doTickIdle();break;case it.WAITING_TRACK:{const{levels:t,trackId:i}=this,n=t==null?void 0:t[i],s=n==null?void 0:n.details;if(s&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(s))break;this.state=it.WAITING_INIT_PTS}break}case it.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:n,trackId:s}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[s])||null),this.state=it.IDLE}break}case it.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:i,part:n,cache:s,complete:r}=t,o=this.mainAnchor;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.state=it.FRAG_LOADING;const c=s.flush().buffer,u={frag:i,part:n,payload:c,networkDetails:null};this._handleFragmentLoadProgress(u),r&&super._handleFragmentLoadComplete(u)}else o&&o.cc!==t.frag.cc&&(this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${o.cc}`),this.nextLoadPosition=this.findSyncFrag(o).start,this.clearWaitingFragment())}else this.state=it.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.state!==it.STOPPED&&(this.state=it.IDLE))}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:s}=this,r=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(i!=null&&i[s]))return;const o=i[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=it.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,v.AUDIO,ce.AUDIO));const d=this.getFwdBufferInfo(u,ce.AUDIO);if(d===null)return;if(!this.switchingTrack&&this._streamEnded(d,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=it.ENDED;return}const f=d.len,b=t.maxBufferLength,x=c.fragments,T=x[0].start,G=this.getLoadPosition(),$=this.flushing?G:d.end;if(this.switchingTrack&&n){const fe=G;c.PTSKnown&&fe<T&&(d.end>T||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=T+.05)}if(f>=b&&!this.switchingTrack&&$<x[x.length-1].start)return;let ue=this.getNextFragment($,c);if(ue&&this.isLoopLoading(ue,$)&&(ue=this.getNextFragmentLoopLoading(ue,c,d,ce.MAIN,b)),!ue){this.bufferFlushed=!0;return}let ge=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ge&&ae(ue)&&!ue.endList&&(!c.live||!this.loadingParts&&$<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ge)===Ai.OK&&(this.mainFragLoading=ge=null),ge&&ae(ge))){if(ue.start>ge.end){const Ce=this.fragmentTracker.getFragAtPos($,ce.MAIN);Ce&&Ce.end>ge.end&&(ge=Ce,this.mainFragLoading={frag:Ce,targetBufferTime:null})}if(ue.start>ge.end)return}this.loadFragment(ue,o,$)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new tt(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==it.STOPPED&&(this.setInterval(Qa),this.state=it.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(p.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:s,id:r,groupId:o,track:c}=t;if(!n){this.warn(`Audio tracks reset while loading track ${r} "${c.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||s.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==it.STOPPED&&(this.state=it.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${r} "${c.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const d=n[r];let f=0;if(s.live||(i=d.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(d.details){var b;f=this.alignPlaylists(s,d.details,(b=this.levelLastLoaded)==null?void 0:b.details)}s.alignedSliding||(an(s,u),s.alignedSliding||$i(s,u),f=s.fragmentStart)}d.details=s,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===it.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=it.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{config:r,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const u=c[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const d=u.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const f=r.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let b=this.transmuxer;b||(b=this.transmuxer=new qa(this.hls,ce.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const x=this.initPTS[i.cc],T=(t=i.initSegment)==null?void 0:t.data;if(x!==void 0){const $=n?n.index:-1,ue=$!==-1,ge=new yn(i.level,i.sn,i.stats.chunkCount,s.byteLength,$,ue);b.push(s,T,f,"",i,n,d.totalduration,!1,ge,x)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:G}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Ds,complete:!1};G.push(new Uint8Array(s)),this.state!==it.STOPPED&&(this.state=it.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===ce.MAIN&&ae(t.frag)&&(this.mainFragLoading=t,this.state===it.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==ce.AUDIO){!this.audioOnly&&i.type===ce.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(ae(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,E({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=it.ERROR;return}switch(t.details){case j.FRAG_GAP:case j.FRAG_PARSING_ERROR:case j.FRAG_DECRYPT_ERROR:case j.FRAG_LOAD_ERROR:case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_ERROR:case j.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.AUDIO,t);break;case j.AUDIO_TRACK_LOAD_ERROR:case j.AUDIO_TRACK_LOAD_TIMEOUT:case j.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===it.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===me.AUDIO_TRACK&&(this.state=it.IDLE);break;case j.BUFFER_ADD_CODEC_ERROR:case j.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case j.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case j.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==v.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==v.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===it.ENDED&&(this.state=it.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,ce.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:d}=o,{details:f}=d,{audio:b,text:x,id3:T,initSegment:G}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=it.PARSING,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),G!=null&&G.tracks){const $=c.initSegment||c;this._bufferInitSegment(d,G.tracks,$,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:$,id:i,tracks:G.tracks})}if(b){const{startPTS:$,endPTS:ue,startDTS:ge,endDTS:fe}=b;u&&(u.elementaryStreams[v.AUDIO]={startPTS:$,endPTS:ue,startDTS:ge,endDTS:fe}),c.setElementaryStreamInfo(v.AUDIO,$,ue,ge,fe),this.bufferFragmentData(b,c,u,r)}if(T!=null&&(t=T.samples)!=null&&t.length){const $=g({id:i,frag:c,details:f},T);n.trigger(p.FRAG_PARSING_METADATA,$)}if(x){const $=g({id:i,frag:c,details:f},x);n.trigger(p.FRAG_PARSING_USERDATA,$)}}_bufferInitSegment(e,t,i,n){if(this.state!==it.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=ce.AUDIO;const r=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${r}/${s.codec}]`),r&&r.split(",").length===1&&(s.levelCodec=r),this.hls.trigger(p.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===Ai.NOT_LOADED||n===Ai.PARTIAL){var s;if(!ae(e))this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=it.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&$i(t.details,r)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;qe({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,Qe)||(ni(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(p.AUDIO_TRACK_SWITCHED,E({},e))}}class ta extends H{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=t==null?void 0:t.renditionReports;if(n){let s=-1;for(let r=0;r<n.length;r++){const o=n[r];let c;try{c=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),c=o.URI||""}if(c===e){s=r;break}else c===e.substring(0,c.length)&&(s=r)}if(s!==-1){const r=n[s],o=parseInt(r["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let c=parseInt(r["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const d=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&d>t.partTarget&&(c+=1)}const u=i&&Gt(i);return new Pt(o,c>=0?c:void 0,u)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:s}=t,r=self.performance.now(),o=s.loading.first?Math.max(0,r-s.loading.first):0;n.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const d=Math.max(c||0,0);n.appliedTimelineOffset=d,n.fragments.forEach(f=>{f.start=f.playlistOffset+d})}if(n.live||i!=null&&i.live){const d="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){hr(i,n);const ge=n.playlistParsingError;if(ge){this.warn(ge);const fe=this.hls;if(!fe.config.ignorePlaylistParsingErrors){var u;const{networkDetails:Ce}=t;fe.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.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:Ce,stats:s});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,b=f?f.end-f.len:0,x=(n.edge-b)*1e3,T=Es(n,x);if(n.requestScheduled+T<r?n.requestScheduled=r:n.requestScheduled+=T,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let G,$,ue;if(n.canBlockReload&&n.endSN&&n.advanced){const ge=this.hls.config.lowLatencyMode,fe=n.lastPartSn,Ce=n.endSN,ke=n.lastPartIndex,Je=ke!==-1,Pe=fe===Ce;Je?Pe?($=Ce+1,ue=ge?0:ke):($=fe,ue=ge?ke+1:n.maxPartIndex):$=Ce+1;const Ze=n.age,nt=Ze+n.ageHeader;let Me=Math.min(nt-n.partTarget,n.targetduration*1.5);if(Me>0){if(nt>n.targetduration*3)this.log(`Playlist last advanced ${Ze.toFixed(2)}s ago. Omitting segment and part directives.`),$=void 0,ue=void 0;else if(i!=null&&i.tuneInGoal&&nt-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Me} with playlist age: ${n.age}`),Me=0;else{const At=Math.floor(Me/n.targetduration);if($+=At,ue!==void 0){const jt=Math.round(Me%n.targetduration/n.partTarget);ue+=jt}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${Ze.toFixed(2)}s goal: ${Me} skip sn ${At} to part ${ue}`)}n.tuneInGoal=Me}if(G=this.getDeliveryDirectives(n,t.deliveryDirectives,$,ue),ge||!Pe){n.requestScheduled=r,this.loadingPlaylist(d,G);return}}else(n.canBlockReload||n.canSkipUntil)&&(G=this.getDeliveryDirectives(n,t.deliveryDirectives,$,ue));G&&$!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(T-o*2,T/2)),this.scheduleLoading(d,G,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n){this.loadingPlaylist(e,t);return}const s=self.performance.now(),r=n.requestScheduled;if(s>=r){this.loadingPlaylist(e,t);return}const o=r-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,i,n){let s=Gt(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=Tt.No),new Pt(i,n,s)}checkRetry(e){const t=e.details,i=Pi(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===Ci.RetryRequest||!n.resolved&&s===Ci.SendAlternateToPenaltyBox);if(c){var u;if(r>=o.maxNumRetry)return!1;if(i&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const d=bi(o,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),d),this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" in ${d}ms`)}e.levelRetry=!0,n.resolved=!0}return c}}function Ja(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!ir(a[t].attrs,e[t].attrs))return!1;return!0}function ir(a,e,t){const i=a["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(n=>a[n]!==e[n])}function ia(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class Ql extends ta{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Audio track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(n==null?void 0:n.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(b=>!i||i.indexOf(b.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(b=>b.default)&&(this.selectDefaultTrack=!1),o.forEach((b,x)=>{b.id=x});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const b=De(c,o,Qe);if(b>-1)s=o[b];else{const x=De(c,this.tracks);s=this.tracks[x]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const d={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(p.AUDIO_TRACKS_UPDATED,d);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var r;const b=new Error(`No audio track selected for current audio group-ID(s): ${(r=this.groupIds)==null?void 0:r.join(",")} track count: ${o.length}`);this.warn(b.message),this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:b})}}}onError(e,t){t.fatal||!t.context||t.context.type===me.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&qe(e,n,Qe))return n;const s=De(e,this.tracksInGroup,Qe);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=ct(e,t.levels,i,r,Qe);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=De(e,i);if(r>-1)return i[r]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],s=n.details&&!n.details.live;if(e===this.trackId&&n===i&&s||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,E({},n)),s))return;const r=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(!(this.selectDefaultTrack&&!n.default)&&(!e||qe(e,n,Qe)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const d=t[u];if(qe({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},d,Qe))return u}for(let u=0;u<t.length;u++){const d=t[u];if(ir(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const d=t[u];if(ir(e.attrs,d.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&ni(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}}class Jl{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];n.push(e),n.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(s){var i;if(n.onError(s),this.queues===null||this.tracks===null)return;const r=(i=this.tracks[e])==null?void 0:i.buffer;r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],n=i==null?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const eo=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,to="HlsJsTrackRemovedError";class eu extends Error{constructor(e){super(e),this.name=to}}class tu extends H{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:n,mediaSource:s}=this;i&&this.log("Media source opened"),!(!n||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:n,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:n}=this;i!==n&&this.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=Le(ye(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=ye(this.appendSource);if(this.transferData=this.overrides=void 0,i&&n){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),s)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&r instanceof c,io(i),iu(i,o),i.load()}catch(c){i.src=o}else i.src=o}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,s=n?Object.keys(n):null,r=s?s.length:0,o=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(n&&s&&r){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
required tracks: ${Ct(i,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${Ct(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 b=this.fragmentTracker,x=d.id;if(b.hasFragments(x)||b.hasParts(x)){const $=fi.getBuffered(f);b.detectEvictedFragments(u,$,x,null,!0)}const T=na(u),G=[u,f];this.sourceBuffers[T]=G,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,d)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=s.readyState==="open";try{const c=s.sourceBuffers;for(let u=c.length;u--;)o&&c[u].abort(),s.removeSourceBuffer(c[u]);o&&s.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(n.removeAttribute("src"),this.appendSource&&io(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(p.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[na(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Jl(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),r=!s&&this.sourceBufferCount&&this.media&&n.some(o=>!i[o]);if(s||r){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${n}" SourceBuffers`);return}n.forEach(o=>{var c,u,d;const f=t[o],{id:b,codec:x,levelCodec:T,container:G,metadata:$,supplemental:ue}=f;let ge=i[o];const fe=(c=this.transferData)==null||(u=c.tracks)==null?void 0:u[o],Ce=fe!=null&&fe.buffer?fe:ge,ke=(Ce==null?void 0:Ce.pendingCodec)||(Ce==null?void 0:Ce.codec),Je=Ce==null?void 0:Ce.levelCodec;ge||(ge=i[o]={buffer:void 0,listeners:[],codec:x,supplemental:ue,container:G,levelCodec:T,metadata:$,id:b});const Pe=Xt(ke,Je),Ze=Pe==null?void 0:Pe.replace(eo,"$1");let nt=Xt(x,T);const Me=(d=nt)==null?void 0:d.replace(eo,"$1");nt&&Pe&&Ze!==Me&&(o.slice(0,5)==="audio"&&(nt=ai(nt,this.appendSource)),this.log(`switching codec ${ke} to ${nt}`),nt!==(ge.pendingCodec||ge.codec)&&(ge.pendingCodec=nt),ge.container=G,this.appendChangeType(o,G,nt))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,s={label:`change-type=${n}`,execute:()=>{const r=this.tracks[e];if(r){const o=r.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),o.changeType(n),r.codec=i,r.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{this.warn(`Failed to change ${e} SourceBuffer type`,r)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,ce.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&fi.isBuffered(c.buffer,n)||((o=this.fragmentTracker.getAppendedFrag(n,ce.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:n,type:s,parent:r,frag:o,part:c,chunkMeta:u}=t,d=u.buffering[s],f=o.sn,b=self.performance.now();d.start=b;const x=o.stats.buffering,T=c?c.stats.buffering:null;x.start===0&&(x.start=b),T&&T.start===0&&(T.start=b);const G=i.audio;let $=!1;s==="audio"&&(G==null?void 0:G.container)==="audio/mpeg"&&($=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const ue=this.tracks.video,ge=ue==null?void 0:ue.buffer;if(ge&&f!=="initSegment"){const ke=c||o,Je=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend){const Ze=ke.start+ke.duration*.05,nt=ge.buffered,Me=this.currentOp("video");!nt.length&&!Me?this.blockAudio(ke):!Me&&!fi.isBuffered(ge,Ze)&&this.lastVideoAppendEnd<Ze&&this.blockAudio(ke)}else if(s==="video"){const Pe=ke.end;if(Je){const Ze=Je.frag.start;(Pe>Ze||Pe<this.lastVideoAppendEnd||fi.isBuffered(ge,Ze))&&this.unblockAudio()}this.lastVideoAppendEnd=Pe}}const fe=(c||o).start,Ce={label:`append-${s}`,execute:()=>{if(d.executeStart=self.performance.now(),$){const ke=this.tracks[s];if(ke){const Je=ke.buffer;if(Je){const Pe=fe-Je.timestampOffset;Math.abs(Pe)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${fe} (delta: ${Pe}) sn: ${f})`),Je.timestampOffset=fe)}}}this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const ke=self.performance.now();d.executeEnd=d.end=ke,x.first===0&&(x.first=ke),T&&T.first===0&&(T.first=ke);const Je={};this.sourceBuffers.forEach(([Pe,Ze])=>{Pe&&(Je[Pe]=fi.getBuffered(Ze))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:s,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:Je})},onError:ke=>{var Je;const Pe={type:he.MEDIA_ERROR,parent:o.type,details:j.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:ke,err:ke,fatal:!1},Ze=(Je=this.media)==null?void 0:Je.error;if(ke.code===DOMException.QUOTA_EXCEEDED_ERR)Pe.details=j.BUFFER_FULL_ERROR;else if(ke.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Ze)Pe.errorAction=Vi(!0);else if(ke.name===to&&this.sourceBufferCount===0)Pe.errorAction=Vi(!0);else{const nt=++this.appendErrors[s];this.warn(`Failed ${nt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Ze||"no media error"})`),(nt>=this.hls.config.appendErrorMaxRetry||Ze)&&(Pe.fatal=!0)}this.hls.trigger(p.ERROR,Pe)}};this.append(Ce,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:s}=t;i?this.append(this.getFlushOp(i,n,s),i):this.sourceBuffers.forEach(([r])=>{r&&this.append(this.getFlushOp(r,n,s),r)})}onFragParsed(e,t){const{frag:i,part:n}=t,s=[],r=n?n.elementaryStreams:i.elementaryStreams;r[v.AUDIOVIDEO]?s.push("audiovideo"):(r[v.AUDIO]&&s.push("audio"),r[v.VIDEO]&&s.push("video"));const o=()=>{const c=self.performance.now();i.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const u=n?n.stats:i.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:i,part:n,stats:u,id:i.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,s).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t,i;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((i=this.tracks[e])==null?void 0:i.ending))})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([r])=>{if(r){const o=this.tracks[r];(!t.type||t.type===r)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${r} buffer reached EOS`)))}});const n=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([r])=>{var o;return r&&!((o=this.tracks[r])!=null&&o.ended)})&&(n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream(),this.hls.trigger(p.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(p.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){const e=this.getDurationAndRange();e&&this.blockUntilOpen(()=>this.updateMediaSource(e))}onError(e,t){if(t.details===j.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;U(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(U(o)&&o>=0){const c=Math.max(o,r),u=Math.floor(s/r)*r-c;this.flushBackBuffer(s,r,u)}if(U(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=fi.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=fi.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 U(s)?{duration:s}:null;const r=this.media.duration,o=U(i.duration)?i.duration:0;return n>o&&n>r||!U(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(U(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}) ${Ct(i)}`),this.tracksReady){var n;const s=(n=this.transferData)==null?void 0:n.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger(p.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const r=s,o=e[r];if(this.isPending(o)){const c=this.getTrackCodec(o,r),u=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(r)?" Queued":""} ${Ct(o)}`);try{const d=i.addSourceBuffer(u),f=na(r),b=[r,d];t[f]=b,o.buffer=d}catch(d){var n;this.error(`error while trying to add sourceBuffer: ${d.message}`),this.shiftAndExecuteNext(r),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[r],this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,sourceBufferName:r,mimeType:u,parent:o.id});return}this.trackSourceBuffer(r,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&(t==="video"||t==="audiovideo")&&St(i,"video")&&(n=xt(n,i));const s=Xt(n,e.levelCodec);return s?t.slice(0,5)==="audio"?ai(s,this.appendSource):s:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,r)=>{const o=r.removedRanges;o!=null&&o.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const s=this.currentOp(e);s&&s.onError(n)}removeExecutor(e,t,i){const{media:n,mediaSource:s}=this,r=this.tracks[e],o=r==null?void 0:r.buffer;if(!n||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=U(n.duration)?n.duration:1/0,u=U(s.duration)?s.duration:1/0,d=Math.max(0,t),f=Math.min(i,c,u);f>d&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${d},${f}] from the ${e} SourceBuffer`),o.remove(d,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i==null?void 0:i.buffer;if(!n)throw new eu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(r=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const s=n.buffer;if(!s)return;const r=i.bind(this,e);n.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function io(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function iu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function na(a){return a==="audio"?1:0}class sa{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&U(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((n,s)=>this.isLevelAllowed(n)&&s<=e);return this.clientRect=null,sa.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const n=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let s=e.length-1;const r=Math.max(t,i);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=r||c.height>=r)&&n(c,e[o+1])){s=o;break}}return s}}const Cn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},nu={HLS:"h"},nr={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},su={[nr.OBJECT]:["br","d","ot","tb"],[nr.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[nr.SESSION]:["cid","pr","sf","sid","st","v"],[nr.STATUS]:["bs","rtp"]};class Ms{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Ms?i:new Ms(i))),this.value=e,this.params=t}}const ru="Dict";function au(a){return Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":typeof a=="object"?JSON.stringify(a):String(a)}function ou(a,e,t,i){return new Error(`failed to ${a} "${au(e)}" as ${t}`,{cause:i})}function ss(a,e,t){return ou("serialize",a,e,t)}class no{constructor(e){this.description=e}}const so="Bare Item",lu="Boolean";function uu(a){if(typeof a!="boolean")throw ss(a,lu);return a?"?1":"?0"}const cu="Byte Sequence";function hu(a){if(ArrayBuffer.isView(a)===!1)throw ss(a,cu);return`:${dl(a)}:`}const du="Integer";function fu(a){return a<-999999999999999||999999999999999<a}function ro(a){if(fu(a))throw ss(a,du);return a.toString()}function pu(a){return`@${ro(a.getTime()/1e3)}`}const mu="Decimal";function gu(a){const e=Ca(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ss(a,mu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const _u="String",vu=/[\x00-\x1f\x7f]+/;function yu(a){if(vu.test(a))throw ss(a,_u);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Eu(a){return a.description||a.toString().slice(7,-1)}const bu="Token";function ao(a){const e=Eu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ss(e,bu);return e}function ra(a){switch(typeof a){case"number":if(!U(a))throw ss(a,so);return Number.isInteger(a)?ro(a):gu(a);case"string":return yu(a);case"symbol":return ao(a);case"boolean":return uu(a);case"object":if(a instanceof Date)return pu(a);if(a instanceof Uint8Array)return hu(a);if(a instanceof no)return ao(a);default:throw ss(a,so)}}const Su="Key";function aa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw ss(a,Su);return a}function oa(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${aa(e)}`:`;${aa(e)}=${ra(t)}`).join("")}function oo(a){return a instanceof Ms?`${ra(a.value)}${oa(a.params)}`:ra(a)}function xu(a){return`(${a.value.map(oo).join(" ")})${oa(a.params)}`}function Tu(a,e={whitespace:!0}){if(typeof a!="object")throw ss(a,ru);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof Ms||(s=new Ms(s));let r=aa(n);return s.value===!0?r+=oa(s.params):(r+="=",Array.isArray(s.value)?r+=xu(s):r+=oo(s)),r}).join(`,${i}`)}function Au(a,e){return Tu(a,e)}function wu(a){return a==="ot"||a==="sf"||a==="st"}function Ru(a){return typeof a=="number"?U(a):a!=null&&a!==""&&a!==!1}const Ar=a=>Math.round(a),Lu=(a,e)=>(e!=null&&e.baseUrl&&(a=fl(a,e.baseUrl)),encodeURIComponent(a)),wr=a=>Ar(a/100)*100,Iu={br:Ar,d:Ar,bl:wr,dl:wr,mtp:wr,nor:Lu,rtp:wr,tb:Ar};function Du(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=g({},Iu,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return i.forEach(r=>{if(s!=null&&s(r))return;let o=a[r];const c=n[r];c&&(o=c(o,e)),!(r==="v"&&o===1)&&(r=="pr"&&o===1||Ru(o)&&(wu(r)&&typeof o=="string"&&(o=new no(o)),t[r]=o))}),t}function lo(a,e={}){return a?Au(Du(a,e),g({whitespace:!1},e)):""}function Cu(a,e={}){const t={};if(!a)return t;const i=Object.entries(a),n=Object.entries(su).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((r,o)=>{var c,u;const[d,f]=o,b=((c=n.find(x=>x[1].includes(d)))===null||c===void 0?void 0:c[0])||nr.REQUEST;return(u=r[b])!==null&&u!==void 0||(r[b]={}),r[b][d]=f,r},{});return Object.entries(s).reduce((r,[o,c])=>(r[o]=lo(c,e),r),t)}function ku(a,e,t){return g(a,Cu(e,t))}const Pu="CMCD";function Ou(a,e={}){if(!a)return"";const t=lo(a,e);return`${Pu}=${encodeURIComponent(t)}`}const uo=/CMCD=[^&#]+/;function Mu(a,e,t){const i=Ou(e,t);if(!i)return a;if(uo.test(a))return a.replace(uo,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Nu{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:Cn.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=n=>{try{const{frag:s,part:r}=n,o=this.hls.levels[s.level],c=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:c};(c===Cn.VIDEO||c===Cn.AUDIO||c==Cn.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const d=r?this.getNextPart(r):this.getNextFrag(s);d!=null&&d.url&&d.url!==s.url&&(u.nor=d.url),this.apply(n,u)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:nu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){g(t,this.createData());const i=t.ot===Cn.INIT||t.ot===Cn.VIDEO||t.ot===Cn.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((r,o)=>(n.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),ku(e.headers,t,s)):e.url=Mu(e.url,t,s)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t,i;const{index:n,fragment:s}=e,r=(t=this.hls.levels[s.level])==null||(i=t.details)==null?void 0:i.partList;if(r){const{sn:o}=s;for(let c=r.length-1;c>=0;c--){const u=r[c];if(u.index===n&&u.fragment.sn===o)return r[c+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Cn.TIMED_TEXT;if(e.sn==="initSegment")return Cn.INIT;if(t==="audio")return Cn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Cn.VIDEO:Cn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Cn.AUDIO)i=n.audioTracks;else{const s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;i=n.levels.slice(0,r)}for(const s of i)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Cn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:fi.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}}const Fu=3e5;class Bu extends H{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===Ci.SendAlternateToPenaltyBox&&i.flags===Ii.MoveAllAlternatesMatchingHost){const n=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&n?r=this.getPathwayForGroupId(o,u,r):c&&(r=c)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&n&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${n&&n.length} priorities: ${Ct(s)} penalized: ${Ct(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(s=>{n-i[s]>Fu&&delete i[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in i)continue;if(r===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,Zs(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];c&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let s=0;s<n.length;s++)if(t===me.AUDIO_TRACK&&n[s].hasAudioGroup(e)||t===me.SUBTITLE_TRACK&&n[s].hasSubtitleGroup(e))return n[s].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};e.forEach(s=>{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":c}=s;if(t.some(d=>d.pathwayId===r))return;const u=this.getLevelsForPathway(o).map(d=>{const f=new Wi(d.attrs);f["PATHWAY-ID"]=r;const b=f.AUDIO&&`${f.AUDIO}_clone_${r}`,x=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;b&&(i[f.AUDIO]=b,f.AUDIO=b),x&&(n[f.SUBTITLES]=x,f.SUBTITLES=x);const T=ho(d.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),G=new tt({attrs:f,audioCodec:d.audioCodec,bitrate:d.bitrate,height:d.height,name:d.name,url:T,videoCodec:d.videoCodec,width:d.width});if(d.audioGroups)for(let $=1;$<d.audioGroups.length;$++)G.addGroupId("audio",`${d.audioGroups[$]}_clone_${r}`);if(d.subtitleGroups)for(let $=1;$<d.subtitleGroups.length;$++)G.addGroupId("text",`${d.subtitleGroups[$]}_clone_${r}`);return G});t.push(...u),co(this.audioTracks,i,c,r),co(this.subtitleTracks,n,c,r)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let n;try{n=new self.URL(e)}catch(d){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const d=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+d)}const s={responseType:"json",url:n.href},r=t.steeringManifestLoadPolicy.default,o=r.errorRetry||r.timeoutRetry||{},c={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(d,f,b,x)=>{this.log(`Loaded steering manifest: "${n}"`);const T=d.data;if((T==null?void 0:T.VERSION)!==1){this.log(`Steering VERSION ${T.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=T.TTL;const{"RELOAD-URI":G,"PATHWAY-CLONES":$,"PATHWAY-PRIORITY":ue}=T;if(G)try{this.uri=new self.URL(G,n).href}catch(fe){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${G}`);return}this.scheduleRefresh(this.uri||b.url),$&&this.clonePathways($);const ge={steeringManifest:T,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,ge),ue&&this.updatePathwayPriority(ue)},onError:(d,f,b,x)=>{if(this.log(`Error loading steering manifest: ${d.code} ${d.text} (${f.url})`),this.stopLoad(),d.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let T=this.timeToLoad*1e3;if(d.code===429){const G=this.loader;if(typeof(G==null?void 0:G.getResponseHeader)=="function"){const $=G.getResponseHeader("Retry-After");$&&(T=parseFloat($)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,T)},onTimeout:(d,f,b)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(s,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const n=(i=this.hls)==null?void 0:i.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function co(a,e,t,i){a&&Object.keys(e).forEach(n=>{const s=a.filter(r=>r.groupId===n).map(r=>{const o=g({},r);return o.details=void 0,o.attrs=new Wi(o.attrs),o.url=o.attrs.URI=ho(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[n],o.attrs["PATHWAY-ID"]=i,o});a.push(...s)})}function ho(a,e,t,i){const{HOST:n,PARAMS:s,[t]:r}=i;let o;e&&(o=r==null?void 0:r[e],o&&(a=o));const c=new self.URL(a);return n&&!o&&(c.host=n),s&&Object.keys(s).sort().forEach(u=>{u&&c.searchParams.set(u,s[u])}),c.href}class Ns extends H{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Ns.CDMCleanupPromise?[Ns.CDMCleanupPromise]:[],this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,s=`"${t.type}" event: init data type: "${i}"`;if(this.debug(s),n!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=qt(this.config));const o=r.map(Hn).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=Wn(r);let c,u;if(i==="sinf"){if(o!==Di.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const T=mt(new Uint8Array(n));try{const G=un(JSON.parse(T).sinf),$=Z(G);if(!$)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array($.subarray(8,24)),u=Di.FAIRPLAY}catch(G){this.warn(`${s} Failed to parse sinf: ${G}`);return}}else{if(o!==Di.WIDEVINE&&o!==Di.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const T=Zt(n),G=T.filter(ue=>!!ue.systemId&&os(ue.systemId)===o);G.length>1&&this.warn(`${s} Using first of ${G.length} pssh found for selected key-system ${o}`);const $=G[0];if(!$){T.length===0||T.some(ue=>!ue.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${T.map(ue=>os(ue.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(u=os($.systemId),$.version===0&&$.data)if(u===Di.WIDEVINE){const ue=$.data.length-22;c=new Uint8Array($.data.subarray(ue,ue+16))}else u===Di.PLAYREADY&&(c=ls($.data))}if(!u||!c)return;const d=J.hexDump(c),{keyIdToKeySessionPromise:f,mediaKeySessions:b}=this;let x=f[d];for(let T=0;T<b.length;T++){const G=b[T],$=G.decryptdata;if(!$.keyId)continue;const ue=J.hexDump($.keyId);if(d===ue||$.uri.replace(/-/g,"").indexOf(d)!==-1){if(x=f[ue],$.pssh)break;delete f[ue],$.pssh=new Uint8Array(n),$.keyId=c,x=f[d]=x.then(()=>this.generateRequestWithPreferredKeySession(G,i,n,"encrypted-event-key-match")),x.catch(ge=>this.handleError(ge));break}}if(!x){if(u!==o){this.log(`Ignoring "${t.type}" event with ${u} init data for selected key-system ${o}`);return}x=f[d]=this.getKeySystemSelectionPromise([u]).then(({keySystem:T,mediaKeys:G})=>{var $;this.throwIfDestroyed();const ue=new bn("ISO-23001-7",d,($=Hn(T))!=null?$:"");return ue.pssh=new Uint8Array(n),ue.keyId=c,this.attemptSetMediaKeys(T,G).then(()=>{this.throwIfDestroyed();const ge=this.createMediaKeySessionContext({decryptdata:ue,keySystem:T,mediaKeys:G});return this.generateRequestWithPreferredKeySession(ge,i,n,"encrypted-event-no-match")})}),x.catch(T=>this.handleError(T))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){const e=this.media;this.unregisterListeners(),this.onMediaDetached(),this._clear(e);const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===Di.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(r,o,c)=>!!r&&c.indexOf(r)===o,n=t.map(r=>r.audioCodec).filter(i),s=t.map(r=>r.videoCodec).filter(i);return n.length+s.length===0&&s.push("avc1.42e01e"),new Promise((r,o)=>{const c=u=>{const d=u.shift();this.getMediaKeysPromise(d,n,s).then(f=>r({keySystem:d,mediaKeys:f})).catch(f=>{u.length?c(u):f instanceof Kn?o(f):o(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return vi===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){const n=Hi(e,t,i,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let r=s==null?void 0:s.keySystemAccess;if(!r){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Ct(n)}`),r=this.requestMediaKeySystemAccess(e,n);const o=this.keySystemAccessPromises[e]={keySystemAccess:r};return r.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),r.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const u=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=c.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),u.then(f=>f?this.setMediaKeysServerCertificate(d,e,f):d))),o.mediaKeys.catch(d=>{this.error(`Failed to create media-keys for "${e}"}: ${d}`)}),o.mediaKeys})}return r.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${J.hexDump(e.keyId||[])}`);const n=i.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,s,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return J.hexDump(e.keyId)}updateKeySession(e,t){var i;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${J.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
} (data length: ${t&&t.byteLength})`),n.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const n=qt(this.config),s=e.map(Wn).filter(r=>!!r&&n.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:r})=>{const o=Hn(r);o?t(o):i(new Error(`Unable to find format for key-system "${r}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);let s=this.keyIdToKeySessionPromise[i];return s||(s=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(o,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:o,mediaKeys:c,decryptdata:t}))))),(this.keyIdToKeySessionPromise[i]=s.then(o=>{const c="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(o,c,u,"playlist-key")})).catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Kn?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=Wn(e.keyFormat),s=n?[n]:qt(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=qt(this.config)),e.length===0)throw new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Ct({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>i.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var s,r;const o=(s=this.config.drmSystems)==null||(r=s[e.keySystem])==null?void 0:r.generateRequest;if(o)try{const T=o.call(this.hls,t,i,e);if(!T)throw new Error("Invalid response from configured generateRequest filter");t=T.initDataType,i=T.initData?T.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(T){var c;if(this.warn(T.message),(c=this.hls)!=null&&c.config.debug)throw T}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${u} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new Xs,f=e._onmessage=T=>{const G=e.mediaKeysSession;if(!G){d.emit("error",new Error("invalid state"));return}const{messageType:$,message:ue}=T;this.log(`"${$}" message event for session "${G.sessionId}" message size: ${ue.byteLength}`),$==="license-request"||$==="license-renewal"?this.renewLicense(e,ue).catch(ge=>{d.eventNames().length?d.emit("error",ge):this.handleError(ge)}):$==="license-release"?e.keySystem===Di.FAIRPLAY&&(this.updateKeySession(e,In("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${$}"`)},b=e._onkeystatuseschange=T=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const $=e.keyStatus;d.emit("keyStatus",$),$==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",f),e.mediaKeysSession.addEventListener("keystatuseschange",b);const x=new Promise((T,G)=>{d.on("error",G),d.on("keyStatus",$=>{$.startsWith("usable")?T():$==="output-restricted"?G(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):$==="internal-error"?G(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${$}"`)):$==="expired"?G(new Error("key expired while generating request")):this.warn(`unhandled key status change "${$}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var T;this.log(`Request generated for key-session "${(T=e.mediaKeysSession)==null?void 0:T.sessionId}" keyId: ${u}`)}).catch(T=>{throw new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_NO_SESSION,error:T,fatal:!1},`Error generating key-session request: ${T}`)}).then(()=>x).catch(T=>{throw d.removeAllListeners(),this.removeSession(e),T}).then(()=>(d.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{if(typeof i=="string"&&typeof t=="object"){const n=i;i=t,t=n}this.log(`key status change "${t}" for keyStatuses keyId: ${J.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${J.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,o)=>{const c={responseType:"arraybuffer",url:s},u=t.certLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(b,x,T,G)=>{r(b.data)},onError:(b,x,T,G)=>{o(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:T,response:E({url:c.url,data:void 0},b)},`"${e}" certificate request failed (${s}). Status: ${b.code} (${b.text})`))},onTimeout:(b,x,T)=>{o(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:T,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(b,x,T)=>{o(new Error("aborted"))}};n.load(c,d,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,s)=>{e.setServerCertificate(i).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),n(e)}).catch(r=>{s(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:n,fatal:!0},n.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(i,"application/xml"),s=n.querySelectorAll("HttpHeader");if(s.length>0){let d;for(let f=0,b=s.length;f<b;f++){var r,o;d=s[f];const x=(r=d.querySelector("name"))==null?void 0:r.textContent,T=(o=d.querySelector("value"))==null?void 0:o.textContent;x&&T&&e.setRequestHeader(x,T)}}const c=n.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return In(atob(u))}setupLicenseXHR(e,t,i,n){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,i,n)}).catch(r=>{if(!i.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,i,n)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,s)=>{const r=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${r}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let c=o.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const u=this.config.licenseResponseCallback;if(u)try{c=u.call(this.hls,o,r,e)}catch(d){this.error(d)}n(c)}else{const c=i.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new Kn({type:he.KEY_SYSTEM_ERROR,details:j.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:r,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${r}). Status: ${o.status} (${o.statusText})`));else{const d=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${d} attempts left`),this.requestLicense(e,t).then(n,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,r,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==Di.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null)}_clear(e){var t;const i=this.mediaKeySessions;this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},bn.clearKeyUriToKeyIdMap();const n=i.length;Ns.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(e==null||(t=e.setMediaKeys(null))==null?void 0:t.catch(s=>{var r;this.log(`Could not clear media keys: ${s}`),(r=this.hls)==null||r.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).then(()=>{n&&(this.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(s=>{var r;this.log(`Could not close sessions and clear media keys: ${s}`),(r=this.hls)==null||r.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,s)=>(n.indexOf(s.keyFormat)===-1&&n.push(s.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{drmSystemOptions:s}=this.config;return(Xi(s)?new Promise((o,c)=>{self.setTimeout(()=>c(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(o)}):Promise.resolve()).catch(o=>{var c;this.log(`Could not remove session: ${o}`),(c=this.hls)==null||c.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${o}`)})}).then(()=>t.close()).catch(o=>{var c;this.log(`Could not close session: ${o}`),(c=this.hls)==null||c.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}}}Ns.CDMCleanupPromise=void 0;class Kn extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class Uu{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const s=n-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),c>0&&r>u.config.fpsDroppedMonitoringThreshold*o){let d=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=d)&&(d=d-1,u.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:u.currentLevel}),u.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function fo(a,e){let t;try{t=new Event("addtrack")}catch(i){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function po(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){ee.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){ee.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function Fs(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let i=a.cues.length;i--;)e&&a.cues[i].removeEventListener("enter",e),a.removeCue(a.cues[i]);t==="disabled"&&(a.mode=t)}function la(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=$u(a.cues,e,t);for(let r=0;r<s.length;r++)(!i||i(s[r]))&&a.removeCue(s[r])}n==="disabled"&&(a.mode=n)}function Ku(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let i=0,n=t,s;for(;i<=n;)if(s=Math.floor((n+i)/2),e<a[s].startTime)n=s-1;else if(e>a[s].startTime&&i<t)i=s+1;else return s;return a[i].startTime-e<e-a[n].startTime?i:n}function $u(a,e,t){const i=[],n=Ku(a,e);if(n>-1)for(let s=n,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Rr(a){const e=[];for(let t=0;t<a.length;t++){const i=a[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(a[t])}return e}class Gu extends ta{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Rr(this.media.textTracks);for(let s=0;s<i.length;s++)if(i[s].mode==="hidden")t=i[s];else if(i[s].mode==="showing"){t=i[s];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;Rr(i.textTracks).forEach(r=>{Fs(r)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(r=>(n==null?void 0:n.indexOf(r))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(d=>!i||i.indexOf(d.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(d=>d.default)&&(this.selectDefaultTrack=!1),r.forEach((d,f)=>{d.id=f});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=r;const o=this.hls.config.subtitlePreference;if(!s&&o){this.selectDefaultTrack=!1;const d=De(o,r);if(d>-1)s=r[d];else{const f=De(o,this.tracks);s=this.tracks[f]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const u={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const s=t[n];if(!(i&&!s.default||!i&&!e)&&(!e||qe(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(ir(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(ir(e.attrs,s.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(ia(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===me.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&qe(e,i))return i;const n=De(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=De(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Rr(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>ia(i,s))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==n&&(s.mode="disabled")}),n){const s=this.subtitleDisplay?"showing":"hidden";n.mode!==s&&(n.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!U(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&s)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:r,groupId:o="",name:c,type:u,url:d}=n;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:d});const f=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(f)}}function sr(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Bs=.025;let Lr=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Vu(a,e,t){return`${a.identifier}-${t+1}-${sr(e)}`}class ju{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){if(e>=this.assetList.length)return!0;const t=this.playoutLimit;return e<=0||isNaN(t)?!1:this.assetList[e].startOffset>t}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return ua(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=ua(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=U(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return ua(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Bs))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Lr.Range:Lr.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return Wu(this)}}function ua(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<Bs)?e.start:e.start+e.duration}function mo(a,e,t){const i=new self.URL(a,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Wu(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function ca(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Hu{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{const u=this.interstitial.playoutLimit,d=this.currentTime;this.startOffset+d>=u&&this.hls.trigger(p.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=n;let r=n.uri;try{r=mo(r,s.sessionId).href}catch(c){}s.loadSource(r);const o=()=>{this.hasDetails=!0};s.once(p.LEVEL_LOADED,o),s.once(p.AUDIO_TRACK_LOADED,o),s.once(p.SUBTITLE_TRACK_LOADED,o),s.on(p.MEDIA_ATTACHING,(c,{media:u})=>{this.removeMediaListeners(),this.mediaAttached=u,this.interstitial.playoutLimit&&u.addEventListener("timeupdate",this.checkPlayout)})}bufferedInPlaceToEnd(e){var t;if(!this.interstitial.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,n=fi.bufferInfo(e,i,0);return this.getAssetTime(n.end)>=this._bufferedEosTime-.02}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=fi.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}on(e,t,i){this.hls.on(e,t)}once(e,t,i){this.hls.once(e,t)}off(e,t,i){this.hls.off(e,t)}toString(){var e,t;return`HlsAssetPlayer: ${ca(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${(t=this.interstitial)!=null&&t.appendInPlace?"append-in-place":""}`}}const go=.033;class Zu extends H{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(s=n[i])!=null&&s.event;){var s;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;n<i.length;n++){let s=i[n];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return n}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let n=e;n<=t&&i[n];n++){const s=i[n].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var i;if(((i=t[n].event)==null?void 0:i.identifier)===e)return n}return-1}findAssetIndex(e,t){const i=e.assetList,n=i.length;if(n>1)for(let s=0;s<n;s++){const r=i[s];if(!r.error){const o=r.timelineStart;if(t===o||t>o&&t<o+(r.duration||0))return s}}return 0}get assetIdAtEnd(){var e,t;const i=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(i){const n=i.assetList,s=n[n.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:n}=i,s=this.events,r=this.parseDateRanges(n,{url:i.url},t),o=Object.keys(n),c=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,d)=>{const f=u.cue.pre,b=u.cue.post,x=d.cue.pre,T=d.cue.post;if(f&&!x)return-1;if(x&&!f||b&&!T)return 1;if(T&&!b)return-1;if(!f&&!x&&!b&&!T){const G=u.startTime,$=d.startTime;if(G!==$)return G-$}return u.dateRange.tagOrder-d.dateRange.tagOrder}),this.events=r,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[]){const i=this.events||[];if(i.length||t.length||this.length<2){const n=this.items,s=this.parseSchedule(i,e);(t.length||(n==null?void 0:n.length)!==s.length||s.some((o,c)=>Math.abs(o.playout.start-n[c].playout.start)>.005||Math.abs(o.playout.end-n[c].playout.end)>.005))&&(this.items=s,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,i){const n=[],s=Object.keys(e);for(let r=0;r<s.length;r++){const o=s[r],c=e[o];if(c.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(c):(u=new ju(c,t),this.eventMap[o]=u,i===!1&&(u.appendInPlace=i)),n.push(u)}}return n}parseSchedule(e,t){const i=[],n=t.main.details,s=n.live?1/0:n.edge;let r=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,u=0;if(e.forEach((d,f)=>{const b=d.cue.pre,x=d.cue.post,T=e[f-1]||null,G=d.appendInPlace,$=x?s:d.startOffset,ue=d.duration,ge=d.timelineOccupancy===Lr.Range?ue:0,fe=d.resumptionOffset,Ce=(T==null?void 0:T.startTime)===$,ke=$+d.cumulativeDuration;let Je=G?ke+ue:$+fe;if(b||!x&&$<=0){const Ze=u;u+=ge,d.timelineStart=ke;const nt=r;r+=ue,i.push({event:d,start:ke,end:Je,playout:{start:nt,end:r},integrated:{start:Ze,end:u}})}else if($<=s){if(!Ce){const Me=$-c;if(Me>go){const At=c,jt=u;u+=Me;const Oi=r;r+=Me;const yi={previousEvent:e[f-1]||null,nextEvent:d,start:At,end:At+Me,playout:{start:Oi,end:r},integrated:{start:jt,end:u}};i.push(yi)}else Me>0&&T&&(T.cumulativeDuration+=Me,i[i.length-1].end=$)}x&&(Je=ke),d.timelineStart=ke;const Ze=u;u+=ge;const nt=r;r+=ue,i.push({event:d,start:ke,end:Je,playout:{start:nt,end:r},integrated:{start:Ze,end:u}})}else return;const Pe=d.resumeTime;x||Pe>s?c=s:c=Pe}),c<s){var o;const d=c,f=u,b=s-c;u+=b;const x=r;r+=b,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:d+b,playout:{start:x,end:r},integrated:{start:f,end:u}})}this.setDurations(s,r,u)}else i.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,n=i.live?1/0:i.edge;let s=0,r=-1;e.forEach((o,c)=>{const u=o.cue.pre,d=o.cue.post,f=u?0:d?n:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!d&&o.snapOptions.in&&(o.resumeAnchor=mi(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<go&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const x=U(o.resumeOffset)?o.resumeOffset:o.duration;s+=x})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>Bs?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):t?!Object.keys(t).some(r=>{const o=t[r].details,c=o.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${r} playlist end ${c}`),!1;const u=mi(null,o.fragments,i);if(!u)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${r} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const d=r==="audio"?.175:0;return Math.abs(u.start-i)<Bs+d||Math.abs(u.end-i)<Bs+d?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${r} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${i} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,n=!1,s=!1;e.assetList.forEach((r,o)=>{const c=t+i;r.startOffset=i,r.timelineStart=c,n||(n=r.duration===null),s||(s=!!r.error);const u=r.error?0:r.duration||0;i+=u}),n&&!s?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function ms(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class zu{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=mo(i,this.hls.sessionId,e.baseUrl)}catch(b){const x=this.assignAssetListError(e,j.ASSET_LIST_LOAD_ERROR,b,i);this.hls.trigger(p.ERROR,x);return}t&&n.protocol!=="data:"&&n.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),c={responseType:"json",url:n.href},u=s.interstitialAssetListLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(b,x,T,G)=>{const $=b.data,ue=$==null?void 0:$.ASSETS;if(!Array.isArray(ue)){const ge=this.assignAssetListError(e,j.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),T.url,x,G);this.hls.trigger(p.ERROR,ge);return}e.assetListResponse=$,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:$,networkDetails:G})},onError:(b,x,T,G)=>{const $=this.assignAssetListError(e,j.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${b.code} ${b.text} (${x.url})`),x.url,G,T);this.hls.trigger(p.ERROR,$)},onTimeout:(b,x,T)=>{const G=this.assignAssetListError(e,j.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${x.url})`),x.url,b,T);this.hls.trigger(p.ERROR,G)}};return o.load(c,d,f),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:he.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function cs(a,e,t){rs(a,e,t),a.addEventListener(e,t)}function rs(a,e,t){a.removeEventListener(e,t)}function _o(a){a==null||a.play().catch(()=>{})}class Yu extends H{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;const n=i-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const r=n<=-.01;this.timelinePos=i,this.bufferedPos=i;const o=this.playingItem;if(!o){this.checkBuffer();return}if(r&&this.schedule.resetErrorsInRange(i,i-n)&&this.updateSchedule(),this.checkBuffer(),r&&i<o.start||i>=o.end){var c;const b=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r){const x=this.findItemIndex(o);if(b>x){const T=this.schedule.findJumpRestrictedIndex(x+1,b);if(T>x){this.setSchedulePosition(T);return}}}this.setSchedulePosition(b);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const b=o.event.assetList[0];b&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,b))}return}const d=u.timelineStart,f=u.duration||0;(r&&i<d||i>=d+f)&&this.setScheduleToAssetAtTime(i,u)},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(i>=n.end){this.timelinePos=n.end;const o=this.findItemIndex(n);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const r=s.timelineStart+(s.duration||0);i>=r&&this.setScheduleToAssetAtTime(i,s)},this.onScheduleUpdate=(i,n)=>{const s=this.schedule,r=this.playingItem,o=s.events||[],c=s.items||[],u=s.durations,d=i.map(x=>x.identifier),f=!!(o.length||d.length);if(f&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(x=>ms(x))}`),d.length&&this.log(`Removed events ${d}`),this.playerQueue.forEach(x=>{if(x.interstitial.appendInPlace){const T=x.assetItem.timelineStart,G=x.timelineOffset-T;if(G)try{x.timelineOffset=T}catch($){Math.abs(G)>Bs&&this.warn(`${$} ("${x.assetId}" ${x.timelineOffset}->${T})`)}}}),r){const x=this.updateItem(r,this.timelinePos);this.itemsMatch(r,x)&&(this.playingItem=x,this.waitingItem=this.endedItem=null)}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const b=this.bufferingItem;if(b){const x=this.updateItem(b,this.bufferedPos);this.itemsMatch(b,x)?this.bufferingItem=x:b.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(b.event,null))}if(i.forEach(x=>{x.assetList.forEach(T=>{this.clearAssetPlayer(T.identifier,null)})}),f||n){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:d}),this.isInterstitial(r)&&d.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new zu(e),this.schedule=new Zu(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(p.MEDIA_ENDED,this.onMediaEnded,this),e.on(p.ERROR,this.onError,this),e.on(p.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(p.MEDIA_ENDED,this.onMediaEnded,this),e.off(p.ERROR,this.onError,this),e.off(p.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){rs(e,"play",this.onPlay),rs(e,"pause",this.onPause),rs(e,"seeking",this.onSeeking),rs(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;cs(i,"seeking",this.onSeeking),cs(i,"timeupdate",this.onTimeupdate),cs(i,"play",this.onPlay),cs(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const s=this.findItemIndex(i);this.setSchedulePosition(s)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=f=>f&&e.getAssetPlayer(f.identifier),n=(f,b,x,T,G)=>{if(f){let $=f[b].start;const ue=f.event;if(ue){if(b==="playout"||ue.timelineOccupancy!==Lr.Point){const ge=i(x);(ge==null?void 0:ge.interstitial)===ue&&($+=ge.assetItem.startOffset+ge[G])}}else{const ge=T==="bufferedPos"?r():e[T];$+=ge-f.start}return $}return 0},s=(f,b)=>{if(f!==0&&b!=="primary"&&e.schedule.length){var x;const T=e.schedule.findItemIndexAtTime(f),G=(x=e.schedule.items)==null?void 0:x[T];if(G){const $=G[b].start-G.start;return f+$}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var b;return(b=e.primaryDetails)!=null&&b.live?e.primaryDetails.edge:e.schedule.durations[f]},c=(f,b)=>{var x,T;const G=e.effectivePlayingItem;if(G!=null&&(x=G.event)!=null&&x.restrictions.skip)return;e.log(`seek to ${f} "${b}"`);const $=e.effectivePlayingItem,ue=e.schedule.findItemIndexAtTime(f,b),ge=(T=e.schedule.items)==null?void 0:T[ue],fe=e.getBufferingPlayer(),Ce=fe==null?void 0:fe.interstitial,ke=Ce==null?void 0:Ce.appendInPlace,Je=$&&e.itemsMatch($,ge);if($&&(ke||Je)){const Ze=i(e.playingAsset),nt=(Ze==null?void 0:Ze.media)||e.primaryMedia;if(nt){const Me=b==="primary"?nt.currentTime:n($,b,e.playingAsset,"timelinePos","currentTime"),At=f-Me,jt=(ke?Me:nt.currentTime)+At;if(jt>=0&&(!Ze||ke||jt<=Ze.duration)){nt.currentTime=jt;return}}}if(ge){let Ze=f;if(b!=="primary"){const Me=ge[b].start,At=f-Me;Ze=ge.start+At}const nt=!e.isInterstitial(ge);if((!e.isInterstitial($)||$.event.appendInPlace)&&(nt||ge.event.appendInPlace)){const Me=e.media||(ke?fe==null?void 0:fe.media:null);Me&&(Me.currentTime=Ze)}else if($){const Me=e.findItemIndex($);if(ue>Me){const jt=e.schedule.findJumpRestrictedIndex(Me+1,ue);if(jt>Me){e.setSchedulePosition(jt);return}}let At=0;if(nt)e.timelinePos=Ze,e.checkBuffer();else{var Pe;const jt=ge==null||(Pe=ge.event)==null?void 0:Pe.assetList;if(jt){const Oi=f-(ge[b]||ge).start;for(let yi=jt.length;yi--;){const hi=jt[yi];if(hi.duration&&Oi>=hi.startOffset&&Oi<hi.startOffset+hi.duration){At=yi;break}}}}e.setSchedulePosition(ue,At)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const b=t();return e.isInterstitial(b)?b:null},d={get currentTime(){const f=u(),b=e.effectivePlayingItem;return b&&b===f?n(b,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-b.playout.start:0},set currentTime(f){const b=u(),x=e.effectivePlayingItem;x&&x===b&&c(f+x.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const b=(f=u())==null?void 0:f.event.assetList;return b?b.map(x=>e.getAssetPlayer(x.identifier)):[]},get playingIndex(){var f;const b=(f=u())==null?void 0:f.event;return b&&e.effectivePlayingAsset?b.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};this.manager={get events(){var f,b;return((f=e.schedule)==null||(b=f.events)==null?void 0:b.slice(0))||[]},get schedule(){var f,b;return((f=e.schedule)==null||(b=f.items)==null?void 0:b.slice(0))||[]},get interstitialPlayer(){return u()?d:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const f=t();return e.findItemIndex(f)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const f=e.effectivePlayingItem;return e.findItemIndex(f)},primary:{get bufferedEnd(){return r()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){c(f,"primary")},get duration(){return o("primary")},get seekableStart(){var f;return((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){c(f,"integrated")},get duration(){return o("integrated")},get seekableStart(){var f;return s(((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,b=f==null?void 0:f.event;if(b&&!b.restrictions.skip){const x=e.findItemIndex(f);if(b.appendInPlace){const T=f.playout.start+f.event.duration;c(T+.001,"playout")}else e.advanceAfterAssetEnded(b,x,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t,i;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(s=this.primaryMedia);const r=(i=s)==null?void 0:i.currentTime;if(!(r===void 0||!U(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} ${Ct(s)}`),this.detachedData=s}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let s=null;const r=this.hls,o=e!==r,c=o&&e.interstitial.appendInPlace,u=(i=this.detachedData)==null?void 0:i.mediaSource;let d;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),d="Primary";else if(u){const x=this.getBufferingPlayer();x?(s=x.transferMedia(),d=`${x}`):d="detached MediaSource"}else d="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${Ct(s)}`);else if(!this.detachedData||r.media===t){const x=this.playerQueue;x.length>1&&x.forEach(T=>{if(o&&T.interstitial.appendInPlace!==c){const G=T.interstitial;this.clearInterstitial(T.interstitial,null),G.appendInPlace=!1,G.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${G}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((n=s.mediaSource)==null?void 0:n.readyState)!=="closed",b=f&&s?s:t;if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${d}`),b===s){const x=o&&e.assetId===this.schedule.assetIdAtEnd;b.overrides={duration:this.schedule.duration,endOfStream:!o||x,cueRemoval:!o}}e.attachMedia(b)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,n=this.effectivePlayingItem;if(i===-1){const s=this.hls.startPosition;if(this.timelinePos=s,t.length&&t[0].cue.pre){const r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(s>=0||!this.primaryLive){const r=this.timelinePos=s>0?s:0,o=e.findItemIndexAtTime(r);this.setSchedulePosition(o)}}else if(n&&!this.playingItem){const s=e.findItemIndex(n);this.setSchedulePosition(s)}}advanceAfterAssetEnded(e,t,i){const n=i+1;if(!e.isAssetPastPlayoutLimit(n)&&!e.assetList[n].error)this.setSchedulePosition(t,n);else{const s=this.schedule.items;if(s){const r=t+1,o=s.length;if(r>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.timelinePos=c,this.checkBuffer()),this.setSchedulePosition(r)}}}setScheduleToAssetAtTime(e,t){const i=this.schedule,n=t.parentIdentifier,s=i.getEvent(n);if(s){const r=i.findEventIndex(n),o=i.findAssetIndex(s,e);this.setSchedulePosition(r,o)}}setSchedulePosition(e,t){const i=this.schedule.items;if(!i||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const n=e>=0?i[e]:null,s=this.playingItem,r=this.playingLastItem;if(this.isInterstitial(s)){var o;const u=s.event,d=this.playingAsset,f=d==null?void 0:d.identifier,b=f?this.getAssetPlayer(f):null;if(b&&f&&(!this.eventItemsMatch(s,n)||t!==void 0&&f!==((o=u.assetList)==null?void 0:o[t].identifier))){var c;const x=u.findAssetIndex(d);this.log(`INTERSTITIAL_ASSET_ENDED ${x+1}/${u.assetList.length} ${ca(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:x,event:u,schedule:i.slice(0),scheduleIndex:e,player:b}),this.retreiveMediaSource(f,n),b.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&b.detachMedia()}if(!this.eventItemsMatch(s,n)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${ms(s)}`),u.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){this.updateSchedule();const x=this.schedule.items;if(n&&x){const T=this.schedule.findItemIndex(n);this.advanceSchedule(T,x,t,s,r)}return}}this.advanceSchedule(e,i,t,s,r)}advanceSchedule(e,t,i,n,s){const r=e>=0?t[e]:null,o=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(u=>{const d=u.interstitial,f=this.schedule.findEventIndex(d.identifier);(f<e||f>e+1)&&this.clearInterstitial(d,r)}),this.isInterstitial(r)){this.timelinePos=Math.min(Math.max(this.timelinePos,r.start),r.end);const u=r.event;i===void 0&&(i=this.schedule.findAssetIndex(u,this.timelinePos));const d=this.waitingItem;this.assetsBuffered(r,o)||this.setBufferingItem(r);let f=this.preloadAssets(u,i);if(this.eventItemsMatch(r,d||n)||(this.waitingItem=r,this.log(`INTERSTITIAL_STARTED ${ms(r)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(p.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!o){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=r;const b=u.assetList[i];if(!b){const x=t[e+1],T=this.media;x&&T&&!this.isInterstitial(x)&&T.currentTime<x.start&&(T.currentTime=this.timelinePos=x.start),this.advanceAfterAssetEnded(u,e,i||0);return}if(f||(f=this.getAssetPlayer(b.identifier)),f===null||f.destroyed){const x=u.assetList.length;this.warn(`asset ${i+1}/${x} player destroyed ${u}`),f=this.createAssetPlayer(u,b,i)}if(!this.eventItemsMatch(r,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(b))return;this.startAssetPlayer(f,i,t,e,o),this.shouldPlay&&_o(f.media)}else r!==null?(this.resumePrimary(r,e,n),this.shouldPlay&&_o(this.hls.media)):s&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,t;return(e=this.mediaSelection)==null||(t=e.main)==null?void 0:t.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ms(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let r=this.timelinePos;(r<e.start||r>=e.end)&&(r=this.getPrimaryResumption(e,t),this.timelinePos=r),this.attachPrimary(r,e)}if(!i)return;const s=this.schedule.items;s&&(this.log(`resumed ${ms(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(i<n.fragmentStart||i>n.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:fi.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((i=n.mainForwardBufferInfo)==null?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(p.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(p.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const i=this.hls.levels[t.level],n=E(E({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=E(E({},this.altSelection),{},{audio:i});return}const s=E(E({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=E(E({},this.altSelection),{},{subtitles:i});return}const s=E(E({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=Ee(t);this.playerQueue.forEach(n=>n.hls.setAudioOption(t)||n.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=Ee(t);this.playerQueue.forEach(n=>n.hls.setSubtitleOption(t)||t.id!==-1&&n.hls.setSubtitleOption(i))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let n=0;n<t.length;n++){const s=t[n];if(s.cue.post){var i;const r=this.schedule.findEventIndex(s.identifier),o=(i=this.schedule.items)==null?void 0:i[r];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){const i=this.schedule.items;if(e&&i){const n=this.findItemIndex(e,t);return i[n]||null}return null}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e?this.schedule.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const i=fi.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,t,e)}updateBufferedPos(e,t,i){const n=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const r=this.playingItem,o=this.findItemIndex(r);let c=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var u,d;const f=this.findItemIndex(s),b=Math.min(f+1,t.length-1),x=t[b];if((c===-1&&s&&e>=s.end||(u=x.event)!=null&&u.appendInPlace&&e+.01>=x.start)&&(c=b),b-o>1&&(s==null||(d=s.event)==null?void 0:d.appendInPlace)===!1)return;if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(x);else{const T=this.primaryDetails;this.primaryLive&&T&&e>T.edge-T.targetduration&&x.start<T.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(x)&&this.preloadAssets(x.event,0)}}else i&&r&&!this.itemsMatch(r,s)&&(c===o?this.bufferedToItem(r):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(n=>{const s=this.getAssetPlayer(n.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:n,events:s}=i;if(!n||!s)return t;const r=this.isInterstitial(e),o=this.getBufferingPlayer();if(this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos)),!this.playbackDisabled){const c=o?o.remaining:t?t.end-this.timelinePos:0;this.log(`buffered to boundary ${ms(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),r?e.event.assetList.forEach(u=>{const d=this.getAssetPlayer(u.identifier);d&&d.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering()))}this.hls.trigger(p.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=i.assetList.length===0&&!i.assetListLoader,s=i.cue.once;if(n||!s){const r=this.preloadAssets(i,t);if(r!=null&&r.interstitial.appendInPlace){const o=i.assetList[t],c=this.primaryMedia;o&&c&&this.bufferAssetPlayer(r,c)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,s=n===0&&!e.assetListLoader,r=e.cue.once;if(s){const c=e.timelineStart;if(e.appendInPlace){var o;const b=this.playingItem;!this.isInterstitial(b)&&(b==null||(o=b.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,d=0;if(!this.playingItem&&this.primaryLive&&(d=this.hls.startPosition,d===-1&&(d=this.hls.liveSyncPosition||0)),d&&!(e.cue.pre||e.cue.post)){const b=d-c;b>0&&(u=Math.round(b*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${u?` live-start: ${d} start-offset: ${u}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const f=this.assetListLoader.loadAssetList(e,u);f&&(e.assetListLoader=f)}else if(!r&&n){for(let c=t;c<n;c++){const u=e.assetList[c],d=this.getAssetPlayerQueueIndex(u.identifier);(d===-1||this.playerQueue[d].destroyed)&&!u.error&&this.createAssetPlayer(e,u,c)}return this.getAssetPlayer(e.assetList[t].identifier)}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(n=>{this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,n,s,r){const o={parentIdentifier:e.identifier,identifier:Vu(e,r,t),duration:s,startOffset:i,timelineStart:n,uri:r};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){this.log(`create HLSAssetPlayer for ${ca(t)}`);const n=this.hls,s=n.userConfig;let r=s.videoPreference;const o=n.loadLevelObj||n.levels[n.currentLevel];(r||o)&&(r=g({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=n.audioTracks[n.audioTrack],u=n.subtitleTracks[n.subtitleTrack];let d=0;if(this.primaryLive||e.appendInPlace){const fe=this.timelinePos-t.timelineStart;if(fe>1){const Ce=t.duration;Ce&&fe<Ce&&(d=fe)}}const f=t.identifier,b=E(E({},s),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:c||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(b.timelineOffset=t.timelineStart));const x=b.cmcd;x!=null&&x.sessionId&&x.contentId&&(b.cmcd=g({},x,{contentId:sr(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const T=new Hu(this.HlsPlayerClass,b,e,t);this.playerQueue.push(T),e.assetList[i]=t;const G=fe=>{if(fe.live){const Je=new Error(`Interstitials MUST be VOD assets ${e}`),Pe={fatal:!0,type:he.OTHER_ERROR,details:j.INTERSTITIAL_ASSET_ITEM_ERROR,error:Je};this.handleAssetItemError(Pe,e,this.schedule.findEventIndex(e.identifier),i,Je.message);return}const Ce=fe.edge-fe.fragmentStart,ke=t.duration;(ke===null||Ce>ke)&&(this.log(`Interstitial asset "${f}" duration change ${ke} > ${Ce}`),t.duration=Ce,this.updateSchedule())};T.on(p.LEVEL_UPDATED,(fe,{details:Ce})=>G(Ce)),T.on(p.LEVEL_PTS_UPDATED,(fe,{details:Ce})=>G(Ce));const $=(fe,Ce)=>{const ke=this.getAssetPlayer(f);if(ke&&Ce.tracks){ke.off(p.BUFFER_CODECS,$),ke.tracks=Ce.tracks;const Je=this.primaryMedia;this.bufferingAsset===ke.assetItem&&Je&&!ke.media&&this.bufferAssetPlayer(ke,Je)}};T.on(p.BUFFER_CODECS,$);const ue=()=>{var fe;const Ce=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${Ce}`),!Ce)return;const ke=this.schedule.findEventIndex(e.identifier),Je=e.findAssetIndex(t),Pe=Je+1,Ze=(fe=this.schedule.items)==null?void 0:fe[ke];if(this.isInterstitial(Ze))if(Je!==-1&&!e.isAssetPastPlayoutLimit(Pe)&&!e.assetList[Pe].error)this.bufferedToItem(Ze,Pe);else{var nt;const Me=(nt=this.schedule.items)==null?void 0:nt[ke+1];Me&&this.bufferedToItem(Me)}};T.on(p.BUFFERED_TO_END,ue);const ge=fe=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const ke=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,ke,fe)};return T.once(p.MEDIA_ENDED,ge(i)),T.once(p.PLAYOUT_LIMIT_REACHED,ge(1/0)),T.on(p.ERROR,(fe,Ce)=>{const ke=this.getAssetPlayer(f);if(Ce.details===j.BUFFER_STALLED_ERROR){if(ke!=null&&ke.media){const Je=ke.currentTime,Pe=ke.duration-Je;Je&&e.appendInPlace&&Pe/ke.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${ke.media.currentTime}`),ue()):(this.warn(`Stalled at ${Je} of ${Je+Pe} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(Ce,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${Ce.error} ${e}`)}),T.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const Ce=new Error(`Asset player destroyed unexpectedly ${f}`),ke={fatal:!0,type:he.OTHER_ERROR,details:j.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ce};this.handleAssetItemError(ke,e,this.schedule.findEventIndex(e.identifier),i,Ce.message)}),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:T}),T}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){this.log(`clearAssetPlayer "${e}" toSegment: ${t&&ms(t)}`);const n=this.playerQueue[i];this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,s){const{interstitial:r,assetItem:o,assetId:c}=e,u=r.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!d||d.identifier!==c)&&(d&&(this.clearAssetPlayer(d.identifier,i[n]),delete d.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${e}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,n;const{interstitial:s,assetItem:r,assetId:o}=e,c=this.schedule.findEventIndex(s.identifier),u=(i=this.schedule.items)==null?void 0:i[c];if(!u)return;this.setBufferingItem(u),this.bufferingAsset=r;const d=this.getBufferingPlayer();if(d===e)return;const f=s.appendInPlace;if(f&&(d==null?void 0:d.interstitial.appendInPlace)===!1)return;const b=(d==null?void 0:d.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(f&&r!==this.playingAsset){if(!e.tracks)return;if(b&&!Te(b,e.tracks)){const x=new Error(`Asset "${o}" SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(b)}')`),T={fatal:!0,type:he.OTHER_ERROR,details:j.INTERSTITIAL_ASSET_ITEM_ERROR,error:x},G=s.findAssetIndex(r);this.handleAssetItemError(T,s,c,G,x.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,n,s){if(e.details===j.BUFFER_STALLED_ERROR)return;const r=t.assetList[n]||null;let o=null;if(r){const f=this.getAssetPlayerQueueIndex(r.identifier);o=this.playerQueue[f]||null}const c=this.schedule.items,u=g({},e,{fatal:!1,errorAction:Vi(!0),asset:r,assetListIndex:n,event:t,schedule:c,scheduleIndex:i,player:o});if(this.warn(`Asset item error: ${e.error}`),this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,u),!e.fatal)return;const d=new Error(s);r&&(this.playingAsset!==r&&this.clearAssetPlayer(r.identifier,null),r.error=d),t.assetList.some(f=>!f.error)?t.appendInPlace&&(t.error=d):t.error=d,this.primaryFallback(t)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(this.updateSchedule(),i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${i?ms(i):"<none>"} error: ${e.error}`),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const s=this.updateItem(i,n);if(this.itemsMatch(i,s))this.clearInterstitial(e,null);else{const r=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(r)}}else this.checkStart()}onAssetListLoaded(e,t){var i;const n=t.event,s=n.identifier,r=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(s))return;const o=n.timelineStart,c=n.duration;let u=0;r.forEach((T,G)=>{const $=parseFloat(T.DURATION);this.createAsset(n,G,u,o+u,$,T.URI),u+=$}),n.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${c}) ${n}`);const d=this.waitingItem,f=(d==null?void 0:d.event.identifier)===s;this.updateSchedule();const b=(i=this.bufferingItem)==null?void 0:i.event;if(f){var x;const T=this.schedule.findEventIndex(s),G=(x=this.schedule.items)==null?void 0:x[T];if(G){if(!this.playingItem&&this.timelinePos>G.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==T){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(G)}this.setSchedulePosition(T)}else if((b==null?void 0:b.identifier)===s&&b.appendInPlace){const T=n.assetList[0],G=this.getAssetPlayer(T.identifier),$=this.primaryMedia;T&&G&&$&&this.bufferAssetPlayer(G,$)}}onError(e,t){switch(t.details){case j.ASSET_LIST_PARSING_ERROR:case j.ASSET_LIST_LOAD_ERROR:case j.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case j.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const vo=500;class Xu extends Sn{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",ce.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=it.IDLE,this.setInterval(vo),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(ae(i)&&(this.fragPrevious=i),this.state=it.IDLE,!n)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=i.start;for(let u=0;u<s.length;u++)if(o>=s[u].start&&o<=s[u].end){r=s[u];break}const c=i.start+i.duration;r?r.end=c:(r={start:o,end:c},s.push(r)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const s=n-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(r=>{for(let o=0;o<r.length;){if(r[o].end<=s){r.shift();continue}else if(r[o].start<s)r[o].start=s;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(i,s,ce.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===ce.SUBTITLE&&(t.details===j.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==it.STOPPED&&(this.state=it.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Ja(this.levels,t)){this.levels=t.map(i=>new tt(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new tt(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ce.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==it.STOPPED&&this.setInterval(vo)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:s}=this,{details:r,id:o}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=s[o];if(o>=s.length||!c)return;this.log(`Subtitle track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(r.live||(i=c.details)!=null&&i.live){const f=this.mainDetails;if(r.deltaUpdateFailed||!f)return;const b=f.fragments[0];if(!c.details)r.hasProgramDateTime&&f.hasProgramDateTime?($i(r,f),u=r.fragmentStart):b&&(u=b.start,Is(r,u));else{var d;u=this.alignPlaylists(r,c.details,(d=this.levelLastLoaded)==null?void 0:d.details),u===0&&b&&(u=b.start,Is(r,u))}}c.details=r,this.levelLastLoaded=c,o===n&&(this.hls.trigger(p.SUBTITLE_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===it.IDLE&&(mi(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&wn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,Rn(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();s.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=it.IDLE})}}doTick(){if(!this.media){this.state=it.IDLE;return}if(this.state===it.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:n}=this,s=this.getLoadPosition(),r=fi.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:c}=r,u=i.details,d=this.hls.maxBufferLength+u.levelTargetDuration;if(c>d)return;const f=u.fragments,b=f.length,x=u.edge;let T=null;const G=this.fragPrevious;if(o<x){const ge=n.maxFragLookUpTolerance,fe=o>x-ge?0:ge;T=mi(G,f,Math.max(f[0].start,o),fe),!T&&G&&G.start<f[0].start&&(T=f[0])}else T=f[b-1];if(T=this.filterReplacedPrimary(T,i.details),!T)return;const $=T.sn-u.startSN,ue=f[$-1];if(ue&&ue.cc===T.cc&&this.fragmentTracker.getState(ue)===Ai.NOT_LOADED&&(T=ue),this.fragmentTracker.getState(T)===Ai.NOT_LOADED){const ge=this.mapToInitFragWhenRequired(T);ge&&this.loadFragment(ge,i,o)}}}loadFragment(e,t,i){ae(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new qu(this.tracksBuffered[this.currentTrackId]||[])}}class qu{constructor(e){this.buffered=void 0;const t=(i,n,s)=>{if(n=n>>>0,n>s-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${s})`);return e[n][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const Qu={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},yo=a=>String.fromCharCode(Qu[a]||a),Yn=15,hs=100,Ju={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ec={17:2,18:4,21:6,22:8,23:10,19:13,20:15},tc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ic={25:2,26:4,29:6,30:8,31:10,27:13,28:15},nc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class sc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;ee.log(`${this.time} [${e}] ${i}`)}}}const Ts=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Eo{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class rc{constructor(){this.uchar=" ",this.penState=new Eo}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class ac{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Eo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<hs;t++)this.chars.push(new rc);this.logger=e}equals(e){for(let t=0;t<hs;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<hs;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<hs;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>hs&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=hs)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=yo(e);if(this.pos>=hs){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<hs;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<hs;i++){const n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class ha{constructor(e){this.rows=[],this.currRow=Yn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Yn;t++)this.rows.push(new ac(e));this.logger=e}reset(){for(let e=0;e<Yn;e++)this.rows[e].clear();this.currRow=Yn-1}equals(e){let t=!0;for(let i=0;i<Yn;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Yn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Yn;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+Ct(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Yn;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const o=r.rows[s].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(r.rows[s+u])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,r=Math.max(s-1,0);i.setCursor(e.indent),e.color=i.chars[r].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Ct(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let s=0;s<Yn;s++){const r=this.rows[s].getTextString();r&&(n=s+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
`)),i}getTextAndFormat(){return this.rows}}class bo{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new ha(i),this.nonDisplayedMemory=new ha(i),this.lastOutputScreen=new ha(i),this.currRollUpRow=this.displayedMemory.rows[Yn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Yn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+Ct(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class So{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=lc(),this.logger=void 0;const n=this.logger=new sc;this.channels=[null,new bo(e,t,n),new bo(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const n=t[i]&127,s=t[i+1]&127;let r=!1,o=null;if(n===0&&s===0)continue;this.logger.log(3,()=>"["+Ts([t[i],t[i+1]])+"] -> ("+Ts([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(oc(n,s,c)){Ir(null,null,c),this.logger.log(3,()=>"Repeated command ("+Ts([n,s])+") is dropped");continue}Ir(n,s,this.cmdHistory),r=this.parseCmd(n,s),r||(r=this.parseMidrow(n,s)),r||(r=this.parsePAC(n,s)),r||(r=this.parseBackgroundAttributes(n,s))}else Ir(null,null,c);if(!r&&(o=this.parseChars(n,s),o)){const d=this.currentChannel;d&&d>0?this.channels[d].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Ts([n,s])+" orig: "+Ts([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))return!1;const s=e===20||e===21||e===23?1:2,r=this.channels[s];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=s,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Ts([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(n||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?i=r===1?Ju[e]:tc[e]:i=r===1?ec[e]:ic[e];const o=this.channels[r];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,n.underline=(i&1)===1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((i-16)/2)*4,n}parseChars(e,t){let i,n=null,s=null;if(e>=25?(i=2,s=e-8):(i=1,s=e),s>=17&&s<=19){let r;s===17?r=t+80:s===18?r=t+112:r=t+144,this.logger.log(2,()=>"Special char '"+yo(r)+"' in channel "+i),n=[r]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+Ts(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=nc[s],t%2===1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Ir(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function Ir(a,e,t){t.a=a,t.b=e}function oc(a,e,t){return t.a===a&&t.b===e}function lc(){return{a:null,b:null}}var da=function(){if(en!=null&&en.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,c){if(typeof c!="string"||!Array.isArray(o))return!1;const u=c.toLowerCase();return~o.indexOf(u)?u:!1}function i(o){return t(a,o)}function n(o){return t(e,o)}function s(o,...c){let u=1;for(;u<arguments.length;u++){const d=arguments[u];for(const f in d)o[f]=d[f]}return o}function r(o,c,u){const d=this,f={enumerable:!0};d.hasBeenReset=!1;let b="",x=!1,T=o,G=c,$=u,ue=null,ge="",fe=!0,Ce="auto",ke="start",Je=50,Pe="middle",Ze=50,nt="middle";Object.defineProperty(d,"id",s({},f,{get:function(){return b},set:function(Me){b=""+Me}})),Object.defineProperty(d,"pauseOnExit",s({},f,{get:function(){return x},set:function(Me){x=!!Me}})),Object.defineProperty(d,"startTime",s({},f,{get:function(){return T},set:function(Me){if(typeof Me!="number")throw new TypeError("Start time must be set to a number.");T=Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",s({},f,{get:function(){return G},set:function(Me){if(typeof Me!="number")throw new TypeError("End time must be set to a number.");G=Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",s({},f,{get:function(){return $},set:function(Me){$=""+Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",s({},f,{get:function(){return ue},set:function(Me){ue=Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",s({},f,{get:function(){return ge},set:function(Me){const At=i(Me);if(At===!1)throw new SyntaxError("An invalid or illegal string was specified.");ge=At,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",s({},f,{get:function(){return fe},set:function(Me){fe=!!Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",s({},f,{get:function(){return Ce},set:function(Me){if(typeof Me!="number"&&Me!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Ce=Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",s({},f,{get:function(){return ke},set:function(Me){const At=n(Me);if(!At)throw new SyntaxError("An invalid or illegal string was specified.");ke=At,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",s({},f,{get:function(){return Je},set:function(Me){if(Me<0||Me>100)throw new Error("Position must be between 0 and 100.");Je=Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",s({},f,{get:function(){return Pe},set:function(Me){const At=n(Me);if(!At)throw new SyntaxError("An invalid or illegal string was specified.");Pe=At,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",s({},f,{get:function(){return Ze},set:function(Me){if(Me<0||Me>100)throw new Error("Size must be between 0 and 100.");Ze=Me,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",s({},f,{get:function(){return nt},set:function(Me){const At=n(Me);if(!At)throw new SyntaxError("An invalid or illegal string was specified.");nt=At,this.hasBeenReset=!0}})),d.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class uc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function xo(a){function e(i,n,s,r){return(i|0)*3600+(n|0)*60+(s|0)+parseFloat(r||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class cc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function To(a,e,t,i){const n=i?a.split(i):[a];for(const s in n){if(typeof n[s]!="string")continue;const r=n[s].split(t);if(r.length!==2)continue;const o=r[0],c=r[1];e(o,c)}}const fa=new da(0,0,""),Dr=fa.align==="middle"?"middle":"center";function hc(a,e,t){const i=a;function n(){const o=xo(a);if(o===null)throw new Error("Malformed timestamp: "+i);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,c){const u=new cc;To(o,function(b,x){let T;switch(b){case"region":for(let G=t.length-1;G>=0;G--)if(t[G].id===x){u.set(b,t[G].region);break}break;case"vertical":u.alt(b,x,["rl","lr"]);break;case"line":T=x.split(","),u.integer(b,T[0]),u.percent(b,T[0])&&u.set("snapToLines",!1),u.alt(b,T[0],["auto"]),T.length===2&&u.alt("lineAlign",T[1],["start",Dr,"end"]);break;case"position":T=x.split(","),u.percent(b,T[0]),T.length===2&&u.alt("positionAlign",T[1],["start",Dr,"end","line-left","line-right","auto"]);break;case"size":u.percent(b,x);break;case"align":u.alt(b,x,["start",Dr,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let d=u.get("line","auto");d==="auto"&&fa.line===-1&&(d=-1),c.line=d,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",Dr);let f=u.get("position","auto");f==="auto"&&fa.position===50&&(f=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=f}function r(){a=a.replace(/^\s+/,"")}if(r(),e.startTime=n(),r(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);a=a.slice(3),r(),e.endTime=n(),r(),s(a,e)}function Ao(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class dc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new uc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let s=t.buffer,r=0;for(s=Ao(s);r<s.length&&s[r]!=="\r"&&s[r]!==`
`;)++r;const o=s.slice(0,r);return s[r]==="\r"&&++r,s[r]===`
`&&++r,t.buffer=s.slice(r),o}function n(s){To(s,function(r,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=i();const o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let r=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:s=i(),t.state){case"HEADER":/:/.test(s)?n(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new da(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{hc(s,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=s.indexOf("-->")!==-1;if(!s||o&&(r=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
`),t.cue.text+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch(s){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const fc=/\r\n|\n\r|\n|\r/g,pa=function(e,t,i=0){return e.slice(i,i+t.length)===t},pc=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!U(t)||!U(i)||!U(n)||!U(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function ma(a,e,t){return sr(a.toString())+sr(e.toString())+sr(t)}const mc=function(e,t,i){let n=e[t],s=e[n.prevCC];if(!s||!s.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(r=s)!=null&&r.new;){var r;e.ccOffset+=n.start-s.start,n.new=!1,n=s,s=e[n.prevCC]}e.presentationOffset=i};function gc(a,e,t,i,n,s,r){const o=new dc,c=$e(new Uint8Array(a)).trim().replace(fc,`
`).split(`
`),u=[],d=e?Kl(e.baseTime,e.timescale):0;let f="00:00.000",b=0,x=0,T,G=!0;o.oncue=function($){const ue=t[i];let ge=t.ccOffset;const fe=(b-d)/9e4;if(ue!=null&&ue.new&&(x!==void 0?ge=t.ccOffset=ue.start:mc(t,i,fe)),fe){if(!e){T=new Error("Missing initPTS for VTT MPEGTS");return}ge=fe-t.presentationOffset}const Ce=$.endTime-$.startTime,ke=Un(($.startTime+ge-x)*9e4,n*9e4)/9e4;$.startTime=Math.max(ke,0),$.endTime=Math.max(ke+Ce,0);const Je=$.text.trim();$.text=decodeURIComponent(encodeURIComponent(Je)),$.id||($.id=ma($.startTime,$.endTime,Je)),$.endTime>0&&u.push($)},o.onparsingerror=function($){T=$},o.onflush=function(){if(T){r(T);return}s(u)},c.forEach($=>{if(G)if(pa($,"X-TIMESTAMP-MAP=")){G=!1,$.slice(16).split(",").forEach(ue=>{pa(ue,"LOCAL:")?f=ue.slice(6):pa(ue,"MPEGTS:")&&(b=parseInt(ue.slice(7)))});try{x=pc(f)/1e3}catch(ue){T=ue}return}else $===""&&(G=!1);o.parse($+`
`)}),o.flush()}const ga="stpp.ttml.im1t",wo=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ro=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_c={left:"start",center:"center",right:"end",start:"start",end:"end"};function Lo(a,e,t,i){const n=se(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>$e(o)),r=Ul(e.baseTime,1,e.timescale);try{s.forEach(o=>t(vc(o,r)))}catch(o){i(o)}}function vc(a,e){const n=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((f,b)=>(f[b]=n.getAttribute(`ttp:${b}`)||s[b],f),{}),o=n.getAttribute("xml:space")!=="preserve",c=Io(_a(n,"styling","style")),u=Io(_a(n,"layout","region")),d=_a(n,"body","[begin]");return[].map.call(d,f=>{const b=Do(f,o);if(!b||!f.hasAttribute("begin"))return null;const x=ya(f.getAttribute("begin"),r),T=ya(f.getAttribute("dur"),r);let G=ya(f.getAttribute("end"),r);if(x===null)throw Co(f);if(G===null){if(T===null)throw Co(f);G=x+T}const $=new da(x-e,G-e,b);$.id=ma($.startTime,$.endTime,$.text);const ue=u[f.getAttribute("region")],ge=c[f.getAttribute("style")],fe=yc(ue,ge,c),{textAlign:Ce}=fe;if(Ce){const ke=_c[Ce];ke&&($.lineAlign=ke),$.align=Ce}return g($,fe),$}).filter(f=>f!==null)}function _a(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Io(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Do(a,e){return[].slice.call(a.childNodes).reduce((t,i,n)=>{var s;return i.nodeName==="br"&&n?t+`
`:(s=i.childNodes)!=null&&s.length?Do(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function yc(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(n=t[r]),s.reduce((o,c)=>{const u=va(e,i,c)||va(a,i,c)||va(n,i,c);return u&&(o[c]=u),o},{})}function va(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Co(a){return new Error(`Could not parse ttml timestamp ${a}`)}function ya(a,e){if(!a)return null;let t=xo(a);return t===null&&(wo.test(a)?t=Ec(a,e):Ro.test(a)&&(t=bc(a,e))),t}function Ec(a,e){const t=wo.exec(a),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function bc(a,e){const t=Ro.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class Cr{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Sc{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Oo(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Cr(this,"textTrack1"),t=new Cr(this,"textTrack2"),i=new Cr(this,"textTrack3"),n=new Cr(this,"textTrack4");this.cea608Parser1=new So(1,e,t),this.cea608Parser2=new So(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=xc(c[0],c[1],t,i);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),r=!0,u/(i-t)>.5))return}if(r||s.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,n)}else{const o=this.Cues.newCue(null,t,i,n);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s}){const{unparsedVttFrags:r}=this;i===ce.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:s}),r.length&&(this.unparsedVttFrags=[],r.forEach(o=>{this.onFragLoaded(p.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const s=i.textTracks[n];if(Po(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:n}=this,{label:s,languageCode:r}=t[e],o=this.getExistingTrack(s,r);if(o)i[e]=o,Fs(i[e]),fo(i[e],n);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,i[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,n={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach(s=>{Fs(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Oo(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Fs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===ga);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(Ja(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Rr(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let d;if(o){let f=null;for(let b=0;b<o.length;b++)if(o[b]&&Po(o[b],c)){f=o[b],o[b]=null;break}f&&(d=f)}if(d)Fs(d);else{const f=ko(c);d=this.createTextTrack(f,c.name,c.lang),d&&(d.mode="disabled")}d&&this.textTracks.push(d)}),o!=null&&o.length){const c=o.filter(u=>u!==null).map(u=>u.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const r=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const n=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!n)return;const s=`textTrack${n[1]}`,r=this.captionsProperties[s];r&&(r.label=i.name,i.lang&&(r.languageCode=i.lang),r.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===ce.MAIN){var i,n;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,d=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;s&&r&&(u!==o+1||u===o&&d!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=d}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===ce.SUBTITLE)if(n.byteLength){const s=i.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===ga?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Lo(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{i.logger.log(`Failed to parse IMSC1: ${n}`),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:s,unparsedVttFrags:r}=this,o=s.length-1;if(!s[i.cc]&&o===-1){r.push(e);return}const c=this.hls,u=(t=i.initSegment)!=null&&t.data?He(i.initSegment.data,new Uint8Array(n)).buffer:n;gc(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,d=>{this._appendCues(d,i.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},d=>{const f=d.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${d}`),!(f&&o>i.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:d})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Lo(t,this.initPTS[e.cc],()=>{i.textCodec=ga,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(s=>po(n,s))}else{const n=this.tracks[t];if(!n)return;const s=n.default?"default":"subtitles"+t;i.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===ce.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(!(i.type===ce.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let s=0;s<n.length;s++){const r=n[s].bytes;if(r){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(r);this.cea608Parser1.addData(n[s].pts,o[0]),this.cea608Parser2.addData(n[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:s}){const{media:r}=this;if(!(!r||r.currentTime<i)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>la(o[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>la(o[c],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let s=0;s<i;s++){const r=e[n++],o=127&e[n++],c=127&e[n++];if(o===0&&c===0)continue;if((4&r)!==0){const d=3&r;(d===0||d===1)&&(t[d].push(o),t[d].push(c))}}return t}}function ko(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Po(a,e){return!!a&&a.kind===ko(e)&&ia(e,a)}function xc(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function Oo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Tc=/\s/,Ac={newCue(a,e,t,i){const n=[];let s,r,o,c,u;const d=self.VTTCue||self.TextTrackCue;for(let b=0;b<i.rows.length;b++)if(s=i.rows[b],o=!0,c=0,u="",!s.isEmpty()){var f;for(let G=0;G<s.chars.length;G++)Tc.test(s.chars[G].uchar)&&o?c++:(u+=s.chars[G].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const x=Ao(u.trim()),T=ma(e,t,x);a!=null&&(f=a.cues)!=null&&f.getCueById(T)||(r=new d(e,t,x),r.id=T,r.line=b+1,r.align="left",r.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(r))}return a&&n.length&&(n.sort((b,x)=>b.line==="auto"||x.line==="auto"?0:b.line>8&&x.line>8?x.line-b.line:b.line-x.line),n.forEach(b=>po(a,b))),n}};function wc(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const Rc=/(\d+)-(\d+)\/(\d+)/;class Mo{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Cc,this.controller=new self.AbortController,this.stats=new S}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const s=Lc(e,this.controller.signal),r=e.responseType==="arraybuffer",o=r?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=c&&U(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(tr(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var b;this.response=this.loader=f;const x=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},u-(x-n.loading.start)),!f.ok){const{status:G,statusText:$}=f;throw new kc($||"fetch, bad network response",G,f)}n.loading.first=x,n.total=Dc(f.headers)||n.total;const T=(b=this.callbacks)==null?void 0:b.onProgress;return T&&U(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,T):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var b,x;const T=this.response;if(!T)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const G=f[o];G&&(n.loaded=n.total=G);const $={url:T.url,data:f,code:T.status},ue=(b=this.callbacks)==null?void 0:b.onProgress;ue&&!U(t.highWaterMark)&&ue(n,e,f,T),(x=this.callbacks)==null||x.onSuccess($,n,e,T)}).catch(f=>{var b;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const x=f&&f.code||0,T=f?f.message:null;(b=this.callbacks)==null||b.onError({code:x,text:T},e,f?f.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,s){const r=new Ds,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const d=u.value,f=d.length;return t.loaded+=f,f<n||r.dataLength?(r.push(d),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,d.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Lc(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(g({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function Ic(a){const e=Rc.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Dc(a){const e=a.get("Content-Range");if(e){const i=Ic(e);if(U(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&&U(s)?s:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,s=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,d=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const T=d!=null?d:t.response;if(T!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const G=t.responseType==="arraybuffer"?T.byteLength:T.length;i.loaded=i.total=G,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const $=(r=this.callbacks)==null?void 0:r.onProgress;$&&$(i,e,T,t);const ue={url:t.responseURL,data:T,code:u};(o=this.callbacks)==null||o.onSuccess(ue,i,e,t);return}}const f=s.loadPolicy.errorRetry,b=i.retry,x={url:e.url,data:void 0,code:u};if(Ri(f,b,!1,x))this.retry(f);else{var c;ee.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ri(e,t,!0))this.retry(e);else{var i;ee.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=bi(e,i.retry),i.retry++,ee.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Pc.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Oc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Mc=E(E({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:No,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Ot,bufferController:tu,capLevelController:sa,errorController:on,fpsController:Uu,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:vi,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,certLoadPolicy:{default:Oc},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Nc()),{},{subtitleStreamController:Xu,subtitleTrackController:Gu,timelineController:Sc,audioStreamController:ql,audioTrackController:Ql,emeController:Ns,cmcdController:Nu,contentSteeringController:Bu,interstitialsController:Yu});function Nc(){return{cueHandler:Ac,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Fc(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=Ea(a),n=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,c=e[o]===void 0,u=[];s.forEach(d=>{const f=`${r}Loading${d}`,b=e[f];if(b!==void 0&&c){u.push(f);const x=i[o].default;switch(e[o]={default:x},d){case"TimeOut":x.maxLoadTimeMs=b,x.maxTimeToFirstByteMs=b;break;case"MaxRetry":x.errorRetry.maxNumRetry=b,x.timeoutRetry.maxNumRetry=b;break;case"RetryDelay":x.errorRetry.retryDelayMs=b,x.timeoutRetry.retryDelayMs=b;break;case"MaxRetryTimeout":x.errorRetry.maxRetryDelayMs=b,x.timeoutRetry.maxRetryDelayMs=b;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${Ct(e[o])}`)}),E(E({},i),e)}function Ea(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(Ea):Object.keys(a).reduce((e,t)=>(e[t]=Ea(a[t]),e),{}):a}function Bc(a,e){const t=a.loader;t!==Mo&&t!==No?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):wc()&&(a.loader=Mo,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const kr=2,Uc=.1,Kc=.05,$c=100;class Gc extends vn{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval($c),this.mediaSource=t.mediaSource;const i=this.media=t.media;cs(i,"playing",this.onMediaPlaying),cs(i,"waiting",this.onMediaWaiting),cs(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(rs(i,"playing",this.onMediaPlaying),rs(i,"waiting",this.onMediaWaiting),rs(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const s=(i=this.hls)==null?void 0:i.config;if(!s)return;const{media:r,stalled:o}=this;if(!r)return;const{seeking:c}=r,u=this.seeking&&!c,d=!this.seeking&&c,f=r.paused&&!c||r.ended||r.playbackRate===0;if(this.seeking=c,e!==t){t&&(this.ended=0),this.moved=!0,c||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||u){u&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1}));return}if(!fi.getBuffered(r).length){this.nudgeRetry=0;return}const b=fi.bufferInfo(r,e,0),x=b.nextStart||0,T=this.fragmentTracker;if(c&&T&&this.hls){const Je=Fo(this.hls.inFlightFragments,e),Pe=b.len>kr,Ze=!x||Je||x-e>kr&&!T.getPartialFragment(e);if(Pe||Ze)return;this.moved=!1}const G=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&T){if(!(b.len>0)&&!x)return;const Pe=Math.max(x,b.start||0)-e,nt=!!(G!=null&&G.live)?G.targetduration*2:kr,Me=T.getPartialFragment(e);if(Pe>0&&(Pe<=nt||Me)){r.paused||this._trySkipBufferHole(Me);return}}const $=s.detectStallWithCurrentTimeMs,ue=self.performance.now(),ge=this.waiting;if(o===null){ge>0&&ue-ge<$?this.stalled=ge:this.stalled=ue;return}const fe=ue-o;if(!c&&(fe>=$||ge)&&this.hls){var Ce;if(((Ce=this.mediaSource)==null?void 0:Ce.readyState)==="ended"&&!(G!=null&&G.live)&&Math.abs(e-((G==null?void 0:G.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(b),!this.media||!this.hls)return}const ke=fi.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(ke,fe)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const s=fi.bufferedInfo(fi.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=fi.timeRangesToArray(n),o=fi.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=fi.bufferedInfo(r,e,0).bufferedIndex,u=r[o].end,d=r[o+1].start;if((c===-1||c>o)&&d-u<1&&e-u<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${d} buffered index: ${c}`);this.warn(f.message),this.media.currentTime+=1e-6;const b=this.fragmentTracker.getPartialFragment(e)||void 0,x=fi.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:b,buffer:x.len,bufferInfo:x})}}}}}_tryFixBufferStall(e,t){var i,n;const{fragmentTracker:s,media:r}=this,o=(i=this.hls)==null?void 0:i.config;if(!r||!s||!o)return;const c=r.currentTime,u=(n=this.hls)==null?void 0:n.latestLevelDetails,d=s.getPartialFragment(c);if((d||u!=null&&u.live&&c<u.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;const f=e.buffered;(f&&f.length>1&&e.len>o.maxBufferHole||e.nextStart&&e.nextStart-c<o.maxBufferHole)&&(t>o.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:s}=this;if(!n&&s!==null&&i&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Ct(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,s=(t=this.hls)==null?void 0:t.config;if(!n||!i||!s)return 0;const r=n.currentTime,o=fi.bufferInfo(n,r,0),c=r<o.start?o.start:o.nextStart;if(c&&this.hls){const d=o.len<=s.maxBufferHole,f=o.len>0&&o.len<1&&n.readyState<3,b=c-r;if(b>0&&(d||f)){if(b>s.maxBufferHole){let T=!1;if(r===0){const G=i.getAppendedFrag(0,ce.MAIN);G&&c<G.end&&(T=!0)}if(!T){const G=e||i.getAppendedFrag(r,ce.MAIN);if(G){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||Fo(this.hls.inFlightFragments,c))return 0;let ue=!1,ge=G.end;for(;ge<c;){const fe=i.getPartialFragment(ge);if(fe)ge+=fe.duration;else{ue=!0;break}}if(ue)return 0}}}const x=Math.max(c+Kc,r+Uc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${x}`),this.moved=!0,n.currentTime=x,!(e!=null&&e.gap)){const T=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${x}`);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:T,reason:T.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return x}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:n}=this,s=t==null?void 0:t.config;if(!i||!s)return 0;const r=i.currentTime;if(this.nudgeRetry++,n<s.nudgeMaxRetry){const o=r+(n+1)*s.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(c.message),i.currentTime=o,t.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${r} after ${s.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Fo(a,e){const t=Bo(a.main);if(t&&t.start<=e)return t;const i=Bo(a.audio);return i&&i.start<=e?i:null}function Bo(a){if(!a)return null;switch(a.state){case it.IDLE:case it.STOPPED:case it.ENDED:case it.ERROR:return null}return a.frag}const Vc=.25;function ba(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Uo(a,e,t,i,n){let s=new a(e,t,"");try{s.value=i,n&&(s.type=n)}catch(r){s=new a(e,t,Ct(n?E({type:n},i):i))}return s}const Pr=(()=>{const a=ba();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function jc(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Wc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(p.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Fs(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return fo(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:n}}}=this;if(!i&&!n)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=ba();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Bn.emsg&&!i||!n)continue;const u=ka(s[o].data);if(u){const d=s[o].pts;let f=d+s[o].duration;f>Pr&&(f=Pr),f-d<=0&&(f=d+Vc);for(let x=0;x<u.length;x++){const T=u[x];if(!Pa(T)){this.updateId3CueEnds(d,c);const G=Uo(r,d,f,T,c);G&&this.id3Track.addCue(G)}}}}}updateId3CueEnds(e,t){var i;const n=(i=this.id3Track)==null?void 0:i.cues;if(n)for(let s=n.length;s--;){const r=n[s];r.type===t&&r.startTime<e&&r.endTime===Pr&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let u;n==="audio"?u=d=>d.type===Bn.audioId3&&c:n==="video"?u=d=>d.type===Bn.emsg&&o:u=d=>d.type===Bn.audioId3&&c||d.type===Bn.emsg&&o,la(s,t,i,u)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:i}=this,{dateRanges:n}=e,s=Object.keys(n);let r=this.dateRangeCuesAppended;if(i&&t){var o;if((o=i.cues)!=null&&o.length){const d=Object.keys(r).filter(f=>!s.includes(f));for(let f=d.length;f--;){const b=d[f],x=r[b].cues;delete r[b],Object.keys(x).forEach(T=>{try{const G=x[T];G.removeEventListener("enter",this.onEventCueEnter),i.removeCue(G)}catch(G){}})}}else r=this.dateRangeCuesAppended={}}const c=e.fragments[e.fragments.length-1];if(s.length===0||!U(c==null?void 0:c.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const u=ba();for(let d=0;d<s.length;d++){const f=s[d],b=n[f],x=b.startTime,T=r[f],G=(T==null?void 0:T.cues)||{};let $=(T==null?void 0:T.durationKnown)||!1,ue=Pr;const{duration:ge,endDate:fe}=b;if(fe&&ge!==null)ue=x+ge,$=!0;else if(b.endOnNext&&!$){const ke=s.reduce((Je,Pe)=>{if(Pe!==b.id){const Ze=n[Pe];if(Ze.class===b.class&&Ze.startDate>b.startDate&&(!Je||b.startDate<Je.startDate))return Ze}return Je},null);ke&&(ue=ke.startTime,$=!0)}const Ce=Object.keys(b.attr);for(let ke=0;ke<Ce.length;ke++){const Je=Ce[ke];if(!An(Je))continue;const Pe=G[Je];if(Pe)$&&!T.durationKnown?Pe.endTime=ue:Math.abs(Pe.startTime-x)>.01&&(Pe.startTime=x,Pe.endTime=ue);else if(u){let Ze=b.attr[Je];as(Je)&&(Ze=jc(Ze));const Me=Uo(u,x,ue,{key:Je,data:Ze},Bn.dateRange);Me&&(Me.id=f,this.id3Track.addCue(Me),G[Je]=Me,this.hls.config.interstitialsController&&(Je==="X-ASSET-LIST"||Je==="X-ASSET-URL")&&Me.addEventListener("enter",this.onEventCueEnter))}}r[f]={cues:G,dateRange:b,durationKnown:$}}}}class Hc{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||r===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const c=n-o,u=Math.min(this.maxLatency,o+i.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,r)),b=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,x=Math.min(f,Math.max(1,b));this.changeMediaPlaybackRate(t,x)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*n);const d=n;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,d)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const n=i.edge,s=e-t-this.edgeStalled,r=n-i.totalduration,o=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(r,s),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===j.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Zc extends ta{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],s={},r={};let o=!1,c=!1,u=!1;t.levels.forEach(d=>{var f;const b=d.attrs;let{audioCodec:x,videoCodec:T}=d;x&&(d.audioCodec=x=ai(x,i)||void 0),((f=T)==null?void 0:f.indexOf("avc1"))===0&&(T=d.videoCodec=Lt(T));const{width:G,height:$,unknownCodecs:ue}=d;let ge=ue?ue.length:0;if(ue)for(let At=ge;At--;){const jt=ue[At];this.isAudioSupported(jt)?(d.audioCodec=x=x?`${x},${jt}`:jt,ge--,Ft.audio[x.substring(0,4)]=2):this.isVideoSupported(jt)&&(d.videoCodec=T=T?`${T},${jt}`:jt,ge--,Ft.video[T.substring(0,4)]=2)}if(o||(o=!!(G&&$)),c||(c=!!T),u||(u=!!x),ge||x&&!this.isAudioSupported(x)||T&&!this.isVideoSupported(T)){this.log(`Some or all CODECS not supported "${b.CODECS}"`);return}const{CODECS:fe,"FRAME-RATE":Ce,"HDCP-LEVEL":ke,"PATHWAY-ID":Je,RESOLUTION:Pe,"VIDEO-RANGE":Ze}=b,Me=`${`${Je||"."}-`}${d.bitrate}-${Pe}-${Ce}-${fe}-${Ze}-${ke}`;if(s[Me])if(s[Me].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const At=r[Me]+=1;d.attrs["PATHWAY-ID"]=new Array(At+1).join(".");const jt=this.createLevel(d);s[Me]=jt,n.push(jt)}else s[Me].addGroupId("audio",b.AUDIO),s[Me].addGroupId("text",b.SUBTITLES);else{const At=this.createLevel(d);s[Me]=At,r[Me]=1,n.push(At)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new tt(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(n.message),t.supportedResult=k(n,[])}return t}isAudioSupported(e){return St(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return St(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){let r=[],o=[],c=e;if((i||n)&&s&&(c=c.filter(({videoCodec:$,videoRange:ue,width:ge,height:fe})=>(!!$||!!(ge&&fe))&&zt(ue))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let $="no level with compatible codecs found in manifest",ue=$;t.levels.length&&(ue=`one or more CODECS in variant not supported: ${Ct(t.levels.map(fe=>fe.attrs.CODECS).filter((fe,Ce,ke)=>ke.indexOf(fe)===Ce))}`,this.warn(ue),$+=` (${ue})`);const ge=new Error($);this.hls.trigger(p.ERROR,{type:he.MEDIA_ERROR,details:j.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:ge,reason:ue})}});return}t.audioTracks&&(r=t.audioTracks.filter($=>!$.audioCodec||this.isAudioSupported($.audioCodec)),Ko(r)),t.subtitles&&(o=t.subtitles,Ko(o));const u=c.slice(0);c.sort(($,ue)=>{if($.attrs["HDCP-LEVEL"]!==ue.attrs["HDCP-LEVEL"])return($.attrs["HDCP-LEVEL"]||"")>(ue.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&$.height!==ue.height)return $.height-ue.height;if($.frameRate!==ue.frameRate)return $.frameRate-ue.frameRate;if($.videoRange!==ue.videoRange)return Ut.indexOf($.videoRange)-Ut.indexOf(ue.videoRange);if($.videoCodec!==ue.videoCodec){const ge=Ht($.videoCodec),fe=Ht(ue.videoCodec);if(ge!==fe)return fe-ge}if($.uri===ue.uri&&$.codecSet!==ue.codecSet){const ge=pt($.codecSet),fe=pt(ue.codecSet);if(ge!==fe)return fe-ge}return $.averageBitrate!==ue.averageBitrate?$.averageBitrate-ue.averageBitrate:0});let d=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let $=0;$<u.length;$++)if(u[$].pathwayId===c[0].pathwayId){d=u[$];break}}this._levels=c;for(let $=0;$<c.length;$++)if(c[$]===d){var f;this._firstLevel=$;const ue=d.bitrate,ge=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${ue}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const fe=Math.min(ue,this.hls.config.abrEwmaDefaultEstimateMax);fe>ge&&ge===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=fe)}break}const b=s&&!n,x=this.hls.config,T=!!(x.audioStreamController&&x.audioTrackController),G={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:T&&!b&&r.some($=>!!$.url)};this.hls.trigger(p.MANIFEST_PARSED,G)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const d=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:d,reason:d.message}),f)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,s=n?n.attrs["PATHWAY-ID"]:void 0,r=t[e],o=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,i===e&&n&&s===o)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${o?" with Pathway "+o:""} from level ${i}${s?" with Pathway "+s:""}`);const c={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(p.LEVEL_SWITCHING,c);const u=r.details;if(!u||u.live){const d=this.switchParams(r.uri,n==null?void 0:n.details,u);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===me.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ce.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(s=>!!i[s]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:s}=t,r=t.levelInfo;if(!r){var o;this.warn(`Invalid level index ${n}`),(o=t.deliveryDirectives)!=null&&o.skip&&(s.deltaUpdateFailed=!0);return}if(r===this.currentLevel||t.withoutMultiVariant){r.fragmentError===0&&(r.loadError=0);let c=r.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(n,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,o=r==null?void 0:r.age;this.log(`Loading level index ${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${i}`),this.hls.trigger(p.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((s,r)=>r!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(o=>o.level=-1)),!1));Zs(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(p.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Ko(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function $o(){return self.SourceBuffer||self.WebKitSourceBuffer}function Go(){if(!ye())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=ye();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(gt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(gt(e,"audio"))))}function Yc(){var a;const e=$o();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Xc=100;class qc extends Sn{constructor(e,t,i){super(e,t,i,"stream-controller",ce.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const n=this.media,s=n?n.currentTime:null;if(s===null||!U(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(n,s,ce.MAIN,0);if(r===null||r.len===0){this.warn(`Main forward buffer length at ${s} on "seeked" event ${r?r.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(Xc),this.level=-1,!this.startFragRequested){let s=n.startLevel;s===-1&&(n.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=n.firstAutoLevel),n.nextLoadLevel=s,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=it.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=it.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case it.WAITING_LEVEL:{const{levels:t,level:i}=this,n=t==null?void 0:t[i],s=n==null?void 0:n.details;if(s&&(!s.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(s))break;this.state=it.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=it.IDLE;break}break}case it.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:n,level:s}=this,r=n==null?void 0:n[s];this.resetStartWhenNotLoaded(r||null),this.state=it.IDLE}}break}this.state===it.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[s]))return;const r=i[s],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const G={};this.altAudio===2&&(G.type="video"),this.hls.trigger(p.BUFFER_EOS,G),this.state=it.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const u=r.details;if(!u||this.state===it.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=it.WAITING_LEVEL,this.startFragRequested=!1;return}const d=o.len,f=this.getMaxBufferLength(r.maxBitrate);if(d>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const b=this.backtrackFragment?this.backtrackFragment.start:o.end;let x=this.getNextFragment(b,u);if(this.couldBacktrack&&!this.fragPrevious&&x&&ae(x)&&this.fragmentTracker.getState(x)!==Ai.OK){var T;const $=((T=this.backtrackFragment)!=null?T:x).sn-u.startSN,ue=u.fragments[$-1];ue&&x.cc===ue.cc&&(x=ue,this.fragmentTracker.removeFragment(ue))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(x&&this.isLoopLoading(x,b)){if(!x.gap){const $=this.audioOnly&&!this.altAudio?v.AUDIO:v.VIDEO,ue=($===v.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;ue&&this.afterBufferFlushed(ue,$,ce.MAIN)}x=this.getNextFragmentLoopLoading(x,u,o,ce.MAIN,f)}x&&(x.initSegment&&!x.initSegment.data&&!this.bitrateTest&&(x=x.initSegment),this.loadFragment(x,r,b))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Ai.NOT_LOADED||n===Ai.PARTIAL?ae(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ce.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<s.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,c=e[o],u=this.fragLastKbps;u&&this.fragCurrent?i=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:i=0}else i=0;const r=this.getBufferedFrag(t.currentTime+i);if(r){const o=this.followingBufferedFrag(r);if(o){this.abortCurrentFrag();const c=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,d=Math.max(r.end,c+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case it.KEY_LOADING:case it.FRAG_LOADING:case it.FRAG_LOADING_WAITING_RETRY:case it.PARSING:case it.PARSED:this.state=it.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;cs(i,"playing",this.onMediaPlaying),cs(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(rs(i,"playing",this.onMediaPlaying),rs(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(p.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,n=!1;t.levels.forEach(s=>{const r=s.audioCodec;r&&(i=i||r.indexOf("mp4a.40.2")!==-1,n=n||r.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&n&&!Yc(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==it.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=it.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:s}=this,r=t.level,o=t.details,c=o.totalduration;if(!n){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${c}`);const u=t.levelInfo,d=this.fragCurrent;d&&(this.state===it.FRAG_LOADING||this.state===it.FRAG_LOADING_WAITING_RETRY)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let f=0;if(o.live||(i=u.details)!=null&&i.live){var b;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(b=this.levelLastLoaded)==null?void 0:b.details)}if(u.details=o,this.levelLastLoaded=u,s||this.setStartPosition(o,f),this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:r}),this.state===it.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=it.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,o=e.edge,c=s>=r-t.maxFragLookUpTolerance&&s<=o;if(n!==null&&i.duration>n&&(s<n||!c)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!c&&i.readyState<4||s<o-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),i.currentTime=n))}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=r[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const u=o.videoCodec,d=c.PTSKnown||!c.live,f=(t=i.initSegment)==null?void 0:t.data,b=this._getAudioCodec(o),x=this.transmuxer=this.transmuxer||new qa(this.hls,ce.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),T=n?n.index:-1,G=T!==-1,$=new yn(i.level,i.sn,i.stats.chunkCount,s.byteLength,T,G),ue=this.initPTS[i.cc];x.push(s,f,b,u,i,n,c.totalduration,d,$,ue)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(ni(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=ni(t.url,this.hls);if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,s,r=!1;for(const o in i){const c=i[o];if(c.id==="main"){if(s=o,n=c,o==="video"){const u=i[o];u&&(this.videoBuffer=u.buffer)}}else r=!0}r&&n?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,s=i.type===ce.MAIN;if(s){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===it.PARSED&&(this.state=it.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),ae(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&fi.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=it.ERROR;return}switch(t.details){case j.FRAG_GAP:case j.FRAG_PARSING_ERROR:case j.FRAG_DECRYPT_ERROR:case j.FRAG_LOAD_ERROR:case j.FRAG_LOAD_TIMEOUT:case j.KEY_LOAD_ERROR:case j.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.MAIN,t);break;case j.LEVEL_LOAD_ERROR:case j.LEVEL_LOAD_TIMEOUT:case j.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===it.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===me.LEVEL&&(this.state=it.IDLE);break;case j.BUFFER_ADD_CODEC_ERROR:case j.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case j.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case j.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=it.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==v.AUDIO||!this.altAudio){const i=(t===v.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,ce.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const n=this.timelineOffset;n&&i&&(i+=n);const s=this.getLevelDetails(),r=fi.getBuffered(e),o=r.length?r.start(0):0,c=o-i,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);c>0&&(c<u||this.loadingParts&&c<2*((s==null?void 0:s.partTarget)||0))&&(this.log(`adjusting start position by ${c} to match buffer start`),i+=c,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:n}=this,s=i==null?void 0:i.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=it.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=s.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),n.trigger(p.FRAG_LOADED,i),s.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i=this.playlistType,{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:d}=o,{video:f,text:b,id3:x,initSegment:T}=s,{details:G}=d,$=this.altAudio?void 0:s.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=it.PARSING,T){if(T!=null&&T.tracks){const fe=c.initSegment||c;this._bufferInitSegment(d,T.tracks,fe,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:fe,id:i,tracks:T.tracks})}const ue=T.initPTS,ge=T.timescale;U(ue)&&(this.initPTS[c.cc]={baseTime:ue,timescale:ge},n.trigger(p.INIT_PTS_FOUND,{frag:c,id:i,initPTS:ue,timescale:ge}))}if(f&&G){$&&f.type==="audiovideo"&&this.logMuxedErr(c);const ue=G.fragments[c.sn-1-G.startSN],ge=c.sn===G.startSN,fe=!ue||c.cc>ue.cc;if(s.independent!==!1){const{startPTS:Ce,endPTS:ke,startDTS:Je,endDTS:Pe}=f;if(u)u.elementaryStreams[f.type]={startPTS:Ce,endPTS:ke,startDTS:Je,endDTS:Pe};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!fe&&(this.couldBacktrack=!0),f.dropped&&f.independent){const Ze=this.getMainFwdBufferInfo(),nt=(Ze?Ze.end:this.getLoadPosition())+this.config.maxBufferHole,Me=f.firstKeyFramePTS?f.firstKeyFramePTS:Ce;if(!ge&&nt<Me-this.config.maxBufferHole&&!fe){this.backtrack(c);return}else fe&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,ke,c.start,Pe,!0)}else ge&&Ce-(G.appliedTimelineOffset||0)>kr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,Ce,ke,Je,Pe),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,u,r,ge||fe)}else if(ge||fe)c.gap=!0;else{this.backtrack(c);return}}if($){const{startPTS:ue,endPTS:ge,startDTS:fe,endDTS:Ce}=$;u&&(u.elementaryStreams[v.AUDIO]={startPTS:ue,endPTS:ge,startDTS:fe,endDTS:Ce}),c.setElementaryStreamInfo(v.AUDIO,ue,ge,fe,Ce),this.bufferFragmentData($,c,u,r)}if(G&&x!=null&&(t=x.samples)!=null&&t.length){const ue={id:i,frag:c,details:G,samples:x.samples};n.trigger(p.FRAG_PARSING_METADATA,ue)}if(G&&b){const ue={id:i,frag:c,details:G,samples:b.samples};n.trigger(p.FRAG_PARSING_USERDATA,ue)}}logMuxedErr(e){this.warn(`${ae(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==it.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:s,video:r,audiovideo:o}=t;if(s){let u=Xt(s.codec,e.audioCodec);u==="mp4a"&&(u="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const f=s.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),e.audioCodec&&e.audioCodec!==u&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${u}"`),s.levelCodec=u,s.id=ce.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${u||""}/${e.audioCodec||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=ce.MAIN;const u=r.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":r.codec="hvc1.1.6.L120.90";break;case"av01":r.codec="av01.0.04M.08";break;case"avc1":r.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${r.codec!==u?" parsed-corrected="+r.codec:""}${r.supplemental?" supplemental="+r.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(p.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const f=t[u].initSegment;f!=null&&f.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:u,data:f,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,ce.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=it.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(fi.isBuffered(e,i)?t=this.getAppendedFrag(i):fi.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 U(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(U(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?mi(null,i.fragments,t):null);if(n){const s=n.programDateTime;if(s!==null){const r=s+(t-n.start)*1e3;return new Date(r)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Qc{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[i].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=j.KEY_LOAD_ERROR,i,n,s){return new Ui({type:he.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:i,networkDetails:n})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:n}=e;for(let s=0;s<t.length;s++){const r=t[s];if(n<=r.cc&&(i==="initSegment"||r.sn==="initSegment"||i<r.sn)){this.emeController.selectKeySystemFormat(r).then(o=>{r.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,j.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,j.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));let o=this.keyUriToKeyInfo[r];if((i=o)!=null&&i.decryptdata.key)return s.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((n=o)!=null&&n.keyLoadPromise){var c;switch((c=o.mediaKeySessionContext)==null?void 0:c.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(u=>(s.key=u.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[r]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,j.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(i);if(n)return(e.keyLoadPromise=n.then(s=>(e.mediaKeySessionContext=s,i))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,s=new n(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((r,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=i.keyLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(b,x,T,G)=>{const{frag:$,keyInfo:ue,url:ge}=T;if(!$.decryptdata||ue!==this.keyUriToKeyInfo[ge])return o(this.createKeyLoadError($,j.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),G));ue.decryptdata.key=$.decryptdata.key=new Uint8Array(b.data),$.keyLoader=null,ue.loader=null,r({frag:$,keyInfo:ue})},onError:(b,x,T,G)=>{this.resetLoader(x),o(this.createKeyLoadError(t,j.KEY_LOAD_ERROR,new Error(`HTTP Error ${b.code} loading key ${b.text}`),T,E({url:c.url,data:void 0},b)))},onTimeout:(b,x,T)=>{this.resetLoader(x),o(this.createKeyLoadError(t,j.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),T))},onAbort:(b,x,T)=>{this.resetLoader(x),o(this.createKeyLoadError(t,j.INTERNAL_ABORTED,new Error("key loading aborted"),T))}};s.load(c,d,f)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,s=i.loader;t.keyLoader===s&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[n],s&&s.destroy()}}function Vo(a){const{type:e}=a;switch(e){case me.AUDIO_TRACK:return ce.AUDIO;case me.SUBTITLE_TRACK:return ce.SUBTITLE;default:return ce.MAIN}}function Sa(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Jc{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,s=i||n,r=new s(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:me.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:c}=t;this.load({id:i,level:n,pathwayId:s,responseType:"text",type:me.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:me.AUDIO_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:me.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[me.LEVEL];if(i){const n=i.context;n&&!t.levels.some(s=>s===n.levelOrTrack)&&(i.abort(),delete this.loaders[me.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const u=this.hls.logger,d=n.context;if(d&&d.levelOrTrack===e.levelOrTrack&&(d.url===e.url||d.deliveryDirectives&&!e.deliveryDirectives)){d.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${d.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let s;if(e.type===me.MANIFEST?s=i.manifestLoadPolicy.default:s=g({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),U((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===me.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===me.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===me.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const d=u.partTarget,f=u.targetduration;if(d&&f){const b=Math.max(d*3,f*.8)*1e3;s=g({},s,{maxTimeToFirstByteMs:Math.min(b,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(b,s.maxTimeToFirstByteMs)})}}}const r=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},c={onSuccess:(u,d,f,b)=>{const x=this.getInternalLoader(f);this.resetInternalLoader(f.type);const T=u.data;if(T.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),b||null,d);return}d.parsing.start=performance.now(),Fn.isMediaPlaylist(T)||f.type!==me.MANIFEST?this.handleTrackOrLevelPlaylist(u,d,f,b||null,x):this.handleMasterPlaylist(u,d,f,b)},onError:(u,d,f,b)=>{this.handleNetworkError(d,f,!1,u,b)},onTimeout:(u,d,f)=>{this.handleNetworkError(d,f,!0,void 0,u)}};n.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const s=this.hls,r=e.data,o=Sa(e,i),c=Fn.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:u,levels:d,sessionData:f,sessionKeys:b,startTimeOffset:x,variableList:T}=c;this.variableList=T;const{AUDIO:G=[],SUBTITLES:$,"CLOSED-CAPTIONS":ue}=Fn.parseMasterPlaylistMedia(r,o,c);G.length&&!G.some(fe=>!fe.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),G.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Wi({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:d,audioTracks:G,subtitles:$,captions:ue,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:b,startTimeOffset:x,variableList:T})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:c,type:u}=i,d=Sa(e,i),f=U(c)?c:U(o)?o:0,b=Vo(i),x=Fn.parseLevelPlaylist(e.data,d,f,b,0,this.variableList);if(u===me.MANIFEST){const T={attrs:new Wi({}),bitrate:0,details:x,name:"",url:d};x.requestScheduled=t.loading.start+Es(x,0),r.trigger(p.MANIFEST_LOADED,{levels:[T],audioTracks:[],url:d,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=x,this.handlePlaylistLoaded(x,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.MANIFEST_PARSING_ERROR,fatal:t.type===me.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:s})}handleNetworkError(e,t,i=!1,n,s){let r=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===me.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===me.AUDIO_TRACK||e.type===me.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=j.UNKNOWN,u=!1;const d=this.getInternalLoader(e);switch(e.type){case me.MANIFEST:c=i?j.MANIFEST_LOAD_TIMEOUT:j.MANIFEST_LOAD_ERROR,u=!0;break;case me.LEVEL:c=i?j.LEVEL_LOAD_TIMEOUT:j.LEVEL_LOAD_ERROR,u=!1;break;case me.AUDIO_TRACK:c=i?j.AUDIO_TRACK_LOAD_TIMEOUT:j.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case me.SUBTITLE_TRACK:c=i?j.SUBTITLE_TRACK_LOAD_TIMEOUT:j.SUBTITLE_LOAD_ERROR,u=!1;break}d&&this.resetInternalLoader(e.type);const f={type:he.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:s};if(n){const b=(t==null?void 0:t.url)||e.url;f.response=E({url:b,data:void 0},n)}this.hls.trigger(p.ERROR,f)}handlePlaylistLoaded(e,t,i,n,s,r){const o=this.hls,{type:c,level:u,id:d,groupId:f,deliveryDirectives:b}=n,x=Sa(t,n),T=Vo(n),G=typeof n.level=="number"&&T===ce.MAIN?u:void 0;if(!e.fragments.length){const ue=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.LEVEL_EMPTY_ERROR,fatal:!1,url:x,error:ue,reason:ue.message,response:t,context:n,level:G,parent:T,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const $=e.playlistParsingError;if($){if(this.hls.logger.warn($),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:he.NETWORK_ERROR,details:j.LEVEL_PARSING_ERROR,fatal:!1,url:x,error:$,reason:$.message,response:t,context:n,level:G,parent:T,networkDetails:s,stats:i});return}e.playlistParsingError=null}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case me.MANIFEST:case me.LEVEL:o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||o.levels[0],level:G||0,id:d||0,stats:i,networkDetails:s,deliveryDirectives:b,withoutMultiVariant:c===me.MANIFEST});break;case me.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:d||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:b});break;case me.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:d||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:b});break}}}class gs{static get version(){return qs}static isMSESupported(){return Go()}static isSupported(){return zc()}static getMediaSource(){return ye()}static get Events(){return p}static get MetadataSchema(){return Bn}static get ErrorTypes(){return he}static get ErrorDetails(){return j}static get DefaultConfig(){return gs.defaultConfig?gs.defaultConfig:Mc}static set DefaultConfig(e){gs.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Xs,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=ne(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=Fc(gs.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Bc(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=i,u=new o(this),d=this.abrController=new n(this),f=new nn(this),b=i.interstitialsController,x=b?this.interstitialsController=new b(this,gs):null,T=this.bufferController=new s(this,f),G=this.capLevelController=new r(this),$=new c(this),ue=new Jc(this),ge=i.contentSteeringController,fe=ge?new ge(this):null,Ce=this.levelController=new Zc(this,fe),ke=new Wc(this),Je=new Qc(this.config),Pe=this.streamController=new qc(this,f,Je),Ze=this.gapController=new Gc(this,f);G.setStreamController(Pe),$.setStreamController(Pe);const nt=[ue,Ce,Pe];x&&nt.splice(1,0,x),fe&&nt.splice(1,0,fe),this.networkControllers=nt;const Me=[d,T,Ze,G,$,ke,f];this.audioTrackController=this.createController(i.audioTrackController,nt);const At=i.audioStreamController;At&&nt.push(this.audioStreamController=new At(this,f,Je)),this.subtitleTrackController=this.createController(i.subtitleTrackController,nt);const jt=i.subtitleStreamController;jt&&nt.push(this.subtititleStreamController=new jt(this,f,Je)),this.createController(i.timelineController,Me),Je.emeController=this.emeController=this.createController(i.emeController,Me),this.cmcdController=this.createController(i.cmcdController,Me),this.latencyController=this.createController(Hc,Me),this.coreComponents=Me,nt.push(u);const Oi=u.onErrorOut;typeof Oi=="function"&&this.on(p.ERROR,Oi,u),this.on(p.MANIFEST_LOADED,ue.onManifestLoaded,ue)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===p.ERROR;this.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(p.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(p.ERROR,{type:he.OTHER_ERROR,details:j.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger(p.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(p.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=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=pl()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){_t(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=Rt(t);return be(e,i,navigator.mediaCapabilities)}}gs.defaultConfig=void 0}}]);
}());