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

100 lines
877 KiB

!(function(){var Qo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[2524],{65352:function(Dt,Me,G){"use strict";G.d(Me,{Z:function(){return ai}});var z=G(89490),J=G(11036),ye=G(39224),ee=G(43403),M=G(92310),p=G.n(M),ie=G(29301),Y=G(76846),l=G(96452),$=G(6089),b=G(80402),y=G(34280),m=G(49658),x=G(59301),S=G(71409),P=G(77900),C=G(8654);function k(ce){var Ie=ce.prefixCls,ne=ce.align,Fe=ce.arrow,Ve=ce.arrowPos,qe=Fe||{},K=qe.className,ae=qe.content,me=Ve.x,Se=me===void 0?0:me,We=Ve.y,Be=We===void 0?0:We,xt=x.useRef();if(!ne||!ne.points)return null;var He={position:"absolute"};if(ne.autoArrow!==!1){var mt=ne.points[0],Nt=ne.points[1],Ot=mt[0],dt=mt[1],Zt=Nt[0],Mt=Nt[1];Ot===Zt||!["t","b"].includes(Ot)?He.top=Be:Ot==="t"?He.top=0:He.bottom=0,dt===Mt||!["l","r"].includes(dt)?He.left=Se:dt==="l"?He.left=0:He.right=0}return x.createElement("div",{ref:xt,className:p()("".concat(Ie,"-arrow"),K),style:He},ae)}function R(ce){var Ie=ce.prefixCls,ne=ce.open,Fe=ce.zIndex,Ve=ce.mask,qe=ce.motion;return Ve?x.createElement(P.default,(0,S.Z)({},qe,{motionAppear:!0,visible:ne,removeOnLeave:!0}),function(K){var ae=K.className;return x.createElement("div",{style:{zIndex:Fe},className:p()("".concat(Ie,"-mask"),ae)})}):null}var I=x.memo(function(ce){var Ie=ce.children;return Ie},function(ce,Ie){return Ie.cache}),F=I,j=x.forwardRef(function(ce,Ie){var ne=ce.popup,Fe=ce.className,Ve=ce.prefixCls,qe=ce.style,K=ce.target,ae=ce.onVisibleChanged,me=ce.open,Se=ce.keepDom,We=ce.fresh,Be=ce.onClick,xt=ce.mask,He=ce.arrow,mt=ce.arrowPos,Nt=ce.align,Ot=ce.motion,dt=ce.maskMotion,Zt=ce.forceRender,Mt=ce.getPopupContainer,ni=ce.autoDestroy,Yt=ce.portal,St=ce.zIndex,Ni=ce.onMouseEnter,De=ce.onMouseLeave,ke=ce.onPointerEnter,je=ce.onPointerDownCapture,si=ce.ready,Xe=ce.offsetX,Qe=ce.offsetY,pt=ce.offsetR,Bt=ce.offsetB,rt=ce.onAlign,Ye=ce.onPrepare,$e=ce.stretch,At=ce.targetWidth,ot=ce.targetHeight,ji=typeof ne=="function"?ne():ne,ti=me||Se,_t=(Mt==null?void 0:Mt.length)>0,lt=x.useState(!Mt||!_t),oi=(0,J.Z)(lt,2),Fi=oi[0],an=oi[1];if((0,y.Z)(function(){!Fi&&_t&&K&&an(!0)},[Fi,_t,K]),!Fi)return null;var Li="auto",bi={left:"-1000vw",top:"-1000vh",right:Li,bottom:Li};if(si||!me){var pi,Bi=Nt.points,zi=Nt.dynamicInset||((pi=Nt._experimental)===null||pi===void 0?void 0:pi.dynamicInset),Di=zi&&Bi[0][1]==="r",Gi=zi&&Bi[0][0]==="b";Di?(bi.right=pt,bi.left=Li):(bi.left=Xe,bi.right=Li),Gi?(bi.bottom=Bt,bi.top=Li):(bi.top=Qe,bi.bottom=Li)}var Ai={};return $e&&($e.includes("height")&&ot?Ai.height=ot:$e.includes("minHeight")&&ot&&(Ai.minHeight=ot),$e.includes("width")&&At?Ai.width=At:$e.includes("minWidth")&&At&&(Ai.minWidth=At)),me||(Ai.pointerEvents="none"),x.createElement(Yt,{open:Zt||ti,getContainer:Mt&&function(){return Mt(K)},autoDestroy:ni},x.createElement(R,{prefixCls:Ve,open:me,zIndex:St,mask:xt,motion:dt}),x.createElement(ie.Z,{onResize:rt,disabled:!me},function(_n){return x.createElement(P.default,(0,S.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Zt,leavedClassName:"".concat(Ve,"-hidden")},Ot,{onAppearPrepare:Ye,onEnterPrepare:Ye,visible:me,onVisibleChanged:function(Ui){var Zi;Ot==null||(Zi=Ot.onVisibleChanged)===null||Zi===void 0||Zi.call(Ot,Ui),ae(Ui)}}),function(Ki,Ui){var Zi=Ki.className,sn=Ki.style,Ci=p()(Ve,Zi,Fe);return x.createElement("div",{ref:(0,C.sQ)(_n,Ie,Ui),className:Ci,style:(0,z.Z)((0,z.Z)((0,z.Z)((0,z.Z)({"--arrow-x":"".concat(mt.x||0,"px"),"--arrow-y":"".concat(mt.y||0,"px")},bi),Ai),sn),{},{boxSizing:"border-box",zIndex:St},qe),onMouseEnter:Ni,onMouseLeave:De,onPointerEnter:ke,onClick:Be,onPointerDownCapture:je},He&&x.createElement(k,{prefixCls:Ve,arrow:He,arrowPos:mt,align:Nt}),x.createElement(F,{cache:!me&&!We},ji))})}))}),q=j,te=x.forwardRef(function(ce,Ie){var ne=ce.children,Fe=ce.getTriggerDOMNode,Ve=(0,C.Yr)(ne),qe=x.useCallback(function(ae){(0,C.mH)(Ie,Fe?Fe(ae):ae)},[Fe]),K=(0,C.x1)(qe,(0,C.C4)(ne));return Ve?x.cloneElement(ne,{ref:K}):ne}),X=te,ge=x.createContext(null),we=ge;function Ee(ce){return ce?Array.isArray(ce)?ce:[ce]:[]}function et(ce,Ie,ne,Fe){return x.useMemo(function(){var Ve=Ee(ne!=null?ne:Ie),qe=Ee(Fe!=null?Fe:Ie),K=new Set(Ve),ae=new Set(qe);return ce&&(K.has("hover")&&(K.delete("hover"),K.add("click")),ae.has("hover")&&(ae.delete("hover"),ae.add("click"))),[K,ae]},[ce,Ie,ne,Fe])}var U=G(29194);function w(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ne=arguments.length>2?arguments[2]:void 0;return ne?ce[0]===Ie[0]:ce[0]===Ie[0]&&ce[1]===Ie[1]}function L(ce,Ie,ne,Fe){for(var Ve=ne.points,qe=Object.keys(ce),K=0;K<qe.length;K+=1){var ae,me=qe[K];if(w((ae=ce[me])===null||ae===void 0?void 0:ae.points,Ve,Fe))return"".concat(Ie,"-placement-").concat(me)}return""}function O(ce,Ie,ne,Fe){return Ie||(ne?{motionName:"".concat(ce,"-").concat(ne)}:Fe?{motionName:Fe}:null)}function H(ce){return ce.ownerDocument.defaultView}function N(ce){for(var Ie=[],ne=ce==null?void 0:ce.parentElement,Fe=["hidden","scroll","clip","auto"];ne;){var Ve=H(ne).getComputedStyle(ne),qe=Ve.overflowX,K=Ve.overflowY,ae=Ve.overflow;[qe,K,ae].some(function(me){return Fe.includes(me)})&&Ie.push(ne),ne=ne.parentElement}return Ie}function _(ce){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(ce)?Ie:ce}function g(ce){return _(parseFloat(ce),0)}function D(ce,Ie){var ne=(0,z.Z)({},ce);return(Ie||[]).forEach(function(Fe){if(!(Fe instanceof HTMLBodyElement||Fe instanceof HTMLHtmlElement)){var Ve=H(Fe).getComputedStyle(Fe),qe=Ve.overflow,K=Ve.overflowClipMargin,ae=Ve.borderTopWidth,me=Ve.borderBottomWidth,Se=Ve.borderLeftWidth,We=Ve.borderRightWidth,Be=Fe.getBoundingClientRect(),xt=Fe.offsetHeight,He=Fe.clientHeight,mt=Fe.offsetWidth,Nt=Fe.clientWidth,Ot=g(ae),dt=g(me),Zt=g(Se),Mt=g(We),ni=_(Math.round(Be.width/mt*1e3)/1e3),Yt=_(Math.round(Be.height/xt*1e3)/1e3),St=(mt-Nt-Zt-Mt)*ni,Ni=(xt-He-Ot-dt)*Yt,De=Ot*Yt,ke=dt*Yt,je=Zt*ni,si=Mt*ni,Xe=0,Qe=0;if(qe==="clip"){var pt=g(K);Xe=pt*ni,Qe=pt*Yt}var Bt=Be.x+je-Xe,rt=Be.y+De-Qe,Ye=Bt+Be.width+2*Xe-je-si-St,$e=rt+Be.height+2*Qe-De-ke-Ni;ne.left=Math.max(ne.left,Bt),ne.top=Math.max(ne.top,rt),ne.right=Math.min(ne.right,Ye),ne.bottom=Math.min(ne.bottom,$e)}}),ne}function V(ce){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ne="".concat(Ie),Fe=ne.match(/^(.*)\%$/);return Fe?ce*(parseFloat(Fe[1])/100):parseFloat(ne)}function pe(ce,Ie){var ne=Ie||[],Fe=(0,J.Z)(ne,2),Ve=Fe[0],qe=Fe[1];return[V(ce.width,Ve),V(ce.height,qe)]}function Ae(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[ce[0],ce[1]]}function Ce(ce,Ie){var ne=Ie[0],Fe=Ie[1],Ve,qe;return ne==="t"?qe=ce.y:ne==="b"?qe=ce.y+ce.height:qe=ce.y+ce.height/2,Fe==="l"?Ve=ce.x:Fe==="r"?Ve=ce.x+ce.width:Ve=ce.x+ce.width/2,{x:Ve,y:qe}}function Ne(ce,Ie){var ne={t:"b",b:"t",l:"r",r:"l"};return ce.map(function(Fe,Ve){return Ve===Ie?ne[Fe]||"c":Fe}).join("")}function ze(ce,Ie,ne,Fe,Ve,qe,K){var ae=x.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Ve[Fe]||{}}),me=(0,J.Z)(ae,2),Se=me[0],We=me[1],Be=x.useRef(0),xt=x.useMemo(function(){return Ie?N(Ie):[]},[Ie]),He=x.useRef({}),mt=function(){He.current={}};ce||mt();var Nt=(0,$.Z)(function(){if(Ie&&ne&&ce){let nn=function(wi,Ri){var Kt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ki,Qi=lt.x+wi,Hn=lt.y+Ri,ts=Qi+Di,os=Hn+zi,jn=Math.max(Qi,Kt.left),nt=Math.max(Hn,Kt.top),Et=Math.min(ts,Kt.right),_i=Math.min(os,Kt.bottom);return Math.max(0,(Et-jn)*(_i-nt))},Nn=function(){Wi=lt.y+gt,Pi=Wi+zi,xi=lt.x+Tt,en=xi+Di};var Zt,Mt,ni,Yt,St=Ie,Ni=St.ownerDocument,De=H(St),ke=De.getComputedStyle(St),je=ke.width,si=ke.height,Xe=ke.position,Qe=St.style.left,pt=St.style.top,Bt=St.style.right,rt=St.style.bottom,Ye=St.style.overflow,$e=(0,z.Z)((0,z.Z)({},Ve[Fe]),qe),At=Ni.createElement("div");(Zt=St.parentElement)===null||Zt===void 0||Zt.appendChild(At),At.style.left="".concat(St.offsetLeft,"px"),At.style.top="".concat(St.offsetTop,"px"),At.style.position=Xe,At.style.height="".concat(St.offsetHeight,"px"),At.style.width="".concat(St.offsetWidth,"px"),St.style.left="0",St.style.top="0",St.style.right="auto",St.style.bottom="auto",St.style.overflow="hidden";var ot;if(Array.isArray(ne))ot={x:ne[0],y:ne[1],width:0,height:0};else{var ji,ti,_t=ne.getBoundingClientRect();_t.x=(ji=_t.x)!==null&&ji!==void 0?ji:_t.left,_t.y=(ti=_t.y)!==null&&ti!==void 0?ti:_t.top,ot={x:_t.x,y:_t.y,width:_t.width,height:_t.height}}var lt=St.getBoundingClientRect();lt.x=(Mt=lt.x)!==null&&Mt!==void 0?Mt:lt.left,lt.y=(ni=lt.y)!==null&&ni!==void 0?ni:lt.top;var oi=Ni.documentElement,Fi=oi.clientWidth,an=oi.clientHeight,Li=oi.scrollWidth,bi=oi.scrollHeight,pi=oi.scrollTop,Bi=oi.scrollLeft,zi=lt.height,Di=lt.width,Gi=ot.height,Ai=ot.width,_n={left:0,top:0,right:Fi,bottom:an},Ki={left:-Bi,top:-pi,right:Li-Bi,bottom:bi-pi},Ui=$e.htmlRegion,Zi="visible",sn="visibleFirst";Ui!=="scroll"&&Ui!==sn&&(Ui=Zi);var Ci=Ui===sn,Tn=D(Ki,xt),jt=D(_n,xt),ki=Ui===Zi?jt:Tn,Jt=Ci?jt:ki;St.style.left="auto",St.style.top="auto",St.style.right="0",St.style.bottom="0";var $i=St.getBoundingClientRect();St.style.left=Qe,St.style.top=pt,St.style.right=Bt,St.style.bottom=rt,St.style.overflow=Ye,(Yt=St.parentElement)===null||Yt===void 0||Yt.removeChild(At);var Ji=_(Math.round(Di/parseFloat(je)*1e3)/1e3),kt=_(Math.round(zi/parseFloat(si)*1e3)/1e3);if(Ji===0||kt===0||(0,Y.Sh)(ne)&&!(0,U.Z)(ne))return;var fn=$e.offset,Vi=$e.targetOffset,yt=pe(lt,fn),Ut=(0,J.Z)(yt,2),Z=Ut[0],de=Ut[1],Te=pe(ot,Vi),_e=(0,J.Z)(Te,2),Re=_e[0],Le=_e[1];ot.x-=Re,ot.y-=Le;var Ge=$e.points||[],it=(0,J.Z)(Ge,2),re=it[0],Je=it[1],It=Ae(Je),ct=Ae(re),at=Ce(ot,It),Lt=Ce(lt,ct),Vt=(0,z.Z)({},$e),Tt=at.x-Lt.x+Z,gt=at.y-Lt.y+de,Qt=nn(Tt,gt),ui=nn(Tt,gt,jt),zt=Ce(ot,["t","l"]),Ft=Ce(lt,["t","l"]),ci=Ce(ot,["b","r"]),Wt=Ce(lt,["b","r"]),li=$e.overflow||{},ii=li.adjustX,Xt=li.adjustY,Xi=li.shiftX,Ei=li.shiftY,Ht=function(Ri){return typeof Ri=="boolean"?Ri:Ri>=0},Wi,Pi,xi,en;Nn();var vi=Ht(Xt),on=ct[0]===It[0];if(vi&&ct[0]==="t"&&(Pi>Jt.bottom||He.current.bt)){var hi=gt;on?hi-=zi-Gi:hi=zt.y-Wt.y-de;var dn=nn(Tt,hi),kn=nn(Tt,hi,jt);dn>Qt||dn===Qt&&(!Ci||kn>=ui)?(He.current.bt=!0,gt=hi,de=-de,Vt.points=[Ne(ct,0),Ne(It,0)]):He.current.bt=!1}if(vi&&ct[0]==="b"&&(Wi<Jt.top||He.current.tb)){var ln=gt;on?ln+=zi-Gi:ln=ci.y-Ft.y-de;var Ln=nn(Tt,ln),An=nn(Tt,ln,jt);Ln>Qt||Ln===Qt&&(!Ci||An>=ui)?(He.current.tb=!0,gt=ln,de=-de,Vt.points=[Ne(ct,0),Ne(It,0)]):He.current.tb=!1}var Hi=Ht(ii),rn=ct[1]===It[1];if(Hi&&ct[1]==="l"&&(en>Jt.right||He.current.rl)){var pn=Tt;rn?pn-=Di-Ai:pn=zt.x-Wt.x-Z;var wn=nn(pn,gt),vn=nn(pn,gt,jt);wn>Qt||wn===Qt&&(!Ci||vn>=ui)?(He.current.rl=!0,Tt=pn,Z=-Z,Vt.points=[Ne(ct,1),Ne(It,1)]):He.current.rl=!1}if(Hi&&ct[1]==="r"&&(xi<Jt.left||He.current.lr)){var ri=Tt;rn?ri+=Di-Ai:ri=ci.x-Ft.x-Z;var un=nn(ri,gt),cn=nn(ri,gt,jt);un>Qt||un===Qt&&(!Ci||cn>=ui)?(He.current.lr=!0,Tt=ri,Z=-Z,Vt.points=[Ne(ct,1),Ne(It,1)]):He.current.lr=!1}Nn();var tn=Xi===!0?0:Xi;typeof tn=="number"&&(xi<jt.left&&(Tt-=xi-jt.left-Z,ot.x+Ai<jt.left+tn&&(Tt+=ot.x-jt.left+Ai-tn)),en>jt.right&&(Tt-=en-jt.right-Z,ot.x>jt.right-tn&&(Tt+=ot.x-jt.right+tn)));var qi=Ei===!0?0:Ei;typeof qi=="number"&&(Wi<jt.top&&(gt-=Wi-jt.top-de,ot.y+Gi<jt.top+qi&&(gt+=ot.y-jt.top+Gi-qi)),Pi>jt.bottom&&(gt-=Pi-jt.bottom-de,ot.y>jt.bottom-qi&&(gt+=ot.y-jt.bottom+qi)));var vt=lt.x+Tt,Pn=vt+Di,yn=lt.y+gt,Kn=yn+zi,On=ot.x,Xn=On+Ai,Mn=ot.y,qn=Mn+Gi,mi=Math.max(vt,On),Vn=Math.min(Pn,Xn),En=(mi+Vn)/2,as=En-vt,Jn=Math.max(yn,Mn),Wn=Math.min(Kn,qn),es=(Jn+Wn)/2,bn=es-yn;K==null||K(Ie,Vt);var xn=$i.right-lt.x-(Tt+lt.width),Yi=$i.bottom-lt.y-(gt+lt.height);Ji===1&&(Tt=Math.round(Tt),xn=Math.round(xn)),kt===1&&(gt=Math.round(gt),Yi=Math.round(Yi));var Rn={ready:!0,offsetX:Tt/Ji,offsetY:gt/kt,offsetR:xn/Ji,offsetB:Yi/kt,arrowX:as/Ji,arrowY:bn/kt,scaleX:Ji,scaleY:kt,align:Vt};We(Rn)}}),Ot=function(){Be.current+=1;var Mt=Be.current;Promise.resolve().then(function(){Be.current===Mt&&Nt()})},dt=function(){We(function(Mt){return(0,z.Z)((0,z.Z)({},Mt),{},{ready:!1})})};return(0,y.Z)(dt,[Fe]),(0,y.Z)(function(){ce||dt()},[ce]),[Se.ready,Se.offsetX,Se.offsetY,Se.offsetR,Se.offsetB,Se.arrowX,Se.arrowY,Se.scaleX,Se.scaleY,Se.align,Ot]}var Ct=G(62730);function Rt(ce,Ie,ne,Fe,Ve){(0,y.Z)(function(){if(ce&&Ie&&ne){let Be=function(){Fe(),Ve()};var qe=Ie,K=ne,ae=N(qe),me=N(K),Se=H(K),We=new Set([Se].concat((0,Ct.Z)(ae),(0,Ct.Z)(me)));return We.forEach(function(xt){xt.addEventListener("scroll",Be,{passive:!0})}),Se.addEventListener("resize",Be,{passive:!0}),Fe(),function(){We.forEach(function(xt){xt.removeEventListener("scroll",Be),Se.removeEventListener("resize",Be)})}}},[ce,Ie,ne])}var tt=G(48736);function bt(ce,Ie,ne,Fe,Ve,qe,K,ae){var me=x.useRef(ce);me.current=ce;var Se=x.useRef(!1);x.useEffect(function(){if(Ie&&Fe&&(!Ve||qe)){var Be=function(){Se.current=!1},xt=function(ni){var Yt;me.current&&!K(((Yt=ni.composedPath)===null||Yt===void 0||(Yt=Yt.call(ni))===null||Yt===void 0?void 0:Yt[0])||ni.target)&&!Se.current&&ae(!1)},He=H(Fe);He.addEventListener("pointerdown",Be,!0),He.addEventListener("mousedown",xt,!0),He.addEventListener("contextmenu",xt,!0);var mt=(0,l.A)(ne);if(mt&&(mt.addEventListener("mousedown",xt,!0),mt.addEventListener("contextmenu",xt,!0)),0)var Nt,Ot,dt,Zt;return function(){He.removeEventListener("pointerdown",Be,!0),He.removeEventListener("mousedown",xt,!0),He.removeEventListener("contextmenu",xt,!0),mt&&(mt.removeEventListener("mousedown",xt,!0),mt.removeEventListener("contextmenu",xt,!0))}}},[Ie,ne,Fe,Ve,qe]);function We(){Se.current=!0}return We}var Ke=["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 Gt(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ee.Z,Ie=x.forwardRef(function(ne,Fe){var Ve=ne.prefixCls,qe=Ve===void 0?"rc-trigger-popup":Ve,K=ne.children,ae=ne.action,me=ae===void 0?"hover":ae,Se=ne.showAction,We=ne.hideAction,Be=ne.popupVisible,xt=ne.defaultPopupVisible,He=ne.onPopupVisibleChange,mt=ne.afterPopupVisibleChange,Nt=ne.mouseEnterDelay,Ot=ne.mouseLeaveDelay,dt=Ot===void 0?.1:Ot,Zt=ne.focusDelay,Mt=ne.blurDelay,ni=ne.mask,Yt=ne.maskClosable,St=Yt===void 0?!0:Yt,Ni=ne.getPopupContainer,De=ne.forceRender,ke=ne.autoDestroy,je=ne.destroyPopupOnHide,si=ne.popup,Xe=ne.popupClassName,Qe=ne.popupStyle,pt=ne.popupPlacement,Bt=ne.builtinPlacements,rt=Bt===void 0?{}:Bt,Ye=ne.popupAlign,$e=ne.zIndex,At=ne.stretch,ot=ne.getPopupClassNameFromAlign,ji=ne.fresh,ti=ne.alignPoint,_t=ne.onPopupClick,lt=ne.onPopupAlign,oi=ne.arrow,Fi=ne.popupMotion,an=ne.maskMotion,Li=ne.popupTransitionName,bi=ne.popupAnimation,pi=ne.maskTransitionName,Bi=ne.maskAnimation,zi=ne.className,Di=ne.getTriggerDOMNode,Gi=(0,ye.Z)(ne,Ke),Ai=ke||je||!1,_n=x.useState(!1),Ki=(0,J.Z)(_n,2),Ui=Ki[0],Zi=Ki[1];(0,y.Z)(function(){Zi((0,m.Z)())},[]);var sn=x.useRef({}),Ci=x.useContext(we),Tn=x.useMemo(function(){return{registerSubPopup:function(Et,_i){sn.current[Et]=_i,Ci==null||Ci.registerSubPopup(Et,_i)}}},[Ci]),jt=(0,b.Z)(),ki=x.useState(null),Jt=(0,J.Z)(ki,2),$i=Jt[0],Ji=Jt[1],kt=x.useRef(null),fn=(0,$.Z)(function(nt){kt.current=nt,(0,Y.Sh)(nt)&&$i!==nt&&Ji(nt),Ci==null||Ci.registerSubPopup(jt,nt)}),Vi=x.useState(null),yt=(0,J.Z)(Vi,2),Ut=yt[0],Z=yt[1],de=x.useRef(null),Te=(0,$.Z)(function(nt){(0,Y.Sh)(nt)&&Ut!==nt&&(Z(nt),de.current=nt)}),_e=x.Children.only(K),Re=(_e==null?void 0:_e.props)||{},Le={},Ge=(0,$.Z)(function(nt){var Et,_i,Oi=Ut;return(Oi==null?void 0:Oi.contains(nt))||((Et=(0,l.A)(Oi))===null||Et===void 0?void 0:Et.host)===nt||nt===Oi||($i==null?void 0:$i.contains(nt))||((_i=(0,l.A)($i))===null||_i===void 0?void 0:_i.host)===nt||nt===$i||Object.values(sn.current).some(function(Si){return(Si==null?void 0:Si.contains(nt))||nt===Si})}),it=O(qe,Fi,bi,Li),re=O(qe,an,Bi,pi),Je=x.useState(xt||!1),It=(0,J.Z)(Je,2),ct=It[0],at=It[1],Lt=Be!=null?Be:ct,Vt=(0,$.Z)(function(nt){Be===void 0&&at(nt)});(0,y.Z)(function(){at(Be||!1)},[Be]);var Tt=x.useRef(Lt);Tt.current=Lt;var gt=x.useRef([]);gt.current=[];var Qt=(0,$.Z)(function(nt){var Et;Vt(nt),((Et=gt.current[gt.current.length-1])!==null&&Et!==void 0?Et:Lt)!==nt&&(gt.current.push(nt),He==null||He(nt))}),ui=x.useRef(),zt=function(){clearTimeout(ui.current)},Ft=function(Et){var _i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;zt(),_i===0?Qt(Et):ui.current=setTimeout(function(){Qt(Et)},_i*1e3)};x.useEffect(function(){return zt},[]);var ci=x.useState(!1),Wt=(0,J.Z)(ci,2),li=Wt[0],ii=Wt[1];(0,y.Z)(function(nt){(!nt||Lt)&&ii(!0)},[Lt]);var Xt=x.useState(null),Xi=(0,J.Z)(Xt,2),Ei=Xi[0],Ht=Xi[1],Wi=x.useState(null),Pi=(0,J.Z)(Wi,2),xi=Pi[0],en=Pi[1],vi=function(Et){en([Et.clientX,Et.clientY])},on=ze(Lt,$i,ti&&xi!==null?xi:Ut,pt,rt,Ye,lt),hi=(0,J.Z)(on,11),dn=hi[0],kn=hi[1],ln=hi[2],Ln=hi[3],An=hi[4],Hi=hi[5],rn=hi[6],pn=hi[7],wn=hi[8],vn=hi[9],ri=hi[10],un=et(Ui,me,Se,We),cn=(0,J.Z)(un,2),tn=cn[0],qi=cn[1],vt=tn.has("click"),Pn=qi.has("click")||qi.has("contextMenu"),yn=(0,$.Z)(function(){li||ri()}),Kn=function(){Tt.current&&ti&&Pn&&Ft(!1)};Rt(Lt,Ut,$i,yn,Kn),(0,y.Z)(function(){yn()},[xi,pt]),(0,y.Z)(function(){Lt&&!(rt!=null&&rt[pt])&&yn()},[JSON.stringify(Ye)]);var On=x.useMemo(function(){var nt=L(rt,qe,vn,ti);return p()(nt,ot==null?void 0:ot(vn))},[vn,ot,rt,qe,ti]);x.useImperativeHandle(Fe,function(){return{nativeElement:de.current,popupElement:kt.current,forceAlign:yn}});var Xn=x.useState(0),Mn=(0,J.Z)(Xn,2),qn=Mn[0],mi=Mn[1],Vn=x.useState(0),En=(0,J.Z)(Vn,2),as=En[0],Jn=En[1],Wn=function(){if(At&&Ut){var Et=Ut.getBoundingClientRect();mi(Et.width),Jn(Et.height)}},es=function(){Wn(),yn()},bn=function(Et){ii(!1),ri(),mt==null||mt(Et)},xn=function(){return new Promise(function(Et){Wn(),Ht(function(){return Et})})};(0,y.Z)(function(){Ei&&(ri(),Ei(),Ht(null))},[Ei]);function Yi(nt,Et,_i,Oi){Le[nt]=function(Si){var ls;Oi==null||Oi(Si),Ft(Et,_i);for(var zn=arguments.length,gn=new Array(zn>1?zn-1:0),fs=1;fs<zn;fs++)gn[fs-1]=arguments[fs];(ls=Re[nt])===null||ls===void 0||ls.call.apply(ls,[Re,Si].concat(gn))}}(vt||Pn)&&(Le.onClick=function(nt){var Et;Tt.current&&Pn?Ft(!1):!Tt.current&&vt&&(vi(nt),Ft(!0));for(var _i=arguments.length,Oi=new Array(_i>1?_i-1:0),Si=1;Si<_i;Si++)Oi[Si-1]=arguments[Si];(Et=Re.onClick)===null||Et===void 0||Et.call.apply(Et,[Re,nt].concat(Oi))});var Rn=bt(Lt,Pn,Ut,$i,ni,St,Ge,Ft),nn=tn.has("hover"),Nn=qi.has("hover"),wi,Ri;nn&&(Yi("onMouseEnter",!0,Nt,function(nt){vi(nt)}),Yi("onPointerEnter",!0,Nt,function(nt){vi(nt)}),wi=function(Et){(Lt||li)&&$i!==null&&$i!==void 0&&$i.contains(Et.target)&&Ft(!0,Nt)},ti&&(Le.onMouseMove=function(nt){var Et;(Et=Re.onMouseMove)===null||Et===void 0||Et.call(Re,nt)})),Nn&&(Yi("onMouseLeave",!1,dt),Yi("onPointerLeave",!1,dt),Ri=function(){Ft(!1,dt)}),tn.has("focus")&&Yi("onFocus",!0,Zt),qi.has("focus")&&Yi("onBlur",!1,Mt),tn.has("contextMenu")&&(Le.onContextMenu=function(nt){var Et;Tt.current&&qi.has("contextMenu")?Ft(!1):(vi(nt),Ft(!0)),nt.preventDefault();for(var _i=arguments.length,Oi=new Array(_i>1?_i-1:0),Si=1;Si<_i;Si++)Oi[Si-1]=arguments[Si];(Et=Re.onContextMenu)===null||Et===void 0||Et.call.apply(Et,[Re,nt].concat(Oi))}),zi&&(Le.className=p()(Re.className,zi));var Kt=(0,z.Z)((0,z.Z)({},Re),Le),Qi={},Hn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Hn.forEach(function(nt){Gi[nt]&&(Qi[nt]=function(){for(var Et,_i=arguments.length,Oi=new Array(_i),Si=0;Si<_i;Si++)Oi[Si]=arguments[Si];(Et=Kt[nt])===null||Et===void 0||Et.call.apply(Et,[Kt].concat(Oi)),Gi[nt].apply(Gi,Oi)})});var ts=x.cloneElement(_e,(0,z.Z)((0,z.Z)({},Kt),Qi)),os={x:Hi,y:rn},jn=oi?(0,z.Z)({},oi!==!0?oi:{}):null;return x.createElement(x.Fragment,null,x.createElement(ie.Z,{disabled:!Lt,ref:Te,onResize:es},x.createElement(X,{getTriggerDOMNode:Di},ts)),x.createElement(we.Provider,{value:Tn},x.createElement(q,{portal:ce,ref:fn,prefixCls:qe,popup:si,className:p()(Xe,On),style:Qe,target:Ut,onMouseEnter:wi,onMouseLeave:Ri,onPointerEnter:wi,zIndex:$e,open:Lt,keepDom:li,fresh:ji,onClick:_t,onPointerDownCapture:Rn,mask:ni,motion:it,maskMotion:re,onVisibleChanged:bn,onPrepare:xn,forceRender:De,autoDestroy:Ai,getPopupContainer:Ni,align:vn,arrow:jn,arrowPos:os,ready:dn,offsetX:kn,offsetY:ln,offsetR:Ln,offsetB:An,onAlign:yn,stretch:At,targetWidth:qn/pn,targetHeight:as/wn})))});return Ie}var ai=Gt(ee.Z)},80109:function(Dt,Me,G){"use strict";G.r(Me),G.d(Me,{default:function(){return Ni}});var z=G(51257),J=G(25399),ye=G(96599),ee=G(60242),M=G(37285),p=G(29787),ie=G(91882),Y=G(82326),l=G(45685),$=G(62957),b=G(59301),y=G(25690),m=G(90356),x=G(45937),S=G(36714),P=G(40463),C=Object.defineProperty,k=Object.defineProperties,R=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,q=(De,ke,je)=>ke in De?C(De,ke,{enumerable:!0,configurable:!0,writable:!0,value:je}):De[ke]=je,te=(De,ke)=>{for(var je in ke||(ke={}))F.call(ke,je)&&q(De,je,ke[je]);if(I)for(var je of I(ke))j.call(ke,je)&&q(De,je,ke[je]);return De},X=(De,ke)=>k(De,R(ke)),ge=(De,ke,je)=>new Promise((si,Xe)=>{var Qe=rt=>{try{Bt(je.next(rt))}catch(Ye){Xe(Ye)}},pt=rt=>{try{Bt(je.throw(rt))}catch(Ye){Xe(Ye)}},Bt=rt=>rt.done?si(rt.value):Promise.resolve(rt.value).then(Qe,pt);Bt((je=je.apply(De,ke)).next())});const we=[{name:"\u6839\u8282\u70B9",src:"/images/one.svg",color:"#CC7CF5"},{name:"\u8BFE\u7A0B",src:"/images/kc.svg",color:"#3241F7"},{name:"\u7AE0\u8282",src:"/images/zj.svg",color:"#5e54e7"},{name:"\u77E5\u8BC6\u70B9",src:"/images/zsd.svg",color:"#FFDF55"},{name:"\u5B9E\u8BAD",src:"/images/sx.svg",color:"#4E9DFF"},{name:"\u4F5C\u4E1A",src:"/images/zy.svg",color:"#445DF3"},{name:"\u89C6\u9891",src:"/images/sp.svg",color:"#6BC4DE"},{name:"\u8BFE\u4EF6",src:"/images/fj.svg",color:"#6BDE73"},{name:"\u8BD5\u5377",src:"/images/sj.svg",color:"#2D9534"},{name:"\u5176\u4ED6",src:"/images/qt.svg",color:"#2D947C"}],Ee=(De,ke)=>{const je={};let si=null;return De.forEach(Xe=>{je[Xe.properties.uuid]=X(te({},Xe),{id:Xe.properties.uuid,children:[]})}),ke.forEach(Xe=>{const Qe=je[Xe.startNodeUuid],pt=je[Xe.endNodeUuid];Qe&&(Qe.id=Qe.properties.uuid),Qe&&pt&&Qe.children.push(pt)}),De.forEach(Xe=>{!ke.some(pt=>pt.endNodeUuid===Xe.properties.uuid)&&(si=je[Xe.properties.uuid])}),si},et=(De,ke)=>{const je=De.getParentData(ke.id,"tree");return je?ke.style.x>je.style.x?"right":"left":"center"};var w=({loading:De,nodes:ke=[],relationships:je=[]})=>{const si=(0,b.useRef)(null),Xe=(0,b.useRef)(),Qe=(0,b.useRef)(0);(0,b.useEffect)(()=>{(ke==null?void 0:ke.length)>0&&pt()},[]);const pt=()=>ge(void 0,null,function*(){var rt,Ye,$e;const At=Ee(ke==null?void 0:ke.map((_t,lt)=>{var oi,Fi,an,Li,bi;return X(te({},_t),{key:lt,title:(oi=_t==null?void 0:_t.properties)==null?void 0:oi.name,newcolor:parseInt((Fi=_t==null?void 0:_t.properties)==null?void 0:Fi.color)===1?"#CC7CF5":((an=we==null?void 0:we.find(pi=>{var Bi;return(pi==null?void 0:pi.name)===((Bi=_t==null?void 0:_t.properties)==null?void 0:Bi.nodeType)}))==null?void 0:an.color)||"#2D947C",colornodeType:parseInt((Li=_t==null?void 0:_t.properties)==null?void 0:Li.color)===1?"\u6839\u8282\u70B9":((bi=we==null?void 0:we.find(pi=>{var Bi;return(pi==null?void 0:pi.name)===((Bi=_t==null?void 0:_t.properties)==null?void 0:Bi.nodeType)}))==null?void 0:bi.name)||"\u5176\u4ED6"})}),je==null?void 0:je.filter(_t=>_t.type==="\u5305\u542B"));Xe!=null&&Xe.current&&((rt=Xe==null?void 0:Xe.current)==null||rt.destroy());const ot=(0,P.RN)(At),ji=(Ye=ot.nodes)==null?void 0:Ye.filter((_t,lt,oi)=>lt===oi.findIndex(Fi=>Fi.id===_t.id)),ti=($e=ot.edges)==null?void 0:$e.filter((_t,lt,oi)=>lt===oi.findIndex(Fi=>Fi.source===_t.source&&Fi.target===_t.target));Bt({nodes:ji,edges:ti})}),Bt=rt=>{var Ye,$e;Xe.current=null,Xe.current=new P.kJ({container:si.current,autoResize:!0,autoFit:{type:((Ye=rt==null?void 0:rt.nodes)==null?void 0:Ye.length)>20?"view":"center",options:{direction:"both",when:"always"}},animation:!((($e=rt==null?void 0:rt.nodes)==null?void 0:$e.length)>300),data:rt,node:{style:{labelText:At=>At.title,labelFill:"#333333",fill:At=>At.newcolor,labelBackground:!1,labelPlacement:function(At){const ot=et(this,At);return ot==="center"?"right":ot},ports:[{placement:"right"},{placement:"left"}]},animation:{enter:!1}},edge:{type:"cubic-horizontal",animation:{enter:!1}},layout:{type:"mindmap",direction:"H",getHeight:()=>32,getWidth:()=>32,getVGap:()=>4,getHGap:()=>80,getSide:At=>(Qe.current++,Qe.current%2==0?"left":"right")},behaviors:["zoom-canvas","collapse-expand","drag-canvas"]}),Xe.current.render()};return b.createElement("div",{style:{height:"100%"}},b.createElement(p.Z,{spinning:De,className:"mt60 w100",tip:"\u52A0\u8F7D\u4E2D..."}),b.createElement("div",{style:{height:"100%"},ref:si}))},L=G(9148),O=G(38986),H=G(346),N=G(45677),_={NextAbility:"NextAbility___wLOPq",AnchorDomStyle:"AnchorDomStyle___CG1xj",AnchorDom:"AnchorDom___jjRxi"},g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA1lJREFUWEfFl09oXFUUxn/nvTEpbXXRos4bgwgGRYtZCIILhQSFtgEjgnShCNJV05pMqQstpV1UjW6seY1pFERB6EYEJVJbRMmALgqCixTFlgoupjOjUhdNo0068z65w0ycmcxMJmbk3e39zne+d/69c40Oz45P1PPnbwxZxEgkHjQjJUg5c4OcRM4zfpLH7LY7mftxjy13Qm1rge6ZVnK5yLEInkfctha+fG9c8+B0T4Ljvx6wQjublgL6T6r3L3EkEoeALR05Xg1a9IwTm403Lo/bUjOOpgLcV98o8hni0f/ouN7MOL8pwTPNorFKQN+kBkrGGYm+rjivkJiR9T2Gs2N2oZa3ToD78qUi33fbedWhE9Gb4JHaSKwIcDm/LjJdC3ur8BnntxqD1ZpYEZAKdTwSR7sZ9lZcnvFaLm3HKi0M5aK7yeUNVPt6dS9uuoV+l4pyBFKhTkVidL0sG8F7xkwubfvNTbiref7oeMhsxGt9+V/bHnC7BVPaqRLnusW7Hh7z2WWpUNOR2N/W0Jj3jBcRd0fi8zqsMW/iKYzDEvs8n6cxslGJjxAD7Xg945QlJzUHDLbuGj72U+zL7rG/g0k9Jvi2FpvwGcqOWSYI9abEqwaP5w/ad6n3tVk3eE/ihTYiMhaEuihx3yqQIYwDhXGbcXfJk3qWiA+BW1ewxheFtI3cO6M7FpfKXeTuFvDYWxi3Tyt2o4jpMlvDMeOSJUMtILY2EfBNIW1PDs4pcfECbyni5QZM0fN5KDdmPwehZlz462rMOHH/AK9khqyYDPU14okmPq63FGDGuXzadt/1rrZHRU4LdtYSVNsomNYDusk8kGgQ8JXn89yVl+xqEOqsxK4mqVhonQIo4jNSGLOzkiwIOWQwIehxYd7SS/8vo/Z7MtQsrggrx2BZxpH8OG+bmZJT2k2J2UaB5SlYTkG7IjRk8M62gMNuw0mGGkacMXg9f9CO9k1psFjCFfG/x2fYiS5vUAUm5PaJJvmvGGRcG645BQ1+8Dz2lowUJb40mJTHBMLltr7VfIY9UVDEB4KH12zD2AdR7KPYhaiTNKxnxHaCXfkZOXDsv+NKFOJbSJyA2FeyaipiW0qrhRPrWl4VEevDpCoi1qdZbR/H9jhtHCb/1/P8H/hZr0qiHgOCAAAAAElFTkSuQmCC",D="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA/1JREFUWEe1l19oW2UYxp/nNMmWdO1cZmcSW3TYKWwKoh3MmdBVUOmEDSeINvNGGEwRLwRR0Y12FHF44c2qTvEuCaNCRS+KiJiQP512eOFFB3XzX7FNXVnLlrRL8+e8ck6XmS45OUc9O5fnfO/7/L7n/b7vvB9h8dk1OuVaLF3po1QOqMBOEgGBBLRwgnMimFOA88KWr7zOzfGpZ3cVraSm2aC7Ryd9xVLxuCoSBqTdbPzad14lJeba6DnxxzM92WYxhgDd4xc2rCxl31YFrwFotSZcN2qZ5AetW3zDF/fvWG2UoyGANutCcfULQPb8R+GbwvjDBrf76UZu1AF0RiYeqKA8LkCnPeLXiwLOKg48Nftc6KfavOsAtJmvFgvn7BavChKcdbndu2uduAGg1Ty/OJ+wz3YD/4jJjYGu3t/7thfWdtD1JxBNnlAFx+y03SgXyeFsOKRr6QBri65w0Wi1EyiAvGaUUASbAVGswhNccbnd3VopdIBANP2hKupLBtuk0N6mbJs+GMwZCfijqXEAPSLS8S8gTmcPh45SO+EuFxcXjA4ZkkvZcMjbLLE/kvrY4VBOlSvqd9YhmNvq8t5Of3TiSZHy103qZQ4QTUYgzAO4SyiPQ9BixQkq7GcgkhpRIS//H4DaWF8kqR29PisACpWP6Iuk4oDsu0UAywQ+BRkUkZ56DSboj6amReReKwAyiV4Qz9eNJcbYg2+09zccIPIk+7MDoXTgzNmH1HLpx5vjSP5MXzSZg2CTFQArtuoAxKaquA4VTb0HkTcagOe1ElwFpM0OgEER5XQ0dQkKD2cHQvrC9kfSbwnUdxvnZ862Egw9LN9+EsucEshZCPo7OtqPLCzkXjUW1xuZaVsWoTZzXZwS02reOTrRXSlVPheRB5uWjYzbsg190fSxFiA9Gw7GzW2vQSJHbDmIfJHUZ0fDwSODpNq85uv9UBTlCVuOYl8sdZICHwTXBHgREKfpjiGu3Hmfp8P8Z0SsOkH/TDi0ZJRUWwOJBJRf59JtJcGfAvGYA3BkPhx6xdLvGESZgrJZUiEcEDjMxoHIu+nq/m1gz1//NCSR9JAK9bhpsB0DyMH5cGhIS7W+JVvKxiF4xA6NJgdbxuv0Pla9uKxrSrfHvr+jIMVzIui6FRAEZzweZfcvhx69VM1f15Z3ncncX65Uxu2G0MSdCvfPDASnaifX8GKiO6EWxwTYa4cTJDMet3KoduaGDlQ/6K1a+fKbELze7G/ZHJA5kO9vdW45aXRZNb2c3jOW2ba8Iu8Q6gsC3GbFEa2PFGGk1cPhRrM2LUEjkX1xcVyYT/WqKg8A2CmAn4B+PRdgjoDWip1XqHy5w783meij6bmhxf4NftTdgSGLQUwAAAAASUVORK5CYII=",V="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAsVJREFUWEfFl0tIVGEUx39nZsxoKpGISlqmC42gxwxCEApBUhC0iR7bMLRyhrZRC6Ntecc0CtoVRRshkbKN0iJ0RmtRBj0WLUKLoEAz0po5cWe4zdWZO/czJuauzz3n9/3P6/sE02/qwSp+fm5FM4dRbUSlDqEu+7syjeg0Iq+RwENWbxqh6eiiiWvxNZrq28z870vASdD1vvZZA5kF7hIOddN05lOpf7wB3iWq+aYXED2PEjYLvMxKmEflKrVyhfquhWI+igPkTj0A2vxPgQt+kjHCoSPF1CgEmOzZQVqGQLeWJ7jjRT4SCBxkz7mXbr9LAXInT5U/uAsiHIq4lcgD5HI+Wj7ZvfSTMWqlxamJPEDS6ga9WF7ZPSEuE43ZnUUOwJb+x6/3ntUujBOqPsbOjg+egBNWK6qDRh1jd8eaqm12KnIASasftMPTuXCKSPy2rzrPr+8jnR5Cda2vLXKDaKxTsCfc/MyXkkNGAieIdN3zdwqkevei6UfAutL2Mkt4y0ZhsvcA6fTjksYrAbAdTSaaSeuw7+QMBtuECauPjHaWFcB2lkrE0cy1kn4D0i+kekZQWsoOMJHoIJPpL+2XUSFpvQFtMAZIWneA7Xl7HSQaL2xfEwDkrZCy5nyr1l0DKasdJT+mg7xgd2yg4AAmACLfVw4wcbMGqCqqWM3CIvVd9ioGEwCYM0yBHCcSu591nLLGUY16pGyYaLzNHCCbApMidAMkdqIUv5gE5OvfbWeigNhFaNSGSwD2o7KhqAIhmWHX2afGCmTb0GgQuQCSPc+ASFEAkSdEYoeMAbKDyGgUuwCM5rFJETqj2GgZyWkisVumsXPF6jcJnWVkG/uuY3lFMNhOpsp7HbvpMgsNoPaGbSyequXrOKdCBS8kNkDFr2ROKip2KXWSVdFruQNR0YeJA1HRp5m7dyr2OF3ewP/pef4HW7pxo3nDj9QAAAAASUVORK5CYII=",pe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA75JREFUWEe1l19sU2UYxn9v2dwGzmSoEZJtRhY1StAQtN2YkEUiYOL/C6LhQtPWLQwXwXAlRKsXcjMUJQzFrUaCesGFjptBREJ0iXQmXOGCIQKJZDH4Z2Jm6UZ7HnNqCx30z2ktJ2lz8p3ned7ne8/7ft/5DI9Xb5dunonzJLDSgWVAi0GTjGlgIvM76RPDzXP5NnLMkl6krRSoe7naUileF7yAaCiFd5+bMYn4pL6Rd3Z/Y38U4xQ0EInId/4QbzhiG2KOl8DXYgwu4mP7mhb61x2wVD6NvAb6Vuj2+AyfSTxWSeDrOMaRulrW7Rm1yTwmZw+FOrQUh4MSzVUJnhUxTtfVsnbPqJ3J1Z2Vge4u3ZaMc8ItsKoGv2riVE0j7XuP2MWrQ5k7953/MsKIxOobEjwjanBozZ08ka2JKxkItyviOLx5I4NntX3GK4Mx253uGPfPbbVkip8qrfayTRsX6htoGzhmU2kDoYCGJIJehAx+NzgsuF+w1AunACYSHbO3zF3hEpe44GWRMWPKxAODY3Y2bdyvZ4B+QVu5Rsw4OxSzRRYK6HmJLzwKHI6O2dpcbN/jqotPsgmxVaLRo04a5jMedA18KNHjkfhldMyey4ft7dKC6Utsl3gxW1ulNH0+tlnQrzHg4VLgzPOCBrL8YKce4jLvA8tLaZqx383ArxJ3lAJ7NXDFSLtew2FHUV3jqIX8Sgjqqm0g013jEvcV1DZOWTCguJcOKDcDLj7o18/AokIGDH50MzAhWFjNDLid8c+f7EBsLKZrxtduDYxKdFbLwMsdejaVor/YzLOxDD61sF8fOND3fw10d2hJ0mEn4lGPWu46sMXCAT3tiK88kYyj0ZitysVuXKVbE1O8Legpdy+pNe6xzPtyl+JbSpowEjVG597jdiLSpZrzCXolIhJNJbnXAozxaMwWpzejYEDvITZ5EjESBj9I3A0s8MTJA/IZmwdjtvO/7XiFFiZnOIOor1SwLJ5xrrWVeyMHbCb3g2SD4zBQllCFYJvD+qHv7XOXPuubMOzXfgfWV6jrjWbsi8bM3bDS1ywDW1Zr3uRfxASLvamVhzLj+Nz5dO0aMfc0db0BdyTs112OMYxYUp58cXQ6+E08tes7+y0XmfdgsrlDDX87DEi8VBUTxr558+nOnXnBDOQGDPsVcox3Pa0R+Zwa58zH1mzB5YeUmOKGR9R0OcmrEiHPpyVj3AcfN7cy4LZasRAlT8dZsiTraaczKVaasUyixYwmxDTGBGIC42QNDH8Us9NeX92/T9xk1NzUiXsAAAAASUVORK5CYII=",Ae="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAYCAYAAADpnJ2CAAAAAXNSR0IArs4c6QAAAu5JREFUSEvlll1IU2EYx//PcW6JSuRFBRVB1I2Qtk3dh1JSXiVRF1bQXaFUBJ5tFFGCLLywTbTtUAwREoIKvIgI+iAqL3Jf0jYUpKsIiogkAsv8aOs8dWyT09zcZnrVe/m+/+f/4/2/7/ucQyhg1I+4ymeLdK0AtQHYQkT3E0LCPVbnmMjXhvIR1o72bvuZ0LSDuA2g9Wk1TIwHMsuuWL09mMtvWeAev6dWEMgBoAWAJpcZGC8Bdkct4kMQcSb9UiA7BUOo4gjAdgANOSEZBMQ0IUN2C9qSu5Ga03G1ZBFYNdZTWjSjPUUMGwg7VgJaWkPvwehLlM4PjFdf+K6sU+OwU/NVV2EH8SUAG1YHtMTlM5jcpNV5yBjwnmDC7TUCpds6qXL4RlmJLjHItHAx1nDw47m54mOLZ2gMS80sczeA3atIjYPxFIRmInRGzGLX37eUmYxBbwsTdQCo/gfwPAM3hQRflYuFMmKeyAxUEWpC3oMyQ7lIhTyNWQYPyCy7x6yOD4qdPiRV5gVMsfcEvFaBcB7AYQBCll3PMMinJbknbLZ9UmvyBur917fHrOfepTqGIdC3E6QRAT4JoDRpOkuALy5rXeP1ZyfBTPqwdJyYy6MW24CiMYQkM5iDOSM1Br0+APuZIJUk5m75Gy5+UwwahwfXTWmn6gTCJi3k50Gr48tCdEGpiQAXwAYmdMfM4uUqv2+jRvgxAmAXAW/lOJmy9lIFyMCZ5E6mwbhDJPdHLPaoOjJj8JqBIbgANKXmU0BjyNPATC8AFP9ulVMyUW2+QDXjNUAjAE8riQHYl36uKaAybwx6WxnoFwiHXpnFRysB5nwtauAfqMcUsdjCC700W3VapDkhakE6UL32PwMDUicTXykoy6SYQGLE0i5lqs0a6dGhoaI3Wz/2giAWAGUm7oqZRGf+vxhp7vqA9wAJ6ARj73JgBkYB6ohZ2p8tp8vrr00xSPZU5ZtpAmMzEbQMmgQQAfO9qFV8kk8SvwBkMTigdig/4QAAAABJRU5ErkJggg==",Ce="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAABBRJREFUSEu1ln1MVXUYx7/fc87FQbRaL7PwZZZRDQTOhRxj1mLZqFz9Q8tVWyb34tVirbmsVpvOWfOPXNqGJl7kMvSfbNnLHyWbWfSuw+s95zIYTd0QFGvZ1gvG4J7ze+pc4h0uBLff38/z/Tx7fs8bMctnbuzI1RJOuRCLoSQHhAOyi1Rd4vraYo35HWOlSkLnr3PdvvUUVAJSBGAQwheZilcS6s1S7pUXIGqdCPJS2RJoJbV6QcanwOAmgWyGSPZYH4I90wLNoP0sRXaKIGeWSZjKrEWjvp8Gom7CPQfy50nAkpD4XCe+DyIb5gECyFO3XpN1/7Ha3IHiQNtaJe4RAC3jgB5MOfHPROTBecH+dSb4xS3ZWWsuX716AoJV0FgzDmgGrAMQhNIBG9EgvkvCyD8zaSwbAfqD1jOicCitsDFipPZGLFK4LQks29yT2f/br2cBLPp/gBTd51sUDeddTgKLA/bLSuStNMMugTQgsjCpq3G91VDUlAT6q+y4QArSBSTh6DTKHbhlULLL0yV4MtZYVMaVgfjtCVHn0wVLihNbYhHz7ZJQ+1I3kbgwrG2Qd9MftAKi0JA2IPGRFTErt28X7eNu+xgEFcPaGvVK+gPWVhHsSAuQ/FE3skuj4eW/+6vsnQJ5bdxoI16iP2DvF5FN8waSF3XDWBUN53cXV1uVysXRiZoE9tIMWHshqJkPkMQVzdDui4YLO0tCdrHroAUi104CknU0g/aW4UqaE5Tsg64/YNWvaL0nYN/lQr4Rwc1TaZHY5qX0cRH5YK4wQ9MeO32woMWrSJVwvhXIkum0qCFILypHpPO/Ar00AvojsUjB6dLqtoUDSn0NkTtT6fioLU82vhmwT0KkdLZQb5FqPlYM/Vn7Utdxjs8EI9gWaywqHAIG7WooqZ8NkGCnkalVtL5b0JP8M8HxVGkc7UG+ciZStCsJLK22Fw+40jMTkOCHGdlZVadqc//wqlE50jxdgUzQupR5/Y25P+xZ0j80SwPxHSJq67Sf7R1MwKuxiLnbs0n2mWLTxJslRbGsizWYh5NjryzYfkO/OF1e35A8ISKrJ0YHQ19r1Rd8742rTy7E35w4QVJmhghbEXPjsI3Xh89DyT6SX93xcOHqc83xwyLy1IgB8QuA3QsyFrw3MDBYJ5CHZkr9qC8/14zCNdEwE6PAKuvLf46bck3Hk2cOmkeeeF/0s81xb1LcO1vhKe3Iet0orBkLS6bUDNg/eUuS8OWTaoUS9zkvgLnCSPQK+bq3bKecNv4qu3tSWZN9BPcAGXWUwUcFEhJISaogSHSA2iFNv6k2Gs75a9oCMoPxpynqHQAZAG0Ijmq+7CZvxYx1WrmhPd91Vb5QboPIMggMaOyl4KLyGS3WgTzvJprx/Q3wmMIl7X6GaAAAAABJRU5ErkJggg==",Ne="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAstJREFUSEu9lk1oE1EQx2de06xNxaNSxS+wYltMNi0iBXsSBE/tQawnIZugXtpKUS9VCGgvFgKxF9EkRfHQFA/tSRC9qKAFm2SDKdoKSgVrPUqamK8deSFbt+km2bTb7imZN/v/vbdvvhA0j9MlTzKGk3NB+7TWrv3dfe3Lgb/Z9EsiIMRd56KhEz8r+erZUTU63fJZUugVIH5raba1vRhvzei9IEqxMBBc5GsIGI5OOC7VDSzBAgBwpCiE+JxZGgfnHrUva8U6PXKPUqA3WlsDQs9cSHxnFIr8MxJQ/4YXEJOMkScSEMN8zeslNr0U/whETq0vAkZ6D9tPeb2oGIFilzveVyDyAdHRMqEZQbBe//Cw7Tu3i27ZAwo91r0XRE805AgaAnKn8wOLwq/V1DMiusD/M2zoj4ROTqkCpwcW92SSqUUA2qsrirgiNNuOz463/qkFXQuarivzLYV8bgEJXkcnHH3r7s4ljylAN6qKIY7FQo5bhoHcsdMT67dahFn1MxZt7sQxRcknAMhaXQyzjFk6IsGOr9X81k6o58RhRPmnRNRda+el6H6PaLlcDaoLLN7Zauo2EAzVPln5VjALCH6h2XZP707XAXnozyzFXQQwCkT7jJyqog/iCgKM9B6yT2hT5n/QSLEzCqGfgDq3BCp7mecpQxpSiwM6pc/7gTI+3eQ3kczLIKAwjKIr9gkAOkzUriaVQKcUSxBB+44BebtJZ9M+tQNsGxhhqsnaNLwWNMVOoIC/vDhveQOIUcZgKBJwvC3mqlaw2BF+xCVQYLRi3TS8A/wNDEb6DtpDummh1eGJn0um7igAg5tJfAbwoHG37W7NxC/fvHh1vhVzuSfbXtrWdYqdLN4qWJTk+0B00/T2VEmwVMwXKtbXzTTgWsHnlGQ3EfFBa8OD9Y4YtWB83bQhyghM9TFlTKwHyH1NGYTrgW511P8HVz1GsEaaZFwAAAAASUVORK5CYII=",ze="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAYAAAB2+A+pAAAAAXNSR0IArs4c6QAAB/FJREFUSEuVV1uInVcV/vblv51z5nIyk2ScZJI0GfCCYttJAjYv+iS+2BfxoVoFNUwKxQsK5tLWiTH44A2hD+1QUExRtNUmTdpYseiLIqKGChVJ0lwmaZO5ZObMnPv5915L1v7PxKTSgjMc/nP+/e/17bXWt9a3fnWcT21+P0+8ulNtfJ9iNg4ERvGn+lcNBVLwS9xYvsQLs4+Yjz0mS9/hV7fsckPPblcjeytIMmJSJAvBQLHbQCOCRoPz9mu9+eP7B6aOh9Vf0l/PbUH13lW00EIPPXgQh+23wQ0MYlhkiFFCjPM0/7t52z5wnxs/V0Iy1OYcHXbImUBc4CqWj4aFRqIiVFSCTEXuT7ww+Y3s/qvqZXqtt4RGtMB1rKGNDnL42z4X57ZskCJGmRNUkKKMBG24xZjsxhb30OQcbXLoEYW9AigmFBtEMCghQlWVMGYGMOfWDj86vPu76mf0Z3+ZF/WbWMEKt9AOwHd4zECECAnFKAs4MpQ4hmELSUuLcjQpR4c8euTBrMIHpKHFYzYY1ClGVRkTZggO/OxXqnseVt+nV/ILfMPO8QqWVRMdlmAzlEIwoEnBcoSYIyQcoYQECUXQbOCZ0SVC2zv0mOAZIJKNKoAq0ojYoqJSjOkKtpsqMp385ODI3i+ob9HJ7nm+GV/lW1hBC12Vg9fJQWLAQJEKHlqyIdeWIhjWIFZwxAHQExeesgb7IszCSIsoRGqTqmCnrWJYp888sWnffnWQn2+d9zeza2oFdW4HcgmL108sIRMPJG9Mushf/0CFZwIg94vwyvr6M7IOMsgQYVSXsd0MY9SUZo9u3jetvkm/alykxfIN1NBUnR96Vv+ySJQmUsJmeNlrOc+ZmfiDuaevCnPFMy2hRPS6UfGPYxI4IZNV8BrkNXvy8lyUIP76ECe7tkVDqOps9tjYvml1kJ5fu8yLA4uoo63zzwPmnEWqbK5V3C8px5ZzeO7m/sNdl58Q9or3FhYpR3+MsvhrpV7Jyx4LHQrYwbJjYupQFCv9ZEWlH9liKhg0SQF8mH5du0bLQ5JfyW2GBBVOEbOFYRPy1mMfmLtGXaxRD02fh/xKiVU4QRUlDKg01HkEG8Iuue+SR8t75MSBG5t1BWUdzR4bf2BaPUYvLL/Fy9U17krPejJC/I+EYhPDak1KkdbscuYuO9fk3t6mcwfkAEwqsHxIZRcqSL+X6ZgyJLJHGzLwmqjjmbqOIsX6SMxm64jJUDbJ7MzY3gC8dJNqI03kqJnO5Fn15Tdut623ffnk6onJju9cqFMeWCylNaDSX5ze+NmH3mmP3H947rcnU9gHN+gUqY5nj44LsH9hYYHqG5vckzCtZpwuDnJqSipRmpUigjCdVn3Pr1J3dMm1hiXcEkrpYFVd5hGULw+rjCs6MoFc0tiJucnkGy7XXe/vEYZXdSZtc3Zm655p9bg/eWOR6mMNzhGTxSBKGJbuhCTkWBgsfbhGXSz5JhZ8G2uuG2o34xgjqozNegAjOsOAFm6YUH45Mxo+x5qTzialIcCFxzNbp6bVE+7Um/NUH69TFw54yiI+N4DUxlBakZFezz1P1IF3Te93N113/+pt4ATDunRxQCU/kIOWlTWGrAa0dDXqefIt8gakDlk2W4pQJ7MzE/dNq8fdi3MLvj4h4aup3uTZdPodc/yJ2k93+R4uiieOpAIiDKjSz8+Mf/oz75bjz136/cmY7YOjNkOq7ezMRPD49JUFV9++Sl0YmJUE8UJFJTqhSIuySC57RNTyOa1yb9OK61TrXsilAvCQLvEGnV0c4oRTFekYUVHHDO56oqZ3uut5lyGtRmyKzMR9j3un31jwjZ0r1IFmMZYE0qQsFWkDe4s6dlhxHaz4bqhNuZ8gwrDKsEGXMKRSlJTUsQl1LLXb8YSGE7kErNIYtQlKJio8PtJ98cK8b0wuUTN4J1tTTpBIA4GBsDoXBRJwIYvPgyJ5AiKyoXEM6v5hgyQIsA7r3T54OKQxGIukju3s0Yk90+pI5/S/3/Rr7533jSDmskmkTP5FgaQ1ivxJm+x6jzYRemKVjTwRIiMdK4VIpxy1EA3pgjkhOKOVEuJhPC5jKEpmj4rHhztnXp9ztQ+85dYgjcERIZgMclgokbRNKavch9yBPIcDBVGQKYPF02KPCIcoW7En1HPwdtjE2BqXscGmT89smzqgDrbP/POaq33oqqthlXrBM/YqnFzaohgXfRUgqc9g0Mt9EXoD0z/AumavS6LoMXHhbaq0AGJbUsFIlD39bQE+1Hrp3Jyr3XvVrWLZt9Hujy/ibWGkr7HB+7vv/VeXi2lDfhd6LE1Ehi7Ra6BsIoxECXbEAlwqgI80z/5tztWmrrgabvWBRWtFU4MRAYP8FqPFVHHbuIw5d4l/EWYZEZllfJJngYoA2wT3pINyferott2PqEP1l59bpNanJNS3XAdt7wOTJdgSvnUgIVOYevuHCTnuR0SukpLg9fp4K0NbmKuBsrYYjTLsSCoo22T62MTUrHq0eWqcHE4u+Ob9t/K2kWnRSy4F/A7DMsRJzkOO7xjohExCxkAqqOBlmOn7HhuoEOpRm3aqUfybH+14IHS59ZcFfJT/YAfQCEPH0vX2+svE/3TCUq52K9InQHq7hv6LUupLa2nnUvHgVgDX+1f5fR2jZmfAmHrPVGdGFS8adwG/W699+9pDV175YsLmmYb3u5+b/Pjf/5+968/+B+0PhllE845BAAAAAElFTkSuQmCC",Ct="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAcCAYAAAAAwr0iAAAAAXNSR0IArs4c6QAABflJREFUSEu1V2tsFUUUPmdmdu+j997SQp9AEULCDxNDCCAEQoqC0R/8IRSIVqIYH7GAT2JMNKlEo4bSFowEEyXBBJUS/5AYRB4lijxU4iMSE5CWh214lL7uo3t356Ezu/e2hVsSkrrJ7s7snJ35zjnfOXMG4bbr8rkvdsVLZ9UzKxZVSiKABFA5IQS8/YcRfX8skFBBCxEQiRJuOj108/zOitlr3hg5xaj5Lvz6SV35lEX7vGwSBXdASQ6g/NVHLp1vB8CGJxkhZf7TfQQkDKgVBmpH5eClU/OrFzx7dlilEXAu/b5nbzgx+XHu9Iv0rb+35lcHAAL0TuWV/k7MDP4TjMGI7iilpG6bQbsmWjr9CRYuhmxf53uV8556qyCAjt8+PcCs+AqeHfBmzHnOvou172mo83BjbShxXzsLJ0AMDXxcteDpDQUBXDy782tCQiuFl/Zmzt80fgAONtbaicp2YheBctPbqxe98HJBABfObN9PWHiVEp43c/6GcQNw6dt3llqximOEhUC5mZbqJQ2vjgGgtY3SSB0CeNPnPj9uAC4feX+ZFS07jEhAeemW6iUbxwBwurWNWbE6goRPm7PeuidH30W463jTchop+05HlHQGm6trN71WmAOnW9uoFa8j1OI1s9eNG4Duo82P0Hj5IZAChJNqqa4dwwUXtQXsRB0hNp86u35cAbB4xSElBSgn2VI5FoCO0zvaqB373wCAlNoFdwFwckcbDWkOMD51zvi6gMXKD4GSIJzB5qraDYU50Hlq+z7CoqsRCa+Z+8y4uaDryIfLraJKQ0LlZporal8sDKDjZGsbEluHoUJkV6xwMbVCMYYsTAgyk4oRUYHSLy1lvvg7glJKCyiQgDoNC66Ul+XCSXGZHaRKyhpEBsCdbRVLG14vnIpPNO8DIKulyAKlIWChBLBQHCiLACHM31yQmFsp4QB3U3oiyiLFCtHSPjZaamSCg/SGQA4lQThJAOEBsghQ4E1lSzduHgPAtq+U4Gu4M2g2VSQhoFYEKLUBkQaLUwPGS/VsDcPQriFFQ4zFtrDwhFVm99QgDBAJimdBuo5ZXINnkWJtr6aK5S8VBtD5Y/OX0nXXeplekJ6TX5Bq7ZEC0SCIBmADYXbeKkpwUNwzC2kQqLdiA0SA4twoQ6wwsKJJQAlrKnu4YQwLtH9Qz73MYukMZBV3OAihzN4qEAljABKRUIqUWoQQi4CiqLdbCUKhEFIKLlFyBUIpCQAMpDEKYRQpK2IYTYSRhA9UPfrKNwVdMF6p917mGVVkXDzeNM9C9iZ3Bz3luVwKVxFjT2IKDZ/72gUEASlhWn9lAsA8wdc+iAi/REEFSJmNYEUYsaMWKviobFlD+x0WUOca7evigauKO+U80wfCy/h+1TGncqVWEAWgI8Fvm8ovYD9qw8vRJRzqmoky0LUAjZZoLvQk7MxkvH+1awDmkHT/vOdzFpnwpJu6ATzTD0qHkPD8ksqPd3MHevm1XmABnQm0EXwJkxN8Sf0OiEvtKNBIMbB4ua6K9pYsXFufB/DPiZ0LQqXTfnCT15mbvA5iqB+ENwQohFncLy19ILkElP+mx3IVcCBr/si3dTjrojQCNJIAligHK17BMXltYdHidb+Yea/9sf+C8tyZTv9V4MmbILJJP361BkYbP+vlQRj9RpbfowHm5InJjbpIpYA05AOITQKrZLIGdD42d8Us7P7psy0sMvFtp+8KuANdwFO9INy0yWSGfwGAPAvMpMMaBr1cQvbfhraBQ3TbALCAWlGgsVKwJlQBK50CMtO3BXv+Oph2kzeiTm/Hn7L32mbwklnPlQqopvPoSydjHd25y7T4WDJ6YISsoAjERitcRDFR9i4rn/Egi08cxK4zu4+C4A95g90pN9XzPXpZT0rpaxCQL8fU3BkAdUgGLvDjIEfNHGFzFgik8ucDCykNUVpUspiVVBcjYcf+s3IjuXo0slspuVJm0yEwxFM65SHRjFN625OIavhgYowb+HcUP3InqBEENGcUqYFoPmlCMH1C6iOUHUg8dmv9v8OxoyB3PgAEAAAAAElFTkSuQmCC",Rt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAHCFJREFUeF7tnQuUXVV5x//fvnfiK6wiUFnSaoNgYiHknjuDCgUUQXloaAUMVnyAAl1VYQGhEsOcmY5zz81LeSnEqsEHal0SAV0EQQooBQVfzLkYYjNCibLEUhFTSX3M3Hv+7bm5CZkwk9nnfe65+6zFmknyfd/e33/vH+e1z7cF5khEgSU3sPToZsz30FoAkfkA9gXUXMLbSyBzAexFYO7237kXgPbfdTrzDIBtgDxDcJu0f0fnd/UM4Pl//g3IcYXS5oMWYHz9GdJKJJEeDyo9nn/k9Bc6fFmfYD48zKf/E1wA+D9xUOTgwQI8CmAckM1CjENhfJIY32jL48HCGOtdFTCABJwP1RU8xPO845SoN5A8DsDeAUOkbb5VRO726H1bKXX32GWyKe0OdHN7BpBZRq9/JQ/2PBwLzzsGIscAOLCbBxzAYyDvhVL3KoXvPLhcHunyfBLtvgFkGnkrNZ4g4p0MqKMBHp7oCGQeXH4EePeR6rbGkNyReXdy1gEDSGdArNHJo6jUYoEsBrAwZ+OUVnc2EtwgnrfBHe77blqN5rmdngakOsoKS1gsxGKCR+R5oNLum0AeoGCDtLBhbFgaabefl/Z6DpDqah7AJpaQPEWA4/MyEHnuB4G7ROQWKWP92DJ5Is99jbtvPQOItZLz0PTOhci5APaPW8geifckyHUoq3XuctnSCzkXHpDKCs6XVhuMcwDs0wuDmkKOT4O8jiW1rnGZjKfQXmZNFBaQRXUuVN5OMPy31OaIX4FtPiieUuseGpSN8YfPPmLhAFlUZ78izgHoX0rNyV7inujBBCDrPMF1Dw3Kg0XKuDCAHDrCfeb04VKSy4o0QN2Wi4isnpjEmodH5Olu6/t0/S0EIJbDsyC4FOQhRRiUrs9BZBOINa4tX+j2XLoaEGslX80WlwlwercPRBH7T+BGKclqd7n8sFvz60pADhnh3Oc9ezll7jPyPfsm/MuuP01izaYR8Zfpd9XRdYBUHb6jfZ8hqHSV0r3eWaLhgzJmy1e6SYquAWTeCJ+/d9m7HJAPdJPApq+7K8C1W5vqki0j8sdu0KYrAOkfnRjwpHw5BK/vBlFNH2dRgLhHsXnJg8Nzfpx3rXIPSLXefA+pLgewX97FNP0LpMBTIt4lY4Pl6wN5pWyca0Asp7UakEtT1sQ0l6oCXOPapdy+u8olIO31Ux6vAPCWVMfKNJaVArdSydI8ruvKHSAVh6cK2nDMy2q0TLuZKLCFkKUNW27OpPUZGs0VIFadZ4P8XJ4EMn1JWQGR97qD8vmUW52xudwAUnF4voCfyIswph/ZKUDIBQ1brsmuB8+2nAtAqg4/THBlHgQxfciHAgJZPmbLqqx7kzkgVq11BUQuzloI034OFSCvdIdKS7PsWaaAWA5vAehXETGHUWCm2+QNri2nZCVPZoBYjre5U6Izq9xNu92jwLhrK7+ka+pHJoBYjsfUMzUNdr0Crq1Sn6+pN2g5fALgS7t+tEwCGSggv3JtOSDNhlMFxHI8/3vlapoJmrYKp8CYa6v+tLJKDRDL4a0A35xWYqadIisg33RtSWUZUiqAVJzWdQJ5X5GHzOSWrgIEP9uwS36ts0SPxAGxanQgHEw0CxO8NxWg1N0hsZNMPlFAKk7rfIGY5SNJjmCPxyZ4QcMuJbYsJTFAOqtyb+rx8TPpp6AAIacltQo4EUA633N8yyxZT2F2mCZ8BbZQyYlJfE+SCCCW420wHzuZmZuyAre6top92VLsgJjPZFOeFqa5XRSI//PdWAHpFFjo+nKTZs51rwIi3llxFoKIDZB2aR5Vvt1UH+neyVWQnj+lvOZJcZUUigWQdlG3Em83dasKMsW6PQ3inq0tOSmO4nSxAGI5rWtNxcNun1VF6z/Xunbpg1GzigxIu1Yu+K9RO2L8jQJxKyCQM6PWAo4EiF9lfU6J95lC0nEPrYkXiwJEY6IlR0epKh8JkGqdoySHYknGBDEKJKCAiNTGBmU4bOjQgPib16DF+8w+gGGlN34pKTCBkhwddhOf0IBUHO9rZmenlIbYNBNJAX+nq4at3hYmSChA2nsCgrmpfhcmcePTawrI2WH2TAwMiL+bbF8f7jUbZvbaBOvyfEU2TU7imKC77wYGpFrnKrPVcpdPlh7tfnsLuEH5cJD0AwGyqM5+ReZ+V6AgAhjb3lLAExl4aFD84iFaRyBALIfXAkx3j0DyI1qZZGBEYIGI+AXN/P9emEEXgjb5CICfkXxEgKeDOmvZK0V43rPzyv+zf/h/t+PfdrXZ/e9E/G32jtVqK5SRrHVt0X7Drg3IojoXds4eqW67nEWxsKC6V1c88+de64WnichpAE4I6p+oPTEGJTcqDzc9OCQ/TbStGIJbjvftZAHBROcsslGnu9qAWLXWVRC5UCdonDbdAMiu+bbfD3m4DORb49QhRCwX9D7iDpW/HsI3M5cUAAHIq92h0kU6SWoB0vmE1r/3mKsTNE6bbgNkR+6W07oIkH8GsHeceujFkqvQxEfcEdmqZ58fq1QAAbZRyYDOJ7pagFi11hqIfCgLGbsVEF8rq04LxJcAHpqednKGa8v69NqLt6WUAPHPIh91h0qzbhA7KyDWSs5Dq/3kap94pdCL1s2A+Bm+ZgX3nfBwTxqQUMkpjcvErwfQtUdqgPgPKUoy4C6XLXsSa3ZAai0HIpkVfut2QHZectW870FwZFIztyRywI8H5VdJxU8rboqA+GeRujtU2mPhuT0CUl3NAzhJ/5nx/mkJtHs7RQGkfcmV1BOaF8mL3Yu7735jujmVmEbTT+AnpU/6x5bJEzPN7z0CYtV5IcirsoLDb7dIgBw7wvLWMv8tzseYLEl/Y7mMZTlGcbadMiCAyEXuoFwdCpCK490pwPFxChA0VpEAaZ9FanwlpA3JXwXVYnd7Kjm9cZkUqnpl2oAQuKthqzcGBqQ6ygoV3aiDGNW/aIB0IDkPwk9H0ybYG+FobaXnnTYgfmbiiTU2LI3pspzxEsuqcxCkk54007dUREDakNS5HmSobxQAPCp98ro9XTtnPW5h288CEIjY7qDUAwFSdXg/wSPCJhqXX1EBqTo8nOAPw+gk4PvH7NK/hPHNu08WgAjkgTFbpn3COO0ZxBqdPAqq5H9Om/lRVEA6Z5EvgzwzoMjjL3ihWPcvlT8E9OsK8ywAaQvjtY52h/u+u7tI0wJScVorBcHWzSelfpEBqdR5opB+NUr9Q2i7g6VpLwf0g+TXMitACK5q2KXlWoBYjvcTAAvzIGORAfH1rTjeLwR4ma7W9KS/MVycx7q7550VIAA2urY6bFZAKjWeIEJ/b49cHEUHxHJ4B8A3aYr9e9dWL9K07UqzDAEBKSc2huSOXYV7ziWWVWtdAZGL86Ju0QGp1PkxIS/R0ZuCHzcG1eE6tt1qkyUgIK90h0pLZwHEewCC1+ZF4KIDUnU4TGh/Nfkd11ZvyMvYJNGPbAHB990hNeXJ7ZQziDXCeSjzsSQSDxuz8IDUOURyVFMfA4imUKHNmnKgO/LsCt+pgIw2z4RSXw4dPAHHogNScVq2QGqa0hlANIUKbeZ573SHyzuLsU8FpM5rQGp/0B66EwEciw6I5fAygLqPbQ0gAeZOKFORa91BOX+H71RAHG8zgPmhAifkVHhAaq3lEFmhKZ8BRFOoCGbjrq38KjXtYycglRHOlzJ9QHJ1FB2QSp3LhFylKboBRFOoKGZsyoLGiIxPAcSq81yQn4kSOAnfogNiOa1LAVmtqZ0BRFOoSGYi57mDsm4qILXWVyFyRqTACTgXHxD+E8CPakpnANEUKpIZeYM7VHr7VEAcz6+09+JIgRNwLjog1TovIfkxTekMIJpCRTT7rWurdpGS9j3IQocvK4O/iBg0EfeiA1JxWksFcrmmeAYQTaGimjUhL99oy+NtQKp1Hk/yzqhBk/AvOiCWw4sAXqmpnQFEU6ioZiLyxrFBuWs7IDW+n8K1UYMm4V94QGqtCyGiWxjDAJLEJJsmplA+MDYkn2wDYjn+/8H8/5Pl7yg6INU6LyD5cU3lDSCaQkU3k6tcWy7uAOJ9E8DJ0YPGH6HogFSc1vkC+YSmcgYQTaFiMLvNtdWbdwDi7xtxUAxBYw9RdEAsx99vxd93ReswgGjJFIvRo66tDpYlN7D0s3E2YwmZQJCiAxLw/s8AksAcmynkK+dLWfpr/GtPuCnFdgM1VXRAKk7rHwXySU1RDCCaQsVhpiiHiFVrvhWibo4jYBIxCg9Inf8g5Kc0tTOAaAoVixm9UyXgWqBY2g0SpOiAWLXmeRClW2XRABJk8kS25TIfkNWAzLqRSOS2QgYoOiDVGs+hsL0wTuMwgGiIFJ8J10gmO9cGyKDogFTqzfcJ1XWakhhANIWKx0zWSsVpXS+Qd8cTMP4oRQfEqvNskJ/TVO7brq2O07TtSrNMizbsphjBL4rleH75/FPzqmbhAXF4FsDP6+kvd7q26NbQ0guZM6s8AfL/df1u9gHx96qYcX+ErPUrOiBVh+8meL2OzgL51pgtJ+nYdqtNzgC5UyqOd78AmVdxn2lAiw5Ipc53CflFzQndXv6gaduVZnkChMAD/k36TwDmog7vdCNadEAsp/lOQH1JazYTG9whdYqWbZca5QkQQDb6l1j+NriRtwNLajyKDkjV4TsI7qzDNIuO33Bt9daktM5D3HwBgp/7gDwFYN88iNOLZ5DqaPPvqdRXdPQX4qaxIXW6jm232uQMkN/4gPwJwJy8Clr0M0ilzjOE/Kqm/utdW+WusIZm37XMcgbIhAFEa9iSM7IcLgF4g2YLBhBNoWIyawNiLrFiUjNMmKrD0wl+TdPXAKIpVExm7Ussc5Mek5phwlRqPE2EN2r6GkA0hYrJzL9JN495YxIzVJiK0zxVoPzVDDqHAURHpdhsZKN5URibmOECWQ7/DuDXNb0NIJpCxWHWeVFolprEIWbYGNVa828p6hua/gYQTaFiMrvTLFaMScmwYSo1LhbhLZr+BhBNoWIyu9ksd49JybBhrDrfAnKDpr8BRFOoOMw6y939kjN+6Zl8HkV/UVit82SSfl0yncMAoqNSbDay1nxyG5uY4QL113iSJ7xN09sAoilUPGbtT24DbeAST7sBohT9DFKpT54oLN2uKYkBRFOoeMz8og2m7E88WoaMYtX5JpB3aLobQDSFisXML/tjCsfFImXoINXa5BspJf+rTp3DAKKjUkw27cJxpvRoTGqGDLOoxuOU8C5NdwOIplBxmLVLj/qBLMczxavjUDREjEqdbxDybk1XA4imUDGYbS9e3QHEbH8Qg6JhQlRX8PX0+B1NXwOIplAxmO26/YHZQCcGQUOFqDp8HcF7NJ0NIJpCRTfbZQOdgCX4o7cdIELRH/MuGp08RqnSv2tKYgDRFCqq2ZQt2MwmnlHlDO9vreBR8HifZgQDiKZQUc2mbOJptoGOKmd4f8uZ/Bug9F3NCAYQTaGimk3ZBrpzo/40gBdHDRy3f9EvsfodHuGB92vqZgDRFCqi2W9dW+3jx2g/xWoDUmt9FSK5q5hRdEAWjfK1SvEBzQE1gGgKFcmMvMEdKr19KiB1ngvyM5ECJ+BcdECslXw1WvyBpnQGEE2hIpmJnOcOSnvPlp1nkMoI50uZmyMFTsC56IBUHR5O8Iea0hlANIWKYsamLGiMyPgUQDr3IT4g86MEj9u36ID0j04MeKr8I03dDCCaQkUwG3dttWCH/84zSBuQOq8B+cEIwWN3LToglVFWRfFBTeEMIJpChTYTudYdlPOnB2S0eSaU+nLo4Ak4Fh0Qqz5hgeUxTekMIJpChTbzvHe6w+WdxcSnnkFGOA9lPhY6eAKORQekv85FHtnQlM4AoilUaLOmHOiOiF9MsX1MAaR9mVXzHoDgtaEbiNmx6IAcNsrDSooPacpmANEUKpQZ8X13SE3ZTGoaQFpXQOTiUA0k4FR0QCqjPFQUN2pKZwDRFCqUGXmlO1RauqvvcwCp1HiCCL8VqoEEnIoOSHUFD6HHhzWlM4BoChXGjJQTG0My5fPn5wDSvsxyvJ8AyMW2bEUHZGAFX9Xy+FPNATWAaAoVwmyja6vDdvebFpCK01opkA+HaCR2l6IDsqjGBUr4H5rCGUA0hQpqRnBVwy4t1wLEGp08CqqkuwQ7aF8C2RcdkMrIH+dLeY7uCgYDSKDZE8DYax3tDvc9Z1X1tGcQP2zV4f0EM98euuiA9K/kwV6LP9McSgOIplBBzATywJgtR07nMyMgVp2DIJ0gDSVhW3RABmo8qCX0i2boHAYQHZWC2ojY7qDUAwFSHWWFim7QtuK2Lzogi2o8UAn/U1M3A4imUEHMxBNrbFimfVk74xnEb6DieHcKcHyQxuK2LTog1krOQ0t79YIBJOYJRuCuhq3eOFPYPQJi1XkhyKti7lOgcEUHZGAVX95q8ueaohhANIXSNhO5yB2Uq0MBUl3NAzjZXmm6v3aDMRsWHZCA9QAMIPHOryelT/rHlskToQDxnaxay4HIYLz90o9WdEAWjfz+L1X5+Y9rKmIA0RRKy4ysu0Mle0+2e7zEagOy/Rr5xwDaH7GnfRQdkM5Z+peauhpANIXSMHsaJRlwlz+7cnc6n1kB6ZxF1kDkQxqNxm5SdEAG6nxpi5zxFL+boAaQuGYY+VF3qHTpbOG0AKms4Hzx2meRubMFjPvfiw7Iwjr3L5P/pambAURTqFnMtlHJQOOy7d+dR7rE2uFs1VpXQeTC2QLG/e9FB2TRCF+iynxSUzcDiKZQezQjr3aHShfphNI6g/iBFtW5ULF9FpmjEzgum6IDMvAx7tf6I3+tqZcBRFOoPZhNeCIDDw2K1jc42oC070Wc9HfELTogr1nBfSc8PqU57gYQTaFmNpO1ri3ahUkCAbKozv7OWSRyN3UDFB2QQ0f+Z5++8l6/0dTDAKIp1ExmnbOHbhWZ536TPlv71TpXkVw2m11s/05+JLZYcQQSbAW5Baq0BZPY4o7I1ihhrRHujTJ/qxkjMiBLlrD0aD8O9DwcSM97hQAv1Ww7HTOR1wM4NonGRGT12GCw75wCnUH8Th86wn36+nAvyEOSSKILY/qAbAH4sIj6fqs1+YOHhud8XzePgVX8s1aTupAFAsR/+qg8DHiCASEHQLwCgpfr9q1QdiKbJidxzMMj4hdp1z4CA9K5FzkL4Oe1W+k5Q/E/gLpFgFvGbNnj5jgLVnOvF0zyd5oSzQpIe+kKcRoEpwF8nWbcHjCTs11bvhA00VCA+I1UHO9rApwetMEetP8BRK52B2VnMbJdNThkhHPnlPmMpi4zAuIXf/A87wKBvCuL91Wa/c/EjMCNDVu9LUzjoQHpVCX3P8tN9bFvmCTz4CPETZTW5a7d971d+zMwwhe2yvxfzT4+B5CKw78AcL6AfrnM1F/kavY7S7MJlORod7noFgif0tfQgPhRqnWOkhzKMvtua5v03tcYKn9uR7+PvIIv+MPv+XvNPKYAUl3BI0F8luSrNP17zkxEamODMhw28UiAtC8PSrwPgkrYDvSi364VNA7+OJ8393f8o6YOOwHpX8HTPI83avr1phnRmGjJ0ZtGZFtYASIB0j6LOHwHwWmvr8N2qkf8bnVttXjgU+xr/ZoTmjm3AbFqzfMg6tOaPj1rJpAzx2z5ShQBIgPiN245rWsB+UCUjvSkr8hIaT+sCAKIeFKnol+e5kU9qZl20lzr2iXtN+YzhY0FkHkjfP7eJd4Ogf+SxxwBFNi7KX1by5zUdFkP8JeAaC2004xZPDPinq0tOWnLiOheus6oQSyA+NE7OyXdDmC/4imeXEZuU0pWmS3NFtaDOBiCqqZ9L5o9pbzmSQ8Oz/EX1kY+YgOkfT9Sb76HVIFfxkTOoosD+GvNLMejZgrrASzRtO1JMxHvrLHB8vVxJR8rIJ37kdWAzPqlVlwJ9FgcA8geB5xrXLsU6zrB2AHZDom3AcBbemzyppGuAWRmldtPBeMehEQA6Xyi6+8xMi/uDvd0POK/IXhJT2swffJbqOREnU9og2qXCCB+JyoOTxXwpqAdMvZGgaAKEHJaw5abg/rp2CcGyHZIWucL5BM6HTE2RoEwChC8oGGXrgnjq+OTKCDt+5EaHQgzKzynI4Kx6VIFKHV3SPZY+C1qZokD0jmTXCeQ90XtrPE3CuxQgOBnG3bpnKQVSQWQ9pnE4a0A35x0QiZ+Lygg33RtSeUpaWqAbIfE8z+WN2+Be2EOJ5fjmGur/uTCT42cKiCdM8kTAPNVKCAttU07ERWQX7m2HBAxSCD31AHpnEl0l1YESsYYF1uBLEpAZQJIBxK/sMH8Yg+pyS4mBcZdWy2IKVagMJkB0rncugVg7MsDAilgjHOugGxwbTklq05mCkgbklrrCohcnJUApt0cK0Be6Q6VlmbZw8wB8ZOvOvwwwZVZCmHazpcCAlk+ZsuqrHuVC0B8ESoO/dI1ZllK1jMiB+0TckHDlsSWjwRJMTeAtC+36jwb5M6SOEESMbYFUUDkve6g5KZqZ64A6ZxJ/FXAV5il8gWZ8PppbCFkaVKrcvW7MdUyd4C0Idm+5ZsPSSrLCcKKZ/xiU+BWKlmaxPccUXuYS0B2JGU5LfP5btQRzr1//J/JxplyrgFpP+HaXgjiclMtJc5hz0Wsp0S8S+IssJBEVrkHxE+6XVJIypebultJTIEMYhL3KDYvias0T5IZdAUgvgDt4nRl73JTwTHJ6ZBGbK7d2lSXxFHULY3edg0gO8Ro1wL2t4AzBbPTmB/xtUE02lugRayVG1+H9CJ1HSB+Wn5V+ef14dLOXolmfxK9sc7KasIH40+TWBOlynpWne9KQHY+5VrJV7PFZWanq6ymz57b9Xd2kpKsDrt5TR6y6mpAnn0czLMguNRsLJqHKQVAZBOINWH2BMxJBju7UQhA/Gz83XfnPHvZlTede6Y//uXUxCTWBN1NNq8CFQaQHQIvqrNfEecAPNfsn5jatJsAZJ0nuO6hQfHrDhTmKBwgu4CyUHneuRDxS8OYzS2TmbLbQF7nKbXuoUHZmEwT2UYtLCA7ZG2v62rtBGWfbOUuTOtP+2CwpNblcf1UnCoXHpBdnnjNQ7MNin/ptX+cIvZQrCdBrkNZrXOXy5ZeyLtnANkxmNXVPIBNLCF5igDH98IgR82RwF0icouUsX5smTwRNV43+fccILsOTnWUFZawWIjFBI/opoFLuq8CeYCCDdLChrFhaSTdXl7j9zQguw6KNTp5FJVaLBC/ysrCvA5Ywv3aSHCDeN4Gd7jP30m35w8DyDRToFLjCSLeyYA6GuDhxZ4l8iPAu49UtzWG5I5i5xo8OwPILJr1r+TBnodj4XnHQOQYAAcGlzlXHo+BvBdK3asUvvPgcnkkV73LWWcMIAEHpLqCh3ied5wS9QaSxwHYO2CItM23isjdHr1vK6XuHrtMNqXdgW5uzwAScfQWOnxZn2A+PMyn/xP0S2T6JVUPihg6qPujAMYB2SzEOBTGJ4nxjbY8HjSQsX9WAQNIQrNhyQ0sPboZ8z20FkDEB2ZfQM0lvL0E4r/Z34vA3O2/c6/O237/p388A2AbIM8Q3Cbt39H5XT0DeP6ffwNyXKG0+aAFGF9/hrQSSqWnw/4f5GnaW9nfPLQAAAAASUVORK5CYII=",tt=Object.defineProperty,bt=Object.defineProperties,Ke=Object.getOwnPropertyDescriptors,Gt=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,Ie=(De,ke,je)=>ke in De?tt(De,ke,{enumerable:!0,configurable:!0,writable:!0,value:je}):De[ke]=je,ne=(De,ke)=>{for(var je in ke||(ke={}))ai.call(ke,je)&&Ie(De,je,ke[je]);if(Gt)for(var je of Gt(ke))ce.call(ke,je)&&Ie(De,je,ke[je]);return De},Fe=(De,ke)=>bt(De,Ke(ke));const Ve={\u5B9E\u8BAD:g,\u8BD5\u5377:D,\u8BFE\u4EF6:V,\u89C6\u9891:pe,\u4E3B\u80FD\u529B:Ce,\u5B50\u80FD\u529B:Ne,\u77E5\u8BC6\u70B9:ze,\u8D44\u6E90:Ct,\u603B\u6570:Ae,\u6559\u6750:Rt};var K=({type:De,ImgProps:ke})=>b.createElement("img",Fe(ne({src:(Ve==null?void 0:Ve[De])||(Ve==null?void 0:Ve.\u8BFE\u4EF6)},ke),{width:"16rem",style:ne({width:"16rem"},(ke==null?void 0:ke.style)||{})})),ae=G(70453),me=G(3736),Se=G(81722),We=Object.defineProperty,Be=Object.defineProperties,xt=Object.getOwnPropertyDescriptors,He=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,Ot=(De,ke,je)=>ke in De?We(De,ke,{enumerable:!0,configurable:!0,writable:!0,value:je}):De[ke]=je,dt=(De,ke)=>{for(var je in ke||(ke={}))mt.call(ke,je)&&Ot(De,je,ke[je]);if(He)for(var je of He(ke))Nt.call(ke,je)&&Ot(De,je,ke[je]);return De},Zt=(De,ke)=>Be(De,xt(ke)),Mt=(De,ke,je)=>new Promise((si,Xe)=>{var Qe=rt=>{try{Bt(je.next(rt))}catch(Ye){Xe(Ye)}},pt=rt=>{try{Bt(je.throw(rt))}catch(Ye){Xe(Ye)}},Bt=rt=>rt.done?si(rt.value):Promise.resolve(rt.value).then(Qe,pt);Bt((je=je.apply(De,ke)).next())});const ni=({children:De,cout:ke=1})=>{const je=(0,b.useRef)(null),[si,Xe]=(0,b.useState)(0),[Qe,pt]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{je.current&&setTimeout(()=>{const Bt=(0,z.ZR)(je.current,"rem",1);Xe(Bt)},500)},[je.current]),b.createElement("div",{className:"relative flex item-end "},b.createElement("div",{style:{height:Qe?"auto":`${ke*23.25}rem`,overflow:"hidden"}},b.createElement("div",{ref:je,style:{fontSize:"14rem"}},De)),si>=ke*23.25&&b.createElement("div",{className:"current c-blue",style:{whiteSpace:"nowrap"},onClick:()=>{pt(!Qe)}},Qe?"\u6536\u8D77":"\u5C55\u793A"))},Yt=({DataProps:De,pathsDetail:ke,getUrl:je})=>{var si,Xe,Qe,pt;const{detail:Bt}=ke,[rt,Ye]=(0,b.useState)(!1);return b.createElement("div",{id:`${De==null?void 0:De.id}`,className:"bg-white",style:{borderRadius:"4rem",padding:"15rem 30rem 30rem"}},b.createElement("div",{style:{color:"#3061D0"}},b.createElement(K,{type:"\u5B50\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u5B50\u80FD\u529B"),b.createElement("div",{className:"c-grey-333 flex item-center",style:{fontSize:"14rem",margin:"20rem 0 10rem 0",gap:"10rem"}},b.createElement(J.Z,{title:De==null?void 0:De.name},b.createElement("div",{className:"multi_ellipsis1 minW-0"},De==null?void 0:De.name)),b.createElement("div",{className:"flex item-center",style:{gap:"5rem"}},(si=De==null?void 0:De.ability_tags)==null?void 0:si.map($e=>b.createElement(ye.default,{color:"orange",style:{fontSize:"12rem"}},$e)))),(De==null?void 0:De.description)&&b.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},b.createElement(ni,null,De==null?void 0:De.description)),b.createElement("div",{className:"flex item-center justify-center w-full",style:{margin:"20rem 0",padding:"12rem",background:"linear-gradient( 180deg, #ECF3FF 0%, rgba(255,255,255,0) 100%)"}},"\u8986\u76D6 ",b.createElement(K,{type:"\u77E5\u8BC6\u70B9",ImgProps:{style:{margin:"0 5rem"}}})," ",De==null?void 0:De.knowledge_count,"\u4E2A\u77E5\u8BC6\u70B9",b.createElement("span",{style:{marginLeft:"40rem"}},b.createElement(K,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),De==null?void 0:De.resource_count,"\u4E2A\u8D44\u6E90\u6570")),b.createElement("div",{style:{marginBottom:"10rem"}},b.createElement(K,{type:"\u77E5\u8BC6\u70B9",ImgProps:{style:{marginRight:"5rem"}}}),"\u8986\u76D6\u77E5\u8BC6\u70B9",De==null?void 0:De.knowledge_count,"\u4E2A"),b.createElement("div",{style:{height:"320rem",background:"#F6F7F9"}},b.createElement(w,{loading:!1,nodes:De==null?void 0:De.nodes,relationships:De==null?void 0:De.relationships})),b.createElement("div",{style:{margin:"30rem 0 10rem"}},b.createElement(K,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),"\u8986\u76D6\u8D44\u6E90\u6570",De==null?void 0:De.resource_count,"\u4E2A"),b.createElement("div",{className:"flex-wrap",style:{gap:"10rem",display:"grid",gridTemplateColumns:"1fr 1fr"}},(pt=((Xe=De==null?void 0:De.resource_knowledge_graphs)==null?void 0:Xe.length)>4&&!rt?(Qe=De==null?void 0:De.resource_knowledge_graphs)==null?void 0:Qe.slice(0,4):De==null?void 0:De.resource_knowledge_graphs)==null?void 0:pt.map($e=>b.createElement("div",{key:$e==null?void 0:$e.id,className:"flex relative current",style:{gap:"10rem",padding:"25rem",background:"#f6f6f6",borderRadius:"10rem"},onClick:()=>Mt(void 0,null,function*(){yield je==null?void 0:je($e)})},!(Bt!=null&&Bt.can_managed)&&b.createElement("div",{className:"absolute c-white",style:{top:0,right:0,padding:"2rem 10rem",borderRadius:"0 10rem 0 10rem",color:($e==null?void 0:$e.complete_rate)!=100&&"#7C3100",background:($e==null?void 0:$e.complete_rate)!=100?"#FFC86B":"#37AD83"}},($e==null?void 0:$e.complete_rate)==100?"\u5DF2\u5B8C\u6210":"\u672A\u5B8C\u6210"),b.createElement(ee.Z,{type:"circle",percent:$e==null?void 0:$e.complete_rate,size:60,status:"success",format:At=>`${At}%`,strokeWidth:10}),b.createElement(K,{type:$e==null?void 0:$e.node_type,ImgProps:{style:{width:"16rem",height:"16rem",marginTop:"3rem"}}}),b.createElement("div",{className:"flex-1 minW-0"},b.createElement(J.Z,{title:$e==null?void 0:$e.name,placement:"topLeft"},b.createElement("div",{className:"multi_ellipsis1 c-grey-333 blod",style:{fontSize:"16rem"}},$e==null?void 0:$e.name)),b.createElement("div",{className:"c-grey-333",style:{marginTop:"10rem",fontSize:"14rem"}},"\u77E5\u8BC6\u70B9\uFF1A",($e==null?void 0:$e.knowledge_text)||"--"),(Bt==null?void 0:Bt.can_managed)&&b.createElement("div",{className:"flex flex-wrap item-center v-grey-666",style:{marginTop:"20rem",fontSize:"12rem",gap:"10rem"}},b.createElement("div",null,"\u5B66\u4E60\u4EBA\u6570\uFF1A",$e==null?void 0:$e.study_count,"\u4EBA"),b.createElement("div",null,"\u638C\u63E1\u4EBA\u6570\uFF1A",$e==null?void 0:$e.complete_count,"\u4EBA"),b.createElement("div",null,"\u638C\u63E1\u7387\uFF1A",$e==null?void 0:$e.complete_rate,"%")))))),(De==null?void 0:De.resource_knowledge_graphs.length)>4&&b.createElement("div",{className:"flex item-center justify-center",style:{padding:"0 220rem"},onClick:()=>{Ye(!rt)}},b.createElement(M.Z,{style:{borderColor:"#3061D0",marginBottom:"0rem",cursor:"pointer"},dashed:!0},b.createElement("span",{style:{color:"#3061D0"}},rt?"\u70B9\u51FB\u6536\u8D77":"\u70B9\u51FB\u5C55\u5F00\u66F4\u591A"))))},St=({pathsDetail:De,dispatch:ke,user:je})=>{var si,Xe,Qe,pt,Bt,rt,Ye,$e,At,ot,ji,ti,_t,lt,oi,Fi,an,Li,bi,pi,Bi,zi,Di,Gi,Ai,_n,Ki,Ui,Zi,sn,Ci,Tn,jt;const{detail:ki}=De,Jt=(0,y.useParams)(),[$i]=(0,y.useSearchParams)(),[Ji,kt]=(0,b.useState)({}),[fn,Vi]=(0,b.useState)({id:null,open:!1,resourceUrl:""}),[,yt,Ut,Z]=(0,x.U)(S.Ju,{subject_id:Jt.pathId,id:Jt==null?void 0:Jt.abilityId}),[de,Te]=(0,b.useState)([{name:"\u638C\u63E1\u738759%\u4EE5\u4E0B",value:0,itemStyle:{color:"rgb(6,110,247)"}},{name:"\u638C\u63E1\u738760%\uFF5E79%",value:0,itemStyle:{color:"rgb(6,234,230)"}},{name:"\u638C\u63E1\u738780%\uFF5E100%",value:0,itemStyle:{color:"rgb(223,209,38)"}}]),_e=new URLSearchParams(window.location.search),Re=()=>Mt(void 0,null,function*(){const re=yield Ut({subject_id:Jt==null?void 0:Jt.pathId,id:Jt==null?void 0:Jt.abilityId})}),Le=re=>ke({type:"userDetail/logWatchHistory",payload:dt({},re)});function Ge(re){return Mt(this,null,function*(){var Je,It,ct;let at=yield(0,O.ZP)("/api/knowledge/v2/get_container_type.json",{method:"get",params:{url:re==null?void 0:re.resourceUrl}});if(localStorage.setItem("container_type_tupu",at==null?void 0:at.container_type),(at==null?void 0:at.status)===0){if((re==null?void 0:re.node_type)=="\u8BD5\u5377"){const Lt=yield(0,Se.Mb)({categoryId:at==null?void 0:at.examination_bank_id});Lt!=null&&Lt.exercise_id&&(0,z.xg)(`/classrooms/coursesId/exercise/${Lt.exercise_id}/${(Je=je.userInfo)==null?void 0:Je.login}/initate_answer`);return}(at==null?void 0:at.container_type)==="video"?Vi({id:at==null?void 0:at.id,open:!0,resourceUrl:re==null?void 0:re.resourceUrl}):(at==null?void 0:at.container_type)==="att"?kt({url:H.Z.API_SERVER+((It=at==null?void 0:at.attachment)==null?void 0:It.url),file_type:(ct=at==null?void 0:at.attachment)==null?void 0:ct.file_type}):window.open(re==null?void 0:re.resourceUrl)}})}const it=re=>Mt(void 0,null,function*(){(re==null?void 0:re.resourceOrigin)===3?(0,z.xg)(re==null?void 0:re.resourceUrl):Ge(re),!(ki!=null&&ki.can_managed)&&(yield(0,O.ZP)("/api/subject_knowledge/create_study.json",{method:"post",body:{subject_id:Jt==null?void 0:Jt.pathId,uuid:(re==null?void 0:re.last_knowledge_uuid)||(re==null?void 0:re.knowledge_uuid)}}))});return(0,b.useEffect)(()=>{var re,Je;if((Z==null?void 0:Z.status)==0&&(ki!=null&&ki.can_managed)){const It=(Je=Object==null?void 0:Object.entries(((re=Z==null?void 0:Z.data)==null?void 0:re.study_grasp_hash)||{}))==null?void 0:Je.map(([ct,at],Lt)=>({name:ct,value:at,itemStyle:de[Lt].itemStyle}));Te(It)}},[ki==null?void 0:ki.can_managed,Z]),(0,b.useEffect)(()=>{Re()},[Jt==null?void 0:Jt.abilityId]),(0,b.useEffect)(()=>{ke({type:"pathsDetail/getKnowledgeGraphs",payload:{graphable_type:$i.get("type")=="classrooms"?"course":"subject",graphable_id:Jt==null?void 0:Jt.pathId}}),_e.set("tabs","5")},[]),(0,b.useEffect)(()=>(ke({type:"globalSetting/footerToggle",payload:!1}),()=>{ke({type:"globalSetting/footerToggle",payload:!0})}),[]),b.createElement(p.Z,{spinning:yt},b.createElement("div",{className:"ml-auto mr-auto",style:{width:"1200rem",paddingTop:"15rem"}},b.createElement(ie.Z,{style:{fontSize:"14rem",marginBottom:"20rem"},items:[{title:b.createElement("a",{className:"flex item-center",style:{fontSize:"14rem"},onClick:()=>{y.history.push(`/knowledgegraph/${Jt.pathId}?${_e}`)}},b.createElement(J.Z,{title:"\u8FD4\u56DE"},b.createElement("i",{className:"iconfont icon-fanhui1",style:{fontSize:"14rem",marginRight:"20rem"}})),"\u80FD\u529B\u56FE\u8C31")},{title:"\u80FD\u529B\u8BE6\u60C5"}]}),b.createElement("div",{className:"w-full flex"},b.createElement("div",{className:"sticky flex flex-col",style:{width:"240rem",borderRadius:"4rem 0 0 4rem",maxHeight:"100vh",overflowY:"auto",overflowX:"hidden",top:0,background:"#F6F7F9"}},b.createElement("div",{style:{padding:"20rem"}},b.createElement("div",{className:"c-grey-333",style:{fontSize:"16rem"}},"\u80FD\u529B\u76EE\u6807\u56FE\u8C31"),b.createElement("div",{className:"w-full",style:{height:"200rem",marginTop:"20rem"}},b.createElement(ae.Z,{isShow:!0,className:"c-grey-333",DataProps:((si=Z==null?void 0:Z.data)==null?void 0:si.ability_goals)||[],baifenbi:1/2,style:{backgroundSize:"auto 100%",height:"100%",width:"100%"}}))),b.createElement("div",{style:{padding:"10rem 20rem 20rem"}},b.createElement("div",{className:"c-grey-333",style:{fontSize:"16rem"}},"\u76EE\u5F55\u5BFC\u822A"),b.createElement(Y.default,{className:"w-full",value:Number(Jt==null?void 0:Jt.abilityId),style:{marginTop:"10rem"},onChange:re=>{y.history.push(`/knowledgegraph/${Jt.pathId}/abilityMap/detail/${re}?${_e}`)},options:((Qe=(Xe=Z==null?void 0:Z.data)==null?void 0:Xe.ability_goals)==null?void 0:Qe.map(re=>({label:re==null?void 0:re.name,value:re==null?void 0:re.id})))||[],size:"large"})),b.createElement(l.default,{className:_.AnchorDomStyle,items:(Bt=(pt=Z==null?void 0:Z.data)==null?void 0:pt.children_ability_goals)==null?void 0:Bt.map(re=>{var Je;return{key:re==null?void 0:re.id,href:`#${re==null?void 0:re.id}`,title:b.createElement("div",{className:`current relative ${_.AnchorDom}`},b.createElement("div",{className:"flex item-center",style:{gap:"10rem"}},b.createElement("div",{className:"flex-1 minW-0 multi_ellipsis1 c-grey-333",style:{fontSize:"14rem"}},re==null?void 0:re.name),b.createElement("span",{style:{color:"#464F66",fontSize:"12rem"}},ki!=null&&ki.can_managed?b.createElement(b.Fragment,null,b.createElement("span",{className:"iconfont icon-a-60-kejian",style:{marginRight:"5rem",fontSize:"12rem"}}),re==null?void 0:re.knowledge_count):b.createElement("span",{style:{color:"#00C088"}},b.createElement("span",{className:"iconfont icon-xuesheng2",style:{marginRight:"5rem",fontSize:"12rem"}}),(re==null?void 0:re.grasp_rate)||0,"%"))),b.createElement("div",{className:"flex flex-wrap",style:{gap:"5rem",marginTop:"10rem"}},(Je=re==null?void 0:re.ability_tags)==null?void 0:Je.map(It=>b.createElement(ye.default,{color:"orange",style:{fontSize:"12rem"},key:It},It))),b.createElement("div",{className:"multi_ellipsis2",style:{marginTop:"20rem",color:"#464F66",fontSize:"12rem"}},re==null?void 0:re.description))}})})),b.createElement("div",{className:"flex-1 minW-0 flex flex-col",style:{gap:"20rem"}},b.createElement("div",{className:"bg-white relative",style:{borderRadius:"4rem",padding:"15rem 30rem 30rem"}},((Ye=(rt=Z==null?void 0:Z.data)==null?void 0:rt.next_ability_goal)==null?void 0:Ye.id)&&b.createElement("div",{className:"absolute current",style:{right:0,top:0},onClick:()=>{var re,Je;y.history.push(`/knowledgegraph/${Jt.pathId}/abilityMap/detail/${(Je=(re=Z==null?void 0:Z.data)==null?void 0:re.next_ability_goal)==null?void 0:Je.id}?${_e}`)}},b.createElement("div",{className:_.NextAbility},b.createElement("div",{className:"multi_ellipsis1"},(At=($e=Z==null?void 0:Z.data)==null?void 0:$e.next_ability_goal)==null?void 0:At.name),b.createElement("div",null,b.createElement("span",{className:"iconfont icon-you2",style:{fontSize:"14rem"}})))),b.createElement("div",{style:{color:"#3061D0"}},b.createElement(K,{type:"\u4E3B\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u4E3B\u80FD\u529B"),b.createElement("div",{className:"c-grey-333 blod",style:{fontSize:"14rem",margin:"20rem 0 10rem 0"}},(ot=Z==null?void 0:Z.data)==null?void 0:ot.name),((ji=Z==null?void 0:Z.data)==null?void 0:ji.description)&&b.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},b.createElement(ni,null,(ti=Z==null?void 0:Z.data)==null?void 0:ti.description)),(ki==null?void 0:ki.can_managed)&&b.createElement(b.Fragment,null,b.createElement("div",{className:"flex",style:{marginTop:"20rem",gap:"20rem"}},[{title:"\u5E73\u5747\u4E3B\u80FD\u529B\u638C\u63E1\u7387",value:(_t=Z==null?void 0:Z.data)==null?void 0:_t.children_ability_goal_grasp_rate,unit:"%",img:G(46016),bg:"#E3F1FF"},{title:"\u8986\u76D6\u77E5\u8BC6\u70B9",value:(lt=Z==null?void 0:Z.data)==null?void 0:lt.total_knowledge_count,unit:"\u4E2A",img:G(99755),bg:"#F1FDEF",ProgressTitle:"\u5360\u603B\u77E5\u8BC6\u70B9",percent:(oi=Z==null?void 0:Z.data)==null?void 0:oi.knowledge_rate,trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u8986\u76D6\u8D44\u6E90\u6570",value:(Fi=Z==null?void 0:Z.data)==null?void 0:Fi.total_resource_count,unit:"\u4E2A",img:G(92691),bg:"#FFF9F4",ProgressTitle:"\u5360\u603B\u8D44\u6E90\u6570",percent:(an=Z==null?void 0:Z.data)==null?void 0:an.resource_rate,trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((re,Je)=>b.createElement("div",{key:Je,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:re==null?void 0:re.bg,padding:"20rem 30rem"}},b.createElement("img",{src:re==null?void 0:re.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),b.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},re==null?void 0:re.title),b.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),(re==null?void 0:re.ProgressTitle)&&b.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},b.createElement("div",null,re==null?void 0:re.ProgressTitle,re==null?void 0:re.percent,"%"),b.createElement(ee.Z,{percent:re==null?void 0:re.percent,showInfo:!1,trailColor:re==null?void 0:re.trailColor,strokeColor:re==null?void 0:re.strokeColor,style:{marginBottom:"0",marginLeft:"0"}}))))),b.createElement("div",{className:"c-grey-333",style:{margin:"40rem 0 30rem 0",fontSize:"14rem"}},"\u5B66\u4E60\u7EDF\u8BA1"),b.createElement("div",{className:"flex"},b.createElement("div",{className:"minW-0 flex flex-col",style:{gap:"13rem",width:"200rem"}},[{title:"\u5B66\u4E60\u4EBA\u6570",value:(Li=Z==null?void 0:Z.data)==null?void 0:Li.study_count,unit:"",img:G(37426),bg:"rgba(68, 95, 232, 0.1)"},{title:"\u5B66\u4E60\u5B8C\u6210\u7387",value:(bi=Z==null?void 0:Z.data)==null?void 0:bi.complete_rate,unit:"%",img:G(19150),bg:"rgba(182, 129, 0, .1)"},{title:"\u5B66\u4E60\u638C\u63E1\u7387",value:(pi=Z==null?void 0:Z.data)==null?void 0:pi.grasp_rate,unit:"%",img:G(55303),bg:"rgba(6, 145, 127, .1)"}].map((re,Je)=>b.createElement("div",{key:Je,className:"relative",style:{borderRadius:"6rem",padding:"20rem",background:re==null?void 0:re.bg}},b.createElement("div",{style:{fontSize:"14rem"}},re==null?void 0:re.title),b.createElement("div",{className:"blod",style:{fontSize:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),b.createElement("img",{className:"absolute",style:{right:"6rem",bottom:"6rem"},height:"35rem",src:re==null?void 0:re.img})))),b.createElement("div",{className:"flex-1 minW-0"},b.createElement(m.Z,{dataSource:de,legend:{top:null,icon:"roundRect",bottom:10,itemWidth:14,itemGap:50,left:"center",formatter:re=>re}})))),!(ki!=null&&ki.can_managed)&&b.createElement(b.Fragment,null,b.createElement("div",{className:"flex item-center",style:{gap:"20rem",marginTop:"20rem"}},[{title:"\u8986\u76D6\u77E5\u8BC6\u70B9",value:(Bi=Z==null?void 0:Z.data)==null?void 0:Bi.total_knowledge_count,unit:"\u4E2A",percent:(zi=Z==null?void 0:Z.data)==null?void 0:zi.knowledge_rate,percenttitle:"\u5360\u603B\u77E5\u8BC6\u70B9",trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u8986\u76D6\u8D44\u6E90\u6570",value:(Di=Z==null?void 0:Z.data)==null?void 0:Di.total_resource_count,unit:"\u4E2A",percent:(Gi=Z==null?void 0:Z.data)==null?void 0:Gi.resource_rate,percenttitle:"\u5360\u603B\u8D44\u6E90\u6570",trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((re,Je)=>b.createElement("div",{key:Je,className:"flex-1 minW-0 flex justify-between c-grey-333",style:{gap:"20rem",background:"#F6F7F9",borderRadius:"6rem",padding:"30rem 60rem"}},b.createElement("div",{className:"flex flex-col justify-between"},b.createElement("div",{style:{fontSize:"14rem",whiteSpace:"nowrap"}},re==null?void 0:re.title),b.createElement("div",{className:"blod",style:{fontSize:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit))),b.createElement("div",{className:"relative",style:{width:"133rem",height:"75rem"}},b.createElement(ee.Z,{type:"dashboard",percent:re==null?void 0:re.percent,gapDegree:178,strokeWidth:10,className:"absolute",style:{right:0,top:0},trailColor:re==null?void 0:re.trailColor,strokeColor:re==null?void 0:re.strokeColor,strokeLinecap:"round",format:It=>b.createElement("div",{className:"c-grey-333",style:{fontSize:"12rem",textAlign:"center",marginTop:"-35rem"}},It,"%",b.createElement("br",null),b.createElement("br",null),re==null?void 0:re.percenttitle)}))))),b.createElement("div",{className:"c-grey-333 blod",style:{margin:"40rem 0 30rem 0",fontSize:"14rem"}},"\u5B66\u4E60\u7EDF\u8BA1"),b.createElement("div",{className:"flex",style:{marginTop:"20rem",gap:"20rem"}},[{title:"\u4E3B\u80FD\u529B\u638C\u63E1\u7387",value:(Ai=Z==null?void 0:Z.data)==null?void 0:Ai.children_ability_goal_grasp_rate,unit:"%",img:G(46016),bg:"#E3F1FF"},{title:"\u5DF2\u638C\u63E1\u77E5\u8BC6\u70B9",value:((_n=Z==null?void 0:Z.data)==null?void 0:_n.knowledge_grasp_count)||0,unit:"\u4E2A",img:G(99755),bg:"#F1FDEF",ProgressTitle:"\u77E5\u8BC6\u70B9\u638C\u63E1\u7387",percent:((Ki=Z==null?void 0:Z.data)==null?void 0:Ki.knowledge_grasp_rate)||0,trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u5DF2\u5B8C\u6210\u8D44\u6E90\u6570",value:((Ui=Z==null?void 0:Z.data)==null?void 0:Ui.resource_complete_count)||0,unit:"\u4E2A",img:G(92691),bg:"#FFF9F4",ProgressTitle:"\u5B8C\u6210\u8D44\u6E90\u7387",percent:((Zi=Z==null?void 0:Z.data)==null?void 0:Zi.resource_complete_rate)||0,trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((re,Je)=>b.createElement("div",{key:Je,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:re==null?void 0:re.bg,padding:"20rem 30rem"}},b.createElement("img",{src:re==null?void 0:re.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),b.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},re==null?void 0:re.title),b.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),(re==null?void 0:re.ProgressTitle)&&b.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},b.createElement("div",null,re==null?void 0:re.ProgressTitle,re==null?void 0:re.percent,"%"),b.createElement(ee.Z,{percent:re==null?void 0:re.percent,showInfo:!1,trailColor:re==null?void 0:re.trailColor,strokeColor:re==null?void 0:re.strokeColor,style:{marginBottom:"0",marginLeft:"0"}}))))),b.createElement("div",{className:"c-grey-333 blod",style:{margin:"30rem 0 10rem 0",fontSize:"14rem"}},"\u5F00\u59CB\u5B66\u4E60"),b.createElement("div",{className:"flex flex-col",style:{gap:"10rem"}},(Ci=(sn=Z==null?void 0:Z.data)==null?void 0:sn.children_ability_goals)==null?void 0:Ci.map(re=>b.createElement("div",{key:re==null?void 0:re.id,className:"flex item-center",style:{gap:"20rem",padding:"20rem",background:"#F6F7F9",borderRadius:"6rem"}},b.createElement("div",{className:"flex-1 minW-0 flex flex-col"},b.createElement("div",{className:"flex",style:{gap:"10rem"}},b.createElement("div",{style:{color:"#3061D0"}},b.createElement(K,{type:"\u5B50\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u5B50\u80FD\u529B"),b.createElement(J.Z,{title:re==null?void 0:re.name,placement:"topLeft"},b.createElement("div",{className:"multi_ellipsis1"},re==null?void 0:re.name))),b.createElement("div",{className:"flex item-center",style:{gap:"10rem",marginTop:"15rem",fontSize:"14rem"}},b.createElement(ye.default,{color:"orange",style:{fontSize:"12rem",lineHeight:"1.5"}},"\u8282\u70B9"),b.createElement("span",{className:"c-grey-333"},re==null?void 0:re.last_knowledge_name),re!=null&&re.is_complete?b.createElement("span",{className:"c-green"},"\uFF08\u5DF2\u638C\u63E1\uFF09"):b.createElement("span",{className:"c-grey-666"},"\uFF08\u672A\u638C\u63E1\uFF09"))),b.createElement(L.op,{onClick:()=>Mt(void 0,null,function*(){yield it(re)})},(re==null?void 0:re.complete_rate)==0?"\u5F00\u59CB\u5B66\u4E60":"\u7EE7\u7EED\u5B66\u4E60")))))),(jt=(Tn=Z==null?void 0:Z.data)==null?void 0:Tn.children_ability_goals)==null?void 0:jt.map(re=>b.createElement(Yt,{key:re==null?void 0:re.id,DataProps:re,pathsDetail:De,getUrl:it}))))),b.createElement($.default,{open:fn==null?void 0:fn.open,title:"\u89C6\u9891",width:800,centered:!0,onCancel:()=>{Vi(Zt(dt({},fn),{open:!1}))},onOk:()=>{Vi(Zt(dt({},fn),{open:!1}))}},b.createElement(me.Z,{allow_skip:!0,videoId:fn.id,toLog:!0,src:fn==null?void 0:fn.resourceUrl,logWatchHistory:re=>Le(Zt(dt({},re),{container_type:localStorage.getItem("container_type_tupu")}))})),b.createElement(N.Z,{close:!0,style:{zIndex:1300,background:"rgba(1, 10, 35, 0.5)"},data:Ji==null?void 0:Ji.url,type:Ji==null?void 0:Ji.file_type,disabledDownload:!0,onClose:()=>kt({})}))};var Ni=(0,y.connect)(({pathsDetail:De,user:ke})=>({pathsDetail:De,user:ke}))(St)},45685:function(Dt,Me,G){"use strict";G.d(Me,{default:function(){return U}});var z=G(62730),J=G(59301),ye=G(92310),ee=G.n(ye),M=G(6089),p=G(16722),ie=G(97224),Y=G(83010),l=G(48608),$=G(48755),b=G(83397),m=J.createContext(void 0),S=w=>{const{href:L,title:O,prefixCls:H,children:N,className:_,target:g,replace:D}=w,V=J.useContext(m),{registerLink:pe,unregisterLink:Ae,scrollTo:Ce,onClick:Ne,activeLink:ze,direction:Ct}=V||{};J.useEffect(()=>(pe==null||pe(L),()=>{Ae==null||Ae(L)}),[L]);const Rt=ce=>{Ne==null||Ne(ce,{title:O,href:L}),Ce==null||Ce(L),D&&(ce.preventDefault(),window.location.replace(L))},{getPrefixCls:tt}=J.useContext($.E_),bt=tt("anchor",H),Ke=ze===L,Gt=ee()(`${bt}-link`,_,{[`${bt}-link-active`]:Ke}),ai=ee()(`${bt}-link-title`,{[`${bt}-link-title-active`]:Ke});return J.createElement("div",{className:Gt},J.createElement("a",{className:ai,href:L,title:typeof O=="string"?O:"",target:g,onClick:Rt},O),Ct!=="horizontal"?N:null)},P=G(93083),C=G(63356),k=G(16931),R=G(51636);const I=w=>{const{componentCls:L,holderOffsetBlock:O,motionDurationSlow:H,lineWidthBold:N,colorPrimary:_,lineType:g,colorSplit:D,calc:V}=w;return{[`${L}-wrapper`]:{marginBlockStart:V(O).mul(-1).equal(),paddingBlockStart:O,[L]:Object.assign(Object.assign({},(0,C.Wf)(w)),{position:"relative",paddingInlineStart:N,[`${L}-link`]:{paddingBlock:w.linkPaddingBlock,paddingInline:`${(0,P.unit)(w.linkPaddingInlineStart)} 0`,"&-title":Object.assign(Object.assign({},C.vS),{position:"relative",display:"block",marginBlockEnd:w.anchorTitleBlock,color:w.colorText,transition:`all ${w.motionDurationSlow}`,"&:only-child":{marginBlockEnd:0}}),[`&-active > ${L}-link-title`]:{color:w.colorPrimary},[`${L}-link`]:{paddingBlock:w.anchorPaddingBlockSecondary}}}),[`&:not(${L}-wrapper-horizontal)`]:{[L]:{"&::before":{position:"absolute",insetInlineStart:0,top:0,height:"100%",borderInlineStart:`${(0,P.unit)(N)} ${g} ${D}`,content:'" "'},[`${L}-ink`]:{position:"absolute",insetInlineStart:0,display:"none",transform:"translateY(-50%)",transition:`top ${H} ease-in-out`,width:N,backgroundColor:_,[`&${L}-ink-visible`]:{display:"inline-block"}}}},[`${L}-fixed ${L}-ink ${L}-ink`]:{display:"none"}}}},F=w=>{const{componentCls:L,motionDurationSlow:O,lineWidthBold:H,colorPrimary:N}=w;return{[`${L}-wrapper-horizontal`]:{position:"relative","&::before":{position:"absolute",left:{_skip_check_:!0,value:0},right:{_skip_check_:!0,value:0},bottom:0,borderBottom:`${(0,P.unit)(w.lineWidth)} ${w.lineType} ${w.colorSplit}`,content:'" "'},[L]:{overflowX:"scroll",position:"relative",display:"flex",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},[`${L}-link:first-of-type`]:{paddingInline:0},[`${L}-ink`]:{position:"absolute",bottom:0,transition:`left ${O} ease-in-out, width ${O} ease-in-out`,height:H,backgroundColor:N}}}}},j=w=>({linkPaddingBlock:w.paddingXXS,linkPaddingInlineStart:w.padding});var q=(0,k.I$)("Anchor",w=>{const{fontSize:L,fontSizeLG:O,paddingXXS:H,calc:N}=w,_=(0,R.mergeToken)(w,{holderOffsetBlock:H,anchorPaddingBlockSecondary:N(H).div(2).equal(),anchorTitleBlock:N(L).div(14).mul(3).equal(),anchorBallSize:N(O).div(2).equal()});return[I(_),F(_)]},j);function te(){return window}function X(w,L){if(!w.getClientRects().length)return 0;const O=w.getBoundingClientRect();return O.width||O.height?L===window?O.top-w.ownerDocument.documentElement.clientTop:O.top-L.getBoundingClientRect().top:O.top}const ge=/#([\S ]+)$/;var Ee=w=>{var L;const{rootClassName:O,prefixCls:H,className:N,style:_,offsetTop:g,affix:D=!0,showInkInFixed:V=!1,children:pe,items:Ae,direction:Ce="vertical",bounds:Ne,targetOffset:ze,onClick:Ct,onChange:Rt,getContainer:tt,getCurrentAnchor:bt,replace:Ke}=w,[Gt,ai]=J.useState([]),[ce,Ie]=J.useState(null),ne=J.useRef(ce),Fe=J.useRef(null),Ve=J.useRef(null),qe=J.useRef(!1),{direction:K,getPrefixCls:ae,className:me,style:Se}=(0,$.dj)("anchor"),{getTargetContainer:We}=J.useContext($.E_),Be=ae("anchor",H),xt=(0,b.Z)(Be),[He,mt,Nt]=q(Be,xt),Ot=(L=tt!=null?tt:We)!==null&&L!==void 0?L:te,dt=JSON.stringify(Gt),Zt=(0,M.Z)(Ye=>{Gt.includes(Ye)||ai($e=>[].concat((0,z.Z)($e),[Ye]))}),Mt=(0,M.Z)(Ye=>{Gt.includes(Ye)&&ai($e=>$e.filter(At=>At!==Ye))}),ni=()=>{var Ye;const $e=(Ye=Fe.current)===null||Ye===void 0?void 0:Ye.querySelector(`.${Be}-link-title-active`);if($e&&Ve.current){const{style:At}=Ve.current,ot=Ce==="horizontal";At.top=ot?"":`${$e.offsetTop+$e.clientHeight/2}px`,At.height=ot?"":`${$e.clientHeight}px`,At.left=ot?`${$e.offsetLeft}px`:"",At.width=ot?`${$e.clientWidth}px`:"",ot&&(0,p.Z)($e,{scrollMode:"if-needed",block:"nearest"})}},Yt=function(Ye){let $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,At=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;const ot=[],ji=Ot();return Ye.forEach(ti=>{const _t=ge.exec(ti==null?void 0:ti.toString());if(!_t)return;const lt=document.getElementById(_t[1]);if(lt){const oi=X(lt,ji);oi<=$e+At&&ot.push({link:ti,top:oi})}}),ot.length?ot.reduce((_t,lt)=>lt.top>_t.top?lt:_t).link:""},St=(0,M.Z)(Ye=>{if(ne.current===Ye)return;const $e=typeof bt=="function"?bt(Ye):Ye;Ie($e),ne.current=$e,Rt==null||Rt(Ye)}),Ni=J.useCallback(()=>{if(qe.current)return;const Ye=Yt(Gt,ze!==void 0?ze:g||0,Ne);St(Ye)},[dt,ze,g]),De=J.useCallback(Ye=>{St(Ye);const $e=ge.exec(Ye);if(!$e)return;const At=document.getElementById($e[1]);if(!At)return;const ot=Ot(),ji=(0,ie.Z)(ot),ti=X(At,ot);let _t=ji+ti;_t-=ze!==void 0?ze:g||0,qe.current=!0,(0,Y.Z)(_t,{getContainer:Ot,callback(){qe.current=!1}})},[ze,g]),ke=ee()(mt,Nt,xt,O,`${Be}-wrapper`,{[`${Be}-wrapper-horizontal`]:Ce==="horizontal",[`${Be}-rtl`]:K==="rtl"},N,me),je=ee()(Be,{[`${Be}-fixed`]:!D&&!V}),si=ee()(`${Be}-ink`,{[`${Be}-ink-visible`]:ce}),Xe=Object.assign(Object.assign({maxHeight:g?`calc(100vh - ${g}px)`:"100vh"},Se),_),Qe=Ye=>Array.isArray(Ye)?Ye.map($e=>J.createElement(S,Object.assign({replace:Ke},$e,{key:$e.key}),Ce==="vertical"&&Qe($e.children))):null,pt=J.createElement("div",{ref:Fe,className:ke,style:Xe},J.createElement("div",{className:je},J.createElement("span",{className:si,ref:Ve}),"items"in w?Qe(Ae):pe));J.useEffect(()=>{const Ye=Ot();return Ni(),Ye==null||Ye.addEventListener("scroll",Ni),()=>{Ye==null||Ye.removeEventListener("scroll",Ni)}},[dt]),J.useEffect(()=>{typeof bt=="function"&&St(bt(ne.current||""))},[bt]),J.useEffect(()=>{ni()},[Ce,bt,dt,ce]);const Bt=J.useMemo(()=>({registerLink:Zt,unregisterLink:Mt,scrollTo:De,activeLink:ce,onClick:Ct,direction:Ce}),[ce,Ct,De,Ce]),rt=D&&typeof D=="object"?D:void 0;return He(J.createElement(m.Provider,{value:Bt},D?J.createElement(l.Z,Object.assign({offsetTop:g,target:Ot},rt),pt):pt))};const et=Ee;et.Link=S;var U=et},25769:function(Dt,Me,G){"use strict";var z=G(98040),J={"text/plain":"Text","text/html":"Url",default:"Text"},ye="Copy to clipboard: #{key}, Enter";function ee(p){var ie=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,ie)}function M(p,ie){var Y,l,$,b,y,m,x=!1;ie||(ie={}),Y=ie.debug||!1;try{$=z(),b=document.createRange(),y=document.getSelection(),m=document.createElement("span"),m.textContent=p,m.ariaHidden="true",m.style.all="unset",m.style.position="fixed",m.style.top=0,m.style.clip="rect(0, 0, 0, 0)",m.style.whiteSpace="pre",m.style.webkitUserSelect="text",m.style.MozUserSelect="text",m.style.msUserSelect="text",m.style.userSelect="text",m.addEventListener("copy",function(P){if(P.stopPropagation(),ie.format)if(P.preventDefault(),typeof P.clipboardData=="undefined"){Y&&console.warn("unable to use e.clipboardData"),Y&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var C=J[ie.format]||J.default;window.clipboardData.setData(C,p)}else P.clipboardData.clearData(),P.clipboardData.setData(ie.format,p);ie.onCopy&&(P.preventDefault(),ie.onCopy(P.clipboardData))}),document.body.appendChild(m),b.selectNodeContents(m),y.addRange(b);var S=document.execCommand("copy");if(!S)throw new Error("copy command was unsuccessful");x=!0}catch(P){Y&&console.error("unable to copy using execCommand: ",P),Y&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ie.format||"text",p),ie.onCopy&&ie.onCopy(window.clipboardData),x=!0}catch(C){Y&&console.error("unable to copy using clipboardData: ",C),Y&&console.error("falling back to prompt"),l=ee("message"in ie?ie.message:ye),window.prompt(l,p)}}finally{y&&(typeof y.removeRange=="function"?y.removeRange(b):y.removeAllRanges()),m&&document.body.removeChild(m),$()}return x}Dt.exports=M},53184:function(Dt,Me,G){"use strict";var z,J;function ye(ee,M,p){var ie=function(Y,l){return ee.js_beautify(Y,l)};return ie.js=ee.js_beautify,ie.css=M.css_beautify,ie.html=p.html_beautify,ie.js_beautify=ee.js_beautify,ie.css_beautify=M.css_beautify,ie.html_beautify=p.html_beautify,ie}z=[G(58553),G(87804),G(40998)],J=function(ee,M,p){return ye(ee,M,p)}.apply(Me,z),J!==void 0&&(Dt.exports=J)},87804:function(Dt,Me){var G,z;(function(){var J;(function(){"use strict";var ee=[,,function(Y){function l(y){this.__parent=y,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 y=new l(this.__parent);return y.set_indent(this.__indent_count,this.__alignment_count),y},l.prototype.item=function(y){return y<0?this.__items[this.__items.length+y]:this.__items[y]},l.prototype.has_match=function(y){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(y))return!0;return!1},l.prototype.set_indent=function(y,m){this.is_empty()&&(this.__indent_count=y||0,this.__alignment_count=m||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 y=this.__parent.current_line;return y.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),y.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),y.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,y.__items[0]===" "&&(y.__items.splice(0,1),y.__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(y){this.__items.push(y);var m=y.lastIndexOf(`
`);m!==-1?this.__character_count=y.length-m:this.__character_count+=y.length},l.prototype.pop=function(){var y=null;return this.is_empty()||(y=this.__items.pop(),this.__character_count-=y.length),y},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 y="";return this.is_empty()?this.__parent.indent_empty_lines&&(y=this.__parent.get_indent_string(this.__indent_count)):(y=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),y+=this.__items.join("")),y};function $(y,m){this.__cache=[""],this.__indent_size=y.indent_size,this.__indent_string=y.indent_char,y.indent_with_tabs||(this.__indent_string=new Array(y.indent_size+1).join(y.indent_char)),m=m||"",y.indent_level>0&&(m=new Array(y.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}$.prototype.get_indent_size=function(y,m){var x=this.__base_string_length;return m=m||0,y<0&&(x=0),x+=y*this.__indent_size,x+=m,x},$.prototype.get_indent_string=function(y,m){var x=this.__base_string;return m=m||0,y<0&&(y=0,x=""),m+=y*this.__indent_size,this.__ensure_cache(m),x+=this.__cache[m],x},$.prototype.__ensure_cache=function(y){for(;y>=this.__cache.length;)this.__add_column()},$.prototype.__add_column=function(){var y=this.__cache.length,m=0,x="";this.__indent_size&&y>=this.__indent_size&&(m=Math.floor(y/this.__indent_size),y-=m*this.__indent_size,x=new Array(m+1).join(this.__indent_string)),y&&(x+=new Array(y+1).join(" ")),this.__cache.push(x)};function b(y,m){this.__indent_cache=new $(y,m),this.raw=!1,this._end_with_newline=y.end_with_newline,this.indent_size=y.indent_size,this.wrap_line_length=y.wrap_line_length,this.indent_empty_lines=y.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()}b.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},b.prototype.get_line_number=function(){return this.__lines.length},b.prototype.get_indent_string=function(y,m){return this.__indent_cache.get_indent_string(y,m)},b.prototype.get_indent_size=function(y,m){return this.__indent_cache.get_indent_size(y,m)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(y){return this.is_empty()||!y&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(y){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var x=this.__lines.join(`
`);return y!==`
`&&(x=x.replace(/[\n]/g,y)),x},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(y,m){return y=y||0,m=m||0,this.next_line.set_indent(y,m),this.__lines.length>1?(this.current_line.set_indent(y,m),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(y){for(var m=0;m<y.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(y.whitespace_before),this.current_line.push(y.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(y){this.__add_space_before_token(),this.current_line.push(y),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},b.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},b.prototype.remove_indent=function(y){for(var m=this.__lines.length;y<m;)this.__lines[y]._remove_indent(),y++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(y){for(y=y===void 0?!1:y,this.current_line.trim();y&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},b.prototype.just_added_newline=function(){return this.current_line.is_empty()},b.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},b.prototype.ensure_empty_line_above=function(y,m){for(var x=this.__lines.length-2;x>=0;){var S=this.__lines[x];if(S.is_empty())break;if(S.item(0).indexOf(y)!==0&&S.item(-1)!==m){this.__lines.splice(x+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}x--}},Y.exports.Output=b},,,,function(Y){function l(y,m){this.raw_options=$(y,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(y,m){var x=this.raw_options[y],S=m||[];return typeof x=="object"?x!==null&&typeof x.concat=="function"&&(S=x.concat()):typeof x=="string"&&(S=x.split(/[^a-zA-Z0-9_\/\-]+/)),S},l.prototype._get_boolean=function(y,m){var x=this.raw_options[y],S=x===void 0?!!m:!!x;return S},l.prototype._get_characters=function(y,m){var x=this.raw_options[y],S=m||"";return typeof x=="string"&&(S=x.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},l.prototype._get_number=function(y,m){var x=this.raw_options[y];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(x,10);return isNaN(S)&&(S=m),S},l.prototype._get_selection=function(y,m,x){var S=this._get_selection_list(y,m,x);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+y+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[y]+"'");return S[0]},l.prototype._get_selection_list=function(y,m,x){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(x=x||[m[0]],!this._is_valid_selection(x,m))throw new Error("Invalid Default Value!");var S=this._get_array(y,x);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+y+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[y]+"'");return S},l.prototype._is_valid_selection=function(y,m){return y.length&&m.length&&!y.some(function(x){return m.indexOf(x)===-1})};function $(y,m){var x={};y=b(y);var S;for(S in y)S!==m&&(x[S]=y[S]);if(m&&y[m])for(S in y[m])x[S]=y[m][S];return x}function b(y){var m={},x;for(x in y){var S=x.replace(/-/g,"_");m[S]=y[x]}return m}Y.exports.Options=l,Y.exports.normalizeOpts=b,Y.exports.mergeOpts=$},,function(Y){var l=RegExp.prototype.hasOwnProperty("sticky");function $(b){this.__input=b||"",this.__input_length=this.__input.length,this.__position=0}$.prototype.restart=function(){this.__position=0},$.prototype.back=function(){this.__position>0&&(this.__position-=1)},$.prototype.hasNext=function(){return this.__position<this.__input_length},$.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},$.prototype.peek=function(b){var y=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(y=this.__input.charAt(b)),y},$.prototype.__match=function(b,y){b.lastIndex=y;var m=b.exec(this.__input);return m&&!(l&&b.sticky)&&m.index!==y&&(m=null),m},$.prototype.test=function(b,y){return y=y||0,y+=this.__position,y>=0&&y<this.__input_length?!!this.__match(b,y):!1},$.prototype.testChar=function(b,y){var m=this.peek(y);return b.lastIndex=0,m!==null&&b.test(m)},$.prototype.match=function(b){var y=this.__match(b,this.__position);return y?this.__position+=y[0].length:y=null,y},$.prototype.read=function(b,y,m){var x="",S;return b&&(S=this.match(b),S&&(x+=S[0])),y&&(S||!b)&&(x+=this.readUntil(y,m)),x},$.prototype.readUntil=function(b,y){var m="",x=this.__position;b.lastIndex=this.__position;var S=b.exec(this.__input);return S?(x=S.index,y&&(x+=S[0].length)):x=this.__input_length,m=this.__input.substring(this.__position,x),this.__position=x,m},$.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},$.prototype.get_regexp=function(b,y){var m=null,x="g";return y&&l&&(x="y"),typeof b=="string"&&b!==""?m=new RegExp(b,x):b&&(m=new RegExp(b.source,x)),m},$.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},$.prototype.peekUntilAfter=function(b){var y=this.__position,m=this.readUntilAfter(b);return this.__position=y,m},$.prototype.lookBack=function(b){var y=this.__position-1;return y>=b.length&&this.__input.substring(y-b.length,y).toLowerCase()===b},Y.exports.InputScanner=$},,,,,function(Y){function l($,b){$=typeof $=="string"?$:$.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp($+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp($+/\sbeautify\signore:end\s/.source+b,"g")}l.prototype.get_directives=function($){if(!$.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var y=this.__directive_pattern.exec($);y;)b[y[1]]=y[2],y=this.__directive_pattern.exec($);return b},l.prototype.readIgnored=function($){return $.readUntilAfter(this.__directives_end_ignore_pattern)},Y.exports.Directives=l},,function(Y,l,$){var b=$(16).Beautifier,y=$(17).Options;function m(x,S){var P=new b(x,S);return P.beautify()}Y.exports=m,Y.exports.defaultOptions=function(){return new y}},function(Y,l,$){var b=$(17).Options,y=$(2).Output,m=$(8).InputScanner,x=$(13).Directives,S=new x(/\/\*/,/\*\//),P=/\r\n|[\r\n]/,C=/\r\n|[\r\n]/g,k=/\s/,R=/(?:\s|\n)+/g,I=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,F=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function j(q,te){this._source_text=q||"",this._options=new b(te),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"]}j.prototype.eatString=function(q){var te="";for(this._ch=this._input.next();this._ch;){if(te+=this._ch,this._ch==="\\")te+=this._input.next();else if(q.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return te},j.prototype.eatWhitespace=function(q){for(var te=k.test(this._input.peek()),X=0;k.test(this._input.peek());)this._ch=this._input.next(),q&&this._ch===`
`&&(X===0||X<this._options.max_preserve_newlines)&&(X++,this._output.add_new_line(!0));return te},j.prototype.foundNestedPseudoClass=function(){for(var q=0,te=1,X=this._input.peek(te);X;){if(X==="{")return!0;if(X==="(")q+=1;else if(X===")"){if(q===0)return!1;q-=1}else if(X===";"||X==="}")return!1;te++,X=this._input.peek(te)}return!1},j.prototype.print_string=function(q){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(q)},j.prototype.preserveSingleSpace=function(q){q&&(this._output.space_before_token=!0)},j.prototype.indent=function(){this._indentLevel++},j.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var q=this._source_text,te=this._options.eol;te==="auto"&&(te=`
`,q&&P.test(q||"")&&(te=q.match(P)[0])),q=q.replace(C,`
`);var X=q.match(/^[\t ]*/)[0];this._output=new y(this._options,X),this._input=new m(q),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ge=0,we=!1,Ee=!1,et=!1,U=!1,w=!1,L=this._ch,O=!1,H,N,_;H=this._input.read(R),N=H!=="",_=L,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),L=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var g=this._input.read(I),D=S.get_directives(g);D&&D.ignore==="start"&&(g+=S.readIgnored(this._input)),this.print_string(g),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(F)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(N),this.print_string(this._ch);var V=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);V.match(/[ :]$/)&&(V=this.eatString(": ").replace(/\s+$/,""),this.print_string(V),this._output.space_before_token=!0),ge===0&&V.indexOf(":")!==-1&&(Ee=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(N),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var pe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);pe.match(/[ :]$/)&&(pe=this.eatString(": ").replace(/\s+$/,""),this.print_string(pe),this._output.space_before_token=!0),ge===0&&pe.indexOf(":")!==-1?(Ee=!0,this.indent()):pe in this.NESTED_AT_RULE?(this._nestedLevel+=1,pe in this.CONDITIONAL_GROUP_RULE&&(et=!0)):ge===0&&!Ee&&(U=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(N),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Ee&&(Ee=!1,this.outdent()),U=!1,et?(et=!1,we=this._indentLevel>=this._nestedLevel):we=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&we&&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)):(_==="("?this._output.space_before_token=!1:_!==","&&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(),_==="{"&&this._output.trim(!0),Ee&&(this.outdent(),Ee=!1),this.print_string(this._ch),we=!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 Ae=0;Ae<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Ae++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Ae])){O=!0;break}(we||et)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!U&&ge===0?(this.print_string(":"),Ee||(Ee=!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 Ce=_==='"'||_==="'";this.preserveSingleSpace(Ce||N),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")O=!1,ge===0?(Ee&&(this.outdent(),Ee=!1),U=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),ge++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),ge&&(ge--,this.outdent()));else{var Ne=!1;this._input.lookBack("with")&&(Ne=!0),this.preserveSingleSpace(N||Ne),this.print_string(this._ch),Ee&&_==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),w=!0):(this.eatWhitespace(),ge++,this.indent())}else if(this._ch===")")ge&&(ge--,this.outdent()),w&&this._input.peek()===";"&&this._options.selector_separator_newline&&(w=!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&&(!Ee||w)&&ge===0&&!U?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Ee&&ge===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&k.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(N),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),k.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 ze=_==='"'||_==="'";this.preserveSingleSpace(ze||N),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&O&&this._output.add_new_line()}var Ct=this._output.get_code(te);return Ct},Y.exports.Beautifier=j},function(Y,l,$){var b=$(6).Options;function y(m){b.call(this,m,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var x=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||x;var S=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var P=0;P<S.length;P++)S[P]!=="expand"?this.brace_style="collapse":this.brace_style=S[P]}y.prototype=new b,Y.exports.Options=y}],M={};function p(Y){var l=M[Y];if(l!==void 0)return l.exports;var $=M[Y]={exports:{}};return ee[Y]($,$.exports,p),$.exports}var ie=p(15);J=ie})();var ye=J;G=[],z=function(){return{css_beautify:ye}}.apply(Me,G),z!==void 0&&(Dt.exports=z)})()},40998:function(Dt,Me,G){var z,J;(function(){var ye;(function(){"use strict";var ie=[,,function(b){function y(S){this.__parent=S,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=[]}y.prototype.clone_empty=function(){var S=new y(this.__parent);return S.set_indent(this.__indent_count,this.__alignment_count),S},y.prototype.item=function(S){return S<0?this.__items[this.__items.length+S]:this.__items[S]},y.prototype.has_match=function(S){for(var P=this.__items.length-1;P>=0;P--)if(this.__items[P].match(S))return!0;return!1},y.prototype.set_indent=function(S,P){this.is_empty()&&(this.__indent_count=S||0,this.__alignment_count=P||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},y.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)},y.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},y.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var S=this.__parent.current_line;return S.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),S.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),S.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,S.__items[0]===" "&&(S.__items.splice(0,1),S.__character_count-=1),!0}return!1},y.prototype.is_empty=function(){return this.__items.length===0},y.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},y.prototype.push=function(S){this.__items.push(S);var P=S.lastIndexOf(`
`);P!==-1?this.__character_count=S.length-P:this.__character_count+=S.length},y.prototype.pop=function(){var S=null;return this.is_empty()||(S=this.__items.pop(),this.__character_count-=S.length),S},y.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},y.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},y.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},y.prototype.toString=function(){var S="";return this.is_empty()?this.__parent.indent_empty_lines&&(S=this.__parent.get_indent_string(this.__indent_count)):(S=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),S+=this.__items.join("")),S};function m(S,P){this.__cache=[""],this.__indent_size=S.indent_size,this.__indent_string=S.indent_char,S.indent_with_tabs||(this.__indent_string=new Array(S.indent_size+1).join(S.indent_char)),P=P||"",S.indent_level>0&&(P=new Array(S.indent_level+1).join(this.__indent_string)),this.__base_string=P,this.__base_string_length=P.length}m.prototype.get_indent_size=function(S,P){var C=this.__base_string_length;return P=P||0,S<0&&(C=0),C+=S*this.__indent_size,C+=P,C},m.prototype.get_indent_string=function(S,P){var C=this.__base_string;return P=P||0,S<0&&(S=0,C=""),P+=S*this.__indent_size,this.__ensure_cache(P),C+=this.__cache[P],C},m.prototype.__ensure_cache=function(S){for(;S>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var S=this.__cache.length,P=0,C="";this.__indent_size&&S>=this.__indent_size&&(P=Math.floor(S/this.__indent_size),S-=P*this.__indent_size,C=new Array(P+1).join(this.__indent_string)),S&&(C+=new Array(S+1).join(" ")),this.__cache.push(C)};function x(S,P){this.__indent_cache=new m(S,P),this.raw=!1,this._end_with_newline=S.end_with_newline,this.indent_size=S.indent_size,this.wrap_line_length=S.wrap_line_length,this.indent_empty_lines=S.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new y(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}x.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},x.prototype.get_line_number=function(){return this.__lines.length},x.prototype.get_indent_string=function(S,P){return this.__indent_cache.get_indent_string(S,P)},x.prototype.get_indent_size=function(S,P){return this.__indent_cache.get_indent_size(S,P)},x.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},x.prototype.add_new_line=function(S){return this.is_empty()||!S&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},x.prototype.get_code=function(S){this.trim(!0);var P=this.current_line.pop();P&&(P[P.length-1]===`
`&&(P=P.replace(/\n+$/g,"")),this.current_line.push(P)),this._end_with_newline&&this.__add_outputline();var C=this.__lines.join(`
`);return S!==`
`&&(C=C.replace(/[\n]/g,S)),C},x.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},x.prototype.set_indent=function(S,P){return S=S||0,P=P||0,this.next_line.set_indent(S,P),this.__lines.length>1?(this.current_line.set_indent(S,P),!0):(this.current_line.set_indent(),!1)},x.prototype.add_raw_token=function(S){for(var P=0;P<S.newlines;P++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(S.whitespace_before),this.current_line.push(S.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},x.prototype.add_token=function(S){this.__add_space_before_token(),this.current_line.push(S),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},x.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(" "))},x.prototype.remove_indent=function(S){for(var P=this.__lines.length;S<P;)this.__lines[S]._remove_indent(),S++;this.current_line._remove_wrap_indent()},x.prototype.trim=function(S){for(S=S===void 0?!1:S,this.current_line.trim();S&&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},x.prototype.just_added_newline=function(){return this.current_line.is_empty()},x.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},x.prototype.ensure_empty_line_above=function(S,P){for(var C=this.__lines.length-2;C>=0;){var k=this.__lines[C];if(k.is_empty())break;if(k.item(0).indexOf(S)!==0&&k.item(-1)!==P){this.__lines.splice(C+1,0,new y(this)),this.previous_line=this.__lines[this.__lines.length-2];break}C--}},b.exports.Output=x},function(b){function y(m,x,S,P){this.type=m,this.text=x,this.comments_before=null,this.newlines=S||0,this.whitespace_before=P||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}b.exports.Token=y},,,function(b){function y(S,P){this.raw_options=m(S,P),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"])}y.prototype._get_array=function(S,P){var C=this.raw_options[S],k=P||[];return typeof C=="object"?C!==null&&typeof C.concat=="function"&&(k=C.concat()):typeof C=="string"&&(k=C.split(/[^a-zA-Z0-9_\/\-]+/)),k},y.prototype._get_boolean=function(S,P){var C=this.raw_options[S],k=C===void 0?!!P:!!C;return k},y.prototype._get_characters=function(S,P){var C=this.raw_options[S],k=P||"";return typeof C=="string"&&(k=C.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),k},y.prototype._get_number=function(S,P){var C=this.raw_options[S];P=parseInt(P,10),isNaN(P)&&(P=0);var k=parseInt(C,10);return isNaN(k)&&(k=P),k},y.prototype._get_selection=function(S,P,C){var k=this._get_selection_list(S,P,C);if(k.length!==1)throw new Error("Invalid Option Value: The option '"+S+`' can only be one of the following values:
`+P+`
You passed in: '`+this.raw_options[S]+"'");return k[0]},y.prototype._get_selection_list=function(S,P,C){if(!P||P.length===0)throw new Error("Selection list cannot be empty.");if(C=C||[P[0]],!this._is_valid_selection(C,P))throw new Error("Invalid Default Value!");var k=this._get_array(S,C);if(!this._is_valid_selection(k,P))throw new Error("Invalid Option Value: The option '"+S+`' can contain only the following values:
`+P+`
You passed in: '`+this.raw_options[S]+"'");return k},y.prototype._is_valid_selection=function(S,P){return S.length&&P.length&&!S.some(function(C){return P.indexOf(C)===-1})};function m(S,P){var C={};S=x(S);var k;for(k in S)k!==P&&(C[k]=S[k]);if(P&&S[P])for(k in S[P])C[k]=S[P][k];return C}function x(S){var P={},C;for(C in S){var k=C.replace(/-/g,"_");P[k]=S[C]}return P}b.exports.Options=y,b.exports.normalizeOpts=x,b.exports.mergeOpts=m},,function(b){var y=RegExp.prototype.hasOwnProperty("sticky");function m(x){this.__input=x||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var x=null;return this.hasNext()&&(x=this.__input.charAt(this.__position),this.__position+=1),x},m.prototype.peek=function(x){var S=null;return x=x||0,x+=this.__position,x>=0&&x<this.__input_length&&(S=this.__input.charAt(x)),S},m.prototype.__match=function(x,S){x.lastIndex=S;var P=x.exec(this.__input);return P&&!(y&&x.sticky)&&P.index!==S&&(P=null),P},m.prototype.test=function(x,S){return S=S||0,S+=this.__position,S>=0&&S<this.__input_length?!!this.__match(x,S):!1},m.prototype.testChar=function(x,S){var P=this.peek(S);return x.lastIndex=0,P!==null&&x.test(P)},m.prototype.match=function(x){var S=this.__match(x,this.__position);return S?this.__position+=S[0].length:S=null,S},m.prototype.read=function(x,S,P){var C="",k;return x&&(k=this.match(x),k&&(C+=k[0])),S&&(k||!x)&&(C+=this.readUntil(S,P)),C},m.prototype.readUntil=function(x,S){var P="",C=this.__position;x.lastIndex=this.__position;var k=x.exec(this.__input);return k?(C=k.index,S&&(C+=k[0].length)):C=this.__input_length,P=this.__input.substring(this.__position,C),this.__position=C,P},m.prototype.readUntilAfter=function(x){return this.readUntil(x,!0)},m.prototype.get_regexp=function(x,S){var P=null,C="g";return S&&y&&(C="y"),typeof x=="string"&&x!==""?P=new RegExp(x,C):x&&(P=new RegExp(x.source,C)),P},m.prototype.get_literal_regexp=function(x){return RegExp(x.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(x){var S=this.__position,P=this.readUntilAfter(x);return this.__position=S,P},m.prototype.lookBack=function(x){var S=this.__position-1;return S>=x.length&&this.__input.substring(S-x.length,S).toLowerCase()===x},b.exports.InputScanner=m},function(b,y,m){var x=m(8).InputScanner,S=m(3).Token,P=m(10).TokenStream,C=m(11).WhitespacePattern,k={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},R=function(I,F){this._input=new x(I),this._options=F||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new C(this._input)};R.prototype.tokenize=function(){this._input.restart(),this.__tokens=new P,this._reset();for(var I,F=new S(k.START,""),j=null,q=[],te=new P;F.type!==k.EOF;){for(I=this._get_next_token(F,j);this._is_comment(I);)te.add(I),I=this._get_next_token(F,j);te.isEmpty()||(I.comments_before=te,te=new P),I.parent=j,this._is_opening(I)?(q.push(j),j=I):j&&this._is_closing(I,j)&&(I.opened=j,j.closed=I,j=q.pop(),I.parent=j),I.previous=F,F.next=I,this.__tokens.add(I),F=I}return this.__tokens},R.prototype._is_first_token=function(){return this.__tokens.isEmpty()},R.prototype._reset=function(){},R.prototype._get_next_token=function(I,F){this._readWhitespace();var j=this._input.read(/.+/g);return j?this._create_token(k.RAW,j):this._create_token(k.EOF,"")},R.prototype._is_comment=function(I){return!1},R.prototype._is_opening=function(I){return!1},R.prototype._is_closing=function(I,F){return!1},R.prototype._create_token=function(I,F){var j=new S(I,F,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return j},R.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},b.exports.Tokenizer=R,b.exports.TOKEN=k},function(b){function y(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}y.prototype.restart=function(){this.__position=0},y.prototype.isEmpty=function(){return this.__tokens_length===0},y.prototype.hasNext=function(){return this.__position<this.__tokens_length},y.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},y.prototype.peek=function(m){var x=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(x=this.__tokens[m]),x},y.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},b.exports.TokenStream=y},function(b,y,m){var x=m(12).Pattern;function S(P,C){x.call(this,P,C),C?this._line_regexp=this._input.get_regexp(C._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}S.prototype=new x,S.prototype.__set_whitespace_patterns=function(P,C){P+="\\t ",C+="\\n\\r",this._match_pattern=this._input.get_regexp("["+P+C+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+C+"]")},S.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var P=this._input.read(this._match_pattern);if(P===" ")this.whitespace_before_token=" ";else if(P){var C=this.__split(this._newline_regexp,P);this.newline_count=C.length-1,this.whitespace_before_token=C[this.newline_count]}return P},S.prototype.matching=function(P,C){var k=this._create();return k.__set_whitespace_patterns(P,C),k._update(),k},S.prototype._create=function(){return new S(this._input,this)},S.prototype.__split=function(P,C){P.lastIndex=0;for(var k=0,R=[],I=P.exec(C);I;)R.push(C.substring(k,I.index)),k=I.index+I[0].length,I=P.exec(C);return k<C.length?R.push(C.substring(k,C.length)):R.push(""),R},b.exports.WhitespacePattern=S},function(b){function y(m,x){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,x&&(this._starting_pattern=this._input.get_regexp(x._starting_pattern,!0),this._match_pattern=this._input.get_regexp(x._match_pattern,!0),this._until_pattern=this._input.get_regexp(x._until_pattern),this._until_after=x._until_after)}y.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},y.prototype.read_match=function(){return this._input.match(this._match_pattern)},y.prototype.until_after=function(m){var x=this._create();return x._until_after=!0,x._until_pattern=this._input.get_regexp(m),x._update(),x},y.prototype.until=function(m){var x=this._create();return x._until_after=!1,x._until_pattern=this._input.get_regexp(m),x._update(),x},y.prototype.starting_with=function(m){var x=this._create();return x._starting_pattern=this._input.get_regexp(m,!0),x._update(),x},y.prototype.matching=function(m){var x=this._create();return x._match_pattern=this._input.get_regexp(m,!0),x._update(),x},y.prototype._create=function(){return new y(this._input,this)},y.prototype._update=function(){},b.exports.Pattern=y},function(b){function y(m,x){m=typeof m=="string"?m:m.source,x=typeof x=="string"?x:x.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+x,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+x,"g")}y.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var x={};this.__directive_pattern.lastIndex=0;for(var S=this.__directive_pattern.exec(m);S;)x[S[1]]=S[2],S=this.__directive_pattern.exec(m);return x},y.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},b.exports.Directives=y},function(b,y,m){var x=m(12).Pattern,S={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function P(C,k){x.call(this,C,k),this.__template_pattern=null,this._disabled=Object.assign({},S),this._excluded=Object.assign({},S),k&&(this.__template_pattern=this._input.get_regexp(k.__template_pattern),this._excluded=Object.assign(this._excluded,k._excluded),this._disabled=Object.assign(this._disabled,k._disabled));var R=new x(C);this.__patterns={handlebars_comment:R.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:R.starting_with(/{{{/).until_after(/}}}/),handlebars:R.starting_with(/{{/).until_after(/}}/),php:R.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:R.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:R.starting_with(/{%/).until_after(/%}/),django_value:R.starting_with(/{{/).until_after(/}}/),django_comment:R.starting_with(/{#/).until_after(/#}/),smarty:R.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:R.starting_with(/{\*/).until_after(/\*}/),smarty_literal:R.starting_with(/{literal}/).until_after(/{\/literal}/)}}P.prototype=new x,P.prototype._create=function(){return new P(this._input,this)},P.prototype._update=function(){this.__set_templated_pattern()},P.prototype.disable=function(C){var k=this._create();return k._disabled[C]=!0,k._update(),k},P.prototype.read_options=function(C){var k=this._create();for(var R in S)k._disabled[R]=C.templating.indexOf(R)===-1;return k._update(),k},P.prototype.exclude=function(C){var k=this._create();return k._excluded[C]=!0,k._update(),k},P.prototype.read=function(){var C="";this._match_pattern?C=this._input.read(this._starting_pattern):C=this._input.read(this._starting_pattern,this.__template_pattern);for(var k=this._read_template();k;)this._match_pattern?k+=this._input.read(this._match_pattern):k+=this._input.readUntil(this.__template_pattern),C+=k,k=this._read_template();return this._until_after&&(C+=this._input.readUntilAfter(this._until_pattern)),C},P.prototype.__set_templated_pattern=function(){var C=[];this._disabled.php||C.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||C.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(C.push(this.__patterns.django._starting_pattern.source),C.push(this.__patterns.django_value._starting_pattern.source),C.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||C.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&C.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+C.join("|")+")")},P.prototype._read_template=function(){var C="",k=this._input.peek();if(k==="<"){var R=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&R==="?"&&(C=C||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&R==="%"&&(C=C||this.__patterns.erb.read())}else k==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(C=C||this.__patterns.handlebars_comment.read(),C=C||this.__patterns.handlebars_unescaped.read(),C=C||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(C=C||this.__patterns.django_value.read()),this._excluded.django||(C=C||this.__patterns.django_comment.read(),C=C||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(C=C||this.__patterns.smarty_comment.read(),C=C||this.__patterns.smarty_literal.read(),C=C||this.__patterns.smarty.read()));return C},b.exports.TemplatablePattern=P},,,,function(b,y,m){var x=m(19).Beautifier,S=m(20).Options;function P(C,k,R,I){var F=new x(C,k,R,I);return F.beautify()}b.exports=P,b.exports.defaultOptions=function(){return new S}},function(b,y,m){var x=m(20).Options,S=m(2).Output,P=m(21).Tokenizer,C=m(21).TOKEN,k=/\r\n|[\r\n]/,R=/\r\n|[\r\n]/g,I=function(U,w){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=U.max_preserve_newlines,this.preserve_newlines=U.preserve_newlines,this._output=new S(U,w)};I.prototype.current_line_has_match=function(U){return this._output.current_line.has_match(U)},I.prototype.set_space_before_token=function(U,w){this._output.space_before_token=U,this._output.non_breaking_space=w},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(U){this._output.add_raw_token(U)},I.prototype.print_preserved_newlines=function(U){var w=0;U.type!==C.TEXT&&U.previous.type!==C.TEXT&&(w=U.newlines?1:0),this.preserve_newlines&&(w=U.newlines<this.max_preserve_newlines+1?U.newlines:this.max_preserve_newlines+1);for(var L=0;L<w;L++)this.print_newline(L>0);return w!==0},I.prototype.traverse_whitespace=function(U){return U.whitespace_before||U.newlines?(this.print_preserved_newlines(U)||(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(U){this._output.add_new_line(U)},I.prototype.print_token=function(U){U.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(U.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(U){return U=this.indent_level+(U||0),U<1?"":this._output.get_indent_string(U)};var F=function(U){for(var w=null,L=U.next;L.type!==C.EOF&&U.closed!==L;){if(L.type===C.ATTRIBUTE&&L.text==="type"){L.next&&L.next.type===C.EQUALS&&L.next.next&&L.next.next.type===C.VALUE&&(w=L.next.next.text);break}L=L.next}return w},j=function(U,w){var L=null,O=null;return w.closed?(U==="script"?L="text/javascript":U==="style"&&(L="text/css"),L=F(w)||L,L.search("text/css")>-1?O="css":L.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?O="javascript":L.search(/(text|application|dojo)\/(x-)?(html)/)>-1?O="html":L.search(/test\/null/)>-1&&(O="null"),O):null};function q(U,w){return w.indexOf(U)!==-1}function te(U,w,L){this.parent=U||null,this.tag=w?w.tag_name:"",this.indent_level=L||0,this.parser_token=w||null}function X(U){this._printer=U,this._current_frame=null}X.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},X.prototype.record_tag=function(U){var w=new te(this._current_frame,U,this._printer.indent_level);this._current_frame=w},X.prototype._try_pop_frame=function(U){var w=null;return U&&(w=U.parser_token,this._printer.indent_level=U.indent_level,this._current_frame=U.parent),w},X.prototype._get_frame=function(U,w){for(var L=this._current_frame;L&&U.indexOf(L.tag)===-1;){if(w&&w.indexOf(L.tag)!==-1){L=null;break}L=L.parent}return L},X.prototype.try_pop=function(U,w){var L=this._get_frame([U],w);return this._try_pop_frame(L)},X.prototype.indent_to_tag=function(U){var w=this._get_frame(U);w&&(this._printer.indent_level=w.indent_level)};function ge(U,w,L,O){this._source_text=U||"",w=w||{},this._js_beautify=L,this._css_beautify=O,this._tag_stack=null;var H=new x(w,"html");this._options=H,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}ge.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var U=this._source_text,w=this._options.eol;this._options.eol==="auto"&&(w=`
`,U&&k.test(U)&&(w=U.match(k)[0])),U=U.replace(R,`
`);var L=U.match(/^[\t ]*/)[0],O={text:"",type:""},H=new we(this._options),N=new I(this._options,L),_=new P(U,this._options).tokenize();this._tag_stack=new X(N);for(var g=null,D=_.next();D.type!==C.EOF;)D.type===C.TAG_OPEN||D.type===C.COMMENT?(g=this._handle_tag_open(N,D,H,O,_),H=g):D.type===C.ATTRIBUTE||D.type===C.EQUALS||D.type===C.VALUE||D.type===C.TEXT&&!H.tag_complete?g=this._handle_inside_tag(N,D,H,O):D.type===C.TAG_CLOSE?g=this._handle_tag_close(N,D,H):D.type===C.TEXT?g=this._handle_text(N,D,H):D.type===C.CONTROL_FLOW_OPEN?g=this._handle_control_flow_open(N,D):D.type===C.CONTROL_FLOW_CLOSE?g=this._handle_control_flow_close(N,D):N.add_raw_token(D),O=g,D=_.next();var V=N._output.get_code(w);return V},ge.prototype._handle_control_flow_open=function(U,w){var L={text:w.text,type:w.type};return U.set_space_before_token(w.newlines||w.whitespace_before!=="",!0),w.newlines?U.print_preserved_newlines(w):U.set_space_before_token(w.newlines||w.whitespace_before!=="",!0),U.print_token(w),U.indent(),L},ge.prototype._handle_control_flow_close=function(U,w){var L={text:w.text,type:w.type};return U.deindent(),w.newlines?U.print_preserved_newlines(w):U.set_space_before_token(w.newlines||w.whitespace_before!=="",!0),U.print_token(w),L},ge.prototype._handle_tag_close=function(U,w,L){var O={text:w.text,type:w.type};return U.alignment_size=0,L.tag_complete=!0,U.set_space_before_token(w.newlines||w.whitespace_before!=="",!0),L.is_unformatted?U.add_raw_token(w):(L.tag_start_char==="<"&&(U.set_space_before_token(w.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&L.has_wrapped_attrs&&U.print_newline(!1)),U.print_token(w)),L.indent_content&&!(L.is_unformatted||L.is_content_unformatted)&&(U.indent(),L.indent_content=!1),!L.is_inline_element&&!(L.is_unformatted||L.is_content_unformatted)&&U.set_wrap_point(),O},ge.prototype._handle_inside_tag=function(U,w,L,O){var H=L.has_wrapped_attrs,N={text:w.text,type:w.type};return U.set_space_before_token(w.newlines||w.whitespace_before!=="",!0),L.is_unformatted?U.add_raw_token(w):L.tag_start_char==="{"&&w.type===C.TEXT?U.print_preserved_newlines(w)?(w.newlines=0,U.add_raw_token(w)):U.print_token(w):(w.type===C.ATTRIBUTE?U.set_space_before_token(!0):(w.type===C.EQUALS||w.type===C.VALUE&&w.previous.type===C.EQUALS)&&U.set_space_before_token(!1),w.type===C.ATTRIBUTE&&L.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(U.traverse_whitespace(w),H=H||w.newlines!==0),this._is_wrap_attributes_force&&L.attr_count>=this._options.wrap_attributes_min_attrs&&(O.type!==C.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(U.print_newline(!1),H=!0)),U.print_token(w),H=H||U.previous_token_wrapped(),L.has_wrapped_attrs=H),N},ge.prototype._handle_text=function(U,w,L){var O={text:w.text,type:"TK_CONTENT"};return L.custom_beautifier_name?this._print_custom_beatifier_text(U,w,L):L.is_unformatted||L.is_content_unformatted?U.add_raw_token(w):(U.traverse_whitespace(w),U.print_token(w)),O},ge.prototype._print_custom_beatifier_text=function(U,w,L){var O=this;if(w.text!==""){var H=w.text,N,_=1,g="",D="";L.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?N=this._js_beautify:L.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?N=this._css_beautify:L.custom_beautifier_name==="html"&&(N=function(ze,Ct){var Rt=new ge(ze,Ct,O._js_beautify,O._css_beautify);return Rt.beautify()}),this._options.indent_scripts==="keep"?_=0:this._options.indent_scripts==="separate"&&(_=-U.indent_level);var V=U.get_full_indent(_);if(H=H.replace(/\n[ \t]*$/,""),L.custom_beautifier_name!=="html"&&H[0]==="<"&&H.match(/^(<!--|<!\[CDATA\[)/)){var pe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(H);if(!pe){U.add_raw_token(w);return}g=V+pe[1]+`
`,H=pe[4],pe[5]&&(D=V+pe[5]),H=H.replace(/\n[ \t]*$/,""),(pe[2]||pe[3].indexOf(`
`)!==-1)&&(pe=pe[3].match(/[ \t]+$/),pe&&(w.whitespace_before=pe[0]))}if(H)if(N){var Ae=function(){this.eol=`
`};Ae.prototype=this._options.raw_options;var Ce=new Ae;H=N(V+H,Ce)}else{var Ne=w.whitespace_before;Ne&&(H=H.replace(new RegExp(`
(`+Ne+")?","g"),`
`)),H=V+H.replace(/\n/g,`
`+V)}g&&(H?H=g+H+`
`+D:H=g+D),U.print_newline(!1),H&&(w.text=H,w.whitespace_before="",w.newlines=0,U.add_raw_token(w),U.print_newline(!0))}},ge.prototype._handle_tag_open=function(U,w,L,O,H){var N=this._get_tag_open_token(w);if((L.is_unformatted||L.is_content_unformatted)&&!L.is_empty_element&&w.type===C.TAG_OPEN&&!N.is_start_tag?(U.add_raw_token(w),N.start_tag_token=this._tag_stack.try_pop(N.tag_name)):(U.traverse_whitespace(w),this._set_tag_position(U,w,N,L,O),N.is_inline_element||U.set_wrap_point(),U.print_token(w)),N.is_start_tag&&this._is_wrap_attributes_force){var _=0,g;do g=H.peek(_),g.type===C.ATTRIBUTE&&(N.attr_count+=1),_+=1;while(g.type!==C.EOF&&g.type!==C.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(N.alignment_size=w.text.length+1),!N.tag_complete&&!N.is_unformatted&&(U.alignment_size=N.alignment_size),N};var we=function(U,w,L){if(this.parent=w||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="",!L)this.tag_complete=!0;else{var O;this.tag_start_char=L.text[0],this.text=L.text,this.tag_start_char==="<"?(O=L.text.match(/^<([^\s>]*)/),this.tag_check=O?O[1]:""):(O=L.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=O?O[1]:"",(L.text.startsWith("{{#>")||L.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&L.next!==null?this.tag_check=L.next.text.split(" ")[0]:this.tag_check=L.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),L.type===C.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||L.closed&&L.closed.text==="/>";var H=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(H=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!U.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(H)))}};ge.prototype._get_tag_open_token=function(U){var w=new we(this._options,this._tag_stack.get_parser_token(),U);return w.alignment_size=this._options.wrap_attributes_indent_size,w.is_end_tag=w.is_end_tag||q(w.tag_check,this._options.void_elements),w.is_empty_element=w.tag_complete||w.is_start_tag&&w.is_end_tag,w.is_unformatted=!w.tag_complete&&q(w.tag_check,this._options.unformatted),w.is_content_unformatted=!w.is_empty_element&&q(w.tag_check,this._options.content_unformatted),w.is_inline_element=q(w.tag_name,this._options.inline)||this._options.inline_custom_elements&&w.tag_name.includes("-")||w.tag_start_char==="{",w},ge.prototype._set_tag_position=function(U,w,L,O,H){if(L.is_empty_element||(L.is_end_tag?L.start_tag_token=this._tag_stack.try_pop(L.tag_name):(this._do_optional_end_element(L)&&(L.is_inline_element||U.print_newline(!1)),this._tag_stack.record_tag(L),(L.tag_name==="script"||L.tag_name==="style")&&!(L.is_unformatted||L.is_content_unformatted)&&(L.custom_beautifier_name=j(L.tag_check,w)))),q(L.tag_check,this._options.extra_liners)&&(U.print_newline(!1),U._output.just_added_blankline()||U.print_newline(!0)),L.is_empty_element){if(L.tag_start_char==="{"&&L.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),L.indent_content=!0;var N=U.current_line_has_match(/{{#if/);N||U.print_newline(!1)}L.tag_name==="!--"&&H.type===C.TAG_CLOSE&&O.is_end_tag&&L.text.indexOf(`
`)===-1||(L.is_inline_element||L.is_unformatted||U.print_newline(!1),this._calcluate_parent_multiline(U,L))}else if(L.is_end_tag){var _=!1;_=L.start_tag_token&&L.start_tag_token.multiline_content,_=_||!L.is_inline_element&&!(O.is_inline_element||O.is_unformatted)&&!(H.type===C.TAG_CLOSE&&L.start_tag_token===O)&&H.type!=="TK_CONTENT",(L.is_content_unformatted||L.is_unformatted)&&(_=!1),_&&U.print_newline(!1)}else L.indent_content=!L.custom_beautifier_name,L.tag_start_char==="<"&&(L.tag_name==="html"?L.indent_content=this._options.indent_inner_html:L.tag_name==="head"?L.indent_content=this._options.indent_head_inner_html:L.tag_name==="body"&&(L.indent_content=this._options.indent_body_inner_html)),!(L.is_inline_element||L.is_unformatted)&&(H.type!=="TK_CONTENT"||L.is_content_unformatted)&&U.print_newline(!1),this._calcluate_parent_multiline(U,L)},ge.prototype._calcluate_parent_multiline=function(U,w){w.parent&&U._output.just_added_newline()&&!((w.is_inline_element||w.is_unformatted)&&w.parent.is_inline_element)&&(w.parent.multiline_content=!0)};var Ee=["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"],et=["a","audio","del","ins","map","noscript","video"];ge.prototype._do_optional_end_element=function(U){var w=null;if(!(U.is_empty_element||!U.is_start_tag||!U.parent)){if(U.tag_name==="body")w=w||this._tag_stack.try_pop("head");else if(U.tag_name==="li")w=w||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(U.tag_name==="dd"||U.tag_name==="dt")w=w||this._tag_stack.try_pop("dt",["dl"]),w=w||this._tag_stack.try_pop("dd",["dl"]);else if(U.parent.tag_name==="p"&&Ee.indexOf(U.tag_name)!==-1){var L=U.parent.parent;(!L||et.indexOf(L.tag_name)===-1)&&(w=w||this._tag_stack.try_pop("p"))}else U.tag_name==="rp"||U.tag_name==="rt"?(w=w||this._tag_stack.try_pop("rt",["ruby","rtc"]),w=w||this._tag_stack.try_pop("rp",["ruby","rtc"])):U.tag_name==="optgroup"?w=w||this._tag_stack.try_pop("optgroup",["select"]):U.tag_name==="option"?w=w||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):U.tag_name==="colgroup"?w=w||this._tag_stack.try_pop("caption",["table"]):U.tag_name==="thead"?(w=w||this._tag_stack.try_pop("caption",["table"]),w=w||this._tag_stack.try_pop("colgroup",["table"])):U.tag_name==="tbody"||U.tag_name==="tfoot"?(w=w||this._tag_stack.try_pop("caption",["table"]),w=w||this._tag_stack.try_pop("colgroup",["table"]),w=w||this._tag_stack.try_pop("thead",["table"]),w=w||this._tag_stack.try_pop("tbody",["table"])):U.tag_name==="tr"?(w=w||this._tag_stack.try_pop("caption",["table"]),w=w||this._tag_stack.try_pop("colgroup",["table"]),w=w||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(U.tag_name==="th"||U.tag_name==="td")&&(w=w||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),w=w||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return U.parent=this._tag_stack.get_parser_token(),w}},b.exports.Beautifier=ge},function(b,y,m){var x=m(6).Options;function S(P){x.call(this,P,"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"])}S.prototype=new x,b.exports.Options=S},function(b,y,m){var x=m(9).Tokenizer,S=m(9).TOKEN,P=m(13).Directives,C=m(14).TemplatablePattern,k=m(12).Pattern,R={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:S.START,RAW:S.RAW,EOF:S.EOF},I=new P(/<\!--/,/-->/),F=function(j,q){x.call(this,j,q),this._current_tag_name="";var te=new C(this._input).read_options(this._options),X=new k(this._input);if(this.__patterns={word:te.until(/[\n\r\t <]/),word_control_flow_close_excluded:te.until(/[\n\r\t <}]/),single_quote:te.until_after(/'/),double_quote:te.until_after(/"/),attribute:te.until(/[\n\r\t =>]|\/>/),element_name:te.until(/[\n\r\t >\/]/),angular_control_flow_start:X.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:X.starting_with(/{{!--/).until_after(/--}}/),handlebars:X.starting_with(/{{/).until_after(/}}/),handlebars_open:X.until(/[\n\r\t }]/),handlebars_raw_close:X.until(/}}/),comment:X.starting_with(/<!--/).until_after(/-->/),cdata:X.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:X.starting_with(/<!\[/).until_after(/]>/),processing:X.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"),this.__patterns.word_control_flow_close_excluded=this.__patterns.word_control_flow_close_excluded.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var ge=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=X.matching(ge).until_after(ge)}};F.prototype=new x,F.prototype._is_comment=function(j){return!1},F.prototype._is_opening=function(j){return j.type===R.TAG_OPEN||j.type===R.CONTROL_FLOW_OPEN},F.prototype._is_closing=function(j,q){return j.type===R.TAG_CLOSE&&q&&((j.text===">"||j.text==="/>")&&q.text[0]==="<"||j.text==="}}"&&q.text[0]==="{"&&q.text[1]==="{")||j.type===R.CONTROL_FLOW_CLOSE&&j.text==="}"&&q.text.endsWith("{")},F.prototype._reset=function(){this._current_tag_name=""},F.prototype._get_next_token=function(j,q){var te=null;this._readWhitespace();var X=this._input.peek();return X===null?this._create_token(R.EOF,""):(te=te||this._read_open_handlebars(X,q),te=te||this._read_attribute(X,j,q),te=te||this._read_close(X,q),te=te||this._read_script_and_style(X,j),te=te||this._read_control_flows(X,q),te=te||this._read_raw_content(X,j,q),te=te||this._read_content_word(X,q),te=te||this._read_comment_or_cdata(X),te=te||this._read_processing(X),te=te||this._read_open(X,q),te=te||this._create_token(R.UNKNOWN,this._input.next()),te)},F.prototype._read_comment_or_cdata=function(j){var q=null,te=null,X=null;if(j==="<"){var ge=this._input.peek(1);ge==="!"&&(te=this.__patterns.comment.read(),te?(X=I.get_directives(te),X&&X.ignore==="start"&&(te+=I.readIgnored(this._input))):te=this.__patterns.cdata.read()),te&&(q=this._create_token(R.COMMENT,te),q.directives=X)}return q},F.prototype._read_processing=function(j){var q=null,te=null,X=null;if(j==="<"){var ge=this._input.peek(1);(ge==="!"||ge==="?")&&(te=this.__patterns.conditional_comment.read(),te=te||this.__patterns.processing.read()),te&&(q=this._create_token(R.COMMENT,te),q.directives=X)}return q},F.prototype._read_open=function(j,q){var te=null,X=null;return(!q||q.type===R.CONTROL_FLOW_OPEN)&&j==="<"&&(te=this._input.next(),this._input.peek()==="/"&&(te+=this._input.next()),te+=this.__patterns.element_name.read(),X=this._create_token(R.TAG_OPEN,te)),X},F.prototype._read_open_handlebars=function(j,q){var te=null,X=null;return(!q||q.type===R.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&j==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(te=this.__patterns.handlebars_comment.read(),te=te||this.__patterns.handlebars.read(),X=this._create_token(R.COMMENT,te)):(te=this.__patterns.handlebars_open.read(),X=this._create_token(R.TAG_OPEN,te))),X},F.prototype._read_control_flows=function(j,q){var te="",X=null;if(!this._options.templating.includes("angular"))return X;if(j==="@"){if(te=this.__patterns.angular_control_flow_start.read(),te==="")return X;for(var ge=te.endsWith("(")?1:0,we=0;!(te.endsWith("{")&&ge===we);){var Ee=this._input.next();if(Ee===null)break;Ee==="("?ge++:Ee===")"&&we++,te+=Ee}X=this._create_token(R.CONTROL_FLOW_OPEN,te)}else j==="}"&&q&&q.type===R.CONTROL_FLOW_OPEN&&(te=this._input.next(),X=this._create_token(R.CONTROL_FLOW_CLOSE,te));return X},F.prototype._read_close=function(j,q){var te=null,X=null;return q&&q.type===R.TAG_OPEN&&(q.text[0]==="<"&&(j===">"||j==="/"&&this._input.peek(1)===">")?(te=this._input.next(),j==="/"&&(te+=this._input.next()),X=this._create_token(R.TAG_CLOSE,te)):q.text[0]==="{"&&j==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),X=this._create_token(R.TAG_CLOSE,"}}"))),X},F.prototype._read_attribute=function(j,q,te){var X=null,ge="";if(te&&te.text[0]==="<")if(j==="=")X=this._create_token(R.EQUALS,this._input.next());else if(j==='"'||j==="'"){var we=this._input.next();j==='"'?we+=this.__patterns.double_quote.read():we+=this.__patterns.single_quote.read(),X=this._create_token(R.VALUE,we)}else ge=this.__patterns.attribute.read(),ge&&(q.type===R.EQUALS?X=this._create_token(R.VALUE,ge):X=this._create_token(R.ATTRIBUTE,ge));return X},F.prototype._is_content_unformatted=function(j){return this._options.void_elements.indexOf(j)===-1&&(this._options.content_unformatted.indexOf(j)!==-1||this._options.unformatted.indexOf(j)!==-1)},F.prototype._read_raw_content=function(j,q,te){var X="";if(te&&te.text[0]==="{")X=this.__patterns.handlebars_raw_close.read();else if(q.type===R.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var ge=q.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ge)&&(X=this._input.readUntil(new RegExp("</"+ge+"[\\n\\r\\t ]*?>","ig")))}return X?this._create_token(R.TEXT,X):null},F.prototype._read_script_and_style=function(j,q){if(q.type===R.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var te=q.opened.text.substr(1).toLowerCase();if(te==="script"||te==="style"){var X=this._read_comment_or_cdata(j);if(X)return X.type=R.TEXT,X;var ge=this._input.readUntil(new RegExp("</"+te+"[\\n\\r\\t ]*?>","ig"));if(ge)return this._create_token(R.TEXT,ge)}}return null},F.prototype._read_content_word=function(j,q){var te="";return this._options.unformatted_content_delimiter&&j===this._options.unformatted_content_delimiter[0]&&(te=this.__patterns.unformatted_content_delimiter.read()),te||(te=q&&q.type===R.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),te?this._create_token(R.TEXT,te):null},b.exports.Tokenizer=F,b.exports.TOKEN=R}],Y={};function l(b){var y=Y[b];if(y!==void 0)return y.exports;var m=Y[b]={exports:{}};return ie[b](m,m.exports,l),m.exports}var $=l(18);ye=$})();var ee=ye;if(1)z=[G,G(58553),G(87804)],J=function(ie){var Y=G(58553),l=G(87804);return{html_beautify:function($,b){return ee($,b,Y.js_beautify,l.css_beautify)}}}.apply(Me,z),J!==void 0&&(Dt.exports=J);else var M,p})()},58553:function(Dt,Me){var G,z;(function(){var J;(function(){"use strict";var ee=[function(Y,l,$){var b=$(1).Beautifier,y=$(5).Options;function m(x,S){var P=new b(x,S);return P.beautify()}Y.exports=m,Y.exports.defaultOptions=function(){return new y}},function(Y,l,$){var b=$(2).Output,y=$(3).Token,m=$(4),x=$(5).Options,S=$(7).Tokenizer,P=$(7).line_starters,C=$(7).positionable_operators,k=$(7).TOKEN;function R(g,D){return D.indexOf(g)!==-1}function I(g){return g.replace(/^\s+/g,"")}function F(g){for(var D={},V=0;V<g.length;V++)D[g[V].replace(/-/g,"_")]=g[V];return D}function j(g,D){return g&&g.type===k.RESERVED&&g.text===D}function q(g,D){return g&&g.type===k.RESERVED&&R(g.text,D)}var te=["case","return","do","if","throw","else","await","break","continue","async"],X=["before-newline","after-newline","preserve-newline"],ge=F(X),we=[ge.before_newline,ge.preserve_newline],Ee={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function et(g,D){D.multiline_frame||D.mode===Ee.ForInitializer||D.mode===Ee.Conditional||g.remove_indent(D.start_line_index)}function U(g){g=g.replace(m.allLineBreaks,`
`);for(var D=[],V=g.indexOf(`
`);V!==-1;)D.push(g.substring(0,V)),g=g.substring(V+1),V=g.indexOf(`
`);return g.length&&D.push(g),D}function w(g){return g===Ee.ArrayLiteral}function L(g){return R(g,[Ee.Expression,Ee.ForInitializer,Ee.Conditional])}function O(g,D){for(var V=0;V<g.length;V++){var pe=g[V].trim();if(pe.charAt(0)!==D)return!1}return!0}function H(g,D){for(var V=0,pe=g.length,Ae;V<pe;V++)if(Ae=g[V],Ae&&Ae.indexOf(D)!==0)return!1;return!0}function N(g,D){D=D||{},this._source_text=g||"",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 x(D)}N.prototype.create_flags=function(g,D){var V=0;g&&(V=g.indentation_level,!this._output.just_added_newline()&&g.line_indent_level>V&&(V=g.line_indent_level));var pe={mode:D,parent:g,last_token:g?g.last_token:new y(k.START_BLOCK,""),last_word:g?g.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:V,alignment:0,line_indent_level:g?g.line_indent_level:V,start_line_index:this._output.get_line_number(),ternary_depth:0};return pe},N.prototype._reset=function(g){var D=g.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new b(this._options,D),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Ee.BlockStatement);var V=new S(g,this._options);return this._tokens=V.tokenize(),g},N.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var g,D=this._reset(this._source_text),V=this._options.eol;this._options.eol==="auto"&&(V=`
`,D&&m.lineBreak.test(D||"")&&(V=D.match(m.lineBreak)[0]));for(var pe=this._tokens.next();pe;)this.handle_token(pe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=pe,pe=this._tokens.next();return g=this._output.get_code(V),g},N.prototype.handle_token=function(g,D){g.type===k.START_EXPR?this.handle_start_expr(g):g.type===k.END_EXPR?this.handle_end_expr(g):g.type===k.START_BLOCK?this.handle_start_block(g):g.type===k.END_BLOCK?this.handle_end_block(g):g.type===k.WORD?this.handle_word(g):g.type===k.RESERVED?this.handle_word(g):g.type===k.SEMICOLON?this.handle_semicolon(g):g.type===k.STRING?this.handle_string(g):g.type===k.EQUALS?this.handle_equals(g):g.type===k.OPERATOR?this.handle_operator(g):g.type===k.COMMA?this.handle_comma(g):g.type===k.BLOCK_COMMENT?this.handle_block_comment(g,D):g.type===k.COMMENT?this.handle_comment(g,D):g.type===k.DOT?this.handle_dot(g):g.type===k.EOF?this.handle_eof(g):g.type===k.UNKNOWN?this.handle_unknown(g,D):this.handle_unknown(g,D)},N.prototype.handle_whitespace_and_comments=function(g,D){var V=g.newlines,pe=this._options.keep_array_indentation&&w(this._flags.mode);if(g.comments_before)for(var Ae=g.comments_before.next();Ae;)this.handle_whitespace_and_comments(Ae,D),this.handle_token(Ae,D),Ae=g.comments_before.next();if(pe)for(var Ce=0;Ce<V;Ce+=1)this.print_newline(Ce>0,D);else if(this._options.max_preserve_newlines&&V>this._options.max_preserve_newlines&&(V=this._options.max_preserve_newlines),this._options.preserve_newlines&&V>1){this.print_newline(!1,D);for(var Ne=1;Ne<V;Ne+=1)this.print_newline(!0,D)}};var _=["async","break","continue","return","throw","yield"];N.prototype.allow_wrap_or_preserved_newline=function(g,D){if(D=D===void 0?!1:D,!this._output.just_added_newline()){var V=this._options.preserve_newlines&&g.newlines||D,pe=R(this._flags.last_token.text,C)||R(g.text,C);if(pe){var Ae=R(this._flags.last_token.text,C)&&R(this._options.operator_position,we)||R(g.text,C);V=V&&Ae}if(V)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(q(this._flags.last_token,_))return;this._output.set_wrap_point()}}},N.prototype.print_newline=function(g,D){if(!D&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==k.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var V=this._tokens.peek();this._flags.mode===Ee.Statement&&!(this._flags.if_block&&j(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(g)&&(this._flags.multiline_frame=!0)},N.prototype.print_token_line_indentation=function(g){this._output.just_added_newline()&&(this._options.keep_array_indentation&&g.newlines&&(g.text==="["||w(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(g.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))},N.prototype.print_token=function(g){if(this._output.raw){this._output.add_raw_token(g);return}if(this._options.comma_first&&g.previous&&g.previous.type===k.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var D=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(D),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(g),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(g),this._output.non_breaking_space=!0,this._output.add_token(g.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},N.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},N.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))},N.prototype.set_mode=function(g){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,g),this._flags=this.create_flags(this._previous_flags,g),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},N.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Ee.Statement&&et(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},N.prototype.start_of_object_property=function(){return this._flags.parent.mode===Ee.ObjectLiteral&&this._flags.mode===Ee.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"]))},N.prototype.start_of_statement=function(g){var D=!1;return D=D||q(this._flags.last_token,["var","let","const"])&&g.type===k.WORD,D=D||j(this._flags.last_token,"do"),D=D||!(this._flags.parent.mode===Ee.ObjectLiteral&&this._flags.mode===Ee.Statement)&&q(this._flags.last_token,_)&&!g.newlines,D=D||j(this._flags.last_token,"else")&&!(j(g,"if")&&!g.comments_before),D=D||this._flags.last_token.type===k.END_EXPR&&(this._previous_flags.mode===Ee.ForInitializer||this._previous_flags.mode===Ee.Conditional),D=D||this._flags.last_token.type===k.WORD&&this._flags.mode===Ee.BlockStatement&&!this._flags.in_case&&!(g.text==="--"||g.text==="++")&&this._last_last_text!=="function"&&g.type!==k.WORD&&g.type!==k.RESERVED,D=D||this._flags.mode===Ee.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"])),D?(this.set_mode(Ee.Statement),this.indent(),this.handle_whitespace_and_comments(g,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g,q(g,["do","for","if","while"])),!0):!1},N.prototype.handle_start_expr=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g);var D=Ee.Expression;if(g.text==="["){if(this._flags.last_token.type===k.WORD||this._flags.last_token.text===")"){q(this._flags.last_token,P)&&(this._output.space_before_token=!0),this.print_token(g),this.set_mode(D),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}D=Ee.ArrayLiteral,w(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()),R(this._flags.last_token.type,[k.START_EXPR,k.END_EXPR,k.WORD,k.OPERATOR,k.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===k.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,D=Ee.ForInitializer):R(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,D=Ee.Conditional):R(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&g.whitespace_before===""?this._output.space_before_token=!1:(R(this._flags.last_token.text,P)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===k.EQUALS||this._flags.last_token.type===k.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g);else if(this._flags.last_token.type===k.WORD){this._output.space_before_token=!1;var V=this._tokens.peek(-3);if(this._options.space_after_named_function&&V){var pe=this._tokens.peek(-4);q(V,["async","function"])||V.text==="*"&&q(pe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Ee.ObjectLiteral?(V.text==="{"||V.text===","||V.text==="*"&&(pe.text==="{"||pe.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(g);(this._flags.last_token.type===k.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(R(this._last_last_text,["function","yield"])||this._flags.mode===Ee.ObjectLiteral&&R(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===k.START_BLOCK?this.print_newline():(this._flags.last_token.type===k.END_EXPR||this._flags.last_token.type===k.START_EXPR||this._flags.last_token.type===k.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===k.COMMA)&&this.allow_wrap_or_preserved_newline(g,g.newlines),this.print_token(g),this.set_mode(D),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},N.prototype.handle_end_expr=function(g){for(;this._flags.mode===Ee.Statement;)this.restore_mode();this.handle_whitespace_and_comments(g),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(g,g.text==="]"&&w(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===k.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(g),this.restore_mode(),et(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Ee.Conditional&&(this._previous_flags.mode=Ee.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},N.prototype.handle_start_block=function(g){this.handle_whitespace_and_comments(g);var D=this._tokens.peek(),V=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===k.END_EXPR?(this.set_mode(Ee.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Ee.BlockStatement):V&&(R(V.text,[":",","])&&R(D.type,[k.STRING,k.WORD,k.RESERVED])||R(D.text,["get","set","..."])&&R(V.type,[k.WORD,k.RESERVED]))?R(this._last_last_text,["class","interface"])&&!R(V.text,[":",","])?this.set_mode(Ee.BlockStatement):this.set_mode(Ee.ObjectLiteral):this._flags.last_token.type===k.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Ee.BlockStatement):R(this._flags.last_token.type,[k.EQUALS,k.START_EXPR,k.COMMA,k.OPERATOR])||q(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Ee.ObjectLiteral):this.set_mode(Ee.BlockStatement),this._flags.last_token&&q(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var pe=!D.comments_before&&D.text==="}",Ae=pe&&this._flags.last_word==="function"&&this._flags.last_token.type===k.END_EXPR;if(this._options.brace_preserve_inline){var Ce=0,Ne=null;this._flags.inline_frame=!0;do if(Ce+=1,Ne=this._tokens.peek(Ce-1),Ne.newlines){this._flags.inline_frame=!1;break}while(Ne.type!==k.EOF&&!(Ne.type===k.END_BLOCK&&Ne.opened===g))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&g.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==k.OPERATOR&&(Ae||this._flags.last_token.type===k.EQUALS||q(this._flags.last_token,te)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(w(this._previous_flags.mode)&&(this._flags.last_token.type===k.START_EXPR||this._flags.last_token.type===k.COMMA)&&((this._flags.last_token.type===k.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===k.COMMA||this._flags.last_token.type===k.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(g),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==k.OPERATOR&&this._flags.last_token.type!==k.START_EXPR&&(R(this._flags.last_token.type,[k.START_BLOCK,k.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(g),this.indent(),!pe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},N.prototype.handle_end_block=function(g){for(this.handle_whitespace_and_comments(g);this._flags.mode===Ee.Statement;)this.restore_mode();var D=this._flags.last_token.type===k.START_BLOCK;this._flags.inline_frame&&!D?this._output.space_before_token=!0:this._options.brace_style==="expand"?D||this.print_newline():D||(w(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(g)},N.prototype.handle_word=function(g){if(g.type===k.RESERVED){if(R(g.text,["set","get"])&&this._flags.mode!==Ee.ObjectLiteral)g.type=k.WORD;else if(g.text==="import"&&R(this._tokens.peek().text,["(","."]))g.type=k.WORD;else if(R(g.text,["as","from"])&&!this._flags.import_block)g.type=k.WORD;else if(this._flags.mode===Ee.ObjectLiteral){var D=this._tokens.peek();D.text===":"&&(g.type=k.WORD)}}if(this.start_of_statement(g)?q(this._flags.last_token,["var","let","const"])&&g.type===k.WORD&&(this._flags.declaration_statement=!0):g.newlines&&!L(this._flags.mode)&&(this._flags.last_token.type!==k.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==k.EQUALS&&(this._options.preserve_newlines||!q(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(g),this.print_newline()):this.handle_whitespace_and_comments(g),this._flags.do_block&&!this._flags.do_while)if(j(g,"while")){this._output.space_before_token=!0,this.print_token(g),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&&j(g,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Ee.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&q(g,["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(g),this._flags.in_case=!0;return}if((this._flags.last_token.type===k.COMMA||this._flags.last_token.type===k.START_EXPR||this._flags.last_token.type===k.EQUALS||this._flags.last_token.type===k.OPERATOR)&&!this.start_of_object_property()&&!(R(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===Ee.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(g),j(g,"function")){(R(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(R(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===k.OPERATOR))&&!this._output.just_added_blankline()&&!g.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===k.RESERVED||this._flags.last_token.type===k.WORD?q(this._flags.last_token,["get","set","new","export"])||q(this._flags.last_token,_)?this._output.space_before_token=!0:j(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===k.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(L(this._flags.mode)||w(this._flags.mode))||this.print_newline(),this.print_token(g),this._flags.last_word=g.text;return}var V="NONE";if(this._flags.last_token.type===k.END_BLOCK?this._previous_flags.inline_frame?V="SPACE":q(g,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&g.newlines?V="NEWLINE":(V="SPACE",this._output.space_before_token=!0):V="NEWLINE":this._flags.last_token.type===k.SEMICOLON&&this._flags.mode===Ee.BlockStatement?V="NEWLINE":this._flags.last_token.type===k.SEMICOLON&&L(this._flags.mode)?V="SPACE":this._flags.last_token.type===k.STRING?V="NEWLINE":this._flags.last_token.type===k.RESERVED||this._flags.last_token.type===k.WORD||this._flags.last_token.text==="*"&&(R(this._last_last_text,["function","yield"])||this._flags.mode===Ee.ObjectLiteral&&R(this._last_last_text,["{",","]))?V="SPACE":this._flags.last_token.type===k.START_BLOCK?this._flags.inline_frame?V="SPACE":V="NEWLINE":this._flags.last_token.type===k.END_EXPR&&(this._output.space_before_token=!0,V="NEWLINE"),q(g,P)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?V="SPACE":V="NEWLINE"),q(g,["else","catch","finally"]))if((!(this._flags.last_token.type===k.END_BLOCK&&this._previous_flags.mode===Ee.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&g.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var pe=this._output.current_line;pe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else V==="NEWLINE"?q(this._flags.last_token,te)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&q(g,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==k.END_EXPR?(this._flags.last_token.type!==k.START_EXPR||!q(g,["var","let","const"]))&&this._flags.last_token.text!==":"&&(j(g,"if")&&j(g.previous,"else")?this._output.space_before_token=!0:this.print_newline()):q(g,P)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&w(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():V==="SPACE"&&(this._output.space_before_token=!0);g.previous&&(g.previous.type===k.WORD||g.previous.type===k.RESERVED)&&(this._output.space_before_token=!0),this.print_token(g),this._flags.last_word=g.text,g.type===k.RESERVED&&(g.text==="do"?this._flags.do_block=!0:g.text==="if"?this._flags.if_block=!0:g.text==="import"?this._flags.import_block=!0:this._flags.import_block&&j(g,"from")&&(this._flags.import_block=!1))},N.prototype.handle_semicolon=function(g){this.start_of_statement(g)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(g);for(var D=this._tokens.peek();this._flags.mode===Ee.Statement&&!(this._flags.if_block&&j(D,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(g)},N.prototype.handle_string=function(g){g.text.startsWith("`")&&g.newlines===0&&g.whitespace_before===""&&(g.previous.text===")"||this._flags.last_token.type===k.WORD)||(this.start_of_statement(g)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(g),this._flags.last_token.type===k.RESERVED||this._flags.last_token.type===k.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===k.COMMA||this._flags.last_token.type===k.START_EXPR||this._flags.last_token.type===k.EQUALS||this._flags.last_token.type===k.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g):g.text.startsWith("`")&&this._flags.last_token.type===k.END_EXPR&&(g.previous.text==="]"||g.previous.text===")")&&g.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(g)},N.prototype.handle_equals=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(g),this._output.space_before_token=!0},N.prototype.handle_comma=function(g){this.handle_whitespace_and_comments(g,!0),this.print_token(g),this._output.space_before_token=!0,this._flags.declaration_statement?(L(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(g)):this._flags.mode===Ee.ObjectLiteral||this._flags.mode===Ee.Statement&&this._flags.parent.mode===Ee.ObjectLiteral?(this._flags.mode===Ee.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(g)},N.prototype.handle_operator=function(g){var D=g.text==="*"&&(q(this._flags.last_token,["function","yield"])||R(this._flags.last_token.type,[k.START_BLOCK,k.COMMA,k.END_BLOCK,k.SEMICOLON])),V=R(g.text,["-","+"])&&(R(this._flags.last_token.type,[k.START_BLOCK,k.START_EXPR,k.EQUALS,k.OPERATOR])||R(this._flags.last_token.text,P)||this._flags.last_token.text===",");if(!this.start_of_statement(g)){var pe=!D;this.handle_whitespace_and_comments(g,pe)}if(g.text==="*"&&this._flags.last_token.type===k.DOT){this.print_token(g);return}if(g.text==="::"){this.print_token(g);return}if(R(g.text,["-","+"])&&this.start_of_object_property()){this.print_token(g);return}if(this._flags.last_token.type===k.OPERATOR&&R(this._options.operator_position,we)&&this.allow_wrap_or_preserved_newline(g),g.text===":"&&this._flags.in_case){this.print_token(g),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==k.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 Ae=!0,Ce=!0,Ne=!1;if(g.text===":"?this._flags.ternary_depth===0?Ae=!1:(this._flags.ternary_depth-=1,Ne=!0):g.text==="?"&&(this._flags.ternary_depth+=1),!V&&!D&&this._options.preserve_newlines&&R(g.text,C)){var ze=g.text===":",Ct=ze&&Ne,Rt=ze&&!Ne;switch(this._options.operator_position){case ge.before_newline:this._output.space_before_token=!Rt,this.print_token(g),(!ze||Ct)&&this.allow_wrap_or_preserved_newline(g),this._output.space_before_token=!0;return;case ge.after_newline:this._output.space_before_token=!0,!ze||Ct?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(g):this._output.space_before_token=!1,this.print_token(g),this._output.space_before_token=!0;return;case ge.preserve_newline:Rt||this.allow_wrap_or_preserved_newline(g),Ae=!(this._output.just_added_newline()||Rt),this._output.space_before_token=Ae,this.print_token(g),this._output.space_before_token=!0;return}}if(D){this.allow_wrap_or_preserved_newline(g),Ae=!1;var tt=this._tokens.peek();Ce=tt&&R(tt.type,[k.WORD,k.RESERVED])}else if(g.text==="...")this.allow_wrap_or_preserved_newline(g),Ae=this._flags.last_token.type===k.START_BLOCK,Ce=!1;else if(R(g.text,["--","++","!","~"])||V){if((this._flags.last_token.type===k.COMMA||this._flags.last_token.type===k.START_EXPR)&&this.allow_wrap_or_preserved_newline(g),Ae=!1,Ce=!1,g.newlines&&(g.text==="--"||g.text==="++"||g.text==="~")){var bt=q(this._flags.last_token,te)&&g.newlines;bt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(bt,!0)}this._flags.last_token.text===";"&&L(this._flags.mode)&&(Ae=!0),this._flags.last_token.type===k.RESERVED?Ae=!0:this._flags.last_token.type===k.END_EXPR?Ae=!(this._flags.last_token.text==="]"&&(g.text==="--"||g.text==="++")):this._flags.last_token.type===k.OPERATOR&&(Ae=R(g.text,["--","-","++","+"])&&R(this._flags.last_token.text,["--","-","++","+"]),R(g.text,["+","-"])&&R(this._flags.last_token.text,["--","++"])&&(Ce=!0)),(this._flags.mode===Ee.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Ee.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Ae,this.print_token(g),this._output.space_before_token=Ce},N.prototype.handle_block_comment=function(g,D){if(this._output.raw){this._output.add_raw_token(g),g.directives&&g.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(g.directives){this.print_newline(!1,D),this.print_token(g),g.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!m.newline.test(g.text)&&!g.newlines){this._output.space_before_token=!0,this.print_token(g),this._output.space_before_token=!0;return}else this.print_block_commment(g,D)},N.prototype.print_block_commment=function(g,D){var V=U(g.text),pe,Ae=!1,Ce=!1,Ne=g.whitespace_before,ze=Ne.length;if(this.print_newline(!1,D),this.print_token_line_indentation(g),this._output.add_token(V[0]),this.print_newline(!1,D),V.length>1){for(V=V.slice(1),Ae=O(V,"*"),Ce=H(V,Ne),Ae&&(this._flags.alignment=1),pe=0;pe<V.length;pe++)Ae?(this.print_token_line_indentation(g),this._output.add_token(I(V[pe]))):Ce&&V[pe]?(this.print_token_line_indentation(g),this._output.add_token(V[pe].substring(ze))):(this._output.current_line.set_indent(-1),this._output.add_token(V[pe])),this.print_newline(!1,D);this._flags.alignment=0}},N.prototype.handle_comment=function(g,D){g.newlines?this.print_newline(!1,D):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(g),this.print_newline(!1,D)},N.prototype.handle_dot=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),q(this._flags.last_token,te)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(g,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(g)},N.prototype.handle_unknown=function(g,D){this.print_token(g),g.text[g.text.length-1]===`
`&&this.print_newline(!1,D)},N.prototype.handle_eof=function(g){for(;this._flags.mode===Ee.Statement;)this.restore_mode();this.handle_whitespace_and_comments(g)},Y.exports.Beautifier=N},function(Y){function l(y){this.__parent=y,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 y=new l(this.__parent);return y.set_indent(this.__indent_count,this.__alignment_count),y},l.prototype.item=function(y){return y<0?this.__items[this.__items.length+y]:this.__items[y]},l.prototype.has_match=function(y){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(y))return!0;return!1},l.prototype.set_indent=function(y,m){this.is_empty()&&(this.__indent_count=y||0,this.__alignment_count=m||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 y=this.__parent.current_line;return y.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),y.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),y.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,y.__items[0]===" "&&(y.__items.splice(0,1),y.__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(y){this.__items.push(y);var m=y.lastIndexOf(`
`);m!==-1?this.__character_count=y.length-m:this.__character_count+=y.length},l.prototype.pop=function(){var y=null;return this.is_empty()||(y=this.__items.pop(),this.__character_count-=y.length),y},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 y="";return this.is_empty()?this.__parent.indent_empty_lines&&(y=this.__parent.get_indent_string(this.__indent_count)):(y=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),y+=this.__items.join("")),y};function $(y,m){this.__cache=[""],this.__indent_size=y.indent_size,this.__indent_string=y.indent_char,y.indent_with_tabs||(this.__indent_string=new Array(y.indent_size+1).join(y.indent_char)),m=m||"",y.indent_level>0&&(m=new Array(y.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}$.prototype.get_indent_size=function(y,m){var x=this.__base_string_length;return m=m||0,y<0&&(x=0),x+=y*this.__indent_size,x+=m,x},$.prototype.get_indent_string=function(y,m){var x=this.__base_string;return m=m||0,y<0&&(y=0,x=""),m+=y*this.__indent_size,this.__ensure_cache(m),x+=this.__cache[m],x},$.prototype.__ensure_cache=function(y){for(;y>=this.__cache.length;)this.__add_column()},$.prototype.__add_column=function(){var y=this.__cache.length,m=0,x="";this.__indent_size&&y>=this.__indent_size&&(m=Math.floor(y/this.__indent_size),y-=m*this.__indent_size,x=new Array(m+1).join(this.__indent_string)),y&&(x+=new Array(y+1).join(" ")),this.__cache.push(x)};function b(y,m){this.__indent_cache=new $(y,m),this.raw=!1,this._end_with_newline=y.end_with_newline,this.indent_size=y.indent_size,this.wrap_line_length=y.wrap_line_length,this.indent_empty_lines=y.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()}b.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},b.prototype.get_line_number=function(){return this.__lines.length},b.prototype.get_indent_string=function(y,m){return this.__indent_cache.get_indent_string(y,m)},b.prototype.get_indent_size=function(y,m){return this.__indent_cache.get_indent_size(y,m)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(y){return this.is_empty()||!y&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(y){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var x=this.__lines.join(`
`);return y!==`
`&&(x=x.replace(/[\n]/g,y)),x},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(y,m){return y=y||0,m=m||0,this.next_line.set_indent(y,m),this.__lines.length>1?(this.current_line.set_indent(y,m),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(y){for(var m=0;m<y.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(y.whitespace_before),this.current_line.push(y.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(y){this.__add_space_before_token(),this.current_line.push(y),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},b.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},b.prototype.remove_indent=function(y){for(var m=this.__lines.length;y<m;)this.__lines[y]._remove_indent(),y++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(y){for(y=y===void 0?!1:y,this.current_line.trim();y&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},b.prototype.just_added_newline=function(){return this.current_line.is_empty()},b.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},b.prototype.ensure_empty_line_above=function(y,m){for(var x=this.__lines.length-2;x>=0;){var S=this.__lines[x];if(S.is_empty())break;if(S.item(0).indexOf(y)!==0&&S.item(-1)!==m){this.__lines.splice(x+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}x--}},Y.exports.Output=b},function(Y){function l($,b,y,m){this.type=$,this.text=b,this.comments_before=null,this.newlines=y||0,this.whitespace_before=m||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}Y.exports.Token=l},function(Y,l){var $="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",b="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",y="\\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",m="\\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",x="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",S="(?:"+x+"|["+$+y+"])",P="(?:"+x+"|["+b+y+m+"])*";l.identifier=new RegExp(S+P,"g"),l.identifierStart=new RegExp(S),l.identifierMatch=new RegExp("(?:"+x+"|["+b+y+m+"])+");var C=/[\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(Y,l,$){var b=$(6).Options,y=["before-newline","after-newline","preserve-newline"];function m(x){b.call(this,x,"js");var S=this.raw_options.brace_style||null;S==="expand-strict"?this.raw_options.brace_style="expand":S==="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 P=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var C=0;C<P.length;C++)P[C]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=P[C];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",y),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}m.prototype=new b,Y.exports.Options=m},function(Y){function l(y,m){this.raw_options=$(y,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(y,m){var x=this.raw_options[y],S=m||[];return typeof x=="object"?x!==null&&typeof x.concat=="function"&&(S=x.concat()):typeof x=="string"&&(S=x.split(/[^a-zA-Z0-9_\/\-]+/)),S},l.prototype._get_boolean=function(y,m){var x=this.raw_options[y],S=x===void 0?!!m:!!x;return S},l.prototype._get_characters=function(y,m){var x=this.raw_options[y],S=m||"";return typeof x=="string"&&(S=x.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},l.prototype._get_number=function(y,m){var x=this.raw_options[y];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(x,10);return isNaN(S)&&(S=m),S},l.prototype._get_selection=function(y,m,x){var S=this._get_selection_list(y,m,x);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+y+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[y]+"'");return S[0]},l.prototype._get_selection_list=function(y,m,x){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(x=x||[m[0]],!this._is_valid_selection(x,m))throw new Error("Invalid Default Value!");var S=this._get_array(y,x);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+y+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[y]+"'");return S},l.prototype._is_valid_selection=function(y,m){return y.length&&m.length&&!y.some(function(x){return m.indexOf(x)===-1})};function $(y,m){var x={};y=b(y);var S;for(S in y)S!==m&&(x[S]=y[S]);if(m&&y[m])for(S in y[m])x[S]=y[m][S];return x}function b(y){var m={},x;for(x in y){var S=x.replace(/-/g,"_");m[S]=y[x]}return m}Y.exports.Options=l,Y.exports.normalizeOpts=b,Y.exports.mergeOpts=$},function(Y,l,$){var b=$(8).InputScanner,y=$(9).Tokenizer,m=$(9).TOKEN,x=$(13).Directives,S=$(4),P=$(12).Pattern,C=$(14).TemplatablePattern;function k(O,H){return H.indexOf(O)!==-1}var R={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:m.START,RAW:m.RAW,EOF:m.EOF},I=new x(/\/\*/,/\*\//),F=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,j=/[0-9]/,q=/[^\d\.]/,te=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),X=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";X=X.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),X="\\?\\.(?!\\d) "+X,X=X.replace(/ /g,"|");var ge=new RegExp(X),we="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Ee=we.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),et=new RegExp("^(?:"+Ee.join("|")+")$"),U,w=function(O,H){y.call(this,O,H),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var N=new P(this._input),_=new C(this._input).read_options(this._options);this.__patterns={template:_,identifier:_.starting_with(S.identifier).matching(S.identifierMatch),number:N.matching(F),punct:N.matching(ge),comment:N.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:N.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:N.matching(/<!--/),html_comment_end:N.matching(/-->/),include:N.starting_with(/#include/).until_after(S.lineBreak),shebang:N.starting_with(/#!/).until_after(S.lineBreak),xml:N.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:_.until(/['\\\n\r\u2028\u2029]/),double_quote:_.until(/["\\\n\r\u2028\u2029]/),template_text:_.until(/[`\\$]/),template_expression:_.until(/[`}\\]/)}};w.prototype=new y,w.prototype._is_comment=function(O){return O.type===R.COMMENT||O.type===R.BLOCK_COMMENT||O.type===R.UNKNOWN},w.prototype._is_opening=function(O){return O.type===R.START_BLOCK||O.type===R.START_EXPR},w.prototype._is_closing=function(O,H){return(O.type===R.END_BLOCK||O.type===R.END_EXPR)&&H&&(O.text==="]"&&H.text==="["||O.text===")"&&H.text==="("||O.text==="}"&&H.text==="{")},w.prototype._reset=function(){U=!1},w.prototype._get_next_token=function(O,H){var N=null;this._readWhitespace();var _=this._input.peek();return _===null?this._create_token(R.EOF,""):(N=N||this._read_non_javascript(_),N=N||this._read_string(_),N=N||this._read_pair(_,this._input.peek(1)),N=N||this._read_word(O),N=N||this._read_singles(_),N=N||this._read_comment(_),N=N||this._read_regexp(_,O),N=N||this._read_xml(_,O),N=N||this._read_punctuation(),N=N||this._create_token(R.UNKNOWN,this._input.next()),N)},w.prototype._read_word=function(O){var H;if(H=this.__patterns.identifier.read(),H!=="")return H=H.replace(S.allLineBreaks,`
`),!(O.type===R.DOT||O.type===R.RESERVED&&(O.text==="set"||O.text==="get"))&&et.test(H)?(H==="in"||H==="of")&&(O.type===R.WORD||O.type===R.STRING)?this._create_token(R.OPERATOR,H):this._create_token(R.RESERVED,H):this._create_token(R.WORD,H);if(H=this.__patterns.number.read(),H!=="")return this._create_token(R.WORD,H)},w.prototype._read_singles=function(O){var H=null;return O==="("||O==="["?H=this._create_token(R.START_EXPR,O):O===")"||O==="]"?H=this._create_token(R.END_EXPR,O):O==="{"?H=this._create_token(R.START_BLOCK,O):O==="}"?H=this._create_token(R.END_BLOCK,O):O===";"?H=this._create_token(R.SEMICOLON,O):O==="."&&q.test(this._input.peek(1))?H=this._create_token(R.DOT,O):O===","&&(H=this._create_token(R.COMMA,O)),H&&this._input.next(),H},w.prototype._read_pair=function(O,H){var N=null;return O==="#"&&H==="{"&&(N=this._create_token(R.START_BLOCK,O+H)),N&&(this._input.next(),this._input.next()),N},w.prototype._read_punctuation=function(){var O=this.__patterns.punct.read();if(O!=="")return O==="="?this._create_token(R.EQUALS,O):O==="?."?this._create_token(R.DOT,O):this._create_token(R.OPERATOR,O)},w.prototype._read_non_javascript=function(O){var H="";if(O==="#"){if(this._is_first_token()&&(H=this.__patterns.shebang.read(),H))return this._create_token(R.UNKNOWN,H.trim()+`
`);if(H=this.__patterns.include.read(),H)return this._create_token(R.UNKNOWN,H.trim()+`
`);O=this._input.next();var N="#";if(this._input.hasNext()&&this._input.testChar(j)){do O=this._input.next(),N+=O;while(this._input.hasNext()&&O!=="#"&&O!=="=");return O==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(N+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(N+="{}",this._input.next(),this._input.next())),this._create_token(R.WORD,N)}this._input.back()}else if(O==="<"&&this._is_first_token()){if(H=this.__patterns.html_comment_start.read(),H){for(;this._input.hasNext()&&!this._input.testChar(S.newline);)H+=this._input.next();return U=!0,this._create_token(R.COMMENT,H)}}else if(U&&O==="-"&&(H=this.__patterns.html_comment_end.read(),H))return U=!1,this._create_token(R.COMMENT,H);return null},w.prototype._read_comment=function(O){var H=null;if(O==="/"){var N="";if(this._input.peek(1)==="*"){N=this.__patterns.block_comment.read();var _=I.get_directives(N);_&&_.ignore==="start"&&(N+=I.readIgnored(this._input)),N=N.replace(S.allLineBreaks,`
`),H=this._create_token(R.BLOCK_COMMENT,N),H.directives=_}else this._input.peek(1)==="/"&&(N=this.__patterns.comment.read(),H=this._create_token(R.COMMENT,N))}return H},w.prototype._read_string=function(O){if(O==="`"||O==="'"||O==='"'){var H=this._input.next();return this.has_char_escapes=!1,O==="`"?H+=this._read_string_recursive("`",!0,"${"):H+=this._read_string_recursive(O),this.has_char_escapes&&this._options.unescape_strings&&(H=L(H)),this._input.peek()===O&&(H+=this._input.next()),H=H.replace(S.allLineBreaks,`
`),this._create_token(R.STRING,H)}return null},w.prototype._allow_regexp_or_xml=function(O){return O.type===R.RESERVED&&k(O.text,["return","case","throw","else","do","typeof","yield"])||O.type===R.END_EXPR&&O.text===")"&&O.opened.previous.type===R.RESERVED&&k(O.opened.previous.text,["if","while","for"])||k(O.type,[R.COMMENT,R.START_EXPR,R.START_BLOCK,R.START,R.END_BLOCK,R.OPERATOR,R.EQUALS,R.EOF,R.SEMICOLON,R.COMMA])},w.prototype._read_regexp=function(O,H){if(O==="/"&&this._allow_regexp_or_xml(H)){for(var N=this._input.next(),_=!1,g=!1;this._input.hasNext()&&(_||g||this._input.peek()!==O)&&!this._input.testChar(S.newline);)N+=this._input.peek(),_?_=!1:(_=this._input.peek()==="\\",this._input.peek()==="["?g=!0:this._input.peek()==="]"&&(g=!1)),this._input.next();return this._input.peek()===O&&(N+=this._input.next(),N+=this._input.read(S.identifier)),this._create_token(R.STRING,N)}return null},w.prototype._read_xml=function(O,H){if(this._options.e4x&&O==="<"&&this._allow_regexp_or_xml(H)){var N="",_=this.__patterns.xml.read_match();if(_){for(var g=_[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),D=g.indexOf("{")===0,V=0;_;){var pe=!!_[1],Ae=_[2],Ce=!!_[_.length-1]||Ae.slice(0,8)==="![CDATA[";if(!Ce&&(Ae===g||D&&Ae.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(pe?--V:++V),N+=_[0],V<=0)break;_=this.__patterns.xml.read_match()}return _||(N+=this._input.match(/[\s\S]*/g)[0]),N=N.replace(S.allLineBreaks,`
`),this._create_token(R.STRING,N)}}return null};function L(O){for(var H="",N=0,_=new b(O),g=null;_.hasNext();)if(g=_.match(/([\s]|[^\\]|\\\\)+/g),g&&(H+=g[0]),_.peek()==="\\"){if(_.next(),_.peek()==="x")g=_.match(/x([0-9A-Fa-f]{2})/g);else if(_.peek()==="u")g=_.match(/u([0-9A-Fa-f]{4})/g),g||(g=_.match(/u\{([0-9A-Fa-f]+)\}/g));else{H+="\\",_.hasNext()&&(H+=_.next());continue}if(!g||(N=parseInt(g[1],16),N>126&&N<=255&&g[0].indexOf("x")===0))return O;N>=0&&N<32||N>1114111?H+="\\"+g[0]:N===34||N===39||N===92?H+="\\"+String.fromCharCode(N):H+=String.fromCharCode(N)}return H}w.prototype._read_string_recursive=function(O,H,N){var _,g;O==="'"?g=this.__patterns.single_quote:O==='"'?g=this.__patterns.double_quote:O==="`"?g=this.__patterns.template_text:O==="}"&&(g=this.__patterns.template_expression);for(var D=g.read(),V="";this._input.hasNext();){if(V=this._input.next(),V===O||!H&&S.newline.test(V)){this._input.back();break}else V==="\\"&&this._input.hasNext()?(_=this._input.peek(),_==="x"||_==="u"?this.has_char_escapes=!0:_==="\r"&&this._input.peek(1)===`
`&&this._input.next(),V+=this._input.next()):N&&(N==="${"&&V==="$"&&this._input.peek()==="{"&&(V+=this._input.next()),N===V&&(O==="`"?V+=this._read_string_recursive("}",H,"`"):V+=this._read_string_recursive("`",H,"${"),this._input.hasNext()&&(V+=this._input.next())));V+=g.read(),D+=V}return D},Y.exports.Tokenizer=w,Y.exports.TOKEN=R,Y.exports.positionable_operators=te.slice(),Y.exports.line_starters=we.slice()},function(Y){var l=RegExp.prototype.hasOwnProperty("sticky");function $(b){this.__input=b||"",this.__input_length=this.__input.length,this.__position=0}$.prototype.restart=function(){this.__position=0},$.prototype.back=function(){this.__position>0&&(this.__position-=1)},$.prototype.hasNext=function(){return this.__position<this.__input_length},$.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},$.prototype.peek=function(b){var y=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(y=this.__input.charAt(b)),y},$.prototype.__match=function(b,y){b.lastIndex=y;var m=b.exec(this.__input);return m&&!(l&&b.sticky)&&m.index!==y&&(m=null),m},$.prototype.test=function(b,y){return y=y||0,y+=this.__position,y>=0&&y<this.__input_length?!!this.__match(b,y):!1},$.prototype.testChar=function(b,y){var m=this.peek(y);return b.lastIndex=0,m!==null&&b.test(m)},$.prototype.match=function(b){var y=this.__match(b,this.__position);return y?this.__position+=y[0].length:y=null,y},$.prototype.read=function(b,y,m){var x="",S;return b&&(S=this.match(b),S&&(x+=S[0])),y&&(S||!b)&&(x+=this.readUntil(y,m)),x},$.prototype.readUntil=function(b,y){var m="",x=this.__position;b.lastIndex=this.__position;var S=b.exec(this.__input);return S?(x=S.index,y&&(x+=S[0].length)):x=this.__input_length,m=this.__input.substring(this.__position,x),this.__position=x,m},$.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},$.prototype.get_regexp=function(b,y){var m=null,x="g";return y&&l&&(x="y"),typeof b=="string"&&b!==""?m=new RegExp(b,x):b&&(m=new RegExp(b.source,x)),m},$.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},$.prototype.peekUntilAfter=function(b){var y=this.__position,m=this.readUntilAfter(b);return this.__position=y,m},$.prototype.lookBack=function(b){var y=this.__position-1;return y>=b.length&&this.__input.substring(y-b.length,y).toLowerCase()===b},Y.exports.InputScanner=$},function(Y,l,$){var b=$(8).InputScanner,y=$(3).Token,m=$(10).TokenStream,x=$(11).WhitespacePattern,S={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},P=function(C,k){this._input=new b(C),this._options=k||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new x(this._input)};P.prototype.tokenize=function(){this._input.restart(),this.__tokens=new m,this._reset();for(var C,k=new y(S.START,""),R=null,I=[],F=new m;k.type!==S.EOF;){for(C=this._get_next_token(k,R);this._is_comment(C);)F.add(C),C=this._get_next_token(k,R);F.isEmpty()||(C.comments_before=F,F=new m),C.parent=R,this._is_opening(C)?(I.push(R),R=C):R&&this._is_closing(C,R)&&(C.opened=R,R.closed=C,R=I.pop(),C.parent=R),C.previous=k,k.next=C,this.__tokens.add(C),k=C}return this.__tokens},P.prototype._is_first_token=function(){return this.__tokens.isEmpty()},P.prototype._reset=function(){},P.prototype._get_next_token=function(C,k){this._readWhitespace();var R=this._input.read(/.+/g);return R?this._create_token(S.RAW,R):this._create_token(S.EOF,"")},P.prototype._is_comment=function(C){return!1},P.prototype._is_opening=function(C){return!1},P.prototype._is_closing=function(C,k){return!1},P.prototype._create_token=function(C,k){var R=new y(C,k,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return R},P.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},Y.exports.Tokenizer=P,Y.exports.TOKEN=S},function(Y){function l($){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=$}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 $=null;return this.hasNext()&&($=this.__tokens[this.__position],this.__position+=1),$},l.prototype.peek=function($){var b=null;return $=$||0,$+=this.__position,$>=0&&$<this.__tokens_length&&(b=this.__tokens[$]),b},l.prototype.add=function($){this.__parent_token&&($.parent=this.__parent_token),this.__tokens.push($),this.__tokens_length+=1},Y.exports.TokenStream=l},function(Y,l,$){var b=$(12).Pattern;function y(m,x){b.call(this,m,x),x?this._line_regexp=this._input.get_regexp(x._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}y.prototype=new b,y.prototype.__set_whitespace_patterns=function(m,x){m+="\\t ",x+="\\n\\r",this._match_pattern=this._input.get_regexp("["+m+x+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+x+"]")},y.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var m=this._input.read(this._match_pattern);if(m===" ")this.whitespace_before_token=" ";else if(m){var x=this.__split(this._newline_regexp,m);this.newline_count=x.length-1,this.whitespace_before_token=x[this.newline_count]}return m},y.prototype.matching=function(m,x){var S=this._create();return S.__set_whitespace_patterns(m,x),S._update(),S},y.prototype._create=function(){return new y(this._input,this)},y.prototype.__split=function(m,x){m.lastIndex=0;for(var S=0,P=[],C=m.exec(x);C;)P.push(x.substring(S,C.index)),S=C.index+C[0].length,C=m.exec(x);return S<x.length?P.push(x.substring(S,x.length)):P.push(""),P},Y.exports.WhitespacePattern=y},function(Y){function l($,b){this._input=$,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,b&&(this._starting_pattern=this._input.get_regexp(b._starting_pattern,!0),this._match_pattern=this._input.get_regexp(b._match_pattern,!0),this._until_pattern=this._input.get_regexp(b._until_pattern),this._until_after=b._until_after)}l.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)),$},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function($){var b=this._create();return b._until_after=!0,b._until_pattern=this._input.get_regexp($),b._update(),b},l.prototype.until=function($){var b=this._create();return b._until_after=!1,b._until_pattern=this._input.get_regexp($),b._update(),b},l.prototype.starting_with=function($){var b=this._create();return b._starting_pattern=this._input.get_regexp($,!0),b._update(),b},l.prototype.matching=function($){var b=this._create();return b._match_pattern=this._input.get_regexp($,!0),b._update(),b},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},Y.exports.Pattern=l},function(Y){function l($,b){$=typeof $=="string"?$:$.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp($+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp($+/\sbeautify\signore:end\s/.source+b,"g")}l.prototype.get_directives=function($){if(!$.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var y=this.__directive_pattern.exec($);y;)b[y[1]]=y[2],y=this.__directive_pattern.exec($);return b},l.prototype.readIgnored=function($){return $.readUntilAfter(this.__directives_end_ignore_pattern)},Y.exports.Directives=l},function(Y,l,$){var b=$(12).Pattern,y={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function m(x,S){b.call(this,x,S),this.__template_pattern=null,this._disabled=Object.assign({},y),this._excluded=Object.assign({},y),S&&(this.__template_pattern=this._input.get_regexp(S.__template_pattern),this._excluded=Object.assign(this._excluded,S._excluded),this._disabled=Object.assign(this._disabled,S._disabled));var P=new b(x);this.__patterns={handlebars_comment:P.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:P.starting_with(/{{{/).until_after(/}}}/),handlebars:P.starting_with(/{{/).until_after(/}}/),php:P.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:P.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:P.starting_with(/{%/).until_after(/%}/),django_value:P.starting_with(/{{/).until_after(/}}/),django_comment:P.starting_with(/{#/).until_after(/#}/),smarty:P.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:P.starting_with(/{\*/).until_after(/\*}/),smarty_literal:P.starting_with(/{literal}/).until_after(/{\/literal}/)}}m.prototype=new b,m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){this.__set_templated_pattern()},m.prototype.disable=function(x){var S=this._create();return S._disabled[x]=!0,S._update(),S},m.prototype.read_options=function(x){var S=this._create();for(var P in y)S._disabled[P]=x.templating.indexOf(P)===-1;return S._update(),S},m.prototype.exclude=function(x){var S=this._create();return S._excluded[x]=!0,S._update(),S},m.prototype.read=function(){var x="";this._match_pattern?x=this._input.read(this._starting_pattern):x=this._input.read(this._starting_pattern,this.__template_pattern);for(var S=this._read_template();S;)this._match_pattern?S+=this._input.read(this._match_pattern):S+=this._input.readUntil(this.__template_pattern),x+=S,S=this._read_template();return this._until_after&&(x+=this._input.readUntilAfter(this._until_pattern)),x},m.prototype.__set_templated_pattern=function(){var x=[];this._disabled.php||x.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||x.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||x.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||x.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(x.push(this.__patterns.django._starting_pattern.source),x.push(this.__patterns.django_value._starting_pattern.source),x.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||x.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&x.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+x.join("|")+")")},m.prototype._read_template=function(){var x="",S=this._input.peek();if(S==="<"){var P=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&P==="?"&&(x=x||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&P==="%"&&(x=x||this.__patterns.erb.read())}else S==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(x=x||this.__patterns.handlebars_comment.read(),x=x||this.__patterns.handlebars_unescaped.read(),x=x||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(x=x||this.__patterns.django_value.read()),this._excluded.django||(x=x||this.__patterns.django_comment.read(),x=x||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(x=x||this.__patterns.smarty_comment.read(),x=x||this.__patterns.smarty_literal.read(),x=x||this.__patterns.smarty.read()));return x},Y.exports.TemplatablePattern=m}],M={};function p(Y){var l=M[Y];if(l!==void 0)return l.exports;var $=M[Y]={exports:{}};return ee[Y]($,$.exports,p),$.exports}var ie=p(0);J=ie})();var ye=J;G=[],z=function(){return{js_beautify:ye}}.apply(Me,G),z!==void 0&&(Dt.exports=z)})()},75918:function(Dt,Me,G){"use strict";G.d(Me,{Wi:function(){return p},Z0:function(){return ie},aU:function(){return M},eZ:function(){return l},wY:function(){return Y}});var z=G(4348),J=G(69323),ye=G(13268),ee=function($,b,y,m){function x(S){return S instanceof y?S:new y(function(P){P(S)})}return new(y||(y=Promise))(function(S,P){function C(I){try{R(m.next(I))}catch(F){P(F)}}function k(I){try{R(m.throw(I))}catch(F){P(F)}}function R(I){I.done?S(I.value):x(I.value).then(C,k)}R((m=m.apply($,b||[])).next())})};class M extends J.JT{constructor(b,y="",m="",x=!0,S){super(),this._onDidChange=this._register(new z.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=b,this._label=y,this._cssClass=m,this._enabled=x,this._actionCallback=S}get id(){return this._id}get label(){return this._label}set label(b){this._setLabel(b)}_setLabel(b){this._label!==b&&(this._label=b,this._onDidChange.fire({label:b}))}get tooltip(){return this._tooltip||""}set tooltip(b){this._setTooltip(b)}_setTooltip(b){this._tooltip!==b&&(this._tooltip=b,this._onDidChange.fire({tooltip:b}))}get class(){return this._cssClass}set class(b){this._setClass(b)}_setClass(b){this._cssClass!==b&&(this._cssClass=b,this._onDidChange.fire({class:b}))}get enabled(){return this._enabled}set enabled(b){this._setEnabled(b)}_setEnabled(b){this._enabled!==b&&(this._enabled=b,this._onDidChange.fire({enabled:b}))}get checked(){return this._checked}set checked(b){this._setChecked(b)}_setChecked(b){this._checked!==b&&(this._checked=b,this._onDidChange.fire({checked:b}))}run(b,y){return ee(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(b))})}}class p extends J.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new z.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new z.Q5),this.onDidRun=this._onDidRun.event}run(b,y){return ee(this,void 0,void 0,function*(){if(!b.enabled)return;this._onBeforeRun.fire({action:b});let m;try{yield this.runAction(b,y)}catch(x){m=x}this._onDidRun.fire({action:b,error:m})})}runAction(b,y){return ee(this,void 0,void 0,function*(){yield b.run(y)})}}class ie extends M{constructor(b){super(ie.ID,b,b?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ie.ID="vs.actions.separator";class Y{constructor(b,y,m,x){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=b,this.label=y,this.class=x,this._actions=m}get actions(){return this._actions}dispose(){}run(){return ee(this,void 0,void 0,function*(){})}}class l extends M{constructor(){super(l.ID,ye.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Dt,Me,G){"use strict";G.d(Me,{ok:function(){return z}});function z(J,ye){if(!J)throw new Error(ye?`Assertion failed (${ye})`:"Assertion Failed")}},52615:function(Dt,Me,G){"use strict";G.d(Me,{CM:function(){return M},JL:function(){return p},dT:function(){return Y},fK:function(){return ee},lA:function(){return ie}});var z=G(4348);class J{constructor(){this._icons=new Map,this._onDidRegister=new z.Q5}add($){const b=this._icons.get($.id);b?$.description?b.description=$.description:console.error(`Duplicate registration of codicon ${$.id}`):(this._icons.set($.id,$),this._onDidRegister.fire($))}get($){return this._icons.get($)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const ye=new J,ee=ye;function M(l,$){return new ie(l,$)}function p(l){return l?l.replace(/\$\((.*?)\)/g,($,b)=>` ${b} `).trim():""}class ie{constructor($,b,y){this.id=$,this.definition=b,this.description=y,ye.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var Y;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const $=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function b(x){if(x instanceof ie)return["codicon","codicon-"+x.id];const S=$.exec(x.id);if(!S)return b(ie.error);let[,P,C]=S;const k=["codicon","codicon-"+P];return C&&k.push("codicon-modifier-"+C.substr(1)),k}l.asClassNameArray=b;function y(x){return b(x).join(" ")}l.asClassName=y;function m(x){return"."+b(x).join(".")}l.asCSSSelector=m})(Y||(Y={})),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"})}(ie||(ie={}))},79881:function(Dt,Me,G){"use strict";G.d(Me,{B8:function(){return b},Cp:function(){return ee},F0:function(){return Y},L6:function(){return $},VV:function(){return ie},b1:function(){return l},dL:function(){return ye},ri:function(){return M}});class z{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(m){setTimeout(()=>{throw m.stack?new Error(m.message+`
`+m.stack):m},0)}}emit(m){this.listeners.forEach(x=>{x(m)})}onUnexpectedError(m){this.unexpectedErrorHandler(m),this.emit(m)}onUnexpectedExternalError(m){this.unexpectedErrorHandler(m)}}const J=new z;function ye(y){ie(y)||J.onUnexpectedError(y)}function ee(y){ie(y)||J.onUnexpectedExternalError(y)}function M(y){if(y instanceof Error){let{name:m,message:x}=y;const S=y.stacktrace||y.stack;return{$isError:!0,name:m,message:x,stack:S}}return y}const p="Canceled";function ie(y){return y instanceof Error&&y.name===p&&y.message===p}function Y(){const y=new Error(p);return y.name=y.message,y}function l(y){return y?new Error(`Illegal argument: ${y}`):new Error("Illegal argument")}function $(y){return y?new Error(`Illegal state: ${y}`):new Error("Illegal state")}class b extends Error{constructor(m){super("NotSupported"),m&&(this.message=m)}}},4348:function(Dt,Me,G){"use strict";G.d(Me,{D0:function(){return b},E7:function(){return y},K3:function(){return $},Q5:function(){return l},ZD:function(){return m},ju:function(){return M}});var z=G(79881),J=G(69323),ye=G(34502),ee=G(95830),M;(function(x){x.None=()=>J.JT.None;function S(L){return(O,H=null,N)=>{let _=!1,g;return g=L(D=>{if(!_)return g?g.dispose():_=!0,O.call(H,D)},null,N),_&&g.dispose(),g}}x.once=S;function P(L,O){return j((H,N=null,_)=>L(g=>H.call(N,O(g)),null,_))}x.map=P;function C(L,O){return j((H,N=null,_)=>L(g=>{O(g),H.call(N,g)},null,_))}x.forEach=C;function k(L,O){return j((H,N=null,_)=>L(g=>O(g)&&H.call(N,g),null,_))}x.filter=k;function R(L){return L}x.signal=R;function I(...L){return(O,H=null,N)=>(0,J.F8)(...L.map(_=>_(g=>O.call(H,g),null,N)))}x.any=I;function F(L,O,H){let N=H;return P(L,_=>(N=O(N,_),N))}x.reduce=F;function j(L){let O;const H=new l({onFirstListenerAdd(){O=L(H.fire,H)},onLastListenerRemove(){O.dispose()}});return H.event}function q(L,O,H=100,N=!1,_){let g,D,V,pe=0;const Ae=new l({leakWarningThreshold:_,onFirstListenerAdd(){g=L(Ce=>{pe++,D=O(D,Ce),N&&!V&&(Ae.fire(D),D=void 0),clearTimeout(V),V=setTimeout(()=>{const Ne=D;D=void 0,V=void 0,(!N||pe>1)&&Ae.fire(Ne),pe=0},H)})},onLastListenerRemove(){g.dispose()}});return Ae.event}x.debounce=q;function te(L,O=(H,N)=>H===N){let H=!0,N;return k(L,_=>{const g=H||!O(_,N);return H=!1,N=_,g})}x.latch=te;function X(L,O){return[x.filter(L,O),x.filter(L,H=>!O(H))]}x.split=X;function ge(L,O=!1,H=[]){let N=H.slice(),_=L(V=>{N?N.push(V):D.fire(V)});const g=()=>{N&&N.forEach(V=>D.fire(V)),N=null},D=new l({onFirstListenerAdd(){_||(_=L(V=>D.fire(V)))},onFirstListenerDidAdd(){N&&(O?setTimeout(g):g())},onLastListenerRemove(){_&&_.dispose(),_=null}});return D.event}x.buffer=ge;class we{constructor(O){this.event=O}map(O){return new we(P(this.event,O))}forEach(O){return new we(C(this.event,O))}filter(O){return new we(k(this.event,O))}reduce(O,H){return new we(F(this.event,O,H))}latch(){return new we(te(this.event))}debounce(O,H=100,N=!1,_){return new we(q(this.event,O,H,N,_))}on(O,H,N){return this.event(O,H,N)}once(O,H,N){return S(this.event)(O,H,N)}}function Ee(L){return new we(L)}x.chain=Ee;function et(L,O,H=N=>N){const N=(...V)=>D.fire(H(...V)),_=()=>L.on(O,N),g=()=>L.removeListener(O,N),D=new l({onFirstListenerAdd:_,onLastListenerRemove:g});return D.event}x.fromNodeEventEmitter=et;function U(L,O,H=N=>N){const N=(...V)=>D.fire(H(...V)),_=()=>L.addEventListener(O,N),g=()=>L.removeEventListener(O,N),D=new l({onFirstListenerAdd:_,onLastListenerRemove:g});return D.event}x.fromDOMEventEmitter=U;function w(L){return new Promise(O=>S(L)(O))}x.toPromise=w})(M||(M={}));class p{constructor(S){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${S}_${p._idPool++}`}start(S){this._stopWatch=new ee.G(!0),this._listenerCount=S}stop(){if(this._stopWatch){const S=this._stopWatch.elapsed();this._elapsedOverall+=S,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${S.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let ie=-1;class Y{constructor(S,P=Math.random().toString(18).slice(2,5)){this.customThreshold=S,this.name=P,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(S){let P=ie;if(typeof this.customThreshold=="number"&&(P=this.customThreshold),P<=0||S<P)return;this._stacks||(this._stacks=new Map);const C=new Error().stack.split(`
`).slice(3).join(`
`),k=this._stacks.get(C)||0;if(this._stacks.set(C,k+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=P*.5;let R,I=0;for(const[F,j]of this._stacks)(!R||I<j)&&(R=F,I=j);console.warn(`[${this.name}] potential listener LEAK detected, having ${S} listeners already. MOST frequent listener (${I}):`),console.warn(R)}return()=>{const R=this._stacks.get(C)||0;this._stacks.set(C,R-1)}}}class l{constructor(S){var P;this._disposed=!1,this._options=S,this._leakageMon=ie>0?new Y(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((P=this._options)===null||P===void 0)&&P._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(S,P,C)=>{var k;this._listeners||(this._listeners=new ye.S);const R=this._listeners.isEmpty();R&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const I=this._listeners.push(P?[S,P]:S);R&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,S,P);const F=(k=this._leakageMon)===null||k===void 0?void 0:k.check(this._listeners.size),j=(0,J.OF)(()=>{F&&F(),this._disposed||(I(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return C instanceof J.SL?C.add(j):Array.isArray(C)&&C.push(j),j}),this._event}fire(S){var P,C;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new ye.S);for(let k of this._listeners)this._deliveryQueue.push([k,S]);for((P=this._perfMon)===null||P===void 0||P.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[k,R]=this._deliveryQueue.shift();try{typeof k=="function"?k.call(void 0,R):k[0].call(k[1],R)}catch(I){(0,z.dL)(I)}}(C=this._perfMon)===null||C===void 0||C.stop()}}dispose(){var S,P,C,k,R;this._disposed||(this._disposed=!0,(S=this._listeners)===null||S===void 0||S.clear(),(P=this._deliveryQueue)===null||P===void 0||P.clear(),(k=(C=this._options)===null||C===void 0?void 0:C.onLastListenerRemove)===null||k===void 0||k.call(C),(R=this._leakageMon)===null||R===void 0||R.dispose())}}class $ extends l{constructor(S){super(S),this._isPaused=0,this._eventQueue=new ye.S,this._mergeFn=S==null?void 0:S.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const S=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(S))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(S){this._listeners&&(this._isPaused!==0?this._eventQueue.push(S):super.fire(S))}}class b extends ${constructor(S){var P;super(S),this._delay=(P=S.delay)!==null&&P!==void 0?P:100}fire(S){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(S)}}class y{constructor(){this.buffers=[]}wrapEvent(S){return(P,C,k)=>S(R=>{const I=this.buffers[this.buffers.length-1];I?I.push(()=>P.call(C,R)):P.call(C,R)},void 0,k)}bufferEvents(S){const P=[];this.buffers.push(P);const C=S();return this.buffers.pop(),P.forEach(k=>k()),C}}class m{constructor(){this.listening=!1,this.inputEvent=M.None,this.inputEventListener=J.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(S){this.inputEvent=S,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=S(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Dt,Me,G){"use strict";G.d(Me,{I:function(){return z}});function z(J){const ye=this;let ee=!1,M;return function(){return ee||(ee=!0,M=J.apply(ye,arguments)),M}}},88226:function(Dt,Me,G){"use strict";G.d(Me,{$:function(){return z}});var z;(function(J){function ye(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}J.is=ye;const ee=Object.freeze([]);function M(){return ee}J.empty=M;function*p(I){yield I}J.single=p;function ie(I){return I||ee}J.from=ie;function Y(I){return!I||I[Symbol.iterator]().next().done===!0}J.isEmpty=Y;function l(I){return I[Symbol.iterator]().next().value}J.first=l;function $(I,F){for(const j of I)if(F(j))return!0;return!1}J.some=$;function b(I,F){for(const j of I)if(F(j))return j}J.find=b;function*y(I,F){for(const j of I)F(j)&&(yield j)}J.filter=y;function*m(I,F){let j=0;for(const q of I)yield F(q,j++)}J.map=m;function*x(...I){for(const F of I)for(const j of F)yield j}J.concat=x;function*S(I){for(const F of I)for(const j of F)yield j}J.concatNested=S;function P(I,F,j){let q=j;for(const te of I)q=F(q,te);return q}J.reduce=P;function*C(I,F,j=I.length){for(F<0&&(F+=I.length),j<0?j+=I.length:j>I.length&&(j=I.length);F<j;F++)yield I[F]}J.slice=C;function k(I,F=Number.POSITIVE_INFINITY){const j=[];if(F===0)return[j,I];const q=I[Symbol.iterator]();for(let te=0;te<F;te++){const X=q.next();if(X.done)return[j,J.empty()];j.push(X.value)}return[j,{[Symbol.iterator](){return q}}]}J.consume=k;function R(I,F,j=(q,te)=>q===te){const q=I[Symbol.iterator](),te=F[Symbol.iterator]();for(;;){const X=q.next(),ge=te.next();if(X.done!==ge.done)return!1;if(X.done)return!0;if(!j(X.value,ge.value))return!1}}J.equals=R})(z||(z={}))},69323:function(Dt,Me,G){"use strict";G.d(Me,{B9:function(){return m},F8:function(){return x},JT:function(){return C},Jz:function(){return R},OF:function(){return S},SL:function(){return P},Wf:function(){return y},XK:function(){return k},dk:function(){return $}});var z=G(17845),J=G(88226);const ye=!1;let ee=null;function M(I){ee=I}if(ye){const I="__is_disposable_tracked__";M(new class{trackDisposable(F){const j=new Error("Potentially leaked disposable").stack;setTimeout(()=>{F[I]||console.log(j)},3e3)}setParent(F,j){if(F&&F!==C.None)try{F[I]=!0}catch(q){}}markAsDisposed(F){if(F&&F!==C.None)try{F[I]=!0}catch(j){}}markAsSingleton(F){}})}function p(I){return ee==null||ee.trackDisposable(I),I}function ie(I){ee==null||ee.markAsDisposed(I)}function Y(I,F){ee==null||ee.setParent(I,F)}function l(I,F){if(ee)for(const j of I)ee.setParent(j,F)}function $(I){return ee==null||ee.markAsSingleton(I),I}class b extends Error{constructor(F){super(`Encountered errors while disposing of store. Errors: [${F.join(", ")}]`),this.errors=F}}function y(I){return typeof I.dispose=="function"&&I.dispose.length===0}function m(I){if(J.$.is(I)){let F=[];for(const j of I)if(j)try{j.dispose()}catch(q){F.push(q)}if(F.length===1)throw F[0];if(F.length>1)throw new b(F);return Array.isArray(I)?[]:I}else if(I)return I.dispose(),I}function x(...I){const F=S(()=>m(I));return l(I,F),F}function S(I){const F=p({dispose:(0,z.I)(()=>{ie(F),I()})});return F}class P{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(ie(this),this._isDisposed=!0,this.clear())}clear(){try{m(this._toDispose.values())}finally{this._toDispose.clear()}}add(F){if(!F)return F;if(F===this)throw new Error("Cannot register a disposable on itself!");return Y(F,this),this._isDisposed?P.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(F),F}}P.DISABLE_DISPOSED_WARNING=!1;class C{constructor(){this._store=new P,p(this),Y(this._store,this)}dispose(){ie(this),this._store.dispose()}_register(F){if(F===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(F)}}C.None=Object.freeze({dispose(){}});class k{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(F){var j;this._isDisposed||F===this._value||((j=this._value)===null||j===void 0||j.dispose(),F&&Y(F,this),this._value=F)}clear(){this.value=void 0}dispose(){var F;this._isDisposed=!0,ie(this),(F=this._value)===null||F===void 0||F.dispose(),this._value=void 0}clearAndLeak(){const F=this._value;return this._value=void 0,F&&Y(F,null),F}}class R{constructor(F){this.object=F}dispose(){}}},34502:function(Dt,Me,G){"use strict";G.d(Me,{S:function(){return J}});class z{constructor(ee){this.element=ee,this.next=z.Undefined,this.prev=z.Undefined}}z.Undefined=new z(void 0);class J{constructor(){this._first=z.Undefined,this._last=z.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===z.Undefined}clear(){let ee=this._first;for(;ee!==z.Undefined;){const M=ee.next;ee.prev=z.Undefined,ee.next=z.Undefined,ee=M}this._first=z.Undefined,this._last=z.Undefined,this._size=0}unshift(ee){return this._insert(ee,!1)}push(ee){return this._insert(ee,!0)}_insert(ee,M){const p=new z(ee);if(this._first===z.Undefined)this._first=p,this._last=p;else if(M){const Y=this._last;this._last=p,p.prev=Y,Y.next=p}else{const Y=this._first;this._first=p,p.next=Y,Y.prev=p}this._size+=1;let ie=!1;return()=>{ie||(ie=!0,this._remove(p))}}shift(){if(this._first!==z.Undefined){const ee=this._first.element;return this._remove(this._first),ee}}pop(){if(this._last!==z.Undefined){const ee=this._last.element;return this._remove(this._last),ee}}_remove(ee){if(ee.prev!==z.Undefined&&ee.next!==z.Undefined){const M=ee.prev;M.next=ee.next,ee.next.prev=M}else ee.prev===z.Undefined&&ee.next===z.Undefined?(this._first=z.Undefined,this._last=z.Undefined):ee.next===z.Undefined?(this._last=this._last.prev,this._last.next=z.Undefined):ee.prev===z.Undefined&&(this._first=this._first.next,this._first.prev=z.Undefined);this._size-=1}*[Symbol.iterator](){let ee=this._first;for(;ee!==z.Undefined;)yield ee.element,ee=ee.next}}},23345:function(Dt,Me,G){"use strict";G.d(Me,{$L:function(){return q},ED:function(){return R},IJ:function(){return F},OS:function(){return we},WE:function(){return X},dz:function(){return I},gn:function(){return te},li:function(){return S},r:function(){return U},tY:function(){return j},xS:function(){return ge}});var z=G(97671),J;const ye="en";let ee=!1,M=!1,p=!1,ie=!1,Y=!1,l=!1,$=!1,b,y=null,m=null,x;const S=typeof self=="object"?self:typeof G.g=="object"?G.g:{};let P;typeof S.vscode!="undefined"&&typeof S.vscode.process!="undefined"?P=S.vscode.process:typeof z!="undefined"&&(P=z);const C=typeof((J=P==null?void 0:P.versions)===null||J===void 0?void 0:J.electron)=="string"&&P.type==="renderer";if(typeof navigator=="object"&&!C)x=navigator.userAgent,ee=x.indexOf("Windows")>=0,M=x.indexOf("Macintosh")>=0,$=(x.indexOf("Macintosh")>=0||x.indexOf("iPad")>=0||x.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=x.indexOf("Linux")>=0,l=!0,b=navigator.language,y=b;else if(typeof P=="object"){ee=P.platform==="win32",M=P.platform==="darwin",p=P.platform==="linux",ie=p&&!!P.env.SNAP&&!!P.env.SNAP_REVISION,b=ye,y=ye;const w=P.env.VSCODE_NLS_CONFIG;if(w)try{const L=JSON.parse(w),O=L.availableLanguages["*"];b=L.locale,y=O||ye,m=L._translationsConfigFile}catch(L){}Y=!0}else console.error("Unable to resolve platform.");let k=0;M?k=1:ee?k=3:p&&(k=2);const R=ee,I=M,F=p,j=Y,q=l,te=$,X=x,ge=function(){if(S.setImmediate)return S.setImmediate.bind(S);if(typeof S.postMessage=="function"&&!S.importScripts){let O=[];S.addEventListener("message",N=>{if(N.data&&N.data.vscodeSetImmediateId)for(let _=0,g=O.length;_<g;_++){const D=O[_];if(D.id===N.data.vscodeSetImmediateId){O.splice(_,1),D.callback();return}}});let H=0;return N=>{const _=++H;O.push({id:_,callback:N}),S.postMessage({vscodeSetImmediateId:_},"*")}}if(typeof(P==null?void 0:P.nextTick)=="function")return P.nextTick.bind(P);const L=Promise.resolve();return O=>L.then(O)}(),we=M||$?2:ee?1:3;let Ee=!0,et=!1;function U(){if(!et){et=!0;const w=new Uint8Array(2);w[0]=1,w[1]=2,Ee=new Uint16Array(w.buffer)[0]===513}return Ee}},95830:function(Dt,Me,G){"use strict";G.d(Me,{G:function(){return ye}});var z=G(23345);const J=z.li.performance&&typeof z.li.performance.now=="function";class ye{constructor(M){this._highResolution=J&&M,this._startTime=this._now(),this._stopTime=-1}static create(M=!0){return new ye(M)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?z.li.performance.now():Date.now()}}},82983:function(Dt,Me,G){"use strict";G.d(Me,{$i:function(){return pe},C8:function(){return Ct},GF:function(){return b},HO:function(){return H},IO:function(){return y},K7:function(){return ze},Kw:function(){return bt},LC:function(){return S},Mh:function(){return ge},P1:function(){return we},PJ:function(){return Ke},Qe:function(){return Ae},R1:function(){return $},RP:function(){return D},S6:function(){return Gt},TT:function(){return R},Ut:function(){return _},V8:function(){return P},WU:function(){return ye},YK:function(){return et},YU:function(){return ee},ZG:function(){return Ee},ZH:function(){return w},ab:function(){return Ce},c1:function(){return Rt},df:function(){return q},ec:function(){return M},fi:function(){return ai},fy:function(){return p},j3:function(){return ie},j_:function(){return F},m5:function(){return z},mK:function(){return j},mr:function(){return m},oH:function(){return ne},oL:function(){return Y},ok:function(){return X},ow:function(){return C},qq:function(){return te},qu:function(){return k},rL:function(){return U},uS:function(){return tt},un:function(){return l},uq:function(){return x},vH:function(){return O},xe:function(){return Ne},zY:function(){return I}});function z(K){return!K||typeof K!="string"?!0:K.trim().length===0}const J=/{(\d+)}/g;function ye(K,...ae){return ae.length===0?K:K.replace(J,function(me,Se){const We=parseInt(Se,10);return isNaN(We)||We<0||We>=ae.length?me:ae[We]})}function ee(K){return K.replace(/[<>&]/g,function(ae){switch(ae){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ae}})}function M(K){return K.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(K,ae=" "){const me=ie(K,ae);return Y(me,ae)}function ie(K,ae){if(!K||!ae)return K;const me=ae.length;if(me===0||K.length===0)return K;let Se=0;for(;K.indexOf(ae,Se)===Se;)Se=Se+me;return K.substring(Se)}function Y(K,ae){if(!K||!ae)return K;const me=ae.length,Se=K.length;if(me===0||Se===0)return K;let We=Se,Be=-1;for(;Be=K.lastIndexOf(ae,We-1),!(Be===-1||Be+me!==We);){if(Be===0)return"";We=Be}return K.substring(0,We)}function l(K){return K.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function $(K){return K.replace(/\*/g,"")}function b(K,ae,me={}){if(!K)throw new Error("Cannot create regex from empty string");ae||(K=M(K)),me.wholeWord&&(/\B/.test(K.charAt(0))||(K="\\b"+K),/\B/.test(K.charAt(K.length-1))||(K=K+"\\b"));let Se="";return me.global&&(Se+="g"),me.matchCase||(Se+="i"),me.multiline&&(Se+="m"),me.unicode&&(Se+="u"),new RegExp(K,Se)}function y(K){return K.source==="^"||K.source==="^$"||K.source==="$"||K.source==="^\\s*$"?!1:!!(K.exec("")&&K.lastIndex===0)}function m(K){return(K.global?"g":"")+(K.ignoreCase?"i":"")+(K.multiline?"m":"")+(K.unicode?"u":"")}function x(K){return K.split(/\r\n|\r|\n/)}function S(K){for(let ae=0,me=K.length;ae<me;ae++){const Se=K.charCodeAt(ae);if(Se!==32&&Se!==9)return ae}return-1}function P(K,ae=0,me=K.length){for(let Se=ae;Se<me;Se++){const We=K.charCodeAt(Se);if(We!==32&&We!==9)return K.substring(ae,Se)}return K.substring(ae,me)}function C(K,ae=K.length-1){for(let me=ae;me>=0;me--){const Se=K.charCodeAt(me);if(Se!==32&&Se!==9)return me}return-1}function k(K,ae){return K<ae?-1:K>ae?1:0}function R(K,ae,me=0,Se=K.length,We=0,Be=ae.length){for(;me<Se&&We<Be;me++,We++){let mt=K.charCodeAt(me),Nt=ae.charCodeAt(We);if(mt<Nt)return-1;if(mt>Nt)return 1}const xt=Se-me,He=Be-We;return xt<He?-1:xt>He?1:0}function I(K,ae){return F(K,ae,0,K.length,0,ae.length)}function F(K,ae,me=0,Se=K.length,We=0,Be=ae.length){for(;me<Se&&We<Be;me++,We++){let mt=K.charCodeAt(me),Nt=ae.charCodeAt(We);if(mt===Nt)continue;if(mt>=128||Nt>=128)return R(K.toLowerCase(),ae.toLowerCase(),me,Se,We,Be);j(mt)&&(mt-=32),j(Nt)&&(Nt-=32);const Ot=mt-Nt;if(Ot!==0)return Ot}const xt=Se-me,He=Be-We;return xt<He?-1:xt>He?1:0}function j(K){return K>=97&&K<=122}function q(K){return K>=65&&K<=90}function te(K,ae){return K.length===ae.length&&F(K,ae)===0}function X(K,ae){const me=ae.length;return ae.length>K.length?!1:F(K,ae,0,me)===0}function ge(K,ae){let me,Se=Math.min(K.length,ae.length);for(me=0;me<Se;me++)if(K.charCodeAt(me)!==ae.charCodeAt(me))return me;return Se}function we(K,ae){let me,Se=Math.min(K.length,ae.length);const We=K.length-1,Be=ae.length-1;for(me=0;me<Se;me++)if(K.charCodeAt(We-me)!==ae.charCodeAt(Be-me))return me;return Se}function Ee(K){return 55296<=K&&K<=56319}function et(K){return 56320<=K&&K<=57343}function U(K,ae){return(K-55296<<10)+(ae-56320)+65536}function w(K,ae,me){const Se=K.charCodeAt(me);if(Ee(Se)&&me+1<ae){const We=K.charCodeAt(me+1);if(et(We))return U(Se,We)}return Se}function L(K,ae){const me=K.charCodeAt(ae-1);if(et(me)&&ae>1){const Se=K.charCodeAt(ae-2);if(Ee(Se))return U(Se,me)}return me}function O(K,ae){const me=ce.getInstance(),Se=ae,We=K.length,Be=w(K,We,ae);ae+=Be>=65536?2:1;let xt=me.getGraphemeBreakType(Be);for(;ae<We;){const He=w(K,We,ae),mt=me.getGraphemeBreakType(He);if(ai(xt,mt))break;ae+=He>=65536?2:1,xt=mt}return ae-Se}function H(K,ae){const me=ce.getInstance(),Se=ae,We=L(K,ae);ae-=We>=65536?2:1;let Be=me.getGraphemeBreakType(We);for(;ae>0;){const xt=L(K,ae),He=me.getGraphemeBreakType(xt);if(ai(He,Be))break;ae-=xt>=65536?2:1,Be=He}return Se-ae}const N=/(?:[\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 _(K){return N.test(K)}const g=/(?:[\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 D(K){return g.test(K)}const V=/^[\t\n\r\x20-\x7E]*$/;function pe(K){return V.test(K)}const Ae=/[\u2028\u2029]/;function Ce(K){return Ae.test(K)}function Ne(K){for(let ae=0,me=K.length;ae<me;ae++)if(ze(K.charCodeAt(ae)))return!0;return!1}function ze(K){return K=+K,K>=11904&&K<=55215||K>=63744&&K<=64255||K>=65281&&K<=65374}function Ct(K){return K>=127462&&K<=127487||K===8986||K===8987||K===9200||K===9203||K>=9728&&K<=10175||K===11088||K===11093||K>=127744&&K<=128591||K>=128640&&K<=128764||K>=128992&&K<=129003||K>=129280&&K<=129535||K>=129648&&K<=129750}const Rt="\uFEFF";function tt(K){return!!(K&&K.length>0&&K.charCodeAt(0)===65279)}function bt(K,ae=!1){return K?(ae&&(K=K.replace(/\\./g,"")),K.toLowerCase()!==K):!1}function Ke(K){return K=K%(2*26),K<26?String.fromCharCode(97+K):String.fromCharCode(65+K-26)}function Gt(K){return ce.getInstance().getGraphemeBreakType(K)}function ai(K,ae){return K===0?ae!==5&&ae!==7:K===2&&ae===3?!1:K===4||K===2||K===3||ae===4||ae===2||ae===3?!0:!(K===8&&(ae===8||ae===9||ae===11||ae===12)||(K===11||K===9)&&(ae===9||ae===10)||(K===12||K===10)&&ae===10||ae===5||ae===13||ae===7||K===1||K===13&&ae===14||K===6&&ae===6)}class ce{constructor(){this._data=Ie()}static getInstance(){return ce._INSTANCE||(ce._INSTANCE=new ce),ce._INSTANCE}getGraphemeBreakType(ae){if(ae<32)return ae===10?3:ae===13?2:4;if(ae<127)return 0;const me=this._data,Se=me.length/3;let We=1;for(;We<=Se;)if(ae<me[3*We])We=2*We;else if(ae>me[3*We+1])We=2*We+1;else return me[3*We+2];return 0}}ce._INSTANCE=null;function Ie(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function ne(K,ae){if(K===0)return 0;const me=Fe(K,ae);if(me!==void 0)return me;const Se=L(ae,K);return K-=Ve(Se),K}function Fe(K,ae){let me=L(ae,K);for(K-=Ve(me);qe(me)||me===65039||me===8419;){if(K===0)return;me=L(ae,K),K-=Ve(me)}if(Ct(me)){if(K>=0){const Se=L(ae,K);Se===8205&&(K-=Ve(Se))}return K}}function Ve(K){return K>=65536?2:1}function qe(K){return 127995<=K&&K<=127999}},72999:function(Dt,Me,G){"use strict";G.d(Me,{$E:function(){return S},$K:function(){return ie},D8:function(){return y},HD:function(){return J},IU:function(){return P},Jp:function(){return Y},Kn:function(){return ye},cW:function(){return $},f6:function(){return C},hj:function(){return ee},jn:function(){return M},kJ:function(){return z},mf:function(){return b},o8:function(){return p},p_:function(){return l},vE:function(){return k}});function z(R){return Array.isArray(R)}function J(R){return typeof R=="string"}function ye(R){return typeof R=="object"&&R!==null&&!Array.isArray(R)&&!(R instanceof RegExp)&&!(R instanceof Date)}function ee(R){return typeof R=="number"&&!isNaN(R)}function M(R){return R===!0||R===!1}function p(R){return typeof R=="undefined"}function ie(R){return!Y(R)}function Y(R){return p(R)||R===null}function l(R,I){if(!R)throw new Error(I?`Unexpected type, expected '${I}'`:"Unexpected type")}function $(R){if(Y(R))throw new Error("Assertion Failed: argument is undefined or null");return R}function b(R){return typeof R=="function"}function y(R,I){const F=Math.min(R.length,I.length);for(let j=0;j<F;j++)m(R[j],I[j])}function m(R,I){if(J(I)){if(typeof R!==I)throw new Error(`argument does not match constraint: typeof ${I}`)}else if(b(I)){try{if(R instanceof I)return}catch(F){}if(!Y(R)&&R.constructor===I||I.length===1&&I.call(void 0,R)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function x(R){let I=[],F=Object.getPrototypeOf(R);for(;Object.prototype!==F;)I=I.concat(Object.getOwnPropertyNames(F)),F=Object.getPrototypeOf(F);return I}function S(R){const I=[];for(const F of x(R))typeof R[F]=="function"&&I.push(F);return I}function P(R,I){const F=q=>function(){const te=Array.prototype.slice.call(arguments,0);return I(q,te)};let j={};for(const q of R)j[q]=F(q);return j}function C(R){return R===null?void 0:R}function k(R,I="Unreachable"){throw new Error(I)}},13268:function(Dt,Me,G){"use strict";G.d(Me,{N:function(){return J}});function z(ye,ee){let M;return ee.length===0?M=ye:M=ye.replace(/\{(\d+)\}/g,function(p,ie){const Y=ie[0];return typeof ee[Y]!="undefined"?ee[Y]:p}),M}function J(ye,ee,...M){return z(ee,M)}},96236:function(Dt,Me,G){"use strict";G.d(Me,{BH:function(){return P},NZ:function(){return C},U8:function(){return k},co:function(){return S},eH:function(){return x},vr:function(){return m}});var z=G(75918),J=G(52615),ye=G(4348),ee=G(88226),M=G(69323),p=G(34502),ie=G(35884),Y=G(90689),l=G(16925),$=G(49055),b=function(R,I,F,j){var q=arguments.length,te=q<3?I:j===null?j=Object.getOwnPropertyDescriptor(I,F):j,X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate(R,I,F,j);else for(var ge=R.length-1;ge>=0;ge--)(X=R[ge])&&(te=(q<3?X(te):q>3?X(I,F,te):X(I,F))||te);return q>3&&te&&Object.defineProperty(I,F,te),te},y=function(R,I){return function(F,j){I(F,j,R)}};function m(R){return R.command!==void 0}class x{constructor(I){this.id=x._idPool++,this._debugName=I}}x._idPool=0,x.CommandPalette=new x("CommandPalette"),x.EditorContext=new x("EditorContext"),x.SimpleEditorContext=new x("SimpleEditorContext"),x.EditorContextCopy=new x("EditorContextCopy"),x.EditorContextPeek=new x("EditorContextPeek"),x.MenubarEditMenu=new x("MenubarEditMenu"),x.MenubarCopy=new x("MenubarCopy"),x.MenubarGoMenu=new x("MenubarGoMenu"),x.MenubarSelectionMenu=new x("MenubarSelectionMenu"),x.InlineCompletionsActions=new x("InlineCompletionsActions");const S=(0,l.yh)("menuService"),P=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new ye.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:R=>R===x.CommandPalette}}addCommand(R){return this.addCommands(ee.$.single(R))}addCommands(R){for(const I of R)this._commands.set(I.id,I);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,M.OF)(()=>{let I=!1;for(const F of R)I=this._commands.delete(F.id)||I;I&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(R){return this._commands.get(R)}getCommands(){const R=new Map;return this._commands.forEach((I,F)=>R.set(F,I)),R}appendMenuItem(R,I){return this.appendMenuItems(ee.$.single({id:R,item:I}))}appendMenuItems(R){const I=new Set,F=new p.S;for(const{id:j,item:q}of R){let te=this._menuItems.get(j);te||(te=new p.S,this._menuItems.set(j,te)),F.push(te.push(q)),I.add(j)}return this._onDidChangeMenu.fire(I),(0,M.OF)(()=>{if(F.size>0){for(let j of F)j();this._onDidChangeMenu.fire(I),F.clear()}})}getMenuItems(R){let I;return this._menuItems.has(R)?I=[...this._menuItems.get(R)]:I=[],R===x.CommandPalette&&this._appendImplicitItems(I),I}_appendImplicitItems(R){const I=new Set;for(const F of R)m(F)&&(I.add(F.command.id),F.alt&&I.add(F.alt.id));this._commands.forEach((F,j)=>{I.has(j)||R.push({command:F})})}};class C extends z.wY{constructor(I,F,j,q){super(`submenuitem.${I.submenu.id}`,typeof I.title=="string"?I.title:I.title.value,[],"submenu"),this.item=I,this._menuService=F,this._contextKeyService=j,this._options=q}get actions(){const I=[],F=this._menuService.createMenu(this.item.submenu,this._contextKeyService),j=F.getActions(this._options);F.dispose();for(const[,q]of j)q.length>0&&(I.push(...q),I.push(new z.Z0));return I.length&&I.pop(),I}}let k=class Xo{constructor(I,F,j,q,te){var X,ge;if(this._commandService=te,this.id=I.id,this.label=j!=null&&j.renderShortTitle&&I.shortTitle?typeof I.shortTitle=="string"?I.shortTitle:I.shortTitle.value:typeof I.title=="string"?I.title:I.title.value,this.tooltip=(ge=typeof I.tooltip=="string"?I.tooltip:(X=I.tooltip)===null||X===void 0?void 0:X.value)!==null&&ge!==void 0?ge:"",this.enabled=!I.precondition||q.contextMatchesRules(I.precondition),this.checked=void 0,I.toggled){const we=I.toggled.condition?I.toggled:{condition:I.toggled};this.checked=q.contextMatchesRules(we.condition),this.checked&&we.tooltip&&(this.tooltip=typeof we.tooltip=="string"?we.tooltip:we.tooltip.value),we.title&&(this.label=typeof we.title=="string"?we.title:we.title.value)}this.item=I,this.alt=F?new Xo(F,void 0,j,q,te):void 0,this._options=j,$.kS.isThemeIcon(I.icon)&&(this.class=J.dT.asClassName(I.icon))}dispose(){}run(...I){var F,j;let q=[];return!((F=this._options)===null||F===void 0)&&F.arg&&(q=[...q,this._options.arg]),!((j=this._options)===null||j===void 0)&&j.shouldForwardArgs&&(q=[...q,...I]),this._commandService.executeCommand(this.id,...q)}};k=b([y(3,Y.i6),y(4,ie.H)],k)},35884:function(Dt,Me,G){"use strict";G.d(Me,{H:function(){return ie},P:function(){return Y}});var z=G(4348),J=G(88226),ye=G(69323),ee=G(34502),M=G(72999),p=G(16925);const ie=(0,p.yh)("commandService"),Y=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new z.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,$){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!$)throw new Error("invalid command");return this.registerCommand({id:l,handler:$})}if(l.description){const S=[];for(let C of l.description.args)S.push(C.constraint);const P=l.handler;l.handler=function(C,...k){return(0,M.D8)(k,S),P(C,...k)}}const{id:b}=l;let y=this._commands.get(b);y||(y=new ee.S,this._commands.set(b,y));let m=y.unshift(l),x=(0,ye.OF)(()=>{m();const S=this._commands.get(b);S!=null&&S.isEmpty()&&this._commands.delete(b)});return this._onDidRegisterCommand.fire(b),x}registerCommandAlias(l,$){return Y.registerCommand(l,(b,...y)=>b.get(ie).executeCommand($,...y))}getCommand(l){const $=this._commands.get(l);if(!(!$||$.isEmpty()))return J.$.first($)}getCommands(){const l=new Map;for(const $ of this._commands.keys()){const b=this.getCommand($);b&&l.set($,b)}return l}};Y.registerCommand("noop",()=>{})},90689:function(Dt,Me,G){"use strict";G.d(Me,{Ao:function(){return ie},Eq:function(){return U},Fb:function(){return Y},K8:function(){return O},i6:function(){return et},uy:function(){return Ee}});var z=G(23345),J=G(82983),ye=G(16925);let ee=z.WE||"";const M=new Map;M.set("false",!1),M.set("true",!0),M.set("isMac",z.dz),M.set("isLinux",z.IJ),M.set("isWindows",z.ED),M.set("isWeb",z.$L),M.set("isMacNative",z.dz&&!z.$L),M.set("isEdge",ee.indexOf("Edg/")>=0),M.set("isFirefox",ee.indexOf("Firefox")>=0),M.set("isChrome",ee.indexOf("Chrome")>=0),M.set("isSafari",ee.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class ie{static has(_){return y.create(_)}static equals(_,g){return m.create(_,g)}static regex(_,g){return q.create(_,g)}static not(_){return C.create(_)}static and(..._){return ge.create(_,null)}static or(..._){return we.create(_,null,!0)}static deserialize(_,g=!1){if(_)return this._deserializeOrExpression(_,g)}static _deserializeOrExpression(_,g){let D=_.split("||");return we.create(D.map(V=>this._deserializeAndExpression(V,g)),null,!0)}static _deserializeAndExpression(_,g){let D=_.split("&&");return ge.create(D.map(V=>this._deserializeOne(V,g)),null)}static _deserializeOne(_,g){if(_=_.trim(),_.indexOf("!=")>=0){let D=_.split("!=");return P.create(D[0].trim(),this._deserializeValue(D[1],g))}if(_.indexOf("==")>=0){let D=_.split("==");return m.create(D[0].trim(),this._deserializeValue(D[1],g))}if(_.indexOf("=~")>=0){let D=_.split("=~");return q.create(D[0].trim(),this._deserializeRegexValue(D[1],g))}if(_.indexOf(" in ")>=0){let D=_.split(" in ");return x.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(_)){const D=_.split(">=");return I.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(_)){const D=_.split(">");return R.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(_)){const D=_.split("<=");return j.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(_)){const D=_.split("<");return F.create(D[0].trim(),D[1].trim())}return/^\!\s*/.test(_)?C.create(_.substr(1).trim()):y.create(_)}static _deserializeValue(_,g){if(_=_.trim(),_==="true")return!0;if(_==="false")return!1;let D=/^'([^']*)'$/.exec(_);return D?D[1].trim():_}static _deserializeRegexValue(_,g){if((0,J.m5)(_)){if(g)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let D=_.indexOf("/"),V=_.lastIndexOf("/");if(D===V||D<0){if(g)throw new Error(`bad regexp-value '${_}', missing /-enclosure`);return console.warn(`bad regexp-value '${_}', missing /-enclosure`),null}let pe=_.slice(D+1,V),Ae=_[V+1]==="i"?"i":"";try{return new RegExp(pe,Ae)}catch(Ce){if(g)throw new Error(`bad regexp-value '${_}', parse error: ${Ce}`);return console.warn(`bad regexp-value '${_}', parse error: ${Ce}`),null}}}function Y(N,_){const g=N?N.substituteConstants():void 0,D=_?_.substituteConstants():void 0;return!g&&!D?!0:!g||!D?!1:g.equals(D)}function l(N,_){return N.cmp(_)}class ${constructor(){this.type=0}cmp(_){return this.type-_.type}equals(_){return _.type===this.type}substituteConstants(){return this}evaluate(_){return!1}serialize(){return"false"}keys(){return[]}negate(){return b.INSTANCE}}$.INSTANCE=new $;class b{constructor(){this.type=1}cmp(_){return this.type-_.type}equals(_){return _.type===this.type}substituteConstants(){return this}evaluate(_){return!0}serialize(){return"true"}keys(){return[]}negate(){return $.INSTANCE}}b.INSTANCE=new b;class y{constructor(_,g){this.key=_,this.negated=g,this.type=2}static create(_,g=null){const D=M.get(_);return typeof D=="boolean"?D?b.INSTANCE:$.INSTANCE:new y(_,g)}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,_.key)}equals(_){return _.type===this.type?this.key===_.key:!1}substituteConstants(){const _=M.get(this.key);return typeof _=="boolean"?_?b.INSTANCE:$.INSTANCE:this}evaluate(_){return!!_.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=C.create(this.key,this)),this.negated}}class m{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=4}static create(_,g,D=null){if(typeof g=="boolean")return g?y.create(_,D):C.create(_,D);const V=M.get(_);return typeof V=="boolean"?g===(V?"true":"false")?b.INSTANCE:$.INSTANCE:new m(_,g,D)}cmp(_){return _.type!==this.type?this.type-_.type:L(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){const _=M.get(this.key);if(typeof _=="boolean"){const g=_?"true":"false";return this.value===g?b.INSTANCE:$.INSTANCE}return this}evaluate(_){return _.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=P.create(this.key,this.value,this)),this.negated}}class x{constructor(_,g){this.key=_,this.valueKey=g,this.type=10,this.negated=null}static create(_,g){return new x(_,g)}cmp(_){return _.type!==this.type?this.type-_.type:L(this.key,this.valueKey,_.key,_.valueKey)}equals(_){return _.type===this.type?this.key===_.key&&this.valueKey===_.valueKey:!1}substituteConstants(){return this}evaluate(_){const g=_.getValue(this.valueKey),D=_.getValue(this.key);return Array.isArray(g)?g.indexOf(D)>=0:typeof D=="string"&&typeof g=="object"&&g!==null?p.call(g,D):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=S.create(this)),this.negated}}class S{constructor(_){this._actual=_,this.type=11}static create(_){return new S(_)}cmp(_){return _.type!==this.type?this.type-_.type:this._actual.cmp(_._actual)}equals(_){return _.type===this.type?this._actual.equals(_._actual):!1}substituteConstants(){return this}evaluate(_){return!this._actual.evaluate(_)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class P{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=5}static create(_,g,D=null){if(typeof g=="boolean")return g?C.create(_,D):y.create(_,D);const V=M.get(_);return typeof V=="boolean"?g===(V?"true":"false")?$.INSTANCE:b.INSTANCE:new P(_,g,D)}cmp(_){return _.type!==this.type?this.type-_.type:L(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){const _=M.get(this.key);if(typeof _=="boolean"){const g=_?"true":"false";return this.value===g?$.INSTANCE:b.INSTANCE}return this}evaluate(_){return _.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this.value,this)),this.negated}}class C{constructor(_,g){this.key=_,this.negated=g,this.type=3}static create(_,g=null){const D=M.get(_);return typeof D=="boolean"?D?$.INSTANCE:b.INSTANCE:new C(_,g)}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,_.key)}equals(_){return _.type===this.type?this.key===_.key:!1}substituteConstants(){const _=M.get(this.key);return typeof _=="boolean"?_?$.INSTANCE:b.INSTANCE:this}evaluate(_){return!_.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=y.create(this.key,this)),this.negated}}function k(N,_){if(typeof N=="string"){const g=parseFloat(N);isNaN(g)||(N=g)}return typeof N=="string"||typeof N=="number"?_(N):$.INSTANCE}class R{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=12}static create(_,g,D=null){return k(g,V=>new R(_,V,D))}cmp(_){return _.type!==this.type?this.type-_.type:L(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=j.create(this.key,this.value,this)),this.negated}}class I{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=13}static create(_,g,D=null){return k(g,V=>new I(_,V,D))}cmp(_){return _.type!==this.type?this.type-_.type:L(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=F.create(this.key,this.value,this)),this.negated}}class F{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=14}static create(_,g,D=null){return k(g,V=>new F(_,V,D))}cmp(_){return _.type!==this.type?this.type-_.type:L(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.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 j{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=15}static create(_,g,D=null){return k(g,V=>new j(_,V,D))}cmp(_){return _.type!==this.type?this.type-_.type:L(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.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 q{constructor(_,g){this.key=_,this.regexp=g,this.type=7,this.negated=null}static create(_,g){return new q(_,g)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.key<_.key)return-1;if(this.key>_.key)return 1;const g=this.regexp?this.regexp.source:"",D=_.regexp?_.regexp.source:"";return g<D?-1:g>D?1:0}equals(_){if(_.type===this.type){const g=this.regexp?this.regexp.source:"",D=_.regexp?_.regexp.source:"";return this.key===_.key&&g===D}return!1}substituteConstants(){return this}evaluate(_){let g=_.getValue(this.key);return this.regexp?this.regexp.test(g):!1}serialize(){const _=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${_}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=te.create(this)),this.negated}}class te{constructor(_){this._actual=_,this.type=8}static create(_){return new te(_)}cmp(_){return _.type!==this.type?this.type-_.type:this._actual.cmp(_._actual)}equals(_){return _.type===this.type?this._actual.equals(_._actual):!1}substituteConstants(){return this}evaluate(_){return!this._actual.evaluate(_)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function X(N){let _=null;for(let g=0,D=N.length;g<D;g++){const V=N[g].substituteConstants();if(N[g]!==V&&_===null){_=[];for(let pe=0;pe<g;pe++)_[pe]=N[pe]}_!==null&&(_[g]=V)}return _===null?N:_}class ge{constructor(_,g){this.expr=_,this.negated=g,this.type=6}static create(_,g){return ge._normalizeArr(_,g)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.expr.length<_.expr.length)return-1;if(this.expr.length>_.expr.length)return 1;for(let g=0,D=this.expr.length;g<D;g++){const V=l(this.expr[g],_.expr[g]);if(V!==0)return V}return 0}equals(_){if(_.type===this.type){if(this.expr.length!==_.expr.length)return!1;for(let g=0,D=this.expr.length;g<D;g++)if(!this.expr[g].equals(_.expr[g]))return!1;return!0}return!1}substituteConstants(){const _=X(this.expr);return _===this.expr?this:ge.create(_,this.negated)}evaluate(_){for(let g=0,D=this.expr.length;g<D;g++)if(!this.expr[g].evaluate(_))return!1;return!0}static _normalizeArr(_,g){const D=[];let V=!1;for(const pe of _)if(pe){if(pe.type===1){V=!0;continue}if(pe.type===0)return $.INSTANCE;if(pe.type===6){D.push(...pe.expr);continue}D.push(pe)}if(D.length===0&&V)return b.INSTANCE;if(D.length!==0){if(D.length===1)return D[0];D.sort(l);for(let pe=1;pe<D.length;pe++)D[pe-1].equals(D[pe])&&(D.splice(pe,1),pe--);if(D.length===1)return D[0];for(;D.length>1;){const pe=D[D.length-1];if(pe.type!==9)break;D.pop();const Ae=D.pop(),Ce=D.length===0,Ne=we.create(pe.expr.map(ze=>ge.create([ze,Ae],null)),null,Ce);Ne&&(D.push(Ne),D.sort(l))}return D.length===1?D[0]:new ge(D,g)}}serialize(){return this.expr.map(_=>_.serialize()).join(" && ")}keys(){const _=[];for(let g of this.expr)_.push(...g.keys());return _}negate(){if(!this.negated){const _=[];for(let g of this.expr)_.push(g.negate());this.negated=we.create(_,this,!0)}return this.negated}}class we{constructor(_,g){this.expr=_,this.negated=g,this.type=9}static create(_,g,D){return we._normalizeArr(_,g,D)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.expr.length<_.expr.length)return-1;if(this.expr.length>_.expr.length)return 1;for(let g=0,D=this.expr.length;g<D;g++){const V=l(this.expr[g],_.expr[g]);if(V!==0)return V}return 0}equals(_){if(_.type===this.type){if(this.expr.length!==_.expr.length)return!1;for(let g=0,D=this.expr.length;g<D;g++)if(!this.expr[g].equals(_.expr[g]))return!1;return!0}return!1}substituteConstants(){const _=X(this.expr);return _===this.expr?this:we.create(_,this.negated,!1)}evaluate(_){for(let g=0,D=this.expr.length;g<D;g++)if(this.expr[g].evaluate(_))return!0;return!1}static _normalizeArr(_,g,D){let V=[],pe=!1;if(_){for(let Ae=0,Ce=_.length;Ae<Ce;Ae++){const Ne=_[Ae];if(Ne){if(Ne.type===0){pe=!0;continue}if(Ne.type===1)return b.INSTANCE;if(Ne.type===9){V=V.concat(Ne.expr);continue}V.push(Ne)}}if(V.length===0&&pe)return $.INSTANCE;V.sort(l)}if(V.length!==0){if(V.length===1)return V[0];for(let Ae=1;Ae<V.length;Ae++)V[Ae-1].equals(V[Ae])&&(V.splice(Ae,1),Ae--);if(V.length===1)return V[0];if(D){for(let Ae=0;Ae<V.length;Ae++)for(let Ce=Ae+1;Ce<V.length;Ce++)O(V[Ae],V[Ce])&&(V.splice(Ce,1),Ce--);if(V.length===1)return V[0]}return new we(V,g)}}serialize(){return this.expr.map(_=>_.serialize()).join(" || ")}keys(){const _=[];for(let g of this.expr)_.push(...g.keys());return _}negate(){if(!this.negated){let _=[];for(let g of this.expr)_.push(g.negate());for(;_.length>1;){const g=_.shift(),D=_.shift(),V=[];for(const Ae of H(g))for(const Ce of H(D))V.push(ge.create([Ae,Ce],null));const pe=_.length===0;_.unshift(we.create(V,null,pe))}this.negated=_[0]}return this.negated}}class Ee extends y{constructor(_,g,D){super(_,null),this._defaultValue=g,typeof D=="object"?Ee._info.push(Object.assign(Object.assign({},D),{key:_})):D!==!0&&Ee._info.push({key:_,description:D,type:g!=null?typeof g:void 0})}static all(){return Ee._info.values()}bindTo(_){return _.createKey(this.key,this._defaultValue)}getValue(_){return _.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(_){return m.create(this.key,_)}}Ee._info=[];const et=(0,ye.yh)("contextKeyService"),U="setContext";function w(N,_){return N<_?-1:N>_?1:0}function L(N,_,g,D){return N<g?-1:N>g?1:_<D?-1:_>D?1:0}function O(N,_){if(_.type===6&&N.type!==9&&N.type!==6){for(const V of _.expr)if(N.equals(V))return!0}const g=N.negate(),D=H(g).concat(H(_));D.sort(l);for(let V=0;V<D.length;V++){const Ae=D[V].negate();for(let Ce=V+1;Ce<D.length;Ce++){const Ne=D[Ce];if(Ae.equals(Ne))return!0}}return!1}function H(N){return N.type===9?N.expr:[N]}},16925:function(Dt,Me,G){"use strict";G.d(Me,{I8:function(){return z},TG:function(){return J},jt:function(){return M},yh:function(){return ee}});var z;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function ie(Y){return Y[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=ie})(z||(z={}));const J=ee("instantiationService");function ye(p,ie,Y,l){ie[z.DI_TARGET]===ie?ie[z.DI_DEPENDENCIES].push({id:p,index:Y,optional:l}):(ie[z.DI_DEPENDENCIES]=[{id:p,index:Y,optional:l}],ie[z.DI_TARGET]=ie)}function ee(p){if(z.serviceIds.has(p))return z.serviceIds.get(p);const ie=function(Y,l,$){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ye(ie,Y,$,!1)};return ie.toString=()=>p,z.serviceIds.set(p,ie),ie}function M(p){return function(ie,Y,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");ye(p,ie,l,!0)}}},44650:function(Dt,Me,G){"use strict";G.d(Me,{B:function(){return ee}});var z=G(76068),J=G(72999);class ye{constructor(){this.data=new Map}add(p,ie){z.ok(J.HD(p)),z.ok(J.Kn(ie)),z.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,ie)}as(p){return this.data.get(p)||null}}const ee=new ye},66213:function(Dt,Me,G){"use strict";G.d(Me,{e:function(){return z}});var z;(function(J){J.DARK="dark",J.LIGHT="light",J.HIGH_CONTRAST="hc"})(z||(z={}))},49055:function(Dt,Me,G){"use strict";G.d(Me,{EN:function(){return l},IP:function(){return y},Ic:function(){return S},XE:function(){return ie},bB:function(){return P},kS:function(){return $},m6:function(){return b}});var z=G(52615),J=G(4348),ye=G(69323),ee=G(16925),M=G(44650),p=G(66213);const ie=(0,ee.yh)("themeService");var Y;(function(C){function k(R){return R&&typeof R=="object"&&typeof R.id=="string"}C.isThemeColor=k})(Y||(Y={}));function l(C){return{id:C}}var $;(function(C){function k(te){return te&&typeof te=="object"&&typeof te.id=="string"&&(typeof te.color=="undefined"||Y.isThemeColor(te.color))}C.isThemeIcon=k;const R=new RegExp(`^\\$\\((${z.dT.iconNameExpression}(?:${z.dT.iconModifierExpression})?)\\)$`);function I(te){const X=R.exec(te);if(!X)return;let[,ge]=X;return{id:ge}}C.fromString=I;function F(te,X){let ge=te.id;const we=ge.lastIndexOf("~");return we!==-1&&(ge=ge.substring(0,we)),X&&(ge=`${ge}~${X}`),{id:ge}}C.modify=F;function j(te,X){var ge,we;return te.id===X.id&&((ge=te.color)===null||ge===void 0?void 0:ge.id)===((we=X.color)===null||we===void 0?void 0:we.id)}C.isEqual=j;function q(te,X){return{id:te.id,color:X?l(X):void 0}}C.asThemeIcon=q,C.asClassNameArray=z.dT.asClassNameArray,C.asClassName=z.dT.asClassName,C.asCSSSelector=z.dT.asCSSSelector})($||($={}));function b(C){switch(C){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const y={ThemingContribution:"base.contributions.theming"};class m{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new J.Q5}onColorThemeChange(k){return this.themingParticipants.push(k),this.onThemingParticipantAddedEmitter.fire(k),(0,ye.OF)(()=>{const R=this.themingParticipants.indexOf(k);this.themingParticipants.splice(R,1)})}getThemingParticipants(){return this.themingParticipants}}let x=new m;M.B.add(y.ThemingContribution,x);function S(C){return x.onColorThemeChange(C)}class P extends ye.JT{constructor(k){super(),this.themeService=k,this.theme=k.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(R=>this.onThemeChange(R)))}onThemeChange(k){this.theme=k,this.updateStyles()}updateStyles(){}}},96478:function(Dt,Me,G){"use strict";G.d(Me,{Z:function(){return te}});var z=G(71409),J=G(87075),ye=G(11036),ee=G(39224),M=G(65352),p=G(92310),ie=G.n(p),Y=G(8654),l=G(59301),$=G(10228),b=G(16089),y=$.Z.ESC,m=$.Z.TAB;function x(X){var ge=X.visible,we=X.triggerRef,Ee=X.onVisibleChange,et=X.autoFocus,U=X.overlayRef,w=l.useRef(!1),L=function(){if(ge){var _,g;(_=we.current)===null||_===void 0||(g=_.focus)===null||g===void 0||g.call(_),Ee==null||Ee(!1)}},O=function(){var _;return(_=U.current)!==null&&_!==void 0&&_.focus?(U.current.focus(),w.current=!0,!0):!1},H=function(_){switch(_.keyCode){case y:L();break;case m:{var g=!1;w.current||(g=O()),g?_.preventDefault():L();break}}};l.useEffect(function(){return ge?(window.addEventListener("keydown",H),et&&(0,b.Z)(O,3),function(){window.removeEventListener("keydown",H),w.current=!1}):function(){w.current=!1}},[ge])}var S=(0,l.forwardRef)(function(X,ge){var we=X.overlay,Ee=X.arrow,et=X.prefixCls,U=(0,l.useMemo)(function(){var L;return typeof we=="function"?L=we():L=we,L},[we]),w=(0,Y.sQ)(ge,(0,Y.C4)(U));return l.createElement(l.Fragment,null,Ee&&l.createElement("div",{className:"".concat(et,"-arrow")}),l.cloneElement(U,{ref:(0,Y.Yr)(U)?w:void 0}))}),P=S,C={adjustX:1,adjustY:1},k=[0,0],R={topLeft:{points:["bl","tl"],overflow:C,offset:[0,-4],targetOffset:k},top:{points:["bc","tc"],overflow:C,offset:[0,-4],targetOffset:k},topRight:{points:["br","tr"],overflow:C,offset:[0,-4],targetOffset:k},bottomLeft:{points:["tl","bl"],overflow:C,offset:[0,4],targetOffset:k},bottom:{points:["tc","bc"],overflow:C,offset:[0,4],targetOffset:k},bottomRight:{points:["tr","br"],overflow:C,offset:[0,4],targetOffset:k}},I=R,F=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function j(X,ge){var we,Ee=X.arrow,et=Ee===void 0?!1:Ee,U=X.prefixCls,w=U===void 0?"rc-dropdown":U,L=X.transitionName,O=X.animation,H=X.align,N=X.placement,_=N===void 0?"bottomLeft":N,g=X.placements,D=g===void 0?I:g,V=X.getPopupContainer,pe=X.showAction,Ae=X.hideAction,Ce=X.overlayClassName,Ne=X.overlayStyle,ze=X.visible,Ct=X.trigger,Rt=Ct===void 0?["hover"]:Ct,tt=X.autoFocus,bt=X.overlay,Ke=X.children,Gt=X.onVisibleChange,ai=(0,ee.Z)(X,F),ce=l.useState(),Ie=(0,ye.Z)(ce,2),ne=Ie[0],Fe=Ie[1],Ve="visible"in X?ze:ne,qe=l.useRef(null),K=l.useRef(null),ae=l.useRef(null);l.useImperativeHandle(ge,function(){return qe.current});var me=function(dt){Fe(dt),Gt==null||Gt(dt)};x({visible:Ve,triggerRef:ae,onVisibleChange:me,autoFocus:tt,overlayRef:K});var Se=function(dt){var Zt=X.onOverlayClick;Fe(!1),Zt&&Zt(dt)},We=function(){return l.createElement(P,{ref:K,overlay:bt,prefixCls:w,arrow:et})},Be=function(){return typeof bt=="function"?We:We()},xt=function(){var dt=X.minOverlayWidthMatchTrigger,Zt=X.alignPoint;return"minOverlayWidthMatchTrigger"in X?dt:!Zt},He=function(){var dt=X.openClassName;return dt!==void 0?dt:"".concat(w,"-open")},mt=l.cloneElement(Ke,{className:ie()((we=Ke.props)===null||we===void 0?void 0:we.className,Ve&&He()),ref:(0,Y.Yr)(Ke)?(0,Y.sQ)(ae,(0,Y.C4)(Ke)):void 0}),Nt=Ae;return!Nt&&Rt.indexOf("contextMenu")!==-1&&(Nt=["click"]),l.createElement(M.Z,(0,z.Z)({builtinPlacements:D},ai,{prefixCls:w,ref:qe,popupClassName:ie()(Ce,(0,J.Z)({},"".concat(w,"-show-arrow"),et)),popupStyle:Ne,action:Rt,showAction:pe,hideAction:Nt,popupPlacement:_,popupAlign:H,popupTransitionName:L,popupAnimation:O,popupVisible:Ve,stretch:xt()?"minWidth":"",popup:Be(),onPopupVisibleChange:me,onPopupClick:Se,getPopupContainer:V}),mt)}var q=l.forwardRef(j),te=q},66003:function(Dt,Me,G){"use strict";G.d(Me,{Z:function(){return ie}});var z=G(39224),J=G(89490),ye=G(28788),ee=G(59301),M=["show"];function p(Y,l){if(!l.max)return!0;var $=l.strategy(Y);return $<=l.max}function ie(Y,l){return ee.useMemo(function(){var $={};l&&($.show=(0,ye.Z)(l)==="object"&&l.formatter?l.formatter:!!l),$=(0,J.Z)((0,J.Z)({},$),Y);var b=$,y=b.show,m=(0,z.Z)(b,M);return(0,J.Z)((0,J.Z)({},m),{},{show:!!y,showFormatter:typeof y=="function"?y:void 0,strategy:m.strategy||function(x){return x.length}})},[Y,l])}},36901:function(Dt,Me,G){"use strict";G.r(Me),G.d(Me,{BaseInput:function(){return $},default:function(){return I}});var z=G(89490),J=G(71409),ye=G(87075),ee=G(28788),M=G(92310),p=G.n(M),ie=G(59301),Y=G(30292),l=ie.forwardRef(function(F,j){var q,te,X,ge=F.inputElement,we=F.children,Ee=F.prefixCls,et=F.prefix,U=F.suffix,w=F.addonBefore,L=F.addonAfter,O=F.className,H=F.style,N=F.disabled,_=F.readOnly,g=F.focused,D=F.triggerFocus,V=F.allowClear,pe=F.value,Ae=F.handleReset,Ce=F.hidden,Ne=F.classes,ze=F.classNames,Ct=F.dataAttrs,Rt=F.styles,tt=F.components,bt=F.onClear,Ke=we!=null?we:ge,Gt=(tt==null?void 0:tt.affixWrapper)||"span",ai=(tt==null?void 0:tt.groupWrapper)||"span",ce=(tt==null?void 0:tt.wrapper)||"span",Ie=(tt==null?void 0:tt.groupAddon)||"span",ne=(0,ie.useRef)(null),Fe=function(ni){var Yt;(Yt=ne.current)!==null&&Yt!==void 0&&Yt.contains(ni.target)&&(D==null||D())},Ve=(0,Y.X3)(F),qe=(0,ie.cloneElement)(Ke,{value:pe,className:p()((q=Ke.props)===null||q===void 0?void 0:q.className,!Ve&&(ze==null?void 0:ze.variant))||null}),K=(0,ie.useRef)(null);if(ie.useImperativeHandle(j,function(){return{nativeElement:K.current||ne.current}}),Ve){var ae=null;if(V){var me=!N&&!_&&pe,Se="".concat(Ee,"-clear-icon"),We=(0,ee.Z)(V)==="object"&&V!==null&&V!==void 0&&V.clearIcon?V.clearIcon:"\u2716";ae=ie.createElement("button",{type:"button",tabIndex:-1,onClick:function(ni){Ae==null||Ae(ni),bt==null||bt()},onMouseDown:function(ni){return ni.preventDefault()},className:p()(Se,(0,ye.Z)((0,ye.Z)({},"".concat(Se,"-hidden"),!me),"".concat(Se,"-has-suffix"),!!U))},We)}var Be="".concat(Ee,"-affix-wrapper"),xt=p()(Be,(0,ye.Z)((0,ye.Z)((0,ye.Z)((0,ye.Z)((0,ye.Z)({},"".concat(Ee,"-disabled"),N),"".concat(Be,"-disabled"),N),"".concat(Be,"-focused"),g),"".concat(Be,"-readonly"),_),"".concat(Be,"-input-with-clear-btn"),U&&V&&pe),Ne==null?void 0:Ne.affixWrapper,ze==null?void 0:ze.affixWrapper,ze==null?void 0:ze.variant),He=(U||V)&&ie.createElement("span",{className:p()("".concat(Ee,"-suffix"),ze==null?void 0:ze.suffix),style:Rt==null?void 0:Rt.suffix},ae,U);qe=ie.createElement(Gt,(0,J.Z)({className:xt,style:Rt==null?void 0:Rt.affixWrapper,onClick:Fe},Ct==null?void 0:Ct.affixWrapper,{ref:ne}),et&&ie.createElement("span",{className:p()("".concat(Ee,"-prefix"),ze==null?void 0:ze.prefix),style:Rt==null?void 0:Rt.prefix},et),qe,He)}if((0,Y.He)(F)){var mt="".concat(Ee,"-group"),Nt="".concat(mt,"-addon"),Ot="".concat(mt,"-wrapper"),dt=p()("".concat(Ee,"-wrapper"),mt,Ne==null?void 0:Ne.wrapper,ze==null?void 0:ze.wrapper),Zt=p()(Ot,(0,ye.Z)({},"".concat(Ot,"-disabled"),N),Ne==null?void 0:Ne.group,ze==null?void 0:ze.groupWrapper);qe=ie.createElement(ai,{className:Zt,ref:K},ie.createElement(ce,{className:dt},w&&ie.createElement(Ie,{className:Nt},w),qe,L&&ie.createElement(Ie,{className:Nt},L)))}return ie.cloneElement(qe,{className:p()((te=qe.props)===null||te===void 0?void 0:te.className,O)||null,style:(0,z.Z)((0,z.Z)({},(X=qe.props)===null||X===void 0?void 0:X.style),H),hidden:Ce})}),$=l,b=G(62730),y=G(11036),m=G(39224),x=G(18929),S=G(2738),P=G(66003),C=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],k=(0,ie.forwardRef)(function(F,j){var q=F.autoComplete,te=F.onChange,X=F.onFocus,ge=F.onBlur,we=F.onPressEnter,Ee=F.onKeyDown,et=F.onKeyUp,U=F.prefixCls,w=U===void 0?"rc-input":U,L=F.disabled,O=F.htmlSize,H=F.className,N=F.maxLength,_=F.suffix,g=F.showCount,D=F.count,V=F.type,pe=V===void 0?"text":V,Ae=F.classes,Ce=F.classNames,Ne=F.styles,ze=F.onCompositionStart,Ct=F.onCompositionEnd,Rt=(0,m.Z)(F,C),tt=(0,ie.useState)(!1),bt=(0,y.Z)(tt,2),Ke=bt[0],Gt=bt[1],ai=(0,ie.useRef)(!1),ce=(0,ie.useRef)(!1),Ie=(0,ie.useRef)(null),ne=(0,ie.useRef)(null),Fe=function(Qe){Ie.current&&(0,Y.nH)(Ie.current,Qe)},Ve=(0,x.Z)(F.defaultValue,{value:F.value}),qe=(0,y.Z)(Ve,2),K=qe[0],ae=qe[1],me=K==null?"":String(K),Se=(0,ie.useState)(null),We=(0,y.Z)(Se,2),Be=We[0],xt=We[1],He=(0,P.Z)(D,g),mt=He.max||N,Nt=He.strategy(me),Ot=!!mt&&Nt>mt;(0,ie.useImperativeHandle)(j,function(){var Xe;return{focus:Fe,blur:function(){var pt;(pt=Ie.current)===null||pt===void 0||pt.blur()},setSelectionRange:function(pt,Bt,rt){var Ye;(Ye=Ie.current)===null||Ye===void 0||Ye.setSelectionRange(pt,Bt,rt)},select:function(){var pt;(pt=Ie.current)===null||pt===void 0||pt.select()},input:Ie.current,nativeElement:((Xe=ne.current)===null||Xe===void 0?void 0:Xe.nativeElement)||Ie.current}}),(0,ie.useEffect)(function(){ce.current&&(ce.current=!1),Gt(function(Xe){return Xe&&L?!1:Xe})},[L]);var dt=function(Qe,pt,Bt){var rt=pt;if(!ai.current&&He.exceedFormatter&&He.max&&He.strategy(pt)>He.max){if(rt=He.exceedFormatter(pt,{max:He.max}),pt!==rt){var Ye,$e;xt([((Ye=Ie.current)===null||Ye===void 0?void 0:Ye.selectionStart)||0,(($e=Ie.current)===null||$e===void 0?void 0:$e.selectionEnd)||0])}}else if(Bt.source==="compositionEnd")return;ae(rt),Ie.current&&(0,Y.rJ)(Ie.current,Qe,te,rt)};(0,ie.useEffect)(function(){if(Be){var Xe;(Xe=Ie.current)===null||Xe===void 0||Xe.setSelectionRange.apply(Xe,(0,b.Z)(Be))}},[Be]);var Zt=function(Qe){dt(Qe,Qe.target.value,{source:"change"})},Mt=function(Qe){ai.current=!1,dt(Qe,Qe.currentTarget.value,{source:"compositionEnd"}),Ct==null||Ct(Qe)},ni=function(Qe){we&&Qe.key==="Enter"&&!ce.current&&(ce.current=!0,we(Qe)),Ee==null||Ee(Qe)},Yt=function(Qe){Qe.key==="Enter"&&(ce.current=!1),et==null||et(Qe)},St=function(Qe){Gt(!0),X==null||X(Qe)},Ni=function(Qe){ce.current&&(ce.current=!1),Gt(!1),ge==null||ge(Qe)},De=function(Qe){ae(""),Fe(),Ie.current&&(0,Y.rJ)(Ie.current,Qe,te)},ke=Ot&&"".concat(w,"-out-of-range"),je=function(){var Qe=(0,S.Z)(F,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return ie.createElement("input",(0,J.Z)({autoComplete:q},Qe,{onChange:Zt,onFocus:St,onBlur:Ni,onKeyDown:ni,onKeyUp:Yt,className:p()(w,(0,ye.Z)({},"".concat(w,"-disabled"),L),Ce==null?void 0:Ce.input),style:Ne==null?void 0:Ne.input,ref:Ie,size:O,type:pe,onCompositionStart:function(Bt){ai.current=!0,ze==null||ze(Bt)},onCompositionEnd:Mt}))},si=function(){var Qe=Number(mt)>0;if(_||He.show){var pt=He.showFormatter?He.showFormatter({value:me,count:Nt,maxLength:mt}):"".concat(Nt).concat(Qe?" / ".concat(mt):"");return ie.createElement(ie.Fragment,null,He.show&&ie.createElement("span",{className:p()("".concat(w,"-show-count-suffix"),(0,ye.Z)({},"".concat(w,"-show-count-has-suffix"),!!_),Ce==null?void 0:Ce.count),style:(0,z.Z)({},Ne==null?void 0:Ne.count)},pt),_)}return null};return ie.createElement($,(0,J.Z)({},Rt,{prefixCls:w,className:p()(H,ke),handleReset:De,value:me,focused:Ke,triggerFocus:Fe,suffix:si(),disabled:L,classes:Ae,classNames:Ce,styles:Ne}),je())}),R=k,I=R},30292:function(Dt,Me,G){"use strict";G.d(Me,{He:function(){return z},X3:function(){return J},nH:function(){return M},rJ:function(){return ee}});function z(p){return!!(p.addonBefore||p.addonAfter)}function J(p){return!!(p.prefix||p.suffix||p.allowClear)}function ye(p,ie,Y){var l=ie.cloneNode(!0),$=Object.create(p,{target:{value:l},currentTarget:{value:l}});return l.value=Y,typeof ie.selectionStart=="number"&&typeof ie.selectionEnd=="number"&&(l.selectionStart=ie.selectionStart,l.selectionEnd=ie.selectionEnd),l.setSelectionRange=function(){ie.setSelectionRange.apply(ie,arguments)},$}function ee(p,ie,Y,l){if(Y){var $=ie;if(ie.type==="click"){$=ye(ie,p,""),Y($);return}if(p.type!=="file"&&l!==void 0){$=ye(ie,p,l),Y($);return}Y($)}}function M(p,ie){if(p){p.focus(ie);var Y=ie||{},l=Y.cursor;if(l){var $=p.value.length;switch(l){case"start":p.setSelectionRange(0,0);break;case"end":p.setSelectionRange($,$);break;default:p.setSelectionRange(0,$)}}}}},28321:function(Dt,Me,G){"use strict";G.d(Me,{iz:function(){return Zi},ck:function(){return rt},BW:function(){return jt},sN:function(){return rt},Wd:function(){return Ki},ZP:function(){return Ut},Xl:function(){return we}});var z=G(71409),J=G(87075),ye=G(89490),ee=G(62730),M=G(11036),p=G(39224),ie=G(92310),Y=G.n(ie),l=G(11780),$=G(18929),b=G(13697),y=G(48736),m=G(59301),x=G(4676),S=m.createContext(null);function P(Z,de){return Z===void 0?null:"".concat(Z,"-").concat(de)}function C(Z){var de=m.useContext(S);return P(de,Z)}var k=G(80547),R=["children","locked"],I=m.createContext(null);function F(Z,de){var Te=(0,ye.Z)({},Z);return Object.keys(de).forEach(function(_e){var Re=de[_e];Re!==void 0&&(Te[_e]=Re)}),Te}function j(Z){var de=Z.children,Te=Z.locked,_e=(0,p.Z)(Z,R),Re=m.useContext(I),Le=(0,k.Z)(function(){return F(Re,_e)},[Re,_e],function(Ge,it){return!Te&&(Ge[0]!==it[0]||!(0,b.Z)(Ge[1],it[1],!0))});return m.createElement(I.Provider,{value:Le},de)}var q=[],te=m.createContext(null);function X(){return m.useContext(te)}var ge=m.createContext(q);function we(Z){var de=m.useContext(ge);return m.useMemo(function(){return Z!==void 0?[].concat((0,ee.Z)(de),[Z]):de},[de,Z])}var Ee=m.createContext(null),et=m.createContext({}),U=et,w=G(29194);function L(Z){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,w.Z)(Z)){var Te=Z.nodeName.toLowerCase(),_e=["input","select","textarea","button"].includes(Te)||Z.isContentEditable||Te==="a"&&!!Z.getAttribute("href"),Re=Z.getAttribute("tabindex"),Le=Number(Re),Ge=null;return Re&&!Number.isNaN(Le)?Ge=Le:_e&&Ge===null&&(Ge=0),_e&&Z.disabled&&(Ge=null),Ge!==null&&(Ge>=0||de&&Ge<0)}return!1}function O(Z){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=(0,ee.Z)(Z.querySelectorAll("*")).filter(function(_e){return L(_e,de)});return L(Z,de)&&Te.unshift(Z),Te}var H=null;function N(){H=document.activeElement}function _(){H=null}function g(){if(H)try{H.focus()}catch(Z){}}function D(Z,de){if(de.keyCode===9){var Te=O(Z),_e=Te[de.shiftKey?0:Te.length-1],Re=_e===document.activeElement||Z===document.activeElement;if(Re){var Le=Te[de.shiftKey?Te.length-1:0];Le.focus(),de.preventDefault()}}}var V=G(10228),pe=G(16089),Ae=V.Z.LEFT,Ce=V.Z.RIGHT,Ne=V.Z.UP,ze=V.Z.DOWN,Ct=V.Z.ENTER,Rt=V.Z.ESC,tt=V.Z.HOME,bt=V.Z.END,Ke=[Ne,ze,Ae,Ce];function Gt(Z,de,Te,_e){var Re,Le="prev",Ge="next",it="children",re="parent";if(Z==="inline"&&_e===Ct)return{inlineTrigger:!0};var Je=(0,J.Z)((0,J.Z)({},Ne,Le),ze,Ge),It=(0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)({},Ae,Te?Ge:Le),Ce,Te?Le:Ge),ze,it),Ct,it),ct=(0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)({},Ne,Le),ze,Ge),Ct,it),Rt,re),Ae,Te?it:re),Ce,Te?re:it),at={inline:Je,horizontal:It,vertical:ct,inlineSub:Je,horizontalSub:ct,verticalSub:ct},Lt=(Re=at["".concat(Z).concat(de?"":"Sub")])===null||Re===void 0?void 0:Re[_e];switch(Lt){case Le:return{offset:-1,sibling:!0};case Ge:return{offset:1,sibling:!0};case re:return{offset:-1,sibling:!1};case it:return{offset:1,sibling:!1};default:return null}}function ai(Z){for(var de=Z;de;){if(de.getAttribute("data-menu-list"))return de;de=de.parentElement}return null}function ce(Z,de){for(var Te=Z||document.activeElement;Te;){if(de.has(Te))return Te;Te=Te.parentElement}return null}function Ie(Z,de){var Te=O(Z,!0);return Te.filter(function(_e){return de.has(_e)})}function ne(Z,de,Te){var _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Z)return null;var Re=Ie(Z,de),Le=Re.length,Ge=Re.findIndex(function(it){return Te===it});return _e<0?Ge===-1?Ge=Le-1:Ge-=1:_e>0&&(Ge+=1),Ge=(Ge+Le)%Le,Re[Ge]}var Fe=function(de,Te){var _e=new Set,Re=new Map,Le=new Map;return de.forEach(function(Ge){var it=document.querySelector("[data-menu-id='".concat(P(Te,Ge),"']"));it&&(_e.add(it),Le.set(it,Ge),Re.set(Ge,it))}),{elements:_e,key2element:Re,element2key:Le}};function Ve(Z,de,Te,_e,Re,Le,Ge,it,re,Je){var It=m.useRef(),ct=m.useRef();ct.current=de;var at=function(){pe.Z.cancel(It.current)};return m.useEffect(function(){return function(){at()}},[]),function(Lt){var Vt=Lt.which;if([].concat(Ke,[Ct,Rt,tt,bt]).includes(Vt)){var Tt=Le(),gt=Fe(Tt,_e),Qt=gt,ui=Qt.elements,zt=Qt.key2element,Ft=Qt.element2key,ci=zt.get(de),Wt=ce(ci,ui),li=Ft.get(Wt),ii=Gt(Z,Ge(li,!0).length===1,Te,Vt);if(!ii&&Vt!==tt&&Vt!==bt)return;(Ke.includes(Vt)||[tt,bt].includes(Vt))&&Lt.preventDefault();var Xt=function(vi){if(vi){var on=vi,hi=vi.querySelector("a");hi!=null&&hi.getAttribute("href")&&(on=hi);var dn=Ft.get(vi);it(dn),at(),It.current=(0,pe.Z)(function(){ct.current===dn&&on.focus()})}};if([tt,bt].includes(Vt)||ii.sibling||!Wt){var Xi;!Wt||Z==="inline"?Xi=Re.current:Xi=ai(Wt);var Ei,Ht=Ie(Xi,ui);Vt===tt?Ei=Ht[0]:Vt===bt?Ei=Ht[Ht.length-1]:Ei=ne(Xi,ui,Wt,ii.offset),Xt(Ei)}else if(ii.inlineTrigger)re(li);else if(ii.offset>0)re(li,!0),at(),It.current=(0,pe.Z)(function(){gt=Fe(Tt,_e);var en=Wt.getAttribute("aria-controls"),vi=document.getElementById(en),on=ne(vi,gt.elements);Xt(on)},5);else if(ii.offset<0){var Wi=Ge(li,!0),Pi=Wi[Wi.length-2],xi=zt.get(Pi);re(Pi,!1),Xt(xi)}}Je==null||Je(Lt)}}function qe(Z){Promise.resolve().then(Z)}var K="__RC_UTIL_PATH_SPLIT__",ae=function(de){return de.join(K)},me=function(de){return de.split(K)},Se="rc-menu-more";function We(){var Z=m.useState({}),de=(0,M.Z)(Z,2),Te=de[1],_e=(0,m.useRef)(new Map),Re=(0,m.useRef)(new Map),Le=m.useState([]),Ge=(0,M.Z)(Le,2),it=Ge[0],re=Ge[1],Je=(0,m.useRef)(0),It=(0,m.useRef)(!1),ct=function(){It.current||Te({})},at=(0,m.useCallback)(function(zt,Ft){var ci=ae(Ft);Re.current.set(ci,zt),_e.current.set(zt,ci),Je.current+=1;var Wt=Je.current;qe(function(){Wt===Je.current&&ct()})},[]),Lt=(0,m.useCallback)(function(zt,Ft){var ci=ae(Ft);Re.current.delete(ci),_e.current.delete(zt)},[]),Vt=(0,m.useCallback)(function(zt){re(zt)},[]),Tt=(0,m.useCallback)(function(zt,Ft){var ci=_e.current.get(zt)||"",Wt=me(ci);return Ft&&it.includes(Wt[0])&&Wt.unshift(Se),Wt},[it]),gt=(0,m.useCallback)(function(zt,Ft){return zt.filter(function(ci){return ci!==void 0}).some(function(ci){var Wt=Tt(ci,!0);return Wt.includes(Ft)})},[Tt]),Qt=function(){var Ft=(0,ee.Z)(_e.current.keys());return it.length&&Ft.push(Se),Ft},ui=(0,m.useCallback)(function(zt){var Ft="".concat(_e.current.get(zt)).concat(K),ci=new Set;return(0,ee.Z)(Re.current.keys()).forEach(function(Wt){Wt.startsWith(Ft)&&ci.add(Re.current.get(Wt))}),ci},[]);return m.useEffect(function(){return function(){It.current=!0}},[]),{registerPath:at,unregisterPath:Lt,refreshOverflowKeys:Vt,isSubPathKey:gt,getKeyPath:Tt,getKeys:Qt,getSubPathKeys:ui}}function Be(Z){var de=m.useRef(Z);de.current=Z;var Te=m.useCallback(function(){for(var _e,Re=arguments.length,Le=new Array(Re),Ge=0;Ge<Re;Ge++)Le[Ge]=arguments[Ge];return(_e=de.current)===null||_e===void 0?void 0:_e.call.apply(_e,[de].concat(Le))},[]);return Z?Te:void 0}var xt=Math.random().toFixed(5).toString().slice(2),He=0;function mt(Z){var de=(0,$.Z)(Z,{value:Z}),Te=(0,M.Z)(de,2),_e=Te[0],Re=Te[1];return m.useEffect(function(){He+=1;var Le="".concat(xt,"-").concat(He);Re("rc-menu-uuid-".concat(Le))},[]),_e}var Nt=G(16552),Ot=G(19210),dt=G(46654),Zt=G(37205),Mt=G(2738),ni=G(8654);function Yt(Z,de,Te,_e){var Re=m.useContext(I),Le=Re.activeKey,Ge=Re.onActive,it=Re.onInactive,re={active:Le===Z};return de||(re.onMouseEnter=function(Je){Te==null||Te({key:Z,domEvent:Je}),Ge(Z)},re.onMouseLeave=function(Je){_e==null||_e({key:Z,domEvent:Je}),it(Z)}),re}function St(Z){var de=m.useContext(I),Te=de.mode,_e=de.rtl,Re=de.inlineIndent;if(Te!=="inline")return null;var Le=Z;return _e?{paddingRight:Le*Re}:{paddingLeft:Le*Re}}function Ni(Z){var de=Z.icon,Te=Z.props,_e=Z.children,Re;return de===null||de===!1?null:(typeof de=="function"?Re=m.createElement(de,(0,ye.Z)({},Te)):typeof de!="boolean"&&(Re=de),Re||_e||null)}var De=["item"];function ke(Z){var de=Z.item,Te=(0,p.Z)(Z,De);return Object.defineProperty(Te,"item",{get:function(){return(0,y.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),de}}),Te}var je=["title","attribute","elementRef"],si=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Xe=["active"],Qe=function(Z){(0,dt.Z)(Te,Z);var de=(0,Zt.Z)(Te);function Te(){return(0,Nt.Z)(this,Te),de.apply(this,arguments)}return(0,Ot.Z)(Te,[{key:"render",value:function(){var Re=this.props,Le=Re.title,Ge=Re.attribute,it=Re.elementRef,re=(0,p.Z)(Re,je),Je=(0,Mt.Z)(re,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,y.ZP)(!Ge,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),m.createElement(l.Z.Item,(0,z.Z)({},Ge,{title:typeof Le=="string"?Le:void 0},Je,{ref:it}))}}]),Te}(m.Component),pt=m.forwardRef(function(Z,de){var Te=Z.style,_e=Z.className,Re=Z.eventKey,Le=Z.warnKey,Ge=Z.disabled,it=Z.itemIcon,re=Z.children,Je=Z.role,It=Z.onMouseEnter,ct=Z.onMouseLeave,at=Z.onClick,Lt=Z.onKeyDown,Vt=Z.onFocus,Tt=(0,p.Z)(Z,si),gt=C(Re),Qt=m.useContext(I),ui=Qt.prefixCls,zt=Qt.onItemClick,Ft=Qt.disabled,ci=Qt.overflowDisabled,Wt=Qt.itemIcon,li=Qt.selectedKeys,ii=Qt.onActive,Xt=m.useContext(U),Xi=Xt._internalRenderMenuItem,Ei="".concat(ui,"-item"),Ht=m.useRef(),Wi=m.useRef(),Pi=Ft||Ge,xi=(0,ni.x1)(de,Wi),en=we(Re),vi=function(ri){return{key:Re,keyPath:(0,ee.Z)(en).reverse(),item:Ht.current,domEvent:ri}},on=it||Wt,hi=Yt(Re,Pi,It,ct),dn=hi.active,kn=(0,p.Z)(hi,Xe),ln=li.includes(Re),Ln=St(en.length),An=function(ri){if(!Pi){var un=vi(ri);at==null||at(ke(un)),zt(un)}},Hi=function(ri){if(Lt==null||Lt(ri),ri.which===V.Z.ENTER){var un=vi(ri);at==null||at(ke(un)),zt(un)}},rn=function(ri){ii(Re),Vt==null||Vt(ri)},pn={};Z.role==="option"&&(pn["aria-selected"]=ln);var wn=m.createElement(Qe,(0,z.Z)({ref:Ht,elementRef:xi,role:Je===null?"none":Je||"menuitem",tabIndex:Ge?null:-1,"data-menu-id":ci&&gt?null:gt},(0,Mt.Z)(Tt,["extra"]),kn,pn,{component:"li","aria-disabled":Ge,style:(0,ye.Z)((0,ye.Z)({},Ln),Te),className:Y()(Ei,(0,J.Z)((0,J.Z)((0,J.Z)({},"".concat(Ei,"-active"),dn),"".concat(Ei,"-selected"),ln),"".concat(Ei,"-disabled"),Pi),_e),onClick:An,onKeyDown:Hi,onFocus:rn}),re,m.createElement(Ni,{props:(0,ye.Z)((0,ye.Z)({},Z),{},{isSelected:ln}),icon:on}));return Xi&&(wn=Xi(wn,Z,{selected:ln})),wn});function Bt(Z,de){var Te=Z.eventKey,_e=X(),Re=we(Te);return m.useEffect(function(){if(_e)return _e.registerPath(Te,Re),function(){_e.unregisterPath(Te,Re)}},[Re]),_e?null:m.createElement(pt,(0,z.Z)({},Z,{ref:de}))}var rt=m.forwardRef(Bt),Ye=["className","children"],$e=function(de,Te){var _e=de.className,Re=de.children,Le=(0,p.Z)(de,Ye),Ge=m.useContext(I),it=Ge.prefixCls,re=Ge.mode,Je=Ge.rtl;return m.createElement("ul",(0,z.Z)({className:Y()(it,Je&&"".concat(it,"-rtl"),"".concat(it,"-sub"),"".concat(it,"-").concat(re==="inline"?"inline":"vertical"),_e),role:"menu"},Le,{"data-menu-list":!0,ref:Te}),Re)},At=m.forwardRef($e);At.displayName="SubMenuList";var ot=At,ji=G(11592);function ti(Z,de){return(0,ji.Z)(Z).map(function(Te,_e){if(m.isValidElement(Te)){var Re,Le,Ge=Te.key,it=(Re=(Le=Te.props)===null||Le===void 0?void 0:Le.eventKey)!==null&&Re!==void 0?Re:Ge,re=it==null;re&&(it="tmp_key-".concat([].concat((0,ee.Z)(de),[_e]).join("-")));var Je={key:it,eventKey:it};return m.cloneElement(Te,Je)}return Te})}var _t=G(65352),lt={adjustX:1,adjustY:1},oi={topLeft:{points:["bl","tl"],overflow:lt},topRight:{points:["br","tr"],overflow:lt},bottomLeft:{points:["tl","bl"],overflow:lt},bottomRight:{points:["tr","br"],overflow:lt},leftTop:{points:["tr","tl"],overflow:lt},leftBottom:{points:["br","bl"],overflow:lt},rightTop:{points:["tl","tr"],overflow:lt},rightBottom:{points:["bl","br"],overflow:lt}},Fi={topLeft:{points:["bl","tl"],overflow:lt},topRight:{points:["br","tr"],overflow:lt},bottomLeft:{points:["tl","bl"],overflow:lt},bottomRight:{points:["tr","br"],overflow:lt},rightTop:{points:["tr","tl"],overflow:lt},rightBottom:{points:["br","bl"],overflow:lt},leftTop:{points:["tl","tr"],overflow:lt},leftBottom:{points:["bl","br"],overflow:lt}},an=null;function Li(Z,de,Te){if(de)return de;if(Te)return Te[Z]||Te.other}var bi={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function pi(Z){var de=Z.prefixCls,Te=Z.visible,_e=Z.children,Re=Z.popup,Le=Z.popupStyle,Ge=Z.popupClassName,it=Z.popupOffset,re=Z.disabled,Je=Z.mode,It=Z.onVisibleChange,ct=m.useContext(I),at=ct.getPopupContainer,Lt=ct.rtl,Vt=ct.subMenuOpenDelay,Tt=ct.subMenuCloseDelay,gt=ct.builtinPlacements,Qt=ct.triggerSubMenuAction,ui=ct.forceSubMenuRender,zt=ct.rootClassName,Ft=ct.motion,ci=ct.defaultMotions,Wt=m.useState(!1),li=(0,M.Z)(Wt,2),ii=li[0],Xt=li[1],Xi=Lt?(0,ye.Z)((0,ye.Z)({},Fi),gt):(0,ye.Z)((0,ye.Z)({},oi),gt),Ei=bi[Je],Ht=Li(Je,Ft,ci),Wi=m.useRef(Ht);Je!=="inline"&&(Wi.current=Ht);var Pi=(0,ye.Z)((0,ye.Z)({},Wi.current),{},{leavedClassName:"".concat(de,"-hidden"),removeOnLeave:!1,motionAppear:!0}),xi=m.useRef();return m.useEffect(function(){return xi.current=(0,pe.Z)(function(){Xt(Te)}),function(){pe.Z.cancel(xi.current)}},[Te]),m.createElement(_t.Z,{prefixCls:de,popupClassName:Y()("".concat(de,"-popup"),(0,J.Z)({},"".concat(de,"-rtl"),Lt),Ge,zt),stretch:Je==="horizontal"?"minWidth":null,getPopupContainer:at,builtinPlacements:Xi,popupPlacement:Ei,popupVisible:ii,popup:Re,popupStyle:Le,popupAlign:it&&{offset:it},action:re?[]:[Qt],mouseEnterDelay:Vt,mouseLeaveDelay:Tt,onPopupVisibleChange:It,forceRender:ui,popupMotion:Pi,fresh:!0},_e)}var Bi=G(77900);function zi(Z){var de=Z.id,Te=Z.open,_e=Z.keyPath,Re=Z.children,Le="inline",Ge=m.useContext(I),it=Ge.prefixCls,re=Ge.forceSubMenuRender,Je=Ge.motion,It=Ge.defaultMotions,ct=Ge.mode,at=m.useRef(!1);at.current=ct===Le;var Lt=m.useState(!at.current),Vt=(0,M.Z)(Lt,2),Tt=Vt[0],gt=Vt[1],Qt=at.current?Te:!1;m.useEffect(function(){at.current&&gt(!1)},[ct]);var ui=(0,ye.Z)({},Li(Le,Je,It));_e.length>1&&(ui.motionAppear=!1);var zt=ui.onVisibleChanged;return ui.onVisibleChanged=function(Ft){return!at.current&&!Ft&&gt(!0),zt==null?void 0:zt(Ft)},Tt?null:m.createElement(j,{mode:Le,locked:!at.current},m.createElement(Bi.default,(0,z.Z)({visible:Qt},ui,{forceRender:re,removeOnLeave:!1,leavedClassName:"".concat(it,"-hidden")}),function(Ft){var ci=Ft.className,Wt=Ft.style;return m.createElement(ot,{id:de,className:ci,style:Wt},Re)}))}var Di=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],Gi=["active"],Ai=m.forwardRef(function(Z,de){var Te=Z.style,_e=Z.className,Re=Z.title,Le=Z.eventKey,Ge=Z.warnKey,it=Z.disabled,re=Z.internalPopupClose,Je=Z.children,It=Z.itemIcon,ct=Z.expandIcon,at=Z.popupClassName,Lt=Z.popupOffset,Vt=Z.popupStyle,Tt=Z.onClick,gt=Z.onMouseEnter,Qt=Z.onMouseLeave,ui=Z.onTitleClick,zt=Z.onTitleMouseEnter,Ft=Z.onTitleMouseLeave,ci=(0,p.Z)(Z,Di),Wt=C(Le),li=m.useContext(I),ii=li.prefixCls,Xt=li.mode,Xi=li.openKeys,Ei=li.disabled,Ht=li.overflowDisabled,Wi=li.activeKey,Pi=li.selectedKeys,xi=li.itemIcon,en=li.expandIcon,vi=li.onItemClick,on=li.onOpenChange,hi=li.onActive,dn=m.useContext(U),kn=dn._internalRenderSubMenuItem,ln=m.useContext(Ee),Ln=ln.isSubPathKey,An=we(),Hi="".concat(ii,"-submenu"),rn=Ei||it,pn=m.useRef(),wn=m.useRef(),vn=It!=null?It:xi,ri=ct!=null?ct:en,un=Xi.includes(Le),cn=!Ht&&un,tn=Ln(Pi,Le),qi=Yt(Le,rn,zt,Ft),vt=qi.active,Pn=(0,p.Z)(qi,Gi),yn=m.useState(!1),Kn=(0,M.Z)(yn,2),On=Kn[0],Xn=Kn[1],Mn=function(Ri){rn||Xn(Ri)},qn=function(Ri){Mn(!0),gt==null||gt({key:Le,domEvent:Ri})},mi=function(Ri){Mn(!1),Qt==null||Qt({key:Le,domEvent:Ri})},Vn=m.useMemo(function(){return vt||(Xt!=="inline"?On||Ln([Wi],Le):!1)},[Xt,vt,Wi,On,Le,Ln]),En=St(An.length),as=function(Ri){rn||(ui==null||ui({key:Le,domEvent:Ri}),Xt==="inline"&&on(Le,!un))},Jn=Be(function(wi){Tt==null||Tt(ke(wi)),vi(wi)}),Wn=function(Ri){Xt!=="inline"&&on(Le,Ri)},es=function(){hi(Le)},bn=Wt&&"".concat(Wt,"-popup"),xn=m.useMemo(function(){return m.createElement(Ni,{icon:Xt!=="horizontal"?ri:void 0,props:(0,ye.Z)((0,ye.Z)({},Z),{},{isOpen:cn,isSubMenu:!0})},m.createElement("i",{className:"".concat(Hi,"-arrow")}))},[Xt,ri,Z,cn,Hi]),Yi=m.createElement("div",(0,z.Z)({role:"menuitem",style:En,className:"".concat(Hi,"-title"),tabIndex:rn?null:-1,ref:pn,title:typeof Re=="string"?Re:null,"data-menu-id":Ht&&Wt?null:Wt,"aria-expanded":cn,"aria-haspopup":!0,"aria-controls":bn,"aria-disabled":rn,onClick:as,onFocus:es},Pn),Re,xn),Rn=m.useRef(Xt);if(Xt!=="inline"&&An.length>1?Rn.current="vertical":Rn.current=Xt,!Ht){var nn=Rn.current;Yi=m.createElement(pi,{mode:nn,prefixCls:Hi,visible:!re&&cn&&Xt!=="inline",popupClassName:at,popupOffset:Lt,popupStyle:Vt,popup:m.createElement(j,{mode:nn==="horizontal"?"vertical":nn},m.createElement(ot,{id:bn,ref:wn},Je)),disabled:rn,onVisibleChange:Wn},Yi)}var Nn=m.createElement(l.Z.Item,(0,z.Z)({ref:de,role:"none"},ci,{component:"li",style:Te,className:Y()(Hi,"".concat(Hi,"-").concat(Xt),_e,(0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)({},"".concat(Hi,"-open"),cn),"".concat(Hi,"-active"),Vn),"".concat(Hi,"-selected"),tn),"".concat(Hi,"-disabled"),rn)),onMouseEnter:qn,onMouseLeave:mi}),Yi,!Ht&&m.createElement(zi,{id:bn,open:cn,keyPath:An},Je));return kn&&(Nn=kn(Nn,Z,{selected:tn,active:Vn,open:cn,disabled:rn})),m.createElement(j,{onItemClick:Jn,mode:Xt==="horizontal"?"vertical":Xt,itemIcon:vn,expandIcon:ri},Nn)}),_n=m.forwardRef(function(Z,de){var Te=Z.eventKey,_e=Z.children,Re=we(Te),Le=ti(_e,Re),Ge=X();m.useEffect(function(){if(Ge)return Ge.registerPath(Te,Re),function(){Ge.unregisterPath(Te,Re)}},[Re]);var it;return Ge?it=Le:it=m.createElement(Ai,(0,z.Z)({ref:de},Z),Le),m.createElement(ge.Provider,{value:Re},it)}),Ki=_n,Ui=G(28788);function Zi(Z){var de=Z.className,Te=Z.style,_e=m.useContext(I),Re=_e.prefixCls,Le=X();return Le?null:m.createElement("li",{role:"separator",className:Y()("".concat(Re,"-item-divider"),de),style:Te})}var sn=["className","title","eventKey","children"],Ci=m.forwardRef(function(Z,de){var Te=Z.className,_e=Z.title,Re=Z.eventKey,Le=Z.children,Ge=(0,p.Z)(Z,sn),it=m.useContext(I),re=it.prefixCls,Je="".concat(re,"-item-group");return m.createElement("li",(0,z.Z)({ref:de,role:"presentation"},Ge,{onClick:function(ct){return ct.stopPropagation()},className:Y()(Je,Te)}),m.createElement("div",{role:"presentation",className:"".concat(Je,"-title"),title:typeof _e=="string"?_e:void 0},_e),m.createElement("ul",{role:"group",className:"".concat(Je,"-list")},Le))}),Tn=m.forwardRef(function(Z,de){var Te=Z.eventKey,_e=Z.children,Re=we(Te),Le=ti(_e,Re),Ge=X();return Ge?Le:m.createElement(Ci,(0,z.Z)({ref:de},(0,Mt.Z)(Z,["warnKey"])),Le)}),jt=Tn,ki=["label","children","key","type","extra"];function Jt(Z,de,Te){var _e=de.item,Re=de.group,Le=de.submenu,Ge=de.divider;return(Z||[]).map(function(it,re){if(it&&(0,Ui.Z)(it)==="object"){var Je=it,It=Je.label,ct=Je.children,at=Je.key,Lt=Je.type,Vt=Je.extra,Tt=(0,p.Z)(Je,ki),gt=at!=null?at:"tmp-".concat(re);return ct||Lt==="group"?Lt==="group"?m.createElement(Re,(0,z.Z)({key:gt},Tt,{title:It}),Jt(ct,de,Te)):m.createElement(Le,(0,z.Z)({key:gt},Tt,{title:It}),Jt(ct,de,Te)):Lt==="divider"?m.createElement(Ge,(0,z.Z)({key:gt},Tt)):m.createElement(_e,(0,z.Z)({key:gt},Tt,{extra:Vt}),It,(!!Vt||Vt===0)&&m.createElement("span",{className:"".concat(Te,"-item-extra")},Vt))}return null}).filter(function(it){return it})}function $i(Z,de,Te,_e,Re){var Le=Z,Ge=(0,ye.Z)({divider:Zi,item:rt,group:jt,submenu:Ki},_e);return de&&(Le=Jt(de,Ge,Re)),ti(Le,Te)}var Ji=["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"],kt=[],fn=m.forwardRef(function(Z,de){var Te,_e=Z,Re=_e.prefixCls,Le=Re===void 0?"rc-menu":Re,Ge=_e.rootClassName,it=_e.style,re=_e.className,Je=_e.tabIndex,It=Je===void 0?0:Je,ct=_e.items,at=_e.children,Lt=_e.direction,Vt=_e.id,Tt=_e.mode,gt=Tt===void 0?"vertical":Tt,Qt=_e.inlineCollapsed,ui=_e.disabled,zt=_e.disabledOverflow,Ft=_e.subMenuOpenDelay,ci=Ft===void 0?.1:Ft,Wt=_e.subMenuCloseDelay,li=Wt===void 0?.1:Wt,ii=_e.forceSubMenuRender,Xt=_e.defaultOpenKeys,Xi=_e.openKeys,Ei=_e.activeKey,Ht=_e.defaultActiveFirst,Wi=_e.selectable,Pi=Wi===void 0?!0:Wi,xi=_e.multiple,en=xi===void 0?!1:xi,vi=_e.defaultSelectedKeys,on=_e.selectedKeys,hi=_e.onSelect,dn=_e.onDeselect,kn=_e.inlineIndent,ln=kn===void 0?24:kn,Ln=_e.motion,An=_e.defaultMotions,Hi=_e.triggerSubMenuAction,rn=Hi===void 0?"hover":Hi,pn=_e.builtinPlacements,wn=_e.itemIcon,vn=_e.expandIcon,ri=_e.overflowedIndicator,un=ri===void 0?"...":ri,cn=_e.overflowedIndicatorPopupClassName,tn=_e.getPopupContainer,qi=_e.onClick,vt=_e.onOpenChange,Pn=_e.onKeyDown,yn=_e.openAnimation,Kn=_e.openTransitionName,On=_e._internalRenderMenuItem,Xn=_e._internalRenderSubMenuItem,Mn=_e._internalComponents,qn=(0,p.Z)(_e,Ji),mi=m.useMemo(function(){return[$i(at,ct,kt,Mn,Le),$i(at,ct,kt,{},Le)]},[at,ct,Mn]),Vn=(0,M.Z)(mi,2),En=Vn[0],as=Vn[1],Jn=m.useState(!1),Wn=(0,M.Z)(Jn,2),es=Wn[0],bn=Wn[1],xn=m.useRef(),Yi=mt(Vt),Rn=Lt==="rtl",nn=(0,$.Z)(Xt,{value:Xi,postState:function(fi){return fi||kt}}),Nn=(0,M.Z)(nn,2),wi=Nn[0],Ri=Nn[1],Kt=function(fi){var Ii=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function be(){Ri(fi),vt==null||vt(fi)}Ii?(0,x.flushSync)(be):be()},Qi=m.useState(wi),Hn=(0,M.Z)(Qi,2),ts=Hn[0],os=Hn[1],jn=m.useRef(!1),nt=m.useMemo(function(){return(gt==="inline"||gt==="vertical")&&Qt?["vertical",Qt]:[gt,!1]},[gt,Qt]),Et=(0,M.Z)(nt,2),_i=Et[0],Oi=Et[1],Si=_i==="inline",ls=m.useState(_i),zn=(0,M.Z)(ls,2),gn=zn[0],fs=zn[1],or=m.useState(Oi),$s=(0,M.Z)(or,2),Mr=$s[0],Gs=$s[1];m.useEffect(function(){fs(_i),Gs(Oi),jn.current&&(Si?Ri(ts):Kt(kt))},[_i,Oi]);var Nr=m.useState(0),Fn=(0,M.Z)(Nr,2),vs=Fn[0],Fr=Fn[1],Rs=vs>=En.length-1||gn!=="horizontal"||zt;m.useEffect(function(){Si&&os(wi)},[wi]),m.useEffect(function(){return jn.current=!0,function(){jn.current=!1}},[]);var is=We(),Ks=is.registerPath,Vs=is.unregisterPath,Br=is.refreshOverflowKeys,Is=is.isSubPathKey,lr=is.getKeyPath,Ws=is.getKeys,Zn=is.getSubPathKeys,ur=m.useMemo(function(){return{registerPath:Ks,unregisterPath:Vs}},[Ks,Vs]),Hs=m.useMemo(function(){return{isSubPathKey:Is}},[Is]);m.useEffect(function(){Br(Rs?kt:En.slice(vs+1).map(function(Mi){return Mi.key}))},[vs,Rs]);var cr=(0,$.Z)(Ei||Ht&&((Te=En[0])===null||Te===void 0?void 0:Te.key),{value:Ei}),hr=(0,M.Z)(cr,2),ys=hr[0],js=hr[1],Ur=Be(function(Mi){js(Mi)}),fr=Be(function(){js(void 0)});(0,m.useImperativeHandle)(de,function(){return{list:xn.current,focus:function(fi){var Ii,be=Ws(),mn=Fe(be,Yi),xs=mn.elements,Ds=mn.key2element,Kr=mn.element2key,Cs=Ie(xn.current,xs),Zs=ys!=null?ys:Cs[0]?Kr.get(Cs[0]):(Ii=En.find(function(Qs){return!Qs.props.disabled}))===null||Ii===void 0?void 0:Ii.key,Ss=Ds.get(Zs);if(Zs&&Ss){var Ys;Ss==null||(Ys=Ss.focus)===null||Ys===void 0||Ys.call(Ss,fi)}}}});var dr=(0,$.Z)(vi||[],{value:on,postState:function(fi){return Array.isArray(fi)?fi:fi==null?kt:[fi]}}),Ls=(0,M.Z)(dr,2),Es=Ls[0],pr=Ls[1],gr=function(fi){if(Pi){var Ii=fi.key,be=Es.includes(Ii),mn;en?be?mn=Es.filter(function(Ds){return Ds!==Ii}):mn=[].concat((0,ee.Z)(Es),[Ii]):mn=[Ii],pr(mn);var xs=(0,ye.Z)((0,ye.Z)({},fi),{},{selectedKeys:mn});be?dn==null||dn(xs):hi==null||hi(xs)}!en&&wi.length&&gn!=="inline"&&Kt(kt)},mr=Be(function(Mi){qi==null||qi(ke(Mi)),gr(Mi)}),zs=Be(function(Mi,fi){var Ii=wi.filter(function(mn){return mn!==Mi});if(fi)Ii.push(Mi);else if(gn!=="inline"){var be=Zn(Mi);Ii=Ii.filter(function(mn){return!be.has(mn)})}(0,b.Z)(wi,Ii,!0)||Kt(Ii,!0)}),bs=function(fi,Ii){var be=Ii!=null?Ii:!wi.includes(fi);zs(fi,be)},$r=Ve(gn,ys,Rn,Yi,xn,Ws,lr,js,bs,Pn);m.useEffect(function(){bn(!0)},[]);var _r=m.useMemo(function(){return{_internalRenderMenuItem:On,_internalRenderSubMenuItem:Xn}},[On,Xn]),vr=gn!=="horizontal"||zt?En:En.map(function(Mi,fi){return m.createElement(j,{key:Mi.key,overflowDisabled:fi>vs},Mi)}),Gr=m.createElement(l.Z,(0,z.Z)({id:Vt,ref:xn,prefixCls:"".concat(Le,"-overflow"),component:"ul",itemComponent:rt,className:Y()(Le,"".concat(Le,"-root"),"".concat(Le,"-").concat(gn),re,(0,J.Z)((0,J.Z)({},"".concat(Le,"-inline-collapsed"),Mr),"".concat(Le,"-rtl"),Rn),Ge),dir:Lt,style:it,role:"menu",tabIndex:It,data:vr,renderRawItem:function(fi){return fi},renderRawRest:function(fi){var Ii=fi.length,be=Ii?En.slice(-Ii):null;return m.createElement(Ki,{eventKey:Se,title:un,disabled:Rs,internalPopupClose:Ii===0,popupClassName:cn},be)},maxCount:gn!=="horizontal"||zt?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(fi){Fr(fi)},onKeyDown:$r},qn));return m.createElement(U.Provider,{value:_r},m.createElement(S.Provider,{value:Yi},m.createElement(j,{prefixCls:Le,rootClassName:Ge,mode:gn,openKeys:wi,rtl:Rn,disabled:ui,motion:es?Ln:null,defaultMotions:es?An:null,activeKey:ys,onActive:Ur,onInactive:fr,selectedKeys:Es,inlineIndent:ln,subMenuOpenDelay:ci,subMenuCloseDelay:li,forceSubMenuRender:ii,builtinPlacements:pn,triggerSubMenuAction:rn,getPopupContainer:tn,itemIcon:wn,expandIcon:vn,onItemClick:mr,onOpenChange:zs},m.createElement(Ee.Provider,{value:Hs},Gr),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(te.Provider,{value:ur},as)))))}),Vi=fn,yt=Vi;yt.Item=rt,yt.SubMenu=Ki,yt.ItemGroup=jt,yt.Divider=Zi;var Ut=yt},11780:function(Dt,Me,G){"use strict";G.d(Me,{Z:function(){return N}});var z=G(71409),J=G(89490),ye=G(11036),ee=G(39224),M=G(59301),p=G(92310),ie=G.n(p),Y=G(29301),l=G(34280),$=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],b=void 0;function y(_,g){var D=_.prefixCls,V=_.invalidate,pe=_.item,Ae=_.renderItem,Ce=_.responsive,Ne=_.responsiveDisabled,ze=_.registerSize,Ct=_.itemKey,Rt=_.className,tt=_.style,bt=_.children,Ke=_.display,Gt=_.order,ai=_.component,ce=ai===void 0?"div":ai,Ie=(0,ee.Z)(_,$),ne=Ce&&!Ke;function Fe(me){ze(Ct,me)}M.useEffect(function(){return function(){Fe(null)}},[]);var Ve=Ae&&pe!==b?Ae(pe,{index:Gt}):bt,qe;V||(qe={opacity:ne?0:1,height:ne?0:b,overflowY:ne?"hidden":b,order:Ce?Gt:b,pointerEvents:ne?"none":b,position:ne?"absolute":b});var K={};ne&&(K["aria-hidden"]=!0);var ae=M.createElement(ce,(0,z.Z)({className:ie()(!V&&D,Rt),style:(0,J.Z)((0,J.Z)({},qe),tt)},K,Ie,{ref:g}),Ve);return Ce&&(ae=M.createElement(Y.Z,{onResize:function(Se){var We=Se.offsetWidth;Fe(We)},disabled:Ne},ae)),ae}var m=M.forwardRef(y);m.displayName="Item";var x=m,S=G(6089),P=G(4676),C=G(16089);function k(_){if(typeof MessageChannel=="undefined")(0,C.Z)(_);else{var g=new MessageChannel;g.port1.onmessage=function(){return _()},g.port2.postMessage(void 0)}}function R(){var _=M.useRef(null),g=function(V){_.current||(_.current=[],k(function(){(0,P.unstable_batchedUpdates)(function(){_.current.forEach(function(pe){pe()}),_.current=null})})),_.current.push(V)};return g}function I(_,g){var D=M.useState(g),V=(0,ye.Z)(D,2),pe=V[0],Ae=V[1],Ce=(0,S.Z)(function(Ne){_(function(){Ae(Ne)})});return[pe,Ce]}var F=M.createContext(null),j=["component"],q=["className"],te=["className"],X=function(g,D){var V=M.useContext(F);if(!V){var pe=g.component,Ae=pe===void 0?"div":pe,Ce=(0,ee.Z)(g,j);return M.createElement(Ae,(0,z.Z)({},Ce,{ref:D}))}var Ne=V.className,ze=(0,ee.Z)(V,q),Ct=g.className,Rt=(0,ee.Z)(g,te);return M.createElement(F.Provider,{value:null},M.createElement(x,(0,z.Z)({ref:D,className:ie()(Ne,Ct)},ze,Rt)))},ge=M.forwardRef(X);ge.displayName="RawItem";var we=ge,Ee=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],et="responsive",U="invalidate";function w(_){return"+ ".concat(_.length," ...")}function L(_,g){var D=_.prefixCls,V=D===void 0?"rc-overflow":D,pe=_.data,Ae=pe===void 0?[]:pe,Ce=_.renderItem,Ne=_.renderRawItem,ze=_.itemKey,Ct=_.itemWidth,Rt=Ct===void 0?10:Ct,tt=_.ssr,bt=_.style,Ke=_.className,Gt=_.maxCount,ai=_.renderRest,ce=_.renderRawRest,Ie=_.suffix,ne=_.component,Fe=ne===void 0?"div":ne,Ve=_.itemComponent,qe=_.onVisibleChange,K=(0,ee.Z)(_,Ee),ae=tt==="full",me=R(),Se=I(me,null),We=(0,ye.Z)(Se,2),Be=We[0],xt=We[1],He=Be||0,mt=I(me,new Map),Nt=(0,ye.Z)(mt,2),Ot=Nt[0],dt=Nt[1],Zt=I(me,0),Mt=(0,ye.Z)(Zt,2),ni=Mt[0],Yt=Mt[1],St=I(me,0),Ni=(0,ye.Z)(St,2),De=Ni[0],ke=Ni[1],je=I(me,0),si=(0,ye.Z)(je,2),Xe=si[0],Qe=si[1],pt=(0,M.useState)(null),Bt=(0,ye.Z)(pt,2),rt=Bt[0],Ye=Bt[1],$e=(0,M.useState)(null),At=(0,ye.Z)($e,2),ot=At[0],ji=At[1],ti=M.useMemo(function(){return ot===null&&ae?Number.MAX_SAFE_INTEGER:ot||0},[ot,Be]),_t=(0,M.useState)(!1),lt=(0,ye.Z)(_t,2),oi=lt[0],Fi=lt[1],an="".concat(V,"-item"),Li=Math.max(ni,De),bi=Gt===et,pi=Ae.length&&bi,Bi=Gt===U,zi=pi||typeof Gt=="number"&&Ae.length>Gt,Di=(0,M.useMemo)(function(){var yt=Ae;return pi?Be===null&&ae?yt=Ae:yt=Ae.slice(0,Math.min(Ae.length,He/Rt)):typeof Gt=="number"&&(yt=Ae.slice(0,Gt)),yt},[Ae,Rt,Be,Gt,pi]),Gi=(0,M.useMemo)(function(){return pi?Ae.slice(ti+1):Ae.slice(Di.length)},[Ae,Di,pi,ti]),Ai=(0,M.useCallback)(function(yt,Ut){var Z;return typeof ze=="function"?ze(yt):(Z=ze&&(yt==null?void 0:yt[ze]))!==null&&Z!==void 0?Z:Ut},[ze]),_n=(0,M.useCallback)(Ce||function(yt){return yt},[Ce]);function Ki(yt,Ut,Z){ot===yt&&(Ut===void 0||Ut===rt)||(ji(yt),Z||(Fi(yt<Ae.length-1),qe==null||qe(yt)),Ut!==void 0&&Ye(Ut))}function Ui(yt,Ut){xt(Ut.clientWidth)}function Zi(yt,Ut){dt(function(Z){var de=new Map(Z);return Ut===null?de.delete(yt):de.set(yt,Ut),de})}function sn(yt,Ut){ke(Ut),Yt(De)}function Ci(yt,Ut){Qe(Ut)}function Tn(yt){return Ot.get(Ai(Di[yt],yt))}(0,l.Z)(function(){if(He&&typeof Li=="number"&&Di){var yt=Xe,Ut=Di.length,Z=Ut-1;if(!Ut){Ki(0,null);return}for(var de=0;de<Ut;de+=1){var Te=Tn(de);if(ae&&(Te=Te||0),Te===void 0){Ki(de-1,void 0,!0);break}if(yt+=Te,Z===0&&yt<=He||de===Z-1&&yt+Tn(Z)<=He){Ki(Z,null);break}else if(yt+Li>He){Ki(de-1,yt-Te-Xe+De);break}}Ie&&Tn(0)+Xe>He&&Ye(null)}},[He,Ot,De,Xe,Ai,Di]);var jt=oi&&!!Gi.length,ki={};rt!==null&&pi&&(ki={position:"absolute",left:rt,top:0});var Jt={prefixCls:an,responsive:pi,component:Ve,invalidate:Bi},$i=Ne?function(yt,Ut){var Z=Ai(yt,Ut);return M.createElement(F.Provider,{key:Z,value:(0,J.Z)((0,J.Z)({},Jt),{},{order:Ut,item:yt,itemKey:Z,registerSize:Zi,display:Ut<=ti})},Ne(yt,Ut))}:function(yt,Ut){var Z=Ai(yt,Ut);return M.createElement(x,(0,z.Z)({},Jt,{order:Ut,key:Z,item:yt,renderItem:_n,itemKey:Z,registerSize:Zi,display:Ut<=ti}))},Ji={order:jt?ti:Number.MAX_SAFE_INTEGER,className:"".concat(an,"-rest"),registerSize:sn,display:jt},kt=ai||w,fn=ce?M.createElement(F.Provider,{value:(0,J.Z)((0,J.Z)({},Jt),Ji)},ce(Gi)):M.createElement(x,(0,z.Z)({},Jt,Ji),typeof kt=="function"?kt(Gi):kt),Vi=M.createElement(Fe,(0,z.Z)({className:ie()(!Bi&&V,Ke),style:bt,ref:g},K),Di.map($i),zi?fn:null,Ie&&M.createElement(x,(0,z.Z)({},Jt,{responsive:bi,responsiveDisabled:!pi,order:ti,className:"".concat(an,"-suffix"),registerSize:Ci,display:!0,style:ki}),Ie));return bi?M.createElement(Y.Z,{onResize:Ui,disabled:!pi},Vi):Vi}var O=M.forwardRef(L);O.displayName="Overflow",O.Item=we,O.RESPONSIVE=et,O.INVALIDATE=U;var H=O,N=H},29301:function(Dt,Me,G){"use strict";G.d(Me,{Z:function(){return U}});var z=G(71409),J=G(59301),ye=G(11592),ee=G(48736),M=G(89490),p=G(28788),ie=G(76846),Y=G(8654),l=J.createContext(null);function $(w){var L=w.children,O=w.onBatchResize,H=J.useRef(0),N=J.useRef([]),_=J.useContext(l),g=J.useCallback(function(D,V,pe){H.current+=1;var Ae=H.current;N.current.push({size:D,element:V,data:pe}),Promise.resolve().then(function(){Ae===H.current&&(O==null||O(N.current),N.current=[])}),_==null||_(D,V,pe)},[O,_]);return J.createElement(l.Provider,{value:g},L)}var b=G(76374),y=new Map;function m(w){w.forEach(function(L){var O,H=L.target;(O=y.get(H))===null||O===void 0||O.forEach(function(N){return N(H)})})}var x=new b.Z(m),S=null,P=null;function C(w,L){y.has(w)||(y.set(w,new Set),x.observe(w)),y.get(w).add(L)}function k(w,L){y.has(w)&&(y.get(w).delete(L),y.get(w).size||(x.unobserve(w),y.delete(w)))}var R=G(16552),I=G(19210),F=G(46654),j=G(37205),q=function(w){(0,F.Z)(O,w);var L=(0,j.Z)(O);function O(){return(0,R.Z)(this,O),L.apply(this,arguments)}return(0,I.Z)(O,[{key:"render",value:function(){return this.props.children}}]),O}(J.Component);function te(w,L){var O=w.children,H=w.disabled,N=J.useRef(null),_=J.useRef(null),g=J.useContext(l),D=typeof O=="function",V=D?O(N):O,pe=J.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ae=!D&&J.isValidElement(V)&&(0,Y.Yr)(V),Ce=Ae?(0,Y.C4)(V):null,Ne=(0,Y.x1)(Ce,N),ze=function(){var bt;return(0,ie.ZP)(N.current)||(N.current&&(0,p.Z)(N.current)==="object"?(0,ie.ZP)((bt=N.current)===null||bt===void 0?void 0:bt.nativeElement):null)||(0,ie.ZP)(_.current)};J.useImperativeHandle(L,function(){return ze()});var Ct=J.useRef(w);Ct.current=w;var Rt=J.useCallback(function(tt){var bt=Ct.current,Ke=bt.onResize,Gt=bt.data,ai=tt.getBoundingClientRect(),ce=ai.width,Ie=ai.height,ne=tt.offsetWidth,Fe=tt.offsetHeight,Ve=Math.floor(ce),qe=Math.floor(Ie);if(pe.current.width!==Ve||pe.current.height!==qe||pe.current.offsetWidth!==ne||pe.current.offsetHeight!==Fe){var K={width:Ve,height:qe,offsetWidth:ne,offsetHeight:Fe};pe.current=K;var ae=ne===Math.round(ce)?ce:ne,me=Fe===Math.round(Ie)?Ie:Fe,Se=(0,M.Z)((0,M.Z)({},K),{},{offsetWidth:ae,offsetHeight:me});g==null||g(Se,tt,Gt),Ke&&Promise.resolve().then(function(){Ke(Se,tt)})}},[]);return J.useEffect(function(){var tt=ze();return tt&&!H&&C(tt,Rt),function(){return k(tt,Rt)}},[N.current,H]),J.createElement(q,{ref:_},Ae?J.cloneElement(V,{ref:Ne}):V)}var X=J.forwardRef(te),ge=X,we="rc-observer-key";function Ee(w,L){var O=w.children,H=typeof O=="function"?[O]:(0,ye.Z)(O);return H.map(function(N,_){var g=(N==null?void 0:N.key)||"".concat(we,"-").concat(_);return J.createElement(ge,(0,z.Z)({},w,{key:g,ref:_===0?L:void 0}),N)})}var et=J.forwardRef(Ee);et.Collection=$;var U=et},29125:function(Dt,Me,G){"use strict";G.d(Me,{G:function(){return ee},Z:function(){return k}});var z=G(92310),J=G.n(z),ye=G(59301);function ee(R){var I=R.children,F=R.prefixCls,j=R.id,q=R.overlayInnerStyle,te=R.bodyClassName,X=R.className,ge=R.style;return ye.createElement("div",{className:J()("".concat(F,"-content"),X),style:ge},ye.createElement("div",{className:J()("".concat(F,"-inner"),te),id:j,role:"tooltip",style:q},typeof I=="function"?I():I))}var M=G(71409),p=G(89490),ie=G(39224),Y=G(65352),l={shiftX:64,adjustY:1},$={adjustX:1,shiftY:!0},b=[0,0],y={left:{points:["cr","cl"],overflow:$,offset:[-4,0],targetOffset:b},right:{points:["cl","cr"],overflow:$,offset:[4,0],targetOffset:b},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:b},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:b},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:b},leftTop:{points:["tr","tl"],overflow:$,offset:[-4,0],targetOffset:b},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:b},rightTop:{points:["tl","tr"],overflow:$,offset:[4,0],targetOffset:b},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:b},rightBottom:{points:["bl","br"],overflow:$,offset:[4,0],targetOffset:b},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:b},leftBottom:{points:["br","bl"],overflow:$,offset:[-4,0],targetOffset:b}},m=null,x=G(80402),S=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],P=function(I,F){var j=I.overlayClassName,q=I.trigger,te=q===void 0?["hover"]:q,X=I.mouseEnterDelay,ge=X===void 0?0:X,we=I.mouseLeaveDelay,Ee=we===void 0?.1:we,et=I.overlayStyle,U=I.prefixCls,w=U===void 0?"rc-tooltip":U,L=I.children,O=I.onVisibleChange,H=I.afterVisibleChange,N=I.transitionName,_=I.animation,g=I.motion,D=I.placement,V=D===void 0?"right":D,pe=I.align,Ae=pe===void 0?{}:pe,Ce=I.destroyTooltipOnHide,Ne=Ce===void 0?!1:Ce,ze=I.defaultVisible,Ct=I.getTooltipContainer,Rt=I.overlayInnerStyle,tt=I.arrowContent,bt=I.overlay,Ke=I.id,Gt=I.showArrow,ai=Gt===void 0?!0:Gt,ce=I.classNames,Ie=I.styles,ne=(0,ie.Z)(I,S),Fe=(0,x.Z)(Ke),Ve=(0,ye.useRef)(null);(0,ye.useImperativeHandle)(F,function(){return Ve.current});var qe=(0,p.Z)({},ne);"visible"in I&&(qe.popupVisible=I.visible);var K=function(){return ye.createElement(ee,{key:"content",prefixCls:w,id:Fe,bodyClassName:ce==null?void 0:ce.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},Rt),Ie==null?void 0:Ie.body)},bt)},ae=function(){var Se=ye.Children.only(L),We=(Se==null?void 0:Se.props)||{},Be=(0,p.Z)((0,p.Z)({},We),{},{"aria-describedby":bt?Fe:null});return ye.cloneElement(L,Be)};return ye.createElement(Y.Z,(0,M.Z)({popupClassName:J()(j,ce==null?void 0:ce.root),prefixCls:w,popup:K,action:te,builtinPlacements:y,popupPlacement:V,ref:Ve,popupAlign:Ae,getPopupContainer:Ct,onPopupVisibleChange:O,afterPopupVisibleChange:H,popupTransitionName:N,popupAnimation:_,popupMotion:g,defaultPopupVisible:ze,autoDestroy:Ne,mouseLeaveDelay:Ee,popupStyle:(0,p.Z)((0,p.Z)({},et),Ie==null?void 0:Ie.root),mouseEnterDelay:ge,arrow:ai},qe),ae())},C=(0,ye.forwardRef)(P),k=C},49658:function(Dt,Me){"use strict";Me.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var G=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(G)||/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(G==null?void 0:G.substr(0,4))}},83145:function(Dt,Me,G){"use strict";Object.defineProperty(Me,"__esModule",{value:!0}),Me.CopyToClipboard=void 0;var z=ye(G(59301)),J=ye(G(25769));function ye(R){return R&&R.__esModule?R:{default:R}}function ee(R){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ee=function(F){return typeof F}:ee=function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},ee(R)}function M(R,I){var F=Object.keys(R);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(R);I&&(j=j.filter(function(q){return Object.getOwnPropertyDescriptor(R,q).enumerable})),F.push.apply(F,j)}return F}function p(R){for(var I=1;I<arguments.length;I++){var F=arguments[I]!=null?arguments[I]:{};I%2?M(F,!0).forEach(function(j){C(R,j,F[j])}):Object.getOwnPropertyDescriptors?Object.defineProperties(R,Object.getOwnPropertyDescriptors(F)):M(F).forEach(function(j){Object.defineProperty(R,j,Object.getOwnPropertyDescriptor(F,j))})}return R}function ie(R,I){if(R==null)return{};var F=Y(R,I),j,q;if(Object.getOwnPropertySymbols){var te=Object.getOwnPropertySymbols(R);for(q=0;q<te.length;q++)j=te[q],!(I.indexOf(j)>=0)&&Object.prototype.propertyIsEnumerable.call(R,j)&&(F[j]=R[j])}return F}function Y(R,I){if(R==null)return{};var F={},j=Object.keys(R),q,te;for(te=0;te<j.length;te++)q=j[te],!(I.indexOf(q)>=0)&&(F[q]=R[q]);return F}function l(R,I){if(!(R instanceof I))throw new TypeError("Cannot call a class as a function")}function $(R,I){for(var F=0;F<I.length;F++){var j=I[F];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(R,j.key,j)}}function b(R,I,F){return I&&$(R.prototype,I),F&&$(R,F),R}function y(R,I){return I&&(ee(I)==="object"||typeof I=="function")?I:x(R)}function m(R){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(F){return F.__proto__||Object.getPrototypeOf(F)},m(R)}function x(R){if(R===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return R}function S(R,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function");R.prototype=Object.create(I&&I.prototype,{constructor:{value:R,writable:!0,configurable:!0}}),I&&P(R,I)}function P(R,I){return P=Object.setPrototypeOf||function(j,q){return j.__proto__=q,j},P(R,I)}function C(R,I,F){return I in R?Object.defineProperty(R,I,{value:F,enumerable:!0,configurable:!0,writable:!0}):R[I]=F,R}var k=function(R){S(I,R);function I(){var F,j;l(this,I);for(var q=arguments.length,te=new Array(q),X=0;X<q;X++)te[X]=arguments[X];return j=y(this,(F=m(I)).call.apply(F,[this].concat(te))),C(x(j),"onClick",function(ge){var we=j.props,Ee=we.text,et=we.onCopy,U=we.children,w=we.options,L=z.default.Children.only(U),O=(0,J.default)(Ee,w);et&&et(Ee,O),L&&L.props&&typeof L.props.onClick=="function"&&L.props.onClick(ge)}),j}return b(I,[{key:"render",value:function(){var j=this.props,q=j.text,te=j.onCopy,X=j.options,ge=j.children,we=ie(j,["text","onCopy","options","children"]),Ee=z.default.Children.only(ge);return z.default.cloneElement(Ee,p({},we,{onClick:this.onClick}))}}]),I}(z.default.PureComponent);Me.CopyToClipboard=k,C(k,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Dt,Me,G){"use strict";var z=G(83145),J=z.CopyToClipboard;J.CopyToClipboard=J,Dt.exports=J},76374:function(Dt,Me,G){"use strict";var z=function(){if(typeof Map!="undefined")return Map;function U(w,L){var O=-1;return w.some(function(H,N){return H[0]===L?(O=N,!0):!1}),O}return function(){function w(){this.__entries__=[]}return Object.defineProperty(w.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),w.prototype.get=function(L){var O=U(this.__entries__,L),H=this.__entries__[O];return H&&H[1]},w.prototype.set=function(L,O){var H=U(this.__entries__,L);~H?this.__entries__[H][1]=O:this.__entries__.push([L,O])},w.prototype.delete=function(L){var O=this.__entries__,H=U(O,L);~H&&O.splice(H,1)},w.prototype.has=function(L){return!!~U(this.__entries__,L)},w.prototype.clear=function(){this.__entries__.splice(0)},w.prototype.forEach=function(L,O){O===void 0&&(O=null);for(var H=0,N=this.__entries__;H<N.length;H++){var _=N[H];L.call(O,_[1],_[0])}},w}()}(),J=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,ye=function(){return typeof G.g!="undefined"&&G.g.Math===Math?G.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),ee=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(ye):function(U){return setTimeout(function(){return U(Date.now())},1e3/60)}}(),M=2;function p(U,w){var L=!1,O=!1,H=0;function N(){L&&(L=!1,U()),O&&g()}function _(){ee(N)}function g(){var D=Date.now();if(L){if(D-H<M)return;O=!0}else L=!0,O=!1,setTimeout(_,w);H=D}return g}var ie=20,Y=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",$=function(){function U(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),ie)}return U.prototype.addObserver=function(w){~this.observers_.indexOf(w)||this.observers_.push(w),this.connected_||this.connect_()},U.prototype.removeObserver=function(w){var L=this.observers_,O=L.indexOf(w);~O&&L.splice(O,1),!L.length&&this.connected_&&this.disconnect_()},U.prototype.refresh=function(){var w=this.updateObservers_();w&&this.refresh()},U.prototype.updateObservers_=function(){var w=this.observers_.filter(function(L){return L.gatherActive(),L.hasActive()});return w.forEach(function(L){return L.broadcastActive()}),w.length>0},U.prototype.connect_=function(){!J||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)},U.prototype.disconnect_=function(){!J||!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)},U.prototype.onTransitionEnd_=function(w){var L=w.propertyName,O=L===void 0?"":L,H=Y.some(function(N){return!!~O.indexOf(N)});H&&this.refresh()},U.getInstance=function(){return this.instance_||(this.instance_=new U),this.instance_},U.instance_=null,U}(),b=function(U,w){for(var L=0,O=Object.keys(w);L<O.length;L++){var H=O[L];Object.defineProperty(U,H,{value:w[H],enumerable:!1,writable:!1,configurable:!0})}return U},y=function(U){var w=U&&U.ownerDocument&&U.ownerDocument.defaultView;return w||ye},m=q(0,0,0,0);function x(U){return parseFloat(U)||0}function S(U){for(var w=[],L=1;L<arguments.length;L++)w[L-1]=arguments[L];return w.reduce(function(O,H){var N=U["border-"+H+"-width"];return O+x(N)},0)}function P(U){for(var w=["top","right","bottom","left"],L={},O=0,H=w;O<H.length;O++){var N=H[O],_=U["padding-"+N];L[N]=x(_)}return L}function C(U){var w=U.getBBox();return q(0,0,w.width,w.height)}function k(U){var w=U.clientWidth,L=U.clientHeight;if(!w&&!L)return m;var O=y(U).getComputedStyle(U),H=P(O),N=H.left+H.right,_=H.top+H.bottom,g=x(O.width),D=x(O.height);if(O.boxSizing==="border-box"&&(Math.round(g+N)!==w&&(g-=S(O,"left","right")+N),Math.round(D+_)!==L&&(D-=S(O,"top","bottom")+_)),!I(U)){var V=Math.round(g+N)-w,pe=Math.round(D+_)-L;Math.abs(V)!==1&&(g-=V),Math.abs(pe)!==1&&(D-=pe)}return q(H.left,H.top,g,D)}var R=function(){return typeof SVGGraphicsElement!="undefined"?function(U){return U instanceof y(U).SVGGraphicsElement}:function(U){return U instanceof y(U).SVGElement&&typeof U.getBBox=="function"}}();function I(U){return U===y(U).document.documentElement}function F(U){return J?R(U)?C(U):k(U):m}function j(U){var w=U.x,L=U.y,O=U.width,H=U.height,N=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,_=Object.create(N.prototype);return b(_,{x:w,y:L,width:O,height:H,top:L,right:w+O,bottom:H+L,left:w}),_}function q(U,w,L,O){return{x:U,y:w,width:L,height:O}}var te=function(){function U(w){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=q(0,0,0,0),this.target=w}return U.prototype.isActive=function(){var w=F(this.target);return this.contentRect_=w,w.width!==this.broadcastWidth||w.height!==this.broadcastHeight},U.prototype.broadcastRect=function(){var w=this.contentRect_;return this.broadcastWidth=w.width,this.broadcastHeight=w.height,w},U}(),X=function(){function U(w,L){var O=j(L);b(this,{target:w,contentRect:O})}return U}(),ge=function(){function U(w,L,O){if(this.activeObservations_=[],this.observations_=new z,typeof w!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=w,this.controller_=L,this.callbackCtx_=O}return U.prototype.observe=function(w){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(w instanceof y(w).Element))throw new TypeError('parameter 1 is not of type "Element".');var L=this.observations_;L.has(w)||(L.set(w,new te(w)),this.controller_.addObserver(this),this.controller_.refresh())}},U.prototype.unobserve=function(w){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(w instanceof y(w).Element))throw new TypeError('parameter 1 is not of type "Element".');var L=this.observations_;L.has(w)&&(L.delete(w),L.size||this.controller_.removeObserver(this))}},U.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},U.prototype.gatherActive=function(){var w=this;this.clearActive(),this.observations_.forEach(function(L){L.isActive()&&w.activeObservations_.push(L)})},U.prototype.broadcastActive=function(){if(this.hasActive()){var w=this.callbackCtx_,L=this.activeObservations_.map(function(O){return new X(O.target,O.broadcastRect())});this.callback_.call(w,L,w),this.clearActive()}},U.prototype.clearActive=function(){this.activeObservations_.splice(0)},U.prototype.hasActive=function(){return this.activeObservations_.length>0},U}(),we=typeof WeakMap!="undefined"?new WeakMap:new z,Ee=function(){function U(w){if(!(this instanceof U))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var L=$.getInstance(),O=new ge(w,L,this);we.set(this,O)}return U}();["observe","unobserve","disconnect"].forEach(function(U){Ee.prototype[U]=function(){var w;return(w=we.get(this))[U].apply(w,arguments)}});var et=function(){return typeof ye.ResizeObserver!="undefined"?ye.ResizeObserver:Ee}();Me.Z=et},98040:function(Dt){Dt.exports=function(){var Me=document.getSelection();if(!Me.rangeCount)return function(){};for(var G=document.activeElement,z=[],J=0;J<Me.rangeCount;J++)z.push(Me.getRangeAt(J));switch(G.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":G.blur();break;default:G=null;break}return Me.removeAllRanges(),function(){Me.type==="Caret"&&Me.removeAllRanges(),Me.rangeCount||z.forEach(function(ye){Me.addRange(ye)}),G&&G.focus()}}},79710:function(Dt,Me,G){"use strict";G.d(Me,{ZP:function(){return ms}});const z=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},J=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=ye},ye=Number.MAX_SAFE_INTEGER||9007199254740991;let ee=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}({}),M=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 ie={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Y={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 ${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 b(a,e,t){return(e=P(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function y(){return y=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},y.apply(null,arguments)}function m(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 x(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?m(Object(t),!0).forEach(function(i){b(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function S(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 P(a){var e=S(a,"string");return typeof e=="symbol"?e:e+""}class C{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=k,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 k=function(){},R={trace:k,debug:k,log:k,warn:k,info:k,error:k};function I(){return y({},R)}function F(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):k}function j(a,e,t){return e[a]?e[a].bind(e):F(a,t)}const q=I();function te(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]=j(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]=j(s,a)})}else y(q,i);return i}const X=q;function ge(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function we(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function Ee(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 et(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const h=u.indexOf("\0");return h!==-1?u.substring(0,h):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 U={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 w(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var L={exports:{}},O;function H(){return O||(O=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,u,h){if(h=h||{},c=c.trim(),u=u.trim(),!u){if(!h.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 d=o.parseURL(u);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return h.alwaysNormalize?(d.path=o.normalizePath(d.path),o.buildURLFromParts(d)):u;var v=o.parseURL(c);if(!v)throw new Error("Error trying to parse base URL.");if(!v.netLoc&&v.path&&v.path[0]!=="/"){var E=n.exec(v.path);v.netLoc=E[1],v.path=E[2]}v.netLoc&&!v.path&&(v.path="/");var A={scheme:v.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(A.netLoc=v.netLoc,d.path[0]!=="/"))if(!d.path)A.path=v.path,d.params||(A.params=v.params,d.query||(A.query=v.query));else{var T=v.path,B=T.substring(0,T.lastIndexOf("/")+1)+d.path;A.path=o.normalizePath(B)}return A.path===null&&(A.path=h.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(A)},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})()}(L)),L.exports}var N=H();class _{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 g={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class D{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,Ne(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={[g.AUDIO]:null,[g.VIDEO]:null,[g.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 _),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=N.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[g.AUDIO]=null,e[g.VIDEO]=null,e[g.AUDIOVIDEO]=null}}function V(a){return a.sn!=="initSegment"}class pe extends D{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(z(e)&&z(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=z(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(!z(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return V(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 Ae extends D{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 Ce(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Ce(t,e)}}function Ne(a,e){const t=Ce(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const ze=Math.pow(2,32)-1,Ct=[].push,Rt={video:1,audio:2,id3:3,text:4};function tt(a){return String.fromCharCode.apply(null,a)}function bt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function Ke(a,e){const t=ai(a,e);return t<0?4294967296+t:t}function Gt(a,e){let t=Ke(a,e);return t*=Math.pow(2,32),t+=Ke(a,e+4),t}function ai(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function ce(a,e,t){a[e]=t>>24,a[e+1]=t>>16&255,a[e+2]=t>>8&255,a[e+3]=t&255}function Ie(a){const e=a.byteLength;for(let t=0;t<e;){const i=Ke(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ne(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=Ke(a,n),r=tt(a.subarray(n+4,n+8)),o=s>1?n+s:i;if(r===e[0])if(e.length===1)t.push(a.subarray(n+8,o));else{const c=ne(a.subarray(n+8,o),e.slice(1));c.length&&Ct.apply(t,c)}n=o}return t}function Fe(a){const e=[],t=a[0];let i=8;const n=Ke(a,i);i+=4;let s=0,r=0;t===0?(s=Ke(a,i),r=Ke(a,i+4),i+=8):(s=Gt(a,i),r=Gt(a,i+8),i+=16),i+=2;let o=a.length+r;const c=bt(a,i);i+=2;for(let u=0;u<c;u++){let h=i;const f=Ke(a,h);h+=4;const d=f&2147483647;if((f&2147483648)>>>31===1)return X.warn("SIDX has hierarchical references (not supported)"),null;const E=Ke(a,h);h+=4,e.push({referenceSize:d,subsegmentDuration:E,info:{duration:E/n,start:o,end:o+d-1}}),o+=d,h+=4,i=h}return{earliestPresentationTime:s,timescale:n,version:t,referencesCount:c,references:e}}function Ve(a){const e=[],t=ne(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=ne(s,["tkhd"])[0];if(r){let o=r[0];const c=Ke(r,o===0?12:20),u=ne(s,["mdia","mdhd"])[0];if(u){o=u[0];const h=Ke(u,o===0?12:20),f=ne(s,["mdia","hdlr"])[0];if(f){const d=tt(f.subarray(8,12)),v={soun:g.AUDIO,vide:g.VIDEO}[d],E=ne(s,["mdia","minf","stbl","stsd"])[0],A=qe(E);v?(e[c]={timescale:h,type:v,stsd:A},e[v]=x({timescale:h,id:c},A)):e[c]={timescale:h,type:d,stsd:A}}}}}return ne(a,["moov","mvex","trex"]).forEach(n=>{const s=Ke(n,4),r=e[s];r&&(r.default={duration:Ke(n,12),flags:Ke(n,20)})}),e}function qe(a){const e=a.subarray(8),t=e.subarray(86),i=tt(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const u=ne(e,[i])[0].subarray(i==="enca"?28:78);ne(u,["sinf"]).forEach(f=>{const d=ne(f,["schm"])[0];if(d){const v=tt(d.subarray(4,8));if(v==="cbcs"||v==="cenc"){const E=ne(f,["frma"])[0];E&&(n=tt(E))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=ne(t,["avcC"])[0];c&&c.length>3&&(n+="."+me(c[1])+me(c[2])+me(c[3]),s=K(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=ne(e,[i])[0],u=ne(c.subarray(28),["esds"])[0];if(u&&u.length>7){let h=4;if(u[h++]!==3)break;h=ae(u,h),h+=2;const f=u[h++];if(f&128&&(h+=2),f&64&&(h+=u[h++]),u[h++]!==4)break;h=ae(u,h);const d=u[h++];if(d===64)n+="."+me(d);else break;if(h+=12,u[h++]!==5)break;h=ae(u,h);const v=u[h++];let E=(v&248)>>3;E===31&&(E+=1+((v&7)<<3)+((u[h]&224)>>5)),n+="."+E}break}case"hvc1":case"hev1":{const c=ne(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],h=["","A","B","C"][u>>6],f=u&31,d=Ke(c,2),v=(u&32)>>5?"H":"L",E=c[12],A=c.subarray(6,12);n+="."+h+f,n+="."+d.toString(16).toUpperCase(),n+="."+v+E;let T="";for(let B=A.length;B--;){const Q=A[B];(Q||T)&&(T="."+Q.toString(16).toUpperCase()+T)}n+=T}s=K(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=K(n,t)||n;break}case"vp09":{const c=ne(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],h=c[5],f=c[6]>>4&15;n+="."+Se(u)+"."+Se(h)+"."+Se(f)}break}case"av01":{const c=ne(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,h=c[1]&31,f=c[2]>>>7?"H":"M",d=(c[2]&64)>>6,v=(c[2]&32)>>5,E=u===2&&d?v?12:10:d?10:8,A=(c[2]&16)>>4,T=(c[2]&8)>>3,B=(c[2]&4)>>2,Q=c[2]&3;n+="."+u+"."+Se(h)+f+"."+Se(E)+"."+A+"."+T+B+Q+"."+Se(1)+"."+Se(1)+"."+Se(1)+"."+0,s=K("dav1",t)}break}}return{codec:n,encrypted:r,supplemental:s}}function K(a,e){const t=ne(e,["dvvC"]),i=t.length?t[0]:ne(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+Se(n)+"."+Se(s)}}function ae(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function me(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function Se(a){return(a<10?"0":"")+a}function We(a,e){if(!a||!e)return a;const t=e.keyId;return t&&e.isCommonEncryption&&ne(a,["moov","trak"]).forEach(n=>{const r=ne(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=ne(r,["enca"]);const c=o.length>0;c||(o=ne(r,["encv"])),o.forEach(u=>{const h=c?u.subarray(28):u.subarray(78);ne(h,["sinf"]).forEach(d=>{const v=Be(d);if(v){const E=v.subarray(8,24);E.some(A=>A!==0)||(X.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${U.hexDump(E)} -> ${U.hexDump(t)}`),v.set(t,8))}})})}),a}function Be(a){const e=ne(a,["schm"])[0];if(e){const t=tt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ne(a,["schi","tenc"])[0]}return null}function xt(a,e){return ne(e,["moof","traf"]).reduce((t,i)=>{const n=ne(i,["tfdt"])[0],s=n[0],r=ne(i,["tfhd"]).reduce((o,c)=>{const u=Ke(c,4),h=a[u];if(h){let f=Ke(n,4);if(s===1){if(f===ze)return X.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;f*=ze+1,f+=Ke(n,8)}const d=h.timescale||9e4,v=f/d;if(z(v)&&(o===null||v<o))return v}return o},null);return r!==null&&z(r)&&(t===null||r<t)?r:t},null)}function He(a,e){let t=0,i=0,n=0;const s=ne(a,["moof","traf"]);for(let r=0;r<s.length;r++){const o=s[r],c=ne(o,["tfhd"])[0],u=Ke(c,4),h=e[u];if(!h)continue;const f=h.default,d=Ke(c,0)|(f==null?void 0:f.flags);let v=f==null?void 0:f.duration;d&8&&(d&2?v=Ke(c,12):v=Ke(c,8));const E=h.timescale||9e4,A=ne(o,["trun"]);for(let T=0;T<A.length;T++){if(t=mt(A[T]),!t&&v){const B=Ke(A[T],4);t=v*B}h.type===g.VIDEO?i+=t/E:h.type===g.AUDIO&&(n+=t/E)}}if(i===0&&n===0){let r=1/0,o=0,c=0;const u=ne(a,["sidx"]);for(let h=0;h<u.length;h++){const f=Fe(u[h]);if(f!=null&&f.references){r=Math.min(r,f.earliestPresentationTime/f.timescale);const d=f.references.reduce((v,E)=>v+E.info.duration||0,0);o=Math.max(o,d+f.earliestPresentationTime/f.timescale),c=o-r}}if(c&&z(c))return c}return i||n}function mt(a){const e=Ke(a,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const n=Ke(a,4);for(let s=0;s<n;s++){if(e&256){const r=Ke(a,t);i+=r,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function Nt(a,e,t){ne(e,["moof","traf"]).forEach(i=>{ne(i,["tfhd"]).forEach(n=>{const s=Ke(n,4),r=a[s];if(!r)return;const o=r.timescale||9e4;ne(i,["tfdt"]).forEach(c=>{const u=c[0],h=t*o;if(h){let f=Ke(c,4);if(u===0)f-=h,f=Math.max(f,0),ce(c,4,f);else{f*=Math.pow(2,32),f+=Ke(c,8),f-=h,f=Math.max(f,0);const d=Math.floor(f/(ze+1)),v=Math.floor(f%(ze+1));ce(c,4,d),ce(c,8,v)}}})})})}function Ot(a){const e={valid:null,remainder:null},t=ne(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=a.slice(0,i.byteOffset-8),e.remainder=a.slice(i.byteOffset-8),e}function dt(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Zt(a,e){const t=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return ne(i,["moof"]).map(c=>{const u=c.byteOffset-8;ne(c,["traf"]).map(f=>{const d=ne(f,["tfdt"]).map(v=>{const E=v[0];let A=Ke(v,4);return E===1&&(A*=Math.pow(2,32),A+=Ke(v,8)),A/n})[0];return d!==void 0&&(a=d),ne(f,["tfhd"]).map(v=>{const E=Ke(v,4),A=Ke(v,0)&16777215,T=(A&1)!==0,B=(A&2)!==0,Q=(A&8)!==0;let W=0;const se=(A&16)!==0;let oe=0;const ve=(A&32)!==0;let le=8;E===s&&(T&&(le+=8),B&&(le+=4),Q&&(W=Ke(v,le),le+=4),se&&(oe=Ke(v,le),le+=4),ve&&(le+=4),e.type==="video"&&(r=Mt(e.codec)),ne(f,["trun"]).map(fe=>{const xe=fe[0],ue=Ke(fe,0)&16777215,Pe=(ue&1)!==0;let Ze=0;const ei=(ue&4)!==0,wt=(ue&256)!==0;let ht=0;const st=(ue&512)!==0;let ft=0;const ut=(ue&1024)!==0,Oe=(ue&2048)!==0;let Ue=0;const $t=Ke(fe,4);let Pt=8;Pe&&(Ze=Ke(fe,Pt),Pt+=4),ei&&(Pt+=4);let qt=Ze+u;for(let di=0;di<$t;di++){if(wt?(ht=Ke(fe,Pt),Pt+=4):ht=W,st?(ft=Ke(fe,Pt),Pt+=4):ft=oe,ut&&(Pt+=4),Oe&&(xe===0?Ue=Ke(fe,Pt):Ue=ai(fe,Pt),Pt+=4),e.type===g.VIDEO){let yi=0;for(;yi<ft;){const Ti=Ke(i,qt);if(qt+=4,ni(r,i[qt])){const In=i.subarray(qt,qt+Ti);Yt(In,r?2:1,a+Ue/n,t)}qt+=Ti,yi+=Ti+4}}a+=ht/n}}))})})}),t}function Mt(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function ni(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Yt(a,e,t,i){const n=St(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 h=s;if(o<u)s+=o;else if(o>u){X.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[h++]===181){const d=bt(n,h);if(h+=2,d===49){const v=Ke(n,h);if(h+=4,v===1195456820){const E=n[h++];if(E===3){const A=n[h++],T=31&A,B=64&A,Q=B?2+T*3:0,W=new Uint8Array(Q);if(B){W[0]=A;for(let se=1;se<Q;se++)W[se]=n[h++]}i.push({type:E,payloadType:r,pts:t,bytes:W})}}}}}else if(r===5&&o>16){const f=[];for(let E=0;E<16;E++){const A=n[h++].toString(16);f.push(A.length==1?"0"+A:A),(E===3||E===5||E===7||E===9)&&f.push("-")}const d=o-16,v=new Uint8Array(d);for(let E=0;E<d;E++)v[E]=n[h++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:et(v),userDataBytes:v})}}}function St(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 Ni(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;tt(a.subarray(u,u+1))!=="\0";)t+=tt(a.subarray(u,u+1)),u+=1;for(t+=tt(a.subarray(u,u+1)),u+=1;tt(a.subarray(u,u+1))!=="\0";)i+=tt(a.subarray(u,u+1)),u+=1;i+=tt(a.subarray(u,u+1)),u+=1,n=Ke(a,12),s=Ke(a,16),o=Ke(a,20),c=Ke(a,24),u=28}else if(e===1){u+=4,n=Ke(a,u),u+=4;const f=Ke(a,u);u+=4;const d=Ke(a,u);for(u+=4,r=Qo(2,32)*f+d,J(r)||(r=Number.MAX_SAFE_INTEGER,X.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ke(a,u),u+=4,c=Ke(a,u),u+=4;tt(a.subarray(u,u+1))!=="\0";)t+=tt(a.subarray(u,u+1)),u+=1;for(t+=tt(a.subarray(u,u+1)),u+=1;tt(a.subarray(u,u+1))!=="\0";)i+=tt(a.subarray(u,u+1)),u+=1;i+=tt(a.subarray(u,u+1)),u+=1}const h=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:h}}function De(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 ke(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),De([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t||new Uint8Array)}function je(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=si(n);e.push(s),i+=s.size}}return e}function si(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=U.hexDump(new Uint8Array(r,t+12,16)),c=a.getUint32(28);let u=null,h=null;if(s===0){if(e-32<c||c<22)return{offset:t,size:e};h=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:h,offset:t,size:e}}const Xe=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Qe={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 pt(a,e){const t=Qe[e];return!!t&&!!t[a.slice(0,4)]}function Bt(a,e,t=!0){return!a.split(",").some(i=>!rt(i,e,t))}function rt(a,e,t=!0){var i;const n=ge(t);return(i=n==null?void 0:n.isTypeSupported(Ye(a,e)))!=null?i:!1}function Ye(a,e){return`${e}/mp4;codecs=${a}`}function $e(a){if(a){const e=a.substring(0,4);return Qe.video[e]}return 2}function At(a){const e=Xe();return a.split(",").reduce((t,i)=>{const s=e&&Mt(i)?9:Qe.video[i];return s?(s*2+t)/(t?3:2):(Qe.audio[i]+t)/(t?2:1)},0)}const ot={};function ji(a,e=!0){if(ot[a])return ot[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(rt(t[n],"audio",e))return ot[a]=t[n],t[n];if(t[n]==="mp3"&&(i=ge(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const ti=/flac|opus|mp4a\.40\.34/i;function _t(a,e=!0){return a.replace(ti,t=>ji(t.toLowerCase(),e))}function lt(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)pt(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function oi(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 Fi(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 an(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 Li(a){const e=ge(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function bi(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const pi={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Bi(a,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const zi={};function Di(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 h=null;if(r!=null&&r.length)try{r.length===1&&r[0]?h=e.groups[r[0]].channels:h=r.reduce((f,d)=>{if(d){const v=e.groups[d];if(!v)throw new Error(`Audio track group ${d} not found`);Object.keys(v.channels).forEach(E=>{f[E]=(f[E]||0)+v.channels[E]})}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))||!!h&&z(u)&&Object.keys(h).some(f=>parseInt(f)>u)}function Gi(a,e,t){const i=a.videoCodec,n=a.audioCodec;if(!i&&!n||!t)return Promise.resolve(pi);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(h=>Mt(h))&&Xe())return Promise.resolve(Bi(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${u})`),s));s.push.apply(s,c.map(h=>({type:"media-source",video:x(x({},r),{},{contentType:Ye(an(h),"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||"",h=parseFloat(u);z(h)&&h>2&&s.push.apply(s,n.split(",").map(f=>({type:"media-source",audio:{contentType:Ye(f,"audio"),channels:""+h}})))}}))}),Promise.all(s.map(r=>{const o=Ai(r);return zi[o]||(zi[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 Ai(a){const{audio:e,video:t}=a,i=t||e;if(i){const n=bi(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 _n=["NONE","TYPE-0","TYPE-1",null];function Ki(a){return _n.indexOf(a)>-1}const Ui=["SDR","PQ","HLG"];function Zi(a){return!!a&&Ui.indexOf(a)>-1}var sn={No:"",Yes:"YES",v2:"v2"};function Ci(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?sn.v2:sn.Yes:sn.No}class Tn{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 jt{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 ki(this._audioGroups,e)}hasSubtitleGroup(e){return ki(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 ki(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Jt(){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 $i(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||Ui.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&Jt(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Ji=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}},kt=(a,e)=>JSON.stringify(a,Ji(e));function fn(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 h=!1,f=!1,d=1/0,v=1/0,E=1/0,A=1/0,T=0,B=[];const{preferHDR:Q,allowedVideoRanges:W}=$i(e,n);for(let fe=s.length;fe--;){const xe=a[s[fe]];h||(h=xe.channels[2]>0),d=Math.min(d,xe.minHeight),v=Math.min(v,xe.minFramerate),E=Math.min(E,xe.minBitrate),W.filter(Pe=>xe.videoRanges[Pe]>0).length>0&&(f=!0)}d=z(d)?d:0,v=z(v)?v:0;const se=Math.max(1080,d),oe=Math.max(30,v);E=z(E)?E:t,t=Math.max(E,t),f||(e=void 0);const ve=s.length>1;return{codecSet:s.reduce((fe,xe)=>{const ue=a[xe];if(xe===fe)return fe;if(B=f?W.filter(Pe=>ue.videoRanges[Pe]>0):[],ve){if(ue.minBitrate>t)return Vi(xe,`min bitrate of ${ue.minBitrate} > current estimate of ${t}`),fe;if(!ue.hasDefaultAudio)return Vi(xe,"no renditions with default or auto-select sound found"),fe;if(o&&xe.indexOf(o.substring(0,4))%5!==0)return Vi(xe,`audio codec preference "${o}" not found`),fe;if(r&&!u){if(!ue.channels[r])return Vi(xe,`no renditions with ${r} channel sound found (channels options: ${Object.keys(ue.channels)})`),fe}else if((!o||u)&&h&&ue.channels[2]===0)return Vi(xe,"no renditions with stereo sound found"),fe;if(ue.minHeight>se)return Vi(xe,`min resolution of ${ue.minHeight} > maximum of ${se}`),fe;if(ue.minFramerate>oe)return Vi(xe,`min framerate of ${ue.minFramerate} > maximum of ${oe}`),fe;if(!B.some(Pe=>ue.videoRanges[Pe]>0))return Vi(xe,`no variants with VIDEO-RANGE of ${kt(B)} found`),fe;if(c&&xe.indexOf(c.substring(0,4))%5!==0)return Vi(xe,`video codec preference "${c}" not found`),fe;if(ue.maxScore<T)return Vi(xe,`max score of ${ue.maxScore} < selected max of ${T}`),fe}return fe&&(At(xe)>=At(fe)||ue.fragmentError>a[fe].fragmentError)?fe:(A=ue.minIndex,T=ue.maxScore,xe)},void 0),videoRanges:B,preferHDR:Q,minFramerate:v,minBitrate:E,minIndex:A}}function Vi(a,e){X.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function yt(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 Ut(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(h=>{if(!h)return;const f=e.groups[h];f&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(d=>{c.channels[d]=(c.channels[d]||0)+f.channels[d]}))}),n},{})}function Z(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(Te(a,n,t))return i}return-1}function Te(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||_e(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||Re(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function _e(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Re(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function Le(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 Ge(a,e,t,i,n){const s=e[i],o=e.reduce((d,v,E)=>{const A=v.uri;return(d[A]||(d[A]=[])).push(E),d},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,h=s.codecSet.substring(0,4),f=it(e,i,d=>{if(d.videoRange!==c||d.frameRate!==u||d.codecSet.substring(0,4)!==h)return!1;const v=d.audioGroups,E=t.filter(A=>!v||v.indexOf(A.groupId)!==-1);return de(a,E,n)>-1});return f>-1?f:it(e,i,d=>{const v=d.audioGroups,E=t.filter(A=>!v||v.indexOf(A.groupId)!==-1);return de(a,E,n)>-1})}function it(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 re(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Je extends C{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(),h=s?s.stats:n.stats,f=s?s.duration:n.duration,d=u-h.loading.start,v=r.minAutoLevel,E=n.level,A=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||E<=v){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const T=A>-1&&A!==E,B=!!t||T;if(!B&&(c.paused||!c.playbackRate||!c.readyState))return;const Q=r.mainForwardBufferInfo;if(!B&&Q===null)return;const W=this.bwEstimator.getEstimateTTFB(),se=Math.abs(c.playbackRate);if(d<=Math.max(W,1e3*(f/(se*2))))return;const oe=Q?Q.len/se:0,ve=h.loading.first?h.loading.first-h.loading.start:-1,le=h.loaded&&ve>-1,fe=this.getBwEstimate(),xe=r.levels,ue=xe[E],Pe=Math.max(h.loaded,Math.round(f*(n.bitrate||ue.averageBitrate)/8));let Ze=le?d-ve:d;Ze<1&&le&&(Ze=Math.min(d,h.loaded*8/fe));const ei=le?h.loaded*1e3/Ze:0,wt=W/1e3,ht=ei?(Pe-h.loaded)/ei:Pe*8/fe+wt;if(ht<=oe)return;const st=ei?ei*8:fe,ft=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,ut=this.hls.config.abrBandWidthUpFactor;let Oe=Number.POSITIVE_INFINITY,Ue;for(Ue=E-1;Ue>v;Ue--){const di=xe[Ue].maxBitrate,yi=!xe[Ue].details||ft;if(Oe=this.getTimeToLoadFrag(wt,st,f*di,yi),Oe<Math.min(oe,f+wt))break}if(Oe>=ht||Oe>f*10)return;le?this.bwEstimator.sample(d-Math.min(W,ve),h.loaded):this.bwEstimator.sampleTTFB(d);const $t=xe[Ue].maxBitrate;this.getBwEstimate()*ut>$t&&this.resetEstimator($t);const Pt=this.findBestLevel($t,v,Ue,0,oe,1,1);Pt>-1&&(Ue=Pt),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${E} is loading too slowly;
Fragment duration: ${n.duration.toFixed(3)}
Time to underbuffer: ${oe.toFixed(3)} s
Estimated load time for current fragment: ${ht.toFixed(3)} s
Estimated load time for down switch fragment: ${Oe.toFixed(3)} s
TTFB estimate: ${ve|0} ms
Current BW estimate: ${z(fe)?fe|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${Ue} @ ${$t|0} bps`),r.nextLoadLevel=r.nextAutoLevel=Ue,this.clearTimer();const qt=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===Ue&&Ue>0){const di=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Ue>0?"and switching down":""}
Fragment duration: ${n.duration.toFixed(3)} s
Time to underbuffer: ${di.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,Ue>v){let yi=this.findBestLevel(this.hls.levels[v].bitrate,v,Ue,0,di,1,1);yi===-1&&(yi=v),this.hls.nextLoadLevel=this.hls.nextAutoLevel=yi,this.resetEstimator(this.hls.levels[yi].bitrate)}}};T||ht>Oe*2?qt():this.timer=self.setInterval(qt,Oe*1e3),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:s,stats:h})},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 $(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 M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case M.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;z(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===Y.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!==Y.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 h=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const T=this.findBestLevel(c,r,n,u,0,h,f);if(T>=0)return this.rebufferNotice=-1,T}let d=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const T=this.bitrateTestDelay;T&&(d=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-T,this.info(`bitrate test took ${Math.round(1e3*T)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=f=1)}const v=this.findBestLevel(c,r,n,u,d,h,f);if(this.rebufferNotice!==v&&(this.rebufferNotice=v,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${v}`)),v>-1)return v;const E=i.levels[r],A=i.loadLevelObj;return A&&(E==null?void 0:E.bitrate)<A.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,h=this.lastLoadedFragLevel,f=h===-1?this.hls.firstLevel:h,{fragCurrent:d,partCurrent:v}=this,{levels:E,allAudioTracks:A,loadLevel:T,config:B}=this.hls;if(E.length===1)return 0;const Q=E[f],W=!!((c=this.hls.latestLevelDetails)!=null&&c.live),se=T===-1||h===-1;let oe,ve="SDR",le=(Q==null?void 0:Q.frameRate)||0;const{audioPreference:fe,videoPreference:xe}=B,ue=this.audioTracksByGroup||(this.audioTracksByGroup=yt(A));let Pe=-1;if(se){if(this.firstSelection!==-1)return this.firstSelection;const st=this.codecTiers||(this.codecTiers=Ut(E,ue,t,i)),ft=fn(st,ve,e,fe,xe),{codecSet:ut,videoRanges:Oe,minFramerate:Ue,minBitrate:$t,minIndex:Pt,preferHDR:qt}=ft;Pe=Pt,oe=ut,ve=qt?Oe[Oe.length-1]:Oe[0],le=Ue,e=Math.max(e,$t),this.log(`picked start tier ${kt(ft)}`)}else oe=Q==null?void 0:Q.codecSet,ve=Q==null?void 0:Q.videoRange;const Ze=v?v.duration:d?d.duration:0,ei=this.bwEstimator.getEstimateTTFB()/1e3,wt=[];for(let st=i;st>=t;st--){var ht;const ft=E[st],ut=st>f;if(!ft)continue;if(B.useMediaCapabilities&&!ft.supportedResult&&!ft.supportedPromise){const yi=navigator.mediaCapabilities;typeof(yi==null?void 0:yi.decodingInfo)=="function"&&(Di(ft,ue,ve,le,e,fe)||Mt(ft.videoCodec))?(ft.supportedPromise=Gi(ft,ue,yi),ft.supportedPromise.then(Ti=>{if(!this.hls)return;ft.supportedResult=Ti;const In=this.hls.levels,Cn=In.indexOf(ft);Ti.error?this.warn(`MediaCapabilities decodingInfo error: "${Ti.error}" for level ${Cn} ${kt(Ti)}`):Ti.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Cn} ${kt(Ti)}`),Cn>-1&&In.length>1&&(this.log(`Removing unsupported level ${Cn}`),this.hls.removeLevel(Cn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):ft.supportedResult=pi}if((oe&&ft.codecSet!==oe||ve&&ft.videoRange!==ve||ut&&le>ft.frameRate||!ut&&le>0&&le<ft.frameRate||ft.supportedResult&&!((ht=ft.supportedResult.decodingInfoResults)!=null&&ht[0].smooth))&&(!se||st!==Pe)){wt.push(st);continue}const Oe=ft.details,Ue=(v?Oe==null?void 0:Oe.partTarget:Oe==null?void 0:Oe.averagetargetduration)||Ze;let $t;ut?$t=o*e:$t=r*e;const Pt=Ze&&n>=Ze*2&&s===0?ft.averageBitrate:ft.maxBitrate,qt=this.getTimeToLoadFrag(ei,$t,Pt*Ue,Oe===void 0);if($t>=Pt&&(st===h||ft.loadError===0&&ft.fragmentError===0)&&(qt<=ei||!z(qt)||W&&!this.bitrateTestDelay||qt<u)){const yi=this.forcedAutoLevel;return st!==T&&(yi===-1||yi!==T)&&(wt.length&&this.trace(`Skipped level(s) ${wt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${E[wt[0]].codecs}" ${E[wt[0]].videoRange}; not compatible with "${oe}" ${ve}`),this.info(`switch candidate:${f}->${st} adjustedbw(${Math.round($t)})-bitrate=${Math.round($t-Pt)} ttfb:${ei.toFixed(1)} avgDuration:${Ue.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${qt.toFixed(1)} firstSelection:${se} codecSet:${ft.codecSet} videoRange:${ft.videoRange} hls.loadLevel:${T}`)),se&&(this.firstSelection=st),st}}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 It={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 ct(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!z(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(Tt(e,t,r))return r}return null}function at(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)&&Vt(t,i,s)===0||Lt(s,a,Math.min(n,i))))return s;const r=It.search(e,Vt.bind(null,t,i));return r&&(r!==a||!s)?r:s}function Lt(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 Vt(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 Tt(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function gt(a,e){return It.search(a,t=>t.cc<e?1:t.cc>e?-1:0)}function Qt(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 It.search(s,r=>r.cc<e||r.end<=i?1:r.cc>e||r.start>=n?-1:0)}return null}function ui(a){switch(a.details){case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_TIMEOUT:case M.LEVEL_LOAD_TIMEOUT:case M.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function zt(a,e){const t=ui(e);return a.default[`${t?"timeout":"error"}Retry`]}function Ft(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function ci(a){return x(x({},a),{errorRetry:null,timeoutRetry:null})}function Wt(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(li(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function li(a){return a===0&&navigator.onLine===!1||!!a&&(a<400||a>499)}var ii={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Xt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Xi extends C{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)===Y.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 M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case M.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Ei();return}case M.FRAG_GAP:case M.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ii.SendAlternateToPenaltyBox;return}case M.LEVEL_EMPTY_ERROR:case M.LEVEL_PARSING_ERROR:{var r,o;const u=t.parent===Y.MAIN?t.level:n.loadLevel;t.details===M.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 M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case M.AUDIO_TRACK_LOAD_ERROR:case M.AUDIO_TRACK_LOAD_TIMEOUT:case M.SUBTITLE_LOAD_ERROR:case M.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const u=n.loadLevelObj;if(u&&(s.type===ie.AUDIO_TRACK&&u.hasAudioGroup(s.groupId)||s.type===ie.SUBTITLE_TRACK&&u.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=ii.SendAlternateToPenaltyBox,t.errorAction.flags=Xt.MoveAllAlternatesMatchingHost;return}}return;case M.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.loadLevelObj,h=u==null?void 0:u.attrs["HDCP-LEVEL"];h?t.errorAction={action:ii.SendAlternateToPenaltyBox,flags:Xt.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}:this.keySystemError(t)}return;case M.BUFFER_ADD_CODEC_ERROR:case M.REMUX_ALLOC_ERROR:case M.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case M.INTERNAL_EXCEPTION:case M.BUFFER_APPENDING_ERROR:case M.BUFFER_FULL_ERROR:case M.LEVEL_SWITCH_ERROR:case M.BUFFER_STALLED_ERROR:case M.BUFFER_SEEK_OVER_HOLE:case M.BUFFER_NUDGE_ON_STALL:t.errorAction=Ei();return}t.type===ee.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=zt(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Wt(n,s,ui(e),e.response))return{action:ii.RetryRequest,flags:Xt.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=zt(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((h,f)=>h+f.fragmentError,0);if(n&&(e.details!==M.FRAG_GAP&&n.fragmentError++,Wt(o,c,ui(e),e.response)))return{action:ii.RetryRequest,flags:Xt.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===M.BUFFER_APPEND_ERROR&&n.fragmentError++;let h=-1;const{levels:f,loadLevel:d,minAutoLevel:v,maxAutoLevel:E}=i;i.autoLevelEnabled||(i.loadLevel=-1);const A=(s=e.frag)==null?void 0:s.type,B=(A===Y.AUDIO&&u===M.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===M.BUFFER_ADD_CODEC_ERROR||u===M.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:ve})=>n.audioCodec!==ve),W=e.sourceBufferName==="video"&&(u===M.BUFFER_ADD_CODEC_ERROR||u===M.BUFFER_APPEND_ERROR)&&f.some(({codecSet:ve,audioCodec:le})=>n.codecSet!==ve&&n.audioCodec===le),{type:se,groupId:oe}=(r=e.context)!=null?r:{};for(let ve=f.length;ve--;){const le=(ve+d)%f.length;if(le!==d&&le>=v&&le<=E&&f[le].loadError===0){var o,c;const fe=f[le];if(u===M.FRAG_GAP&&A===Y.MAIN&&e.frag){const xe=f[le].details;if(xe){const ue=at(e.frag,xe.fragments,e.frag.start);if(ue!=null&&ue.gap)continue}}else{if(se===ie.AUDIO_TRACK&&fe.hasAudioGroup(oe)||se===ie.SUBTITLE_TRACK&&fe.hasSubtitleGroup(oe))continue;if(A===Y.AUDIO&&(o=n.audioGroups)!=null&&o.some(xe=>fe.hasAudioGroup(xe))||A===Y.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(xe=>fe.hasSubtitleGroup(xe))||B&&n.audioCodec===fe.audioCodec||!B&&n.audioCodec!==fe.audioCodec||W&&n.codecSet===fe.codecSet)continue}h=le;break}}if(h>-1&&i.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:ii.SendAlternateToPenaltyBox,flags:Xt.None,nextAutoLevel:h}}return{action:ii.SendAlternateToPenaltyBox,flags:Xt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ii.DoNothing:break;case ii.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==M.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 ii.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 Xt.None:this.switchLevel(e,r);break;case Xt.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=_n[_n.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===M.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=bi(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function Ei(a){const e={action:ii.DoNothing,flags:Xt.None};return a&&(e.resolved=!0),e}var Ht={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Wi{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(h=>{const f=!this.isTimeBuffered(h.startPTS,h.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=xi(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],h=r||c.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,h,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),Pi(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=en(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=xi(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 h=0;h<n.length;h++){const f=n.start(h)-this.bufferPadding,d=n.end(h)+this.bufferPadding;if(u>=f&&c<=d){s.time.push({startPTS:Math.max(r,n.start(h)),endPTS:Math.min(o,n.end(h))});break}else if(r<d&&o>f){const v=Math.max(r,n.start(h)),E=Math.min(o,n.end(h));E>v&&(s.partial=!0,s.time.push({startPTS:v,endPTS:E}))}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 h=c[u];h&&Pi(h)&&(n=h.body.start-o,s=h.body.end+o,e>=n&&e<=s&&(i=Math.min(e-n,s-e),r<=i&&(t=h.body,r=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Pi(t))}getState(e){const t=xi(e),i=this.fragments[t];return i?i.buffered?Pi(i)?Ht.PARTIAL:Ht.OK:Ht.APPENDING:Ht.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=xi(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=xi(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=xi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=en(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 Pi(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 xi(a){return`${a.type}_${a.level}_${a.sn}`}function en(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var vi={cbc:0,ctr:1};class on{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 vi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case vi.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 hi(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class dn{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],h=c[1],f=c[2],d=c[3],v=new Uint32Array(256);let E=0,A=0,T=0;for(T=0;T<256;T++)T<128?v[T]=T<<1:v[T]=T<<1^283;for(T=0;T<256;T++){let B=A^A<<1^A<<2^A<<3^A<<4;B=B>>>8^B&255^99,e[E]=B,t[B]=E;const Q=v[E],W=v[Q],se=v[W];let oe=v[B]*257^B*16843008;n[E]=oe<<24|oe>>>8,s[E]=oe<<16|oe>>>16,r[E]=oe<<8|oe>>>24,o[E]=oe,oe=se*16843009^W*65537^Q*257^E*16843008,u[B]=oe<<24|oe>>>8,h[B]=oe<<16|oe>>>16,f[B]=oe<<8|oe>>>24,d[B]=oe,E?(E=Q^v[v[v[se^Q]]],A^=v[v[A]]):E=A=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),h=this.invKeySchedule=new Uint32Array(r),f=this.sBox,d=this.rcon,v=this.invSubMix,E=v[0],A=v[1],T=v[2],B=v[3];let Q,W;for(o=0;o<r;o++){if(o<s){Q=u[o]=t[o];continue}W=Q,o%s===0?(W=W<<8|W>>>24,W=f[W>>>24]<<24|f[W>>>16&255]<<16|f[W>>>8&255]<<8|f[W&255],W^=d[o/s|0]<<24):s>6&&o%s===4&&(W=f[W>>>24]<<24|f[W>>>16&255]<<16|f[W>>>8&255]<<8|f[W&255]),u[o]=Q=(u[o-s]^W)>>>0}for(c=0;c<r;c++)o=r-c,c&3?W=u[o]:W=u[o-4],c<4||o<=4?h[c]=W:h[c]=E[f[W>>>24]]^A[f[W>>>16&255]]^T[f[W>>>8&255]]^B[f[W&255]],h[c]=h[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],h=o[2],f=o[3],d=this.uint8ArrayToUint32Array_(i);let v=d[0],E=d[1],A=d[2],T=d[3];const B=new Int32Array(e),Q=new Int32Array(B.length);let W,se,oe,ve,le,fe,xe,ue,Pe,Ze,ei,wt,ht,st;const ft=this.networkToHostOrderSwap;for(;t<B.length;){for(Pe=ft(B[t]),Ze=ft(B[t+1]),ei=ft(B[t+2]),wt=ft(B[t+3]),le=Pe^s[0],fe=wt^s[1],xe=ei^s[2],ue=Ze^s[3],ht=4,st=1;st<n;st++)W=c[le>>>24]^u[fe>>16&255]^h[xe>>8&255]^f[ue&255]^s[ht],se=c[fe>>>24]^u[xe>>16&255]^h[ue>>8&255]^f[le&255]^s[ht+1],oe=c[xe>>>24]^u[ue>>16&255]^h[le>>8&255]^f[fe&255]^s[ht+2],ve=c[ue>>>24]^u[le>>16&255]^h[fe>>8&255]^f[xe&255]^s[ht+3],le=W,fe=se,xe=oe,ue=ve,ht=ht+4;W=r[le>>>24]<<24^r[fe>>16&255]<<16^r[xe>>8&255]<<8^r[ue&255]^s[ht],se=r[fe>>>24]<<24^r[xe>>16&255]<<16^r[ue>>8&255]<<8^r[le&255]^s[ht+1],oe=r[xe>>>24]<<24^r[ue>>16&255]<<16^r[le>>8&255]<<8^r[fe&255]^s[ht+2],ve=r[ue>>>24]<<24^r[le>>16&255]<<16^r[fe>>8&255]<<8^r[xe&255]^s[ht+3],Q[t]=ft(W^v),Q[t+1]=ft(ve^E),Q[t+2]=ft(oe^A),Q[t+3]=ft(se^T),v=Pe,E=Ze,A=ei,T=wt,t=t+4}return Q.buffer}}class kn{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=ln(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function ln(a){switch(a){case vi.cbc:return"AES-CBC";case vi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const Ln=16;class An{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?hi(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!==vi.cbc||t.byteLength!==16)return X.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=dt(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 dn),u.expandKey(t);const h=r;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,h||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 kn(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new on(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(X.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%Ln;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(X.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Hi=Math.pow(2,17);class rn{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 ri({type:ee.NETWORK_ERROR,details:M.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(E=>E[0]==="GAP")){c(wn(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),h=pn(e);e.loader=u;const f=ci(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Hi};e.stats=u.stats;const v={onSuccess:(E,A,T,B)=>{this.resetLoader(e,u);let Q=E.data;T.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(Q.slice(0,16)),Q=Q.slice(16)),o({frag:e,part:null,payload:Q,networkDetails:B})},onError:(E,A,T,B)=>{this.resetLoader(e,u),c(new ri({type:ee.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:x({url:i,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:T,stats:B}))},onAbort:(E,A,T)=>{this.resetLoader(e,u),c(new ri({type:ee.NETWORK_ERROR,details:M.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:T,stats:E}))},onTimeout:(E,A,T)=>{this.resetLoader(e,u),c(new ri({type:ee.NETWORK_ERROR,details:M.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:T,stats:E}))}};t&&(v.onProgress=(E,A,T,B)=>t({frag:e,part:null,payload:T,networkDetails:B})),u.load(h,d,v)})}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(wn(e,t));return}const u=this.loader=s?new s(n):new r(n),h=pn(e,t);e.loader=u;const f=ci(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Hi};t.stats=u.stats,u.load(h,d,{onSuccess:(v,E,A,T)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const B={frag:e,part:t,payload:v.data,networkDetails:T};i(B),o(B)},onError:(v,E,A,T)=>{this.resetLoader(e,u),c(new ri({type:ee.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:x({url:h.url,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:A,stats:T}))},onAbort:(v,E,A)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new ri({type:ee.NETWORK_ERROR,details:M.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:A,stats:v}))},onTimeout:(v,E,A)=>{this.resetLoader(e,u),c(new ri({type:ee.NETWORK_ERROR,details:M.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:A,stats:v}))}})})}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 pn(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(z(n)&&z(s)){var r;let o=n,c=s;if(a.sn==="initSegment"&&vn((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 wn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:ee.MEDIA_ERROR,details:M.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new ri(i)}function vn(a){return a==="AES-128"||a==="AES-256"}class ri extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class un extends C{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 cn{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=tn(),this.buffering={audio:tn(),video:tn(),audiovideo:tn()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function tn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const qi={length:0,start:()=>0,end:()=>0};class vt{static isBuffered(e,t){if(e){const i=vt.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=vt.getBuffered(e);return vt.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=vt.bufferedRanges(e);if(n.length)return vt.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((h,f)=>h.start-f.start||f.end-h.end);let n=-1,s=[];if(i)for(let h=0;h<e.length;h++){t>=e[h].start&&t<=e[h].end&&(n=h);const f=s.length;if(f){const d=s[f-1].end;e[h].start-d<i?e[h].end>d&&(s[f-1].end=e[h].end):s.push(e[h])}else s.push(e[h])}else s=e;let r=0,o,c=t,u=t;for(let h=0;h<s.length;h++){const f=s[h].start,d=s[h].end;if(n===-1&&t>=f&&t<=d&&(n=h),t+i>=f&&t<d)c=f,u=d,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||qi}catch(t){return X.log("failed to get media.buffered",t),qi}}}const Pn=/\{\$([a-zA-Z0-9-_]+)\}/g;function yn(a){return Pn.test(a)}function Kn(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 Xn(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 mi{constructor(e,t){typeof e=="string"&&(e=mi.parseAttrList(e,t)),y(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=Kn(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":X.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const Vn="com.apple.hls.interstitial";function En(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]){X.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=y(new mi({}),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"]);z(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?(X.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(z(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&&z(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 Wn=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?z(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Wn}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 bn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function xn(a){switch(a){case"AES-128":case"AES-256":return vi.cbc;case"AES-256-CTR":return vi.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function Yi(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Rn(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function nn(a){const e=Rn(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 wi(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=Yi(r)):t=nn(r)}}return t}const Ri=typeof self!="undefined"?self:void 0;var Kt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Qi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Hn(a){switch(a){case Qi.FAIRPLAY:return Kt.FAIRPLAY;case Qi.PLAYREADY:return Kt.PLAYREADY;case Qi.WIDEVINE:return Kt.WIDEVINE;case Qi.CLEARKEY:return Kt.CLEARKEY}}var ts={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function os(a){if(a===ts.WIDEVINE)return Kt.WIDEVINE;if(a===ts.PLAYREADY)return Kt.PLAYREADY;if(a===ts.CENC||a===ts.CLEARKEY)return Kt.CLEARKEY}function jn(a){switch(a){case Kt.FAIRPLAY:return Qi.FAIRPLAY;case Kt.PLAYREADY:return Qi.PLAYREADY;case Kt.WIDEVINE:return Qi.WIDEVINE;case Kt.CLEARKEY:return Qi.CLEARKEY}}function nt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[Kt.FAIRPLAY,Kt.WIDEVINE,Kt.PLAYREADY,Kt.CLEARKEY].filter(n=>!!e[n]):[];return!i[Kt.WIDEVINE]&&t&&i.push(Kt.WIDEVINE),i}const Et=function(a){return Ri!=null&&(a=Ri.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function _i(a,e,t,i){let n;switch(a){case Kt.FAIRPLAY:n=["cenc","sinf"];break;case Kt.WIDEVINE:case Kt.PLAYREADY:n=["cenc"];break;case Kt.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Oi(n,e,t,i)}function Oi(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 Si(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=Yi(o).subarray(0,16);return Nn(c),c}}return null}let zn={};class gn{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&&!bn(e)}isSupported(){if(this.method){if(bn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Qi.FAIRPLAY:case Qi.WIDEVINE:case Qi.PLAYREADY:case Qi.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(bn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(X.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=fs(e);return new gn(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=wi(this.uri);if(t)switch(this.keyFormat){case Qi.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Qi.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=ke(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 fs(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,$s=/#EXT-X-MEDIA:(.*)/g,Mr=/^#EXT(?:INF|-X-TARGETDURATION):/m,Gs=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 N.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Mr.test(e)}static parseMasterPlaylist(e,t){const i=yn(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 mi(r[1],n),h=Kn(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Fn.resolve(h,t)},d=u.decimalResolution("RESOLUTION");d&&(f.width=d.width,f.height=d.height),Ks(u.CODECS,f);const v=u["SUPPLEMENTAL-CODECS"];v&&(f.supplemental={},Ks(v,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),n.levels.push(f)}else if(r[3]){const u=r[3],h=r[4];switch(u){case"SESSION-DATA":{const f=new mi(h,n),d=f["DATA-ID"];d&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[d]=f);break}case"SESSION-KEY":{const f=Rs(h,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):X.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const f=new mi(h,n);On(n,f,t)}break}case"CONTENT-STEERING":{const f=new mi(h,n);n.contentSteering={uri:Fn.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=is(h);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($s.lastIndex=0;(n=$s.exec(e))!==null;){const u=new mi(n[1],i),h=u.TYPE;if(h){const f=o[h],d=s[h]||[];s[h]=d;const v=u.LANGUAGE,E=u["ASSOC-LANGUAGE"],A=u.CHANNELS,T=u.CHARACTERISTICS,B=u["INSTREAM-ID"],Q={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||v||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:v,url:u.URI?Fn.resolve(u.URI,t):""};if(E&&(Q.assocLang=E),A&&(Q.channels=A),T&&(Q.characteristics=T),B&&(Q.instreamId=B),f!=null&&f.length){const W=Fn.findGroup(f,Q.groupId)||f[0];Vs(Q,W,"audioCodec"),Vs(Q,W,"textCodec")}d.push(Q)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new es(t),h=u.fragments,f=[];let d=null,v=0,E=0,A=0,T=0,B=0,Q=null,W=new pe(n,c),se,oe,ve,le=-1,fe=!1,xe=null,ue;if(Gs.lastIndex=0,u.m3u8=e,u.hasVariableRefs=yn(e),((o=Gs.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(se=Gs.exec(e))!==null;){fe&&(fe=!1,W=new pe(n,c),W.playlistOffset=A,W.start=A,W.sn=v,W.cc=T,B&&(W.bitrate=B),W.level=i,d&&(W.initSegment=d,d.rawProgramDateTime&&(W.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),xe&&(W.setByteRange(xe),xe=null)));const wt=se[1];if(wt){W.duration=parseFloat(wt);const ht=(" "+se[2]).slice(1);W.title=ht||null,W.tagList.push(ht?["INF",wt,ht]:["INF",wt])}else if(se[3]){if(z(W.duration)){W.playlistOffset=A,W.start=A,ve&&Ws(W,ve,u),W.sn=v,W.level=i,W.cc=T,h.push(W);const ht=(" "+se[3]).slice(1);W.relurl=Kn(u,ht),Is(W,Q,f),Q=W,A+=W.duration,v++,E=0,fe=!0}}else{if(se=se[0].match(Nr),!se){X.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<se.length&&se[oe]===void 0;oe++);const ht=(" "+se[oe]).slice(1),st=(" "+se[oe+1]).slice(1),ft=se[oe+2]?(" "+se[oe+2]).slice(1):null;switch(ht){case"BYTERANGE":Q?W.setByteRange(st,Q):W.setByteRange(st);break;case"PROGRAM-DATE-TIME":W.rawProgramDateTime=st,W.tagList.push(["PROGRAM-DATE-TIME",st]),le===-1&&(le=h.length);break;case"PLAYLIST-TYPE":u.type&&Zn(u,ht,se),u.type=st.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Zn(u,ht,se):h.length>0&&ur(u,ht,se),v=u.startSN=parseInt(st);break;case"SKIP":{u.skippedSegments&&Zn(u,ht,se);const ut=new mi(st,u),Oe=ut.decimalInteger("SKIPPED-SEGMENTS");if(z(Oe)){u.skippedSegments+=Oe;for(let $t=Oe;$t--;)h.push(null);v+=Oe}const Ue=ut.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ue&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(Ue.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Zn(u,ht,se),u.targetduration=Math.max(parseInt(st),1);break;case"VERSION":u.version!==null&&Zn(u,ht,se),u.version=parseInt(st);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Zn(u,ht,se),u.live=!1;break;case"#":(st||ft)&&W.tagList.push(ft?[st,ft]:[st]);break;case"DISCONTINUITY":T++,W.tagList.push(["DIS"]);break;case"GAP":W.gap=!0,W.tagList.push([ht]);break;case"BITRATE":W.tagList.push([ht,st]),B=parseInt(st)*1e3,z(B)?W.bitrate=B:B=0;break;case"DATERANGE":{const ut=new mi(st,u),Oe=new Jn(ut,u.dateRanges[ut.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Oe.isValid||u.skippedSegments?u.dateRanges[Oe.id]=Oe:X.warn(`Ignoring invalid DATERANGE tag: "${st}"`),W.tagList.push(["EXT-X-DATERANGE",st]);break}case"DEFINE":{{const ut=new mi(st,u);"IMPORT"in ut?Xn(u,ut,r):On(u,ut,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?Zn(u,ht,se):h.length>0&&ur(u,ht,se),u.startCC=T=parseInt(st);break;case"KEY":{const ut=Rs(st,t,u);if(ut.isSupported()){if(ut.method==="NONE"){ve=void 0;break}ve||(ve={}),ve[ut.keyFormat]&&(ve=y({},ve)),ve[ut.keyFormat]=ut}else X.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${st}"`);break}case"START":u.startTimeOffset=is(st);break;case"MAP":{const ut=new mi(st,u);if(W.duration){const Oe=new pe(n,c);lr(Oe,ut,i,ve),d=Oe,W.initSegment=d,d.rawProgramDateTime&&!W.rawProgramDateTime&&(W.rawProgramDateTime=d.rawProgramDateTime)}else{const Oe=W.byteRangeEndOffset;if(Oe){const Ue=W.byteRangeStartOffset;xe=`${Oe-Ue}@${Ue}`}else xe=null;lr(W,ut,i,ve),d=W,fe=!0}d.cc=T;break}case"SERVER-CONTROL":{ue&&Zn(u,ht,se),ue=new mi(st),u.canBlockReload=ue.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=ue.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&ue.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=ue.optionalFloat("PART-HOLD-BACK",0),u.holdBack=ue.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&Zn(u,ht,se);const ut=new mi(st);u.partTarget=ut.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ut=u.partList;ut||(ut=u.partList=[]);const Oe=E>0?ut[ut.length-1]:void 0,Ue=E++,$t=new mi(st,u),Pt=new Ae($t,W,c,Ue,Oe);ut.push(Pt),W.duration+=Pt.duration;break}case"PRELOAD-HINT":{const ut=new mi(st,u);u.preloadHint=ut;break}case"RENDITION-REPORT":{const ut=new mi(st,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(ut);break}default:X.warn(`line parsed but not handled: ${se}`);break}}}Q&&!Q.relurl?(h.pop(),A-=Q.duration,u.partList&&(u.fragmentHint=Q)):u.partList&&(Is(W,Q,f),W.cc=T,u.fragmentHint=W,ve&&Ws(W,ve,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Pe=h.length,Ze=h[0],ei=h[Pe-1];if(A+=u.skippedSegments*u.targetduration,A>0&&Pe&&ei){u.averagetargetduration=A/Pe;const wt=ei.sn;u.endSN=wt!=="initSegment"?wt:0,u.live||(ei.endList=!0),Ze&&u.startCC===void 0&&(u.startCC=Ze.cc),le>0&&(Br(h,le),Ze&&f.unshift(Ze))}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(A+=u.fragmentHint.duration),u.totalduration=A,f.length&&u.dateRangeTagCount&&Ze&&vs(f,u),u.endCC=T,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 h=Fr(e,c,a,u,n);if(h!==-1){o.tagAnchor=e.fragments[h].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,h=a.fragments;if(h.length>t.length){const d=(t[i+1]||h[h.length-1]).sn-a.startSN;for(let v=d;v>u;v--){const E=h[v].programDateTime;if(e>=E&&e<E+h[v].duration*1e3)return v}}return u}}}return-1}function Rs(a,e,t){var i,n;const s=new mi(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,h=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!c&&X.error(`Invalid IV: ${s.IV}`);const f=o?Fn.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new gn(r,f,h,d,c)}function is(a){const t=new mi(a).decimalFloatingPoint("TIME-OFFSET");return z(t)?t:null}function Ks(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>pt(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 Is(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 Ws(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 Hs(a,e){const t=e.startPTS;if(z(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&&(X.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,h=e.endPTS;if(z(u)){const T=Math.abs(u-t);z(e.deltaPTS)?e.deltaPTS=Math.max(T,e.deltaPTS):e.deltaPTS=T,o=Math.max(t,u),t=Math.min(t,u),n=Math.min(n,e.startDTS),c=Math.min(i,h),i=Math.max(i,h),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 d=e.sn;if(!a||d<a.startSN||d>a.endSN)return 0;let v;const E=d-a.startSN,A=a.fragments;for(A[E]=e,v=E;v>0;v--)Hs(A[v],A[v-1]);for(v=E;v<A.length-1;v++)Hs(A[v],A[v+1]);return a.fragmentHint&&Hs(A[A.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,h,f)=>{if(!e.startCC&&u.cc!==c.cc){var d,v;const E=c.cc-u.cc;for(let A=h;A<f.length;A++)f[A].cc+=E;e.startCC=(d=(v=pr(a,e.startSN-1))==null?void 0:v.cc)!=null?d:f[0].cc,e.endCC=f[f.length-1].cc}z(c.startPTS)&&z(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){X.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&&Is(r[u],r[u-1],c);vs(c,e)}js(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):dr(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=y({},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)):X.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${kt(t[o].attr)}"`)}),n}function js(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 h=c[r+u];let f=o[u];if(i&&!f&&h&&(f=e.fragments[u]=h),h&&f){if(t(h,f,u,o),h.url&&h.url!==f.url){e.playlistParsingError=fr(`media sequence mismatch ${f.sn}:`,a,e,h,f);return}else if(h.cc!==f.cc){e.playlistParsingError=fr(`discontinuity sequence mismatch (${h.cc}!=${f.cc})`,a,e,h,f);return}}}}function fr(a,e,t,i,n){return new Error(`${a} ${n.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function dr(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;Ls(e,r)}function Ls(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 gr(a,e,t){return a?mr(a.partList,e,t):null}function mr(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 $r(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 Gr(a,e){a&&(Mi(e,a),!e.alignedSliding&&a&&fi(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&dr(a,e,!1))}function Mi(a,e){if(!$r(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;X.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;vr(s,a)}function fi(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 Ii={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}},be={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 mn extends un{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=be.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:h}=this,f=c?c.currentTime:0,d=vt.bufferInfo(u||c,f,r.maxBufferHole);if(this.log(`media seeking to ${z(f)?f.toFixed(3):f}, state: ${h}`),this.state===be.ENDED)this.resetLoadingState();else if(o){const v=r.maxFragLookUpTolerance,E=o.start-v,A=o.start+o.duration+v;if(!d.len||A<d.start||E>d.end){const T=f>A;(f<E||T)&&(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 v=this.lastCurrentTime;if(f>v&&(this.lastCurrentTime=f),!this.loadingParts){const E=Math.max(d.end,f),A=this.shouldLoadParts(this.getLevelDetails(),E);A&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${E.toFixed(2)}`),this.loadingParts=A)}}!this.hls.hasEnoughToStart&&!d.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 rn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new An(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===be.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=be.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 vt.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===be.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=be.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===be.FRAG_LOADING||!this.fragCurrent&&r===be.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=be.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===be.STOPPED||this.state===be.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)===Ht.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)===Ht.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&&bn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,xn(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const h=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:h}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===be.STOPPED||this.state===be.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!==be.STOPPED&&(this.state=be.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?Ii.toString(vt.getBuffered(i)):"(detached)"})`),V(e)){var n;if(e.type!==Y.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=be.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=be.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 cn(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=be.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===be.KEY_LOADING&&(this.state=be.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(V(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&&V(e)){const f=r.partList;if(f&&n){i>e.end&&r.fragmentHint&&(e=r.fragmentHint);const d=this.getNextPart(f,e,i);if(d>-1){const v=f[d];e=this.fragCurrent=v.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${v.index} (${d}/${f.length-1}) of ${this.fragInfo(e,!1,v)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=v.start+v.duration,this.state=be.FRAG_LOADING;let E;return o?E=o.then(A=>!A||this.fragContextChanged(A.frag)?null:this.doFragPartsLoad(e,v,t,n)).catch(A=>this.handleFragLoadError(A)):E=this.doFragPartsLoad(e,v,t,n).catch(A=>this.handleFragLoadError(A)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:v,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):E}else if(!e.url||this.loadedEndOfParts(f,i))return Promise.resolve(null)}}if(V(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))}`),z(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=be.FRAG_LOADING;const u=this.config.progressive;let h;return u&&o?h=o.then(f=>!f||this.fragContextChanged(f==null?void 0:f.frag)?null:this.fragmentLoader.load(e,n)).catch(f=>this.handleFragLoadError(f)):h=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")):h}doFragPartsLoad(e,t,i,n){return new Promise((s,r)=>{var o;const c=[],u=(o=i.details)==null?void 0:o.partList,h=f=>{this.fragmentLoader.loadPart(e,f,n).then(d=>{c[f.index]=d;const v=d.part;this.hls.trigger(p.FRAG_LOADED,d);const E=gr(i.details,e.sn,f.index+1)||mr(u,e.sn,f.index+1);if(E)h(E);else return s({frag:e,part:v,partsLoaded:c})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===M.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:ee.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==be.PARSING){!this.fragCurrent&&this.state!==be.STOPPED&&this.state!==be.ERROR&&(this.state=be.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?gr(c,s,r):null,h=u?u.fragment:pr(c,s,i);return h?(i&&i!==h&&(h.stats=i.stats),{frag:h,part:u,level:o}):null}bufferFragmentData(e,t,i,n,s){var r;if(!e||this.state!==be.PARSING)return;const{data1:o,data2:c}=e;let u=o;if(o&&c&&(u=dt(o,c)),!((r=u)!=null&&r.length))return;const h={type:e.type,frag:t,part:i,chunkMeta:n,parent:t.type,data:u};if(this.hls.trigger(p.BUFFER_APPENDING,h),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!vt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=vt.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(!z(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=vt.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 vt.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=Y.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 d=this.hls.startPosition,v=this.hls.liveSyncPosition,E=c?(d!==-1&&d>=r?d:v)||c.start:e;this.log(`Setting startPosition to ${E} to match start frag at live edge. mainStart: ${d} liveSyncPosition: ${v} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=E}}else e<=r&&(c=i[0]);if(!c){const f=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,f,t)}let h=this.filterReplacedPrimary(c,t);if(!h&&c){const f=c.sn-t.startSN;h=this.filterReplacedPrimary(i[f+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Ht.OK||i===Ht.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(xs(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(xs(this.hls.config)&&e.type!==Y.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 h=u.loaded;h?n=-1:(s||u.independent||r)&&u.fragment===t&&(n=o),s=h}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=ct(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=gt(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,h=i.partList,f=!!(this.loadingParts&&h!=null&&h.length&&c);f&&c&&!this.bitrateTest&&h[h.length-1].fragment.sn===c.sn&&(r=r.concat(c),o=c.sn);let d;if(e<t){var v;const A=e<this.lastCurrentTime||e>t-u||(v=this.media)!=null&&v.paused||!this.startFragRequested?0:u;d=at(s,r,e,A)}else d=r[r.length-1];if(d){const E=d.sn-i.startSN,A=this.fragmentTracker.getState(d);if((A===Ht.OK||A===Ht.PARTIAL&&d.gap)&&(s=d),s&&d.sn===s.sn&&(!f||h[0].fragment.sn>d.sn||!i.live&&!f)&&s&&d.level===s.level){const B=r[E+1];d.sn<o&&this.fragmentTracker.getState(B)!==Ht.OK?d=B:d=null}}return d}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&&z(s);if(r||!o&&!s){Gr(i,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),c}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const n=this.timelineOffset;if(i===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&z(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&&V(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!==be.FRAG_LOADING_WAITING_RETRY)&&(this.state=be.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const E=this.getCurrentContext(t.chunkMeta);E&&(t.frag=E.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===M.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const r=t.errorAction,{action:o,flags:c,retryCount:u=0,retryConfig:h}=r||{},f=!!r&&!!h,d=f&&o===ii.RetryRequest,v=f&&!r.resolved&&c===Xt.MoveAllAlternatesMatchingHost;if(!d&&v&&V(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),r.resolved=!0;else if((d||v)&&u<h.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const E=Ft(h,u);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${h.maxNumRetry} in ${E}ms`),r.resolved=!0,this.retryDate=self.performance.now()+E,this.state=be.FRAG_LOADING_WAITING_RETRY}else if(h&&r)if(this.resetFragmentErrors(e),u<h.maxNumRetry)!s&&o!==ii.RemoveAlternatePermanently&&(r.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else o===ii.SendAlternateToPenaltyBox?this.state=be.WAITING_LEVEL:this.state=be.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===be.PARSING||this.state===be.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===Y.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==be.STOPPED&&(this.state=be.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=vt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===be.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==be.STOPPED&&(this.state=be.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 h=e.elementaryStreams[u];if(h){const f=h.endPTS-h.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),c||!1;const d=n?0:cr(s,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:i,drift:d,type:u,frag:e,start:h.startPTS,end:h.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:ee.MEDIA_ERROR,details:M.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=be.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===Y.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 xs(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=Kr(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Kr(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 Ss(){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,h){this.fn=c,this.context=u,this.once=h||!1}function s(c,u,h,f,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var v=new n(h,f||c,d),E=t?t+u:u;return c._events[E]?c._events[E].fn?c._events[E]=[c._events[E],v]:c._events[E].push(v):(c._events[E]=v,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=[],h,f;if(this._eventsCount===0)return u;for(f in h=this._events)e.call(h,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},o.prototype.listeners=function(u){var h=t?t+u:u,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,v=f.length,E=new Array(v);d<v;d++)E[d]=f[d].fn;return E},o.prototype.listenerCount=function(u){var h=t?t+u:u,f=this._events[h];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,h,f,d,v,E){var A=t?t+u:u;if(!this._events[A])return!1;var T=this._events[A],B=arguments.length,Q,W;if(T.fn){switch(T.once&&this.removeListener(u,T.fn,void 0,!0),B){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,h),!0;case 3:return T.fn.call(T.context,h,f),!0;case 4:return T.fn.call(T.context,h,f,d),!0;case 5:return T.fn.call(T.context,h,f,d,v),!0;case 6:return T.fn.call(T.context,h,f,d,v,E),!0}for(W=1,Q=new Array(B-1);W<B;W++)Q[W-1]=arguments[W];T.fn.apply(T.context,Q)}else{var se=T.length,oe;for(W=0;W<se;W++)switch(T[W].once&&this.removeListener(u,T[W].fn,void 0,!0),B){case 1:T[W].fn.call(T[W].context);break;case 2:T[W].fn.call(T[W].context,h);break;case 3:T[W].fn.call(T[W].context,h,f);break;case 4:T[W].fn.call(T[W].context,h,f,d);break;default:if(!Q)for(oe=1,Q=new Array(B-1);oe<B;oe++)Q[oe-1]=arguments[oe];T[W].fn.apply(T[W].context,Q)}}return!0},o.prototype.on=function(u,h,f){return s(this,u,h,f,!1)},o.prototype.once=function(u,h,f){return s(this,u,h,f,!0)},o.prototype.removeListener=function(u,h,f,d){var v=t?t+u:u;if(!this._events[v])return this;if(!h)return r(this,v),this;var E=this._events[v];if(E.fn)E.fn===h&&(!d||E.once)&&(!f||E.context===f)&&r(this,v);else{for(var A=0,T=[],B=E.length;A<B;A++)(E[A].fn!==h||d&&!E[A].once||f&&E[A].context!==f)&&T.push(E[A]);T.length?this._events[v]=T.length===1?T[0]:T:r(this,v)}return this},o.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&r(this,h)):(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=Ss(),Qs=w(Ys);const Xs="1.6.2",ks={};function qo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Jo(){const a=ks[Xs];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[Xs]=n,n}function el(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 tl(a){const e=ks[a||Xs];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete ks[a||Xs],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 il(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 v=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:ee.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!0,error:v,reason:v.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,h=n[r];let f=r;(o===5||o===29)&&(f-=3);const d=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return X.log(`manifest codec:${i}, parsed codec:${u}, channels:${c}, rate:${h} (ADTS object type:${o} sampling index:${r})`),{config:d,samplerate:h,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 Wr(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function nl(a,e){return e+5<a.length}function Er(a,e){return e+1<a.length&&wa(a,e)}function sl(a,e){return nl(a,e)&&wa(a,e)&&Wr(a,e)<=a.length-e}function rl(a,e){if(Er(a,e)){const t=Ra(a,e);if(e+t>=a.length)return!1;const i=Wr(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||Er(a,n)}return!1}function Ia(a,e,t,i,n){if(!a.samplerate){const s=il(e,t,i,n);if(!s)return;y(a,s)}}function La(a){return 1024*9e4/a}function al(a,e){const t=Ra(a,e);if(e+t<=a.length){const i=Wr(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Da(a,e,t,i,n){const s=La(a.samplerate),r=i+n*s,o=al(e,t);let c;if(o){const{frameLength:f,headerLength:d}=o,v=d+f,E=Math.max(0,t+v-e.length);E?(c=new Uint8Array(v-d),c.set(e.subarray(t+d,e.length),0)):c=e.subarray(t+d,t+v);const A={unit:c,pts:r};return E||a.samples.push(A),{sample:A,length:v,missing:E}}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 ol(a,e){return Vr(a,e)&&yr(a,e+6)+10<=a.length-e}function ll(a){if(a.size<2)return;const e=et(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function ul(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=et(a.data.subarray(t),!0);t+=i.length+1;const n=et(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=et(a.data.subarray(1));return{key:a.type,info:"",data:e}}function cl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=et(a.data.subarray(t),!0);t+=i.length+1;const n=et(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=et(a.data);return{key:a.type,info:"",data:e}}function hl(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 dl(){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 pl(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function Hr(a,e=0,t=1/0){return gl(a,e,t,Uint8Array)}function gl(a,e,t,i){const n=ml(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=_l(a)?a.byteOffset:0,o=(r+a.byteLength)/s,c=(r+e)/s,u=Math.floor(Math.max(0,Math.min(c,o))),h=Math.floor(Math.min(u+Math.max(t,0),o));return new i(n,u,h-u)}function ml(a){return a instanceof ArrayBuffer?a:a.buffer}function _l(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function vl(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=et(Hr(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=et(Hr(a.data,3+i,r));let c;return n==="-->"?c=et(Hr(a.data,4+i+r)):c=pl(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function yl(a){return a.type==="PRIV"?ll(a):a.type[0]==="W"?cl(a):a.type==="APIC"?vl(a):ul(a)}function El(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,bl=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+bl<n;){const s=El(a.subarray(e)),r=yl(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 jr(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=dt(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?jr(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&z(c))&&(this.basePTS=Sl(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 h=this.appendFrame(r,e,n);h?(this.frameIndex++,this.lastPTS=h.sample.pts,n+=h.length,s=n):n=u}else ol(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 h=e.slice(s);this.cachedData?this.cachedData=dt(this.cachedData,h):this.cachedData=h}}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 Sl=(a,e,t)=>{if(z(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let xr=null;const Tl=[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],Al=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],wl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Rl=[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=Tl[c*14+n-1]*1e3,f=Al[(t===3?0:t===2?1:2)*3+s],d=o===3?1:2,v=wl[t][i],E=Rl[i],A=v*8*E,T=Math.floor(v*u/f+r)*E;if(xr===null){const W=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);xr=W?parseInt(W[1]):0}return!!xr&&xr<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:d,frameLength:T,samplesPerFrame:A}}}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 Ll 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(rl(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return sl(e,t)}appendFrame(e,t,i){Ia(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 Dl 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&&jr(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,h=[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+h>e.length)return-1;const f=e[t+6]>>5;let d=0;f===2?d+=2:(f&1&&f!==1&&(d+=2),f&4&&(d+=2));const v=(e[t+6]<<8|e[t+7])>>12-d&1,A=[2,1,2,3,3,4,4,5][f]+v,T=e[t+5]>>3,B=e[t+5]&7,Q=new Uint8Array([s<<6|T<<1|B>>2,(B&3)<<6|f<<3|v<<2|c>>4,c<<4&224]),W=1536/o*9e4,se=i+n*W,oe=e.subarray(t,t+h);return a.config=Q,a.channelCount=A,a.samplerate=o,a.samples.push({unit:oe,pts:se}),h}class Cl 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&&jr(t)!==void 0&&Ba(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(Fa(e,i))return X.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 kl=/\/emsg[-/]ID3/i;class Pl{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=Ve(e);if(c.video){const{id:u,timescale:h,codec:f,supplemental:d}=c.video;s.id=u,s.timescale=o.timescale=h,s.codec=f,s.supplemental=d}if(c.audio){const{id:u,timescale:h,codec:f}=c.audio;r.id=u,r.timescale=h,r.codec=f}o.id=Rt.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return Ie(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=dt(this.remainderData,e));const o=Ot(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=Zt(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=Zt(e,t),{videoTrack:t,audioTrack:ns(),id3Track:n,textTrack:ns()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=ne(e.samples,["emsg"]);n&&n.forEach(s=>{const r=Ni(s);if(kl.test(r.schemeIdUri)){const o=$a(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=$a(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 $a(a,e){return z(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ol{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new An(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,vi.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=St(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 Ga{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,h,f,d=-1,v=0;for(s===-1&&(d=0,v=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(h=c-s-1,d>=0){const E={data:t.subarray(d,h),type:v};o.push(E)}else{const E=this.getLastNalUnit(e.samples);E&&(r&&c<=4-r&&E.state&&(E.data=E.data.subarray(0,E.data.byteLength-r)),h>0&&(E.data=dt(E.data,t.subarray(0,h)),E.state=0))}c<n?(f=this.getNALuType(t,c),d=c,v=f,s=0):s=-1}else s=0}if(d>=0&&s>=0){const E={data:t.subarray(d,n),type:v,state:s};o.push(E)}if(o.length===0){const E=this.getLastNalUnit(e.samples);E&&(E.data=dt(E.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&&X.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 Ka extends Ga{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 h,f;switch(u.type){case 1:{let A=!1;o=!0;const T=u.data;if(c&&T.length>4){const B=this.readSliceType(T);(B===2||B===4||B===7||B===9)&&(A=!0)}if(A){var d;(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.frame=!0,r.key=A;break}case 5:o=!0,(h=r)!=null&&h.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,Yt(u.data,1,i.pts,t.samples);break}case 7:{var v,E;o=!0,c=!0;const A=u.data,T=this.readSPS(A);if(!e.sps||e.width!==T.width||e.height!==T.height||((v=e.pixelRatio)==null?void 0:v[0])!==T.pixelRatio[0]||((E=e.pixelRatio)==null?void 0:E[1])!==T.pixelRatio[1]){e.width=T.width,e.height=T.height,e.pixelRatio=T.pixelRatio,e.sps=[A];const B=A.subarray(1,4);let Q="avc1.";for(let W=0;W<3;W++){let se=B[W].toString(16);se.length<2&&(se="0"+se),Q+=se}e.codec=Q}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 h=t.readUByte.bind(t),f=t.readBits.bind(t),d=t.readUEG.bind(t),v=t.readBoolean.bind(t),E=t.skipBits.bind(t),A=t.skipEG.bind(t),T=t.skipUEG.bind(t),B=this.skipScalingList.bind(this);h();const Q=h();if(f(5),E(3),h(),T(),Q===100||Q===110||Q===122||Q===244||Q===44||Q===83||Q===86||Q===118||Q===128){const fe=d();if(fe===3&&E(1),T(),T(),E(1),v())for(c=fe!==3?8:12,u=0;u<c;u++)v()&&(u<6?B(16,t):B(64,t))}T();const W=d();if(W===0)d();else if(W===1)for(E(1),A(),A(),o=d(),u=0;u<o;u++)A();T(),E(1);const se=d(),oe=d(),ve=f(1);ve===0&&E(1),E(1),v()&&(i=d(),n=d(),s=d(),r=d());let le=[1,1];if(v()&&v())switch(h()){case 1:le=[1,1];break;case 2:le=[12,11];break;case 3:le=[10,11];break;case 4:le=[16,11];break;case 5:le=[40,33];break;case 6:le=[24,11];break;case 7:le=[20,11];break;case 8:le=[32,11];break;case 9:le=[80,33];break;case 10:le=[18,11];break;case 11:le=[15,11];break;case 12:le=[64,33];break;case 13:le=[160,99];break;case 14:le=[4,3];break;case 15:le=[3,2];break;case 16:le=[2,1];break;case 255:{le=[h()<<8|h(),h()<<8|h()];break}}return{width:Math.ceil((se+1)*16-i*2-n*2),height:(2-ve)*(oe+1)*16-(ve?2:4)*(s+r),pixelRatio:le}}}class Va extends Ga{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 h,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 d;(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 19:case 20:o=!0,(h=r)!=null&&h.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,Yt(u.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=y(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 v=this.readSPS(u.data);e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.codec=v.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const E in v.params)e.params[E]=v.params[E]}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 v=this.readPPS(u.data);for(const E in v)e.params[E]=v[E]}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(),h=t.readUByte(),f=t.readUByte(),d=t.readUByte(),v=t.readUByte(),E=t.readUByte(),A=t.readUByte(),T=t.readUByte(),B=t.readUByte(),Q=[],W=[];for(let gi=0;gi<i;gi++)Q.push(t.readBoolean()),W.push(t.readBoolean());if(i>0)for(let gi=i;gi<8;gi++)t.readBits(2);for(let gi=0;gi<i;gi++)Q[gi]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),W[gi]&&t.readUByte();t.readUEG();const se=t.readUEG();se==3&&t.skipBits(1);const oe=t.readUEG(),ve=t.readUEG(),le=t.readBoolean();let fe=0,xe=0,ue=0,Pe=0;le&&(fe+=t.readUEG(),xe+=t.readUEG(),ue+=t.readUEG(),Pe+=t.readUEG());const Ze=t.readUEG(),ei=t.readUEG(),wt=t.readUEG(),ht=t.readBoolean();for(let gi=ht?0:i;gi<=i;gi++)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 Sn=0;Sn<4;Sn++)for(let Gn=0;Gn<(Sn===3?2:6);Gn++)if(!t.readBoolean())t.readUEG();else{const Qn=Math.min(64,1<<4+(Sn<<1));Sn>1&&t.readEG();for(let Us=0;Us<Qn;Us++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const ut=t.readUEG();let Oe=0;for(let gi=0;gi<ut;gi++){let Sn=!1;if(gi!==0&&(Sn=t.readBoolean()),Sn){gi===ut&&t.readUEG(),t.readBoolean(),t.readUEG();let Gn=0;for(let As=0;As<=Oe;As++){const Qn=t.readBoolean();let Us=!1;Qn||(Us=t.readBoolean()),(Qn||Us)&&Gn++}Oe=Gn}else{const Gn=t.readUEG(),As=t.readUEG();Oe=Gn+As;for(let Qn=0;Qn<Gn;Qn++)t.readUEG(),t.readBoolean();for(let Qn=0;Qn<As;Qn++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const gi=t.readUEG();for(let Sn=0;Sn<gi;Sn++){for(let Gn=0;Gn<wt+4;Gn++)t.readBits(1);t.readBits(1)}}let $t=0,Pt=1,qt=1,di=!0,yi=1,Ti=0;t.readBoolean(),t.readBoolean();let In=!1;if(t.readBoolean()){if(t.readBoolean()){const ws=t.readUByte(),Ho=[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?(Pt=Ho[ws-1],qt=Or[ws-1]):ws===255&&(Pt=t.readBits(16),qt=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(),In=t.readBoolean(),In&&(fe+=t.readUEG(),xe+=t.readUEG(),ue+=t.readUEG(),Pe+=t.readUEG()),t.readBoolean()&&(yi=t.readBits(32),Ti=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Or=t.readBoolean(),jo=t.readBoolean();let rr=!1;(Or||jo)&&(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++){di=t.readBoolean();const th=di||t.readBoolean();let Zo=!1;th?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(jo)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(),$t=t.readUEG())}let _s=oe,Wo=ve;if(le||In){let gi=1,Sn=1;se===1?gi=Sn=2:se==2&&(gi=2),_s=oe-gi*xe-gi*fe,Wo=ve-Sn*Pe-Sn*ue}const Jc=n?["A","B","C"][n]:"",eh=o<<24|c<<16|u<<8|h;let Sa=0;for(let gi=0;gi<32;gi++)Sa=(Sa|(eh>>gi&1)<<31-gi)>>>0;let Ta=Sa.toString(16);return r===1&&Ta==="2"&&(Ta="6"),{codecString:`hvc1.${Jc}${r}.${Ta}.${s?"H":"L"}${B}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,c,u,h],general_constraint_indicator_flags:[f,d,v,E,A,T],general_level_idc:B,bit_depth:Ze+8,bit_depth_luma_minus8:Ze,bit_depth_chroma_minus8:ei,min_spatial_segmentation_idc:$t,chroma_format_idc:se,frame_rate:{fixed:di,fps:Ti/yi}},width:_s,height:Wo,pixelRatio:[Pt,qt]}}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 hn=188;class ds{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=ds.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(hn*5,t-hn)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=hn)if(e[c]===71&&(t-c===hn||e[c+hn]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+hn*99,e.length-hn)+1)),s||(s=Yr(e,c)===0),s&&o>1&&(r===0&&o>2||c+hn>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:Rt[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=ds.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=ds.createTrack("audio",n),this._id3Track=ds.createTrack("id3"),this._txtTrack=ds.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 h=r.pid,f=r.pesData,d=o.pid,v=c.pid,E=o.pesData,A=c.pesData,T=null,B=this.pmtParsed,Q=this._pmtId,W=e.length;if(this.remainderData&&(e=dt(this.remainderData,e),W=e.length,this.remainderData=null),W<hn&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const se=Math.max(0,ds.syncOffset(e));W-=(W-se)%hn,W<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,W,e.buffer.byteLength-W));let oe=0;for(let le=se;le<W;le+=hn)if(e[le]===71){const fe=!!(e[le+1]&64),xe=Yr(e,le),ue=(e[le+3]&48)>>4;let Pe;if(ue>1){if(Pe=le+5+e[le+4],Pe===le+hn)continue}else Pe=le+4;switch(xe){case h:if(fe){if(f&&(s=Ps(f,this.logger))){if(this.videoParser===null)switch(r.segmentCodec){case"avc":this.videoParser=new Ka;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(Pe,le+hn)),f.size+=le+hn-Pe);break;case d:if(fe){if(E&&(s=Ps(E,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}E={data:[],size:0}}E&&(E.data.push(e.subarray(Pe,le+hn)),E.size+=le+hn-Pe);break;case v:fe&&(A&&(s=Ps(A,this.logger))&&this.parseID3PES(c,s),A={data:[],size:0}),A&&(A.data.push(e.subarray(Pe,le+hn)),A.size+=le+hn-Pe);break;case 0:fe&&(Pe+=e[Pe]+1),Q=this._pmtId=Ml(e,Pe);break;case Q:{fe&&(Pe+=e[Pe]+1);const Ze=Nl(e,Pe,this.typeSupported,i,this.observer,this.logger);h=Ze.videoPid,h>0&&(r.pid=h,r.segmentCodec=Ze.segmentVideoCodec),d=Ze.audioPid,d>0&&(o.pid=d,o.segmentCodec=Ze.segmentAudioCodec),v=Ze.id3Pid,v>0&&(c.pid=v),T!==null&&!B&&(this.logger.warn(`MPEG-TS PMT found at ${le} after unknown PID '${T}'. Backtracking to sync byte @${se} to parse all TS packets.`),T=null,le=se-188),B=this.pmtParsed=!0;break}case 17:case 8191:break;default:T=xe;break}}else oe++;oe>0&&Qr(this.observer,new Error(`Found ${oe} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=E,c.pesData=A;const ve={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(ve),ve}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 Ka;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 Ol(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,d=n.sample.unit.byteLength;if(f===-1)s=dt(n.sample.unit,s);else{const v=d-f;n.sample.unit.set(s.subarray(0,f),v),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 d=r<o-1;if(d?f=`AAC PES did not start with ADTS header,offset:${r}`:f="No ADTS header found in AAC PES",Qr(this.observer,new Error(f),d,this.logger),!d)return}Ia(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const f=La(e.samplerate);c=n.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,h;for(;r<o;)if(h=Da(e,s,r,c,u),r+=h.length,h.missing){this.aacOverFlow=h;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=y({},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 Ml(a,e){return(a[e+10]&31)<<8|a[e+11]}function Nl(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 h=Yr(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){Xr("ADTS AAC",s);break}case 15:r.audioPid===-1&&(r.audioPid=h);break;case 21:r.id3Pid===-1&&(r.id3Pid=h);break;case 219:if(!i){Xr("H.264",s);break}case 27:r.videoPid===-1&&(r.videoPid=h);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=h,r.segmentAudioCodec="mp3");break;case 193:if(!i){Xr("AC-3",s);break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=h,r.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&f>0){let d=e+5,v=f;for(;v>2;){switch(a[d]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=h,r.segmentAudioCodec="ac3");break}const A=a[d+1]+2;d+=A,v-=A}}break;case 194:case 135:return Qr(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),r;case 36:r.videoPid===-1&&(r.videoPid=h,r.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=f+5}return r}function Qr(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:ee.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Xr(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]=dt(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 h=i[7];h&192&&(r=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,h&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 d=new Uint8Array(a.size);for(let v=0,E=c.length;v<E;v++){i=c[v];let A=i.byteLength;if(f)if(f>A){f-=A;continue}else i=i.subarray(f),A-=f,f=0;d.set(i,t),t+=A}return n&&(n-=s+3),{data:d,pts:r,dts:o,len:n}}return null}class Fl{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 he{static init(){he.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 he.types)he.types.hasOwnProperty(e)&&(he.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]);he.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]);he.STTS=he.STSC=he.STCO=s,he.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),he.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),he.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),he.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]);he.FTYP=he.box(he.types.ftyp,r,c,r,o),he.DINF=he.box(he.types.dinf,he.box(he.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 he.box(he.types.hdlr,he.HDLR_TYPES[e])}static mdat(e){return he.box(he.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(ps+1)),n=Math.floor(t%(ps+1));return he.box(he.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 he.box(he.types.mdia,he.mdhd(e.timescale||0,e.duration||0),he.hdlr(e.type),he.minf(e))}static mfhd(e){return he.box(he.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"?he.box(he.types.minf,he.box(he.types.smhd,he.SMHD),he.DINF,he.stbl(e)):he.box(he.types.minf,he.box(he.types.vmhd,he.VMHD),he.DINF,he.stbl(e))}static moof(e,t,i){return he.box(he.types.moof,he.mfhd(e),he.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=he.trak(e[t]);return he.box.apply(null,[he.types.moov,he.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(he.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=he.trex(e[t]);return he.box.apply(null,[he.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 he.box(he.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 he.box(he.types.sdtp,i)}static stbl(e){return he.box(he.types.stbl,he.stsd(e),he.box(he.types.stts,he.STTS),he.box(he.types.stsc,he.STSC),he.box(he.types.stsz,he.STSZ),he.box(he.types.stco,he.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=he.box(he.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,h=e.pixelRatio[0],f=e.pixelRatio[1];return he.box(he.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,he.box(he.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),he.box(he.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&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 he.box(he.types.mp4a,he.audioStsd(e),he.box(he.types.esds,he.esds(e)))}static mp3(e){return he.box(he.types[".mp3"],he.audioStsd(e))}static ac3(e){return he.box(he.types["ac-3"],he.audioStsd(e),he.box(he.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return he.box(he.types.stsd,he.STSD,he.mp4a(e));if(t==="ac3"&&e.config)return he.box(he.types.stsd,he.STSD,he.ac3(e));if(t==="mp3"&&e.codec==="mp3")return he.box(he.types.stsd,he.STSD,he.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return he.box(he.types.stsd,he.STSD,he.avc1(e));if(t==="hevc"&&e.vps)return he.box(he.types.stsd,he.STSD,he.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 he.box(he.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=he.sdtp(e),n=e.id,s=Math.floor(t/(ps+1)),r=Math.floor(t%(ps+1));return he.box(he.types.traf,he.box(he.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),he.box(he.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])),he.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,he.box(he.types.trak,he.tkhd(e),he.mdia(e))}static trex(e){const t=e.id;return he.box(he.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,h,f,d;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,h=c.size,f=c.flags,d=c.cts,r.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*o);return he.box(he.types.trun,r)}static initSegment(e){he.types||he.init();const t=he.moov(e);return dt(he.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 E=0;E<i.length;E+=1){r+=3;for(let A=0;A<i[E].length;A+=1)r+=2+i[E][A].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let E=0;E<i.length;E+=1){o.set(new Uint8Array([32+E|(E===c?128:0),0,i[E].length]),r),r+=3;for(let A=0;A<i[E].length;A+=1)o.set(new Uint8Array([i[E][A].length>>8,i[E][A].length&255]),r),r+=2,o.set(i[E][A],r),r+=i[E][A].length}const u=he.box(he.types.hvcC,o),h=e.width,f=e.height,d=e.pixelRatio[0],v=e.pixelRatio[1];return he.box(he.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,h>>8&255,h&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,he.box(he.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),he.box(he.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,v>>24,v>>16&255,v>>8&255,v&255])))}}he.types=void 0,he.HDLR_TYPES=void 0,he.STTS=void 0,he.STSC=void 0,he.STCO=void 0,he.STSZ=void 0,he.VMHD=void 0,he.SMHD=void 0,he.STSD=void 0,he.FTYP=void 0,he.DINF=void 0;const Wa=9e4;function qr(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function Bl(a,e,t=1,i=!1){return qr(a,e,1/t,i)}function er(a,e=!1){return qr(a,1e3,1/Wa,e)}function Ul(a,e=1){return qr(a,Wa,1/e)}const $l=10*1e3,Gl=1024,Kl=1152,Vl=1536;let Os=null,Jr=null;function Ha(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 Sr{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,h,f,d,v,E,A=s,T=s;const B=e.pid>-1,Q=t.pid>-1,W=t.samples.length,se=e.samples.length>0,oe=o&&W>0||W>1;if((!B||se)&&(!Q||oe)||this.ISGenerated||o){if(this.ISGenerated){var le,fe,xe,ue;const wt=this.videoTrackConfig;(wt&&(t.width!==wt.width||t.height!==wt.height||((le=t.pixelRatio)==null?void 0:le[0])!==((fe=wt.pixelRatio)==null?void 0:fe[0])||((xe=t.pixelRatio)==null?void 0:xe[1])!==((ue=wt.pixelRatio)==null?void 0:ue[1]))||!wt&&oe||this.nextAudioPts===null&&se)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const Pe=this.isVideoContiguous;let Ze=-1,ei;if(oe&&(Ze=Wl(t.samples),!Pe&&this.config.forceKeyFrameOnDiscontinuity))if(E=!0,Ze>0){this.logger.warn(`[mp4-remuxer]: Dropped ${Ze} out of ${W} video samples due to a missing keyframe`);const wt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Ze),t.dropped+=Ze,T+=(t.samples[0].pts-wt)/t.inputTimeScale,ei=T}else Ze===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${W} video samples`),E=!1);if(this.ISGenerated){if(se&&oe){const wt=this.getVideoStartPts(t.samples),st=(Un(e.samples[0].pts,wt)-wt)/t.inputTimeScale;A+=Math.max(0,st),T+=Math.max(0,-st)}if(se){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),h=this.remuxAudio(e,A,this.isAudioContiguous,r,Q||oe||c===Y.AUDIO?T:void 0),oe){const wt=h?h.endPTS-h.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,T,Pe,wt)}}else oe&&(u=this.remuxVideo(t,T,Pe,0));u&&(u.firstKeyFrame=Ze,u.independent=Ze!==-1,u.firstKeyFramePTS=ei)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(v=ja(i,s,this._initPTS,this._initDTS)),n.samples.length&&(d=za(n,s,this._initPTS))),{audio:h,video:u,initSegment:f,independent:E,text:d,id3:v}}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let h=!u||n,f="audio/mp4",d,v,E;if(h&&(d=v=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):he.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(E=e.inputTimeScale,!u||E!==u.timescale?d=v=s[0].pts-Math.round(E*i):h=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:he.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(E=t.inputTimeScale,!u||E!==u.timescale){const A=this.getVideoStartPts(r),T=Math.round(E*i);v=Math.min(v,Un(r[0].dts,A)-T),d=Math.min(d,A-T)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:d,timescale:E},this._initDTS={baseTime:v,timescale:E}):d=E=void 0,{tracks:c,initPTS:d,timescale:E}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,u=this._initPTS;let h=this.nextAvcDts,f=8,d=this.videoSampleDuration,v,E,A=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,B=!1;if(!i||h===null){const Oe=t*s,Ue=r[0].pts-Un(r[0].dts,r[0].pts);Os&&h!==null&&Math.abs(Oe-Ue-h)<15e3?i=!0:h=Oe-Ue}const Q=u.baseTime*s/u.timescale;for(let Oe=0;Oe<c;Oe++){const Ue=r[Oe];Ue.pts=Un(Ue.pts-Q,h),Ue.dts=Un(Ue.dts-Q,h),Ue.dts<r[Oe>0?Oe-1:Oe].dts&&(B=!0)}B&&r.sort(function(Oe,Ue){const $t=Oe.dts-Ue.dts,Pt=Oe.pts-Ue.pts;return $t||Pt}),v=r[0].dts,E=r[r.length-1].dts;const W=E-v,se=W?Math.round(W/(c-1)):d||e.inputTimeScale/30;if(i){const Oe=v-h,Ue=Oe>se,$t=Oe<-1;if((Ue||$t)&&(Ue?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${er(Oe,!0)} ms (${Oe}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${er(-Oe,!0)} ms (${Oe}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!$t||h>=r[0].pts||Os)){v=h;const Pt=r[0].pts-Oe;if(Ue)r[0].dts=v,r[0].pts=Pt;else{let qt=!0;for(let di=0;di<r.length&&!(r[di].dts>Pt&&qt);di++){const yi=r[di].pts;if(r[di].dts-=Oe,r[di].pts-=Oe,di<r.length-1){const Ti=r[di+1].pts,In=r[di].pts,Cn=Ti<=In,_s=Ti<=yi;qt=Cn==_s}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${er(Pt,!0)}/${er(v,!0)}, delta: ${er(Oe,!0)} ms`)}}v=Math.max(0,v);let oe=0,ve=0,le=v;for(let Oe=0;Oe<c;Oe++){const Ue=r[Oe],$t=Ue.units,Pt=$t.length;let qt=0;for(let di=0;di<Pt;di++)qt+=$t[di].data.length;ve+=qt,oe+=Pt,Ue.length=qt,Ue.dts<le?(Ue.dts=le,le+=se/4|0||1):le=Ue.dts,A=Math.min(Ue.pts,A),T=Math.max(Ue.pts,T)}E=r[c-1].dts;const fe=ve+4*oe+8;let xe;try{xe=new Uint8Array(fe)}catch(Oe){this.observer.emit(p.ERROR,p.ERROR,{type:ee.MUX_ERROR,details:M.REMUX_ALLOC_ERROR,fatal:!1,error:Oe,bytes:fe,reason:`fail allocating video mdat ${fe}`});return}const ue=new DataView(xe.buffer);ue.setUint32(0,fe),xe.set(he.types.mdat,4);let Pe=!1,Ze=Number.POSITIVE_INFINITY,ei=Number.POSITIVE_INFINITY,wt=Number.NEGATIVE_INFINITY,ht=Number.NEGATIVE_INFINITY;for(let Oe=0;Oe<c;Oe++){const Ue=r[Oe],$t=Ue.units;let Pt=0;for(let yi=0,Ti=$t.length;yi<Ti;yi++){const In=$t[yi],Cn=In.data,_s=In.data.byteLength;ue.setUint32(f,_s),f+=4,xe.set(Cn,f),f+=_s,Pt+=4+_s}let qt;if(Oe<c-1)d=r[Oe+1].dts-Ue.dts,qt=r[Oe+1].pts-Ue.pts;else{const yi=this.config,Ti=Oe>0?Ue.dts-r[Oe-1].dts:se;if(qt=Oe>0?Ue.pts-r[Oe-1].pts:se,yi.stretchShortVideoTrack&&this.nextAudioPts!==null){const In=Math.floor(yi.maxBufferHole*s),Cn=(n?A+n*s:this.nextAudioPts)-Ue.pts;Cn>In?(d=Cn-Ti,d<0?d=Ti:Pe=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${Cn/90} ms to the next segment; using duration ${d/90} ms for the last video frame.`)):d=Ti}else d=Ti}const di=Math.round(Ue.pts-Ue.dts);Ze=Math.min(Ze,d),wt=Math.max(wt,d),ei=Math.min(ei,qt),ht=Math.max(ht,qt),o.push(Ha(Ue.key,d,Pt,di))}if(o.length){if(Os){if(Os<70){const Oe=o[0].flags;Oe.dependsOn=2,Oe.isNonSync=0}}else if(Jr&&ht-ei<wt-Ze&&se/wt<.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 Oe=v;for(let Ue=0,$t=o.length;Ue<$t;Ue++){const Pt=Oe+o[Ue].duration,qt=Oe+o[Ue].cts;if(Ue<$t-1){const di=Pt+o[Ue+1].cts;o[Ue].duration=di-qt}else o[Ue].duration=Ue?o[Ue-1].duration:se;o[Ue].cts=0,Oe=Pt}}}d=Pe||!d?se:d,this.nextAvcDts=h=E+d,this.videoSampleDuration=d,this.isVideoContiguous=!0;const ut={data1:he.moof(e.sequenceNumber++,v,y(e,{samples:o})),data2:xe,startPTS:A/s,endPTS:(T+d)/s,startDTS:v/s,endDTS:h/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,ut}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Kl;case"ac3":return Vl;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),h=u*c,f=this._initPTS,d=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,v=[],E=s!==void 0;let A=e.samples,T=d?0:8,B=this.nextAudioPts||-1;const Q=t*r,W=f.baseTime*r/f.timescale;if(this.isAudioContiguous=i=i||A.length&&B>0&&(n&&Math.abs(Q-B)<9e3||Math.abs(Un(A[0].pts-W,Q)-B)<20*h),A.forEach(function(st){st.pts=Un(st.pts-W,Q)}),!i||B<0){if(A=A.filter(st=>st.pts>=0),!A.length)return;s===0?B=0:n&&!E?B=Math.max(0,Q):B=A[0].pts}if(e.segmentCodec==="aac"){const st=this.config.maxAudioFramesDrift;for(let ft=0,ut=B;ft<A.length;ft++){const Oe=A[ft],Ue=Oe.pts,$t=Ue-ut,Pt=Math.abs(1e3*$t/r);if($t<=-st*h&&E)ft===0&&(this.logger.warn(`Audio frame @ ${(Ue/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*$t/r)} ms.`),this.nextAudioPts=B=ut=Ue);else if($t>=st*h&&Pt<$l&&E){let qt=Math.round($t/h);ut=Ue-qt*h,ut<0&&(qt--,ut+=h),ft===0&&(this.nextAudioPts=B=ut),this.logger.warn(`[mp4-remuxer]: Injecting ${qt} audio frame @ ${(ut/r).toFixed(3)}s due to ${Math.round(1e3*$t/r)} ms gap.`);for(let di=0;di<qt;di++){const yi=Math.max(ut,0);let Ti=Fl.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Ti||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ti=Oe.unit.subarray()),A.splice(ft,0,{unit:Ti,pts:yi}),ut+=h,ft++}}Oe.pts=ut,ut+=h}}let se=null,oe=null,ve,le=0,fe=A.length;for(;fe--;)le+=A[fe].unit.byteLength;for(let st=0,ft=A.length;st<ft;st++){const ut=A[st],Oe=ut.unit;let Ue=ut.pts;if(oe!==null){const Pt=v[st-1];Pt.duration=Math.round((Ue-oe)/c)}else if(i&&e.segmentCodec==="aac"&&(Ue=B),se=Ue,le>0){le+=T;try{ve=new Uint8Array(le)}catch(Pt){this.observer.emit(p.ERROR,p.ERROR,{type:ee.MUX_ERROR,details:M.REMUX_ALLOC_ERROR,fatal:!1,error:Pt,bytes:le,reason:`fail allocating audio mdat ${le}`});return}d||(new DataView(ve.buffer).setUint32(0,le),ve.set(he.types.mdat,4))}else return;ve.set(Oe,T);const $t=Oe.byteLength;T+=$t,v.push(Ha(!0,u,$t,0)),oe=Ue}const xe=v.length;if(!xe)return;const ue=v[v.length-1];this.nextAudioPts=B=oe+c*ue.duration;const Pe=d?new Uint8Array(0):he.moof(e.sequenceNumber++,se/c,y({},e,{samples:v}));e.samples=[];const Ze=se/r,ei=B/r,ht={data1:Pe,data2:ve,startPTS:Ze,endPTS:ei,startDTS:Ze,endDTS:ei,type:"audio",hasAudio:!0,hasVideo:!1,nb:xe};return this.isAudioContiguous=!0,ht}}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 ja(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(We(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=Ve(e);n.audio&&(t=Za(n.audio,g.AUDIO)),n.video&&(i=Za(n.video,g.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:h}=this;const f={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};z(h)||(h=this.lastEndTime=s||0);const d=t.samples;if(!(d!=null&&d.length))return f;const v={initPTS:void 0,timescale:1};let E=this.initData;if((o=E)!=null&&o.length||(this.generateInitSegment(d),E=this.initData),!((c=E)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);const A=He(d,E),T=xt(E,d),B=T===null?s:T;(r||!u)&&(jl(u,B,s,A)||v.timescale!==u.timescale)&&(v.initPTS=B-s,u&&u.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${u.baseTime/u.timescale} to ${v.initPTS}`),this.initPTS=u={baseTime:v.initPTS,timescale:1});const Q=e?B-u.baseTime/u.timescale:h,W=Q+A;Nt(E,d,u.baseTime/u.timescale),A>0?this.lastEndTime=W:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const se=!!E.audio,oe=!!E.video;let ve="";se&&(ve+="audio"),oe&&(ve+="video");const le={data1:d,startPTS:Q,startDTS:Q,endPTS:W,endDTS:W,type:ve,hasAudio:se,hasVideo:oe,nb:1,dropped:0};return f.audio=le.type==="audio"?le:void 0,f.video=le.type!=="audio"?le:void 0,f.initSegment=v,f.id3=ja(i,s,u,u),n.samples.length&&(f.text=za(n,s,u)),f}}function jl(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>n}function Za(a,e){const t=a==null?void 0:a.codec;return t&&t.length>4?t:e===g.AUDIO?t==="ec-3"||t==="ac-3"||t==="alac"?t:t==="fLaC"||t==="Opus"?_t(t,!1):(X.warn(`Unhandled audio codec "${t}" in mp4 MAP`),t||"mp4a"):(X.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:Pl,remux:Hl},{demux:ds,remux:Sr},{demux:Ll,remux:Sr},{demux:Cl,remux:Sr}];Tr.splice(2,0,{demux:Dl,remux:Sr});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:h,trackSwitch:f,accurateTimeOffset:d,timeOffset:v,initSegmentChange:E}=n||o,{audioCodec:A,videoCodec:T,defaultInitPts:B,duration:Q,initSegmentData:W}=c,se=zl(r,t);if(se&&bn(se.method)){const fe=this.getDecrypter(),xe=xn(se.method);if(fe.isSync()){let ue=fe.softwareDecrypt(r,se.key.buffer,se.iv.buffer,xe);if(i.part>-1){const Ze=fe.flush();ue=Ze&&Ze.buffer}if(!ue)return s.executeEnd=us(),ea(i);r=new Uint8Array(ue)}else return this.asyncResult=!0,this.decryptionPromise=fe.webCryptoDecrypt(r,se.key.buffer,se.iv.buffer,xe).then(ue=>{const Pe=this.push(ue,null,i);return this.decryptionPromise=null,Pe}),this.decryptionPromise}const oe=this.needsProbing(h,f);if(oe){const fe=this.configureTransmuxer(r);if(fe)return this.logger.warn(`[transmuxer] ${fe.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:ee.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,error:fe,reason:fe.message}),s.executeEnd=us(),ea(i)}(h||f||E||oe)&&this.resetInitSegment(W,A,T,Q,t),(h||E||oe)&&this.resetInitialTimestamp(B),u||this.resetContiguity();const ve=this.transmux(r,se,v,d,i);this.asyncResult=tr(ve);const le=this.currentTransmuxState;return le.contiguous=!0,le.discontinuity=!1,le.trackSwitch=!1,s.executeEnd=us(),ve}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 h=c.flush(o);return tr(h)?(this.asyncResult=!0,h.then(f=>(this.flushRemux(r,f,e),r))):(this.flushRemux(r,h,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===Y.MAIN?"level":"track"} ${i.level}`);const h=this.remuxer.remux(n,s,r,o,u,c,!0,this.id);e.push({remuxResult:h,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,d=Tr.length;f<d;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,h=s.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(i,t,n,this.logger)),(!o||!(o instanceof h))&&(this.demuxer=new h(i,t,n,this.logger),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new An(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 Zl{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 Yl{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 Qa=0;class Xa{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Qa++,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,h=this.hls;if(!(!h||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var f;const d=(f=this.workerContext)==null?void 0:f.objectURL;d&&self.URL.revokeObjectURL(d);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{h.logger[u.data.logType]&&h.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,h.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:ee.OTHER_ERROR,details:M.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 Qs,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=Li(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||qo()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=el(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=Jo());const{worker:h}=this.workerContext;h.addEventListener("message",this.onWorkerMessage),h.addEventListener("error",this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:kt(s)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),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=Qa++;const t=this.hls.config,i=Li(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:kt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),tl(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,h){var f,d;u.transmuxing.start=self.performance.now();const{instanceNo:v,transmuxer:E}=this,A=r?r.start:s.start,T=s.decryptdata,B=this.frag,Q=!(B&&s.cc===B.cc),W=!(B&&u.level===B.level),se=B?u.sn-B.sn:-1,oe=this.part?u.part-this.part.index:-1,ve=se===0&&u.id>1&&u.id===(B==null?void 0:B.stats.chunkCount),le=!W&&(se===1||se===0&&(oe===1||ve&&oe<=0)),fe=self.performance.now();(W||se||s.stats.parsing.start===0)&&(s.stats.parsing.start=fe),r&&(oe||!le)&&(r.stats.parsing.start=fe);const xe=!(B&&((f=s.initSegment)==null?void 0:f.url)===((d=B.initSegment)==null?void 0:d.url)),ue=new Yl(Q,le,c,W,A,xe);if(!le||Q||xe){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===Y.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${Q}
trackSwitch: ${W}
contiguous: ${le}
accurateTimeOffset: ${c}
timeOffset: ${A}
initSegmentChange: ${xe}`);const Pe=new Zl(i,n,t,o,h);this.configureTransmuxer(Pe)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:v,cmd:"demux",data:e,decryptdata:T,chunkMeta:u,state:ue},e instanceof ArrayBuffer?[e]:[]);else if(E){const Pe=E.push(e,T,u,ue);tr(Pe)?Pe.then(Ze=>{this.handleTransmuxComplete(Ze)}).catch(Ze=>{this.transmuxerError(Ze,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(Pe)}}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:ee.MEDIA_ERROR,details:M.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 mn{constructor(e,t,i){super(e,t,i,"audio-stream-controller",Y.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===Y.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===be.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===be.IDLE&&this.tick()}}findSyncFrag(e){const t=this.getLevelDetails(),i=e.cc;return Qt(t,i,e)||t&&gt(t.fragments,i)||e}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=be.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=be.IDLE):this.state=be.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case be.IDLE:this.doTickIdle();break;case be.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=be.WAITING_INIT_PTS}break}case be.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=be.IDLE}break}case be.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=be.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=be.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!==be.STOPPED&&(this.state=be.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=be.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,g.AUDIO,Y.AUDIO));const h=this.getFwdBufferInfo(u,Y.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=be.ENDED;return}const f=h.len,d=t.maxBufferLength,v=c.fragments,E=v[0].start,A=this.getLoadPosition(),T=this.flushing?A:h.end;if(this.switchingTrack&&n){const W=A;c.PTSKnown&&W<E&&(h.end>E||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=E+.05)}if(f>=d&&!this.switchingTrack&&T<v[v.length-1].start)return;let B=this.getNextFragment(T,c);if(B&&this.isLoopLoading(B,T)&&(B=this.getNextFragmentLoopLoading(B,c,h,Y.MAIN,d)),!B){this.bufferFlushed=!0;return}let Q=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&Q&&V(B)&&!B.endList&&(!c.live||!this.loadingParts&&T<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(Q)===Ht.OK&&(this.mainFragLoading=Q=null),Q&&V(Q))){if(B.start>Q.end){const se=this.fragmentTracker.getFragAtPos(T,Y.MAIN);se&&se.end>Q.end&&(Q=se,this.mainFragLoading={frag:se,targetBufferTime:null})}if(B.start>Q.end)return}this.loadFragment(B,o,T)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new jt(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!==be.STOPPED&&(this.setInterval(qa),this.state=be.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!==be.STOPPED&&(this.state=be.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 h=n[r];let f=0;if(s.live||(i=h.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(h.details){var d;f=this.alignPlaylists(s,h.details,(d=this.levelLastLoaded)==null?void 0:d.details)}s.alignedSliding||(Mi(s,u),s.alignedSliding||fi(s,u),f=s.fragmentStart)}h.details=s,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===be.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=be.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 h=u.details;if(!h){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 d=this.transmuxer;d||(d=this.transmuxer=new Xa(this.hls,Y.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const v=this.initPTS[i.cc],E=(t=i.initSegment)==null?void 0:t.data;if(v!==void 0){const T=n?n.index:-1,B=T!==-1,Q=new cn(i.level,i.sn,i.stats.chunkCount,s.byteLength,T,B);d.push(s,E,f,"",i,n,h.totalduration,!1,Q,v)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:A}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Ds,complete:!1};A.push(new Uint8Array(s)),this.state!==be.STOPPED&&(this.state=be.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===Y.MAIN&&V(t.frag)&&(this.mainFragLoading=t,this.state===be.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==Y.AUDIO){!this.audioOnly&&i.type===Y.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(V(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,x({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=be.ERROR;return}switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.AUDIO,t);break;case M.AUDIO_TRACK_LOAD_ERROR:case M.AUDIO_TRACK_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===be.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ie.AUDIO_TRACK&&(this.state=be.IDLE);break;case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case M.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case M.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==g.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==g.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===be.ENDED&&(this.state=be.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,Y.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:h}=o,{details:f}=h,{audio:d,text:v,id3:E,initSegment:A}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=be.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),A!=null&&A.tracks){const T=c.initSegment||c;this._bufferInitSegment(h,A.tracks,T,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:i,tracks:A.tracks})}if(d){const{startPTS:T,endPTS:B,startDTS:Q,endDTS:W}=d;u&&(u.elementaryStreams[g.AUDIO]={startPTS:T,endPTS:B,startDTS:Q,endDTS:W}),c.setElementaryStreamInfo(g.AUDIO,T,B,Q,W),this.bufferFragmentData(d,c,u,r)}if(E!=null&&(t=E.samples)!=null&&t.length){const T=y({id:i,frag:c,details:f},E);n.trigger(p.FRAG_PARSING_METADATA,T)}if(v){const T=y({id:i,frag:c,details:f},v);n.trigger(p.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,i,n){if(this.state!==be.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=Y.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===Ht.NOT_LOADED||n===Ht.PARTIAL){var s;if(!V(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=be.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&fi(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;Te({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,Le)||(re(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,x({},e))}}class ta extends C{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 h=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&h>t.partTarget&&(c+=1)}const u=i&&Ci(i);return new Tn(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 h=Math.max(c||0,0);n.appliedTimelineOffset=h,n.fragments.forEach(f=>{f.start=f.playlistOffset+h})}if(n.live||i!=null&&i.live){const h="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){hr(i,n);const Q=n.playlistParsingError;if(Q){this.warn(Q);const W=this.hls;if(!W.config.ignorePlaylistParsingErrors){var u;const{networkDetails:se}=t;W.trigger(p.ERROR,{type:ee.NETWORK_ERROR,details:M.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:Q,reason:Q.message,level:t.level||void 0,parent:(u=n.fragments[0])==null?void 0:u.type,networkDetails:se,stats:s});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,d=f?f.end-f.len:0,v=(n.edge-d)*1e3,E=Es(n,v);if(n.requestScheduled+E<r?n.requestScheduled=r:n.requestScheduled+=E,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let A,T,B;if(n.canBlockReload&&n.endSN&&n.advanced){const Q=this.hls.config.lowLatencyMode,W=n.lastPartSn,se=n.endSN,oe=n.lastPartIndex,ve=oe!==-1,le=W===se;ve?le?(T=se+1,B=Q?0:oe):(T=W,B=Q?oe+1:n.maxPartIndex):T=se+1;const fe=n.age,xe=fe+n.ageHeader;let ue=Math.min(xe-n.partTarget,n.targetduration*1.5);if(ue>0){if(xe>n.targetduration*3)this.log(`Playlist last advanced ${fe.toFixed(2)}s ago. Omitting segment and part directives.`),T=void 0,B=void 0;else if(i!=null&&i.tuneInGoal&&xe-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${ue} with playlist age: ${n.age}`),ue=0;else{const Pe=Math.floor(ue/n.targetduration);if(T+=Pe,B!==void 0){const Ze=Math.round(ue%n.targetduration/n.partTarget);B+=Ze}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${fe.toFixed(2)}s goal: ${ue} skip sn ${Pe} to part ${B}`)}n.tuneInGoal=ue}if(A=this.getDeliveryDirectives(n,t.deliveryDirectives,T,B),Q||!le){n.requestScheduled=r,this.loadingPlaylist(h,A);return}}else(n.canBlockReload||n.canSkipUntil)&&(A=this.getDeliveryDirectives(n,t.deliveryDirectives,T,B));A&&T!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(E-o*2,E/2)),this.scheduleLoading(h,A,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=Ci(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=sn.No),new Tn(i,n,s)}checkRetry(e){const t=e.details,i=ui(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===ii.RetryRequest||!n.resolved&&s===ii.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 h=Ft(o,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" in ${h}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 Xl 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(d=>!i||i.indexOf(d.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(d=>d.default)&&(this.selectDefaultTrack=!1),o.forEach((d,v)=>{d.id=v});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const d=de(c,o,Le);if(d>-1)s=o[d];else{const v=de(c,this.tracks);s=this.tracks[v]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const h={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,h);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var r;const d=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(d.message),this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:d})}}}onError(e,t){t.fatal||!t.context||t.context.type===ie.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&&Te(e,n,Le))return n;const s=de(e,this.tracksInGroup,Le);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=Ge(e,t.levels,i,r,Le);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,x({},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||Te(e,n,Le)))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 h=t[u];if(Te({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},h,Le))return u}for(let u=0;u<t.length;u++){const h=t[u];if(ir(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const h=t[u];if(ir(e.attrs,h.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&re(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 ql{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 Jl extends Error{constructor(e){super(e),this.name=to}}class eu extends C{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=we(ge(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this),e.off(p.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const r=this.isQueued();(s||r)&&this.warn(`Transfering MediaSource with${r?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?y(i,n.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(i[r]=y({},this.tracks[r]),this.removeBuffer(r)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media,n=ge(this.appendSource);if(this.transferData=this.overrides=void 0,i&&n){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),s)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&r instanceof c,io(i),tu(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: ${kt(i,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${kt(n,(c,u)=>c==="initSegment"?void 0:u)}}`),!Ee(n,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,u=this.details,h=Math.max(c,(u==null?void 0:u.fragments[0].start)||0);if(h-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${h}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${h} currentTime: ${c}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,s.forEach(c=>{const u=c,h=n[u];if(h){const f=h.buffer;if(f){const d=this.fragmentTracker,v=h.id;if(d.hasFragments(v)||d.hasParts(v)){const T=vt.getBuffered(f);d.detectEvictedFragments(u,T,v,null,!0)}const E=na(u),A=[u,f];this.sourceBuffers[E]=A,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,h)}}}),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 ql(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,h;const f=t[o],{id:d,codec:v,levelCodec:E,container:A,metadata:T,supplemental:B}=f;let Q=i[o];const W=(c=this.transferData)==null||(u=c.tracks)==null?void 0:u[o],se=W!=null&&W.buffer?W:Q,oe=(se==null?void 0:se.pendingCodec)||(se==null?void 0:se.codec),ve=se==null?void 0:se.levelCodec;Q||(Q=i[o]={buffer:void 0,listeners:[],codec:v,supplemental:B,container:A,levelCodec:E,metadata:T,id:d});const le=oi(oe,ve),fe=le==null?void 0:le.replace(eo,"$1");let xe=oi(v,E);const ue=(h=xe)==null?void 0:h.replace(eo,"$1");xe&&le&&fe!==ue&&(o.slice(0,5)==="audio"&&(xe=_t(xe,this.appendSource)),this.log(`switching codec ${oe} to ${xe}`),xe!==(Q.pendingCodec||Q.codec)&&(Q.pendingCodec=xe),Q.container=A,this.appendChangeType(o,A,xe))}),(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,Y.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&&vt.isBuffered(c.buffer,n)||((o=this.fragmentTracker.getAppendedFrag(n,Y.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,h=u.buffering[s],f=o.sn,d=self.performance.now();h.start=d;const v=o.stats.buffering,E=c?c.stats.buffering:null;v.start===0&&(v.start=d),E&&E.start===0&&(E.start=d);const A=i.audio;let T=!1;s==="audio"&&(A==null?void 0:A.container)==="audio/mpeg"&&(T=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const B=this.tracks.video,Q=B==null?void 0:B.buffer;if(Q&&f!=="initSegment"){const oe=c||o,ve=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend){const fe=oe.start+oe.duration*.05,xe=Q.buffered,ue=this.currentOp("video");!xe.length&&!ue?this.blockAudio(oe):!ue&&!vt.isBuffered(Q,fe)&&this.lastVideoAppendEnd<fe&&this.blockAudio(oe)}else if(s==="video"){const le=oe.end;if(ve){const fe=ve.frag.start;(le>fe||le<this.lastVideoAppendEnd||vt.isBuffered(Q,fe))&&this.unblockAudio()}this.lastVideoAppendEnd=le}}const W=(c||o).start,se={label:`append-${s}`,execute:()=>{if(h.executeStart=self.performance.now(),T){const oe=this.tracks[s];if(oe){const ve=oe.buffer;if(ve){const le=W-ve.timestampOffset;Math.abs(le)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${W} (delta: ${le}) sn: ${f})`),ve.timestampOffset=W)}}}this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const oe=self.performance.now();h.executeEnd=h.end=oe,v.first===0&&(v.first=oe),E&&E.first===0&&(E.first=oe);const ve={};this.sourceBuffers.forEach(([le,fe])=>{le&&(ve[le]=vt.getBuffered(fe))}),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:ve})},onError:oe=>{var ve;const le={type:ee.MEDIA_ERROR,parent:o.type,details:M.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:oe,err:oe,fatal:!1},fe=(ve=this.media)==null?void 0:ve.error;if(oe.code===DOMException.QUOTA_EXCEEDED_ERR)le.details=M.BUFFER_FULL_ERROR;else if(oe.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!fe)le.errorAction=Ei(!0);else if(oe.name===to&&this.sourceBufferCount===0)le.errorAction=Ei(!0);else{const xe=++this.appendErrors[s];this.warn(`Failed ${xe}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${fe||"no media error"})`),(xe>=this.hls.config.appendErrorMaxRetry||fe)&&(le.fatal=!0)}this.hls.trigger(p.ERROR,le)}};this.append(se,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[g.AUDIOVIDEO]?s.push("audiovideo"):(r[g.AUDIO]&&s.push("audio"),r[g.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===M.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;z(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(z(o)&&o>=0){const c=Math.max(o,r),u=Math.floor(s/r)*r-c;this.flushBackBuffer(s,r,u)}if(z(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),u=Math.max(c,r),h=Math.floor(s/r)*r+u;this.flushFrontBuffer(s,r,h)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const o=vt.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=vt.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),h=Math.max(u,n);return{duration:1/0,start:u,end:h}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return z(s)?{duration:s}:null;const r=this.media.duration,o=z(i.duration)?i.duration:0;return n>o&&n>r||!z(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(z(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}) ${kt(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:ee.MEDIA_ERROR,details:M.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":""} ${kt(o)}`);try{const h=i.addSourceBuffer(u),f=na(r),d=[r,h];t[f]=d,o.buffer=h}catch(h){var n;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(r),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[r],this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,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")&&Bt(i,"video")&&(n=lt(n,i));const s=oi(n,e.levelCodec);return s?t.slice(0,5)==="audio"?_t(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:ee.MEDIA_ERROR,details:M.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=z(n.duration)?n.duration:1/0,u=z(s.duration)?s.duration:1/0,h=Math.max(0,t),f=Math.min(i,c,u);f>h&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${h},${f}] from the ${e} SourceBuffer`),o.remove(h,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i==null?void 0:i.buffer;if(!n)throw new Jl(`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 tu(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&&z(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 Dn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},iu={HLS:"h"},nr={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},nu={[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 su="Dict";function ru(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 au(a,e,t,i){return new Error(`failed to ${a} "${ru(e)}" as ${t}`,{cause:i})}function ss(a,e,t){return au("serialize",a,e,t)}class no{constructor(e){this.description=e}}const so="Bare Item",ou="Boolean";function lu(a){if(typeof a!="boolean")throw ss(a,ou);return a?"?1":"?0"}const uu="Byte Sequence";function cu(a){if(ArrayBuffer.isView(a)===!1)throw ss(a,uu);return`:${hl(a)}:`}const hu="Integer";function fu(a){return a<-999999999999999||999999999999999<a}function ro(a){if(fu(a))throw ss(a,hu);return a.toString()}function du(a){return`@${ro(a.getTime()/1e3)}`}const pu="Decimal";function gu(a){const e=Ca(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ss(a,pu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const mu="String",_u=/[\x00-\x1f\x7f]+/;function vu(a){if(_u.test(a))throw ss(a,mu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function yu(a){return a.description||a.toString().slice(7,-1)}const Eu="Token";function ao(a){const e=yu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ss(e,Eu);return e}function ra(a){switch(typeof a){case"number":if(!z(a))throw ss(a,so);return Number.isInteger(a)?ro(a):gu(a);case"string":return vu(a);case"symbol":return ao(a);case"boolean":return lu(a);case"object":if(a instanceof Date)return du(a);if(a instanceof Uint8Array)return cu(a);if(a instanceof no)return ao(a);default:throw ss(a,so)}}const bu="Key";function aa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw ss(a,bu);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 Su(a,e={whitespace:!0}){if(typeof a!="object")throw ss(a,su);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 Tu(a,e){return Su(a,e)}function Au(a){return a==="ot"||a==="sf"||a==="st"}function wu(a){return typeof a=="number"?z(a):a!=null&&a!==""&&a!==!1}const Ar=a=>Math.round(a),Ru=(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:Ru,rtp:wr,tb:Ar};function Lu(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=y({},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||wu(o)&&(Au(r)&&typeof o=="string"&&(o=new no(o)),t[r]=o))}),t}function lo(a,e={}){return a?Tu(Lu(a,e),y({whitespace:!1},e)):""}function Du(a,e={}){const t={};if(!a)return t;const i=Object.entries(a),n=Object.entries(nu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((r,o)=>{var c,u;const[h,f]=o,d=((c=n.find(v=>v[1].includes(h)))===null||c===void 0?void 0:c[0])||nr.REQUEST;return(u=r[d])!==null&&u!==void 0||(r[d]={}),r[d][h]=f,r},{});return Object.entries(s).reduce((r,[o,c])=>(r[o]=lo(c,e),r),t)}function Cu(a,e,t){return y(a,Du(e,t))}const ku="CMCD";function Pu(a,e={}){if(!a)return"";const t=lo(a,e);return`${ku}=${encodeURIComponent(t)}`}const uo=/CMCD=[^&#]+/;function Ou(a,e,t){const i=Pu(e,t);if(!i)return a;if(uo.test(a))return a.replace(uo,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Mu{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:Dn.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===Dn.VIDEO||c===Dn.AUDIO||c==Dn.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const h=r?this.getNextPart(r):this.getNextFrag(s);h!=null&&h.url&&h.url!==s.url&&(u.nor=h.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:iu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){y(t,this.createData());const i=t.ot===Dn.INIT||t.ot===Dn.VIDEO||t.ot===Dn.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((r,o)=>(n.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Cu(e.headers,t,s)):e.url=Ou(e.url,t,s)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t,i;const{index:n,fragment:s}=e,r=(t=this.hls.levels[s.level])==null||(i=t.details)==null?void 0:i.partList;if(r){const{sn:o}=s;for(let c=r.length-1;c>=0;c--){const u=r[c];if(u.index===n&&u.fragment.sn===o)return r[c+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Dn.TIMED_TEXT;if(e.sn==="initSegment")return Dn.INIT;if(t==="audio")return Dn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Dn.VIDEO:Dn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Dn.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===Dn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:vt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}}const Nu=3e5;class Fu extends C{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)===ii.SendAlternateToPenaltyBox&&i.flags===Xt.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: ${kt(s)} penalized: ${kt(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(s=>{n-i[s]>Nu&&delete i[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in i)continue;if(r===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,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===ie.AUDIO_TRACK&&n[s].hasAudioGroup(e)||t===ie.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(h=>h.pathwayId===r))return;const u=this.getLevelsForPathway(o).map(h=>{const f=new mi(h.attrs);f["PATHWAY-ID"]=r;const d=f.AUDIO&&`${f.AUDIO}_clone_${r}`,v=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;d&&(i[f.AUDIO]=d,f.AUDIO=d),v&&(n[f.SUBTITLES]=v,f.SUBTITLES=v);const E=ho(h.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),A=new jt({attrs:f,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:E,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let T=1;T<h.audioGroups.length;T++)A.addGroupId("audio",`${h.audioGroups[T]}_clone_${r}`);if(h.subtitleGroups)for(let T=1;T<h.subtitleGroups.length;T++)A.addGroupId("text",`${h.subtitleGroups[T]}_clone_${r}`);return A});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(h){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+h)}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:(h,f,d,v)=>{this.log(`Loaded steering manifest: "${n}"`);const E=h.data;if((E==null?void 0:E.VERSION)!==1){this.log(`Steering VERSION ${E.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=E.TTL;const{"RELOAD-URI":A,"PATHWAY-CLONES":T,"PATHWAY-PRIORITY":B}=E;if(A)try{this.uri=new self.URL(A,n).href}catch(W){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${A}`);return}this.scheduleRefresh(this.uri||d.url),T&&this.clonePathways(T);const Q={steeringManifest:E,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,Q),B&&this.updatePathwayPriority(B)},onError:(h,f,d,v)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${f.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let E=this.timeToLoad*1e3;if(h.code===429){const A=this.loader;if(typeof(A==null?void 0:A.getResponseHeader)=="function"){const T=A.getResponseHeader("Retry-After");T&&(E=parseFloat(T)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,E)},onTimeout:(h,f,d)=>{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=y({},r);return o.details=void 0,o.attrs=new mi(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 C{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=nt(this.config));const o=r.map(jn).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=Hn(r);let c,u;if(i==="sinf"){if(o!==Kt.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const E=tt(new Uint8Array(n));try{const A=Yi(JSON.parse(E).sinf),T=Be(A);if(!T)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(T.subarray(8,24)),u=Kt.FAIRPLAY}catch(A){this.warn(`${s} Failed to parse sinf: ${A}`);return}}else{if(o!==Kt.WIDEVINE&&o!==Kt.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const E=je(n),A=E.filter(B=>!!B.systemId&&os(B.systemId)===o);A.length>1&&this.warn(`${s} Using first of ${A.length} pssh found for selected key-system ${o}`);const T=A[0];if(!T){E.length===0||E.some(B=>!B.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${E.map(B=>os(B.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(u=os(T.systemId),T.version===0&&T.data)if(u===Kt.WIDEVINE){const B=T.data.length-22;c=new Uint8Array(T.data.subarray(B,B+16))}else u===Kt.PLAYREADY&&(c=ls(T.data))}if(!u||!c)return;const h=U.hexDump(c),{keyIdToKeySessionPromise:f,mediaKeySessions:d}=this;let v=f[h];for(let E=0;E<d.length;E++){const A=d[E],T=A.decryptdata;if(!T.keyId)continue;const B=U.hexDump(T.keyId);if(h===B||T.uri.replace(/-/g,"").indexOf(h)!==-1){if(v=f[B],T.pssh)break;delete f[B],T.pssh=new Uint8Array(n),T.keyId=c,v=f[h]=v.then(()=>this.generateRequestWithPreferredKeySession(A,i,n,"encrypted-event-key-match")),v.catch(Q=>this.handleError(Q));break}}if(!v){if(u!==o){this.log(`Ignoring "${t.type}" event with ${u} init data for selected key-system ${o}`);return}v=f[h]=this.getKeySystemSelectionPromise([u]).then(({keySystem:E,mediaKeys:A})=>{var T;this.throwIfDestroyed();const B=new gn("ISO-23001-7",h,(T=jn(E))!=null?T:"");return B.pssh=new Uint8Array(n),B.keyId=c,this.attemptSetMediaKeys(E,A).then(()=>{this.throwIfDestroyed();const Q=this.createMediaKeySessionContext({decryptdata:B,keySystem:E,mediaKeys:A});return this.generateRequestWithPreferredKeySession(Q,i,n,"encrypted-event-no-match")})}),v.catch(E=>this.handleError(E))}})}},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===Kt.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 h=u.shift();this.getMediaKeysPromise(h,n,s).then(f=>r({keySystem:h,mediaKeys:f})).catch(f=>{u.length?c(u):f instanceof $n?o(f):o(new $n({type:ee.KEY_SYSTEM_ERROR,details:M.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 Et===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=_i(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: ${kt(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(h=>(this.log(`Media-keys created for "${e}"`),u.then(f=>f?this.setMediaKeysServerCertificate(h,e,f):h))),o.mediaKeys.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),o.mediaKeys})}return r.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${U.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 U.hexDump(e.keyId)}updateKeySession(e,t){var i;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${U.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=nt(this.config),s=e.map(Hn).filter(r=>!!r&&n.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:r})=>{const o=jn(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 $n?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:ee.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=Hn(e.keyFormat),s=n?[n]:nt(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=nt(this.config)),e.length===0)throw new $n({type:ee.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${kt({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 E=o.call(this.hls,t,i,e);if(!E)throw new Error("Invalid response from configured generateRequest filter");t=E.initDataType,i=E.initData?E.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(E){var c;if(this.warn(E.message),(c=this.hls)!=null&&c.config.debug)throw E}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 h=new Qs,f=e._onmessage=E=>{const A=e.mediaKeysSession;if(!A){h.emit("error",new Error("invalid state"));return}const{messageType:T,message:B}=E;this.log(`"${T}" message event for session "${A.sessionId}" message size: ${B.byteLength}`),T==="license-request"||T==="license-renewal"?this.renewLicense(e,B).catch(Q=>{h.eventNames().length?h.emit("error",Q):this.handleError(Q)}):T==="license-release"?e.keySystem===Kt.FAIRPLAY&&(this.updateKeySession(e,Rn("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${T}"`)},d=e._onkeystatuseschange=E=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const T=e.keyStatus;h.emit("keyStatus",T),T==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",f),e.mediaKeysSession.addEventListener("keystatuseschange",d);const v=new Promise((E,A)=>{h.on("error",A),h.on("keyStatus",T=>{T.startsWith("usable")?E():T==="output-restricted"?A(new $n({type:ee.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):T==="internal-error"?A(new $n({type:ee.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${T}"`)):T==="expired"?A(new Error("key expired while generating request")):this.warn(`unhandled key status change "${T}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var E;this.log(`Request generated for key-session "${(E=e.mediaKeysSession)==null?void 0:E.sessionId}" keyId: ${u}`)}).catch(E=>{throw new $n({type:ee.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_SESSION,error:E,fatal:!1},`Error generating key-session request: ${E}`)}).then(()=>v).catch(E=>{throw h.removeAllListeners(),this.removeSession(e),E}).then(()=>(h.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: ${U.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${U.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,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,v,E,A)=>{r(d.data)},onError:(d,v,E,A)=>{o(new $n({type:ee.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:x({url:c.url,data:void 0},d)},`"${e}" certificate request failed (${s}). Status: ${d.code} (${d.text})`))},onTimeout:(d,v,E)=>{o(new $n({type:ee.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(d,v,E)=>{o(new Error("aborted"))}};n.load(c,h,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 $n({type:ee.KEY_SYSTEM_ERROR,details:M.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 $n({type:ee.KEY_SYSTEM_ERROR,details:M.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 h;for(let f=0,d=s.length;f<d;f++){var r,o;h=s[f];const v=(r=h.querySelector("name"))==null?void 0:r.textContent,E=(o=h.querySelector("value"))==null?void 0:o.textContent;v&&E&&e.setRequestHeader(v,E)}}const c=n.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Rn(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(h){this.error(h)}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 $n({type:ee.KEY_SYSTEM_ERROR,details:M.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 h=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} 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==Kt.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={},gn.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:ee.OTHER_ERROR,details:M.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:ee.OTHER_ERROR,details:M.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(Si(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:ee.OTHER_ERROR,details:M.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:ee.OTHER_ERROR,details:M.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}}}Ns.CDMCleanupPromise=void 0;class $n extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class Bu{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const s=n-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),c>0&&r>u.config.fpsDroppedMonitoringThreshold*o){let h=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=h)&&(h=h-1,u.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,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){X.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){X.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 Uu(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let i=0,n=t,s;for(;i<=n;)if(s=Math.floor((n+i)/2),e<a[s].startTime)n=s-1;else if(e>a[s].startTime&&i<t)i=s+1;else return s;return a[i].startTime-e<e-a[n].startTime?i:n}function $u(a,e,t){const i=[],n=Uu(a,e);if(n>-1)for(let s=n,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function 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(h=>!i||i.indexOf(h.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(h=>h.default)&&(this.selectDefaultTrack=!1),r.forEach((h,f)=>{h.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 h=de(o,r);if(h>-1)s=r[h];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||Te(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===ie.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&&Te(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||!z(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:h}=n;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:h});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 Ir=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Ku(a,e,t){return`${a.identifier}-${t+1}-${sr(e)}`}class Vu{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=z(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"?Ir.Range:Ir.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 go(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,h=this.currentTime;this.startOffset+h>=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=go(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=vt.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=vt.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 mo=.033;class ju extends C{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,h)=>{const f=u.cue.pre,d=u.cue.post,v=h.cue.pre,E=h.cue.post;if(f&&!v)return-1;if(v&&!f||d&&!E)return 1;if(E&&!d)return-1;if(!f&&!v&&!d&&!E){const A=u.startTime,T=h.startTime;if(A!==T)return A-T}return u.dateRange.tagOrder-h.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 Vu(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((h,f)=>{const d=h.cue.pre,v=h.cue.post,E=e[f-1]||null,A=h.appendInPlace,T=v?s:h.startOffset,B=h.duration,Q=h.timelineOccupancy===Ir.Range?B:0,W=h.resumptionOffset,se=(E==null?void 0:E.startTime)===T,oe=T+h.cumulativeDuration;let ve=A?oe+B:T+W;if(d||!v&&T<=0){const fe=u;u+=Q,h.timelineStart=oe;const xe=r;r+=B,i.push({event:h,start:oe,end:ve,playout:{start:xe,end:r},integrated:{start:fe,end:u}})}else if(T<=s){if(!se){const ue=T-c;if(ue>mo){const Pe=c,Ze=u;u+=ue;const ei=r;r+=ue;const wt={previousEvent:e[f-1]||null,nextEvent:h,start:Pe,end:Pe+ue,playout:{start:ei,end:r},integrated:{start:Ze,end:u}};i.push(wt)}else ue>0&&E&&(E.cumulativeDuration+=ue,i[i.length-1].end=T)}v&&(ve=oe),h.timelineStart=oe;const fe=u;u+=Q;const xe=r;r+=B,i.push({event:h,start:oe,end:ve,playout:{start:xe,end:r},integrated:{start:fe,end:u}})}else return;const le=h.resumeTime;v||le>s?c=s:c=le}),c<s){var o;const h=c,f=u,d=s-c;u+=d;const v=r;r+=d,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:h+d,playout:{start:v,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,h=o.cue.post,f=u?0:h?n:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!h&&o.snapOptions.in&&(o.resumeAnchor=at(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<mo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const v=z(o.resumeOffset)?o.resumeOffset:o.duration;s+=v})}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=at(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 h=r==="audio"?.175:0;return Math.abs(u.start-i)<Bs+h||Math.abs(u.end-i)<Bs+h?!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 gs(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=go(i,this.hls.sessionId,e.baseUrl)}catch(d){const v=this.assignAssetListError(e,M.ASSET_LIST_LOAD_ERROR,d,i);this.hls.trigger(p.ERROR,v);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,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,v,E,A)=>{const T=d.data,B=T==null?void 0:T.ASSETS;if(!Array.isArray(B)){const Q=this.assignAssetListError(e,M.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),E.url,v,A);this.hls.trigger(p.ERROR,Q);return}e.assetListResponse=T,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:T,networkDetails:A})},onError:(d,v,E,A)=>{const T=this.assignAssetListError(e,M.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${v.url})`),v.url,A,E);this.hls.trigger(p.ERROR,T)},onTimeout:(d,v,E)=>{const A=this.assignAssetListError(e,M.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${v.url})`),v.url,d,E);this.hls.trigger(p.ERROR,A)}};return o.load(c,h,f),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:ee.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 Zu extends C{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 d=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r){const v=this.findItemIndex(o);if(d>v){const E=this.schedule.findJumpRestrictedIndex(v+1,d);if(E>v){this.setSchedulePosition(E);return}}}this.setSchedulePosition(d);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const d=o.event.assetList[0];d&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,d))}return}const h=u.timelineStart,f=u.duration||0;(r&&i<h||i>=h+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,h=i.map(v=>v.identifier),f=!!(o.length||h.length);if(f&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(v=>gs(v))}`),h.length&&this.log(`Removed events ${h}`),this.playerQueue.forEach(v=>{if(v.interstitial.appendInPlace){const E=v.assetItem.timelineStart,A=v.timelineOffset-E;if(A)try{v.timelineOffset=E}catch(T){Math.abs(A)>Bs&&this.warn(`${T} ("${v.assetId}" ${v.timelineOffset}->${E})`)}}}),r){const v=this.updateItem(r,this.timelinePos);this.itemsMatch(r,v)&&(this.playingItem=v,this.waitingItem=this.endedItem=null)}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const d=this.bufferingItem;if(d){const v=this.updateItem(d,this.bufferedPos);this.itemsMatch(d,v)?this.bufferingItem=v:d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))}if(i.forEach(v=>{v.assetList.forEach(E=>{this.clearAssetPlayer(E.identifier,null)})}),f||n){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:h}),this.isInterstitial(r)&&h.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 ju(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,d,v,E,A)=>{if(f){let T=f[d].start;const B=f.event;if(B){if(d==="playout"||B.timelineOccupancy!==Ir.Point){const Q=i(v);(Q==null?void 0:Q.interstitial)===B&&(T+=Q.assetItem.startOffset+Q[A])}}else{const Q=E==="bufferedPos"?r():e[E];T+=Q-f.start}return T}return 0},s=(f,d)=>{if(f!==0&&d!=="primary"&&e.schedule.length){var v;const E=e.schedule.findItemIndexAtTime(f),A=(v=e.schedule.items)==null?void 0:v[E];if(A){const T=A[d].start-A.start;return f+T}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var d;return(d=e.primaryDetails)!=null&&d.live?e.primaryDetails.edge:e.schedule.durations[f]},c=(f,d)=>{var v,E;const A=e.effectivePlayingItem;if(A!=null&&(v=A.event)!=null&&v.restrictions.skip)return;e.log(`seek to ${f} "${d}"`);const T=e.effectivePlayingItem,B=e.schedule.findItemIndexAtTime(f,d),Q=(E=e.schedule.items)==null?void 0:E[B],W=e.getBufferingPlayer(),se=W==null?void 0:W.interstitial,oe=se==null?void 0:se.appendInPlace,ve=T&&e.itemsMatch(T,Q);if(T&&(oe||ve)){const fe=i(e.playingAsset),xe=(fe==null?void 0:fe.media)||e.primaryMedia;if(xe){const ue=d==="primary"?xe.currentTime:n(T,d,e.playingAsset,"timelinePos","currentTime"),Pe=f-ue,Ze=(oe?ue:xe.currentTime)+Pe;if(Ze>=0&&(!fe||oe||Ze<=fe.duration)){xe.currentTime=Ze;return}}}if(Q){let fe=f;if(d!=="primary"){const ue=Q[d].start,Pe=f-ue;fe=Q.start+Pe}const xe=!e.isInterstitial(Q);if((!e.isInterstitial(T)||T.event.appendInPlace)&&(xe||Q.event.appendInPlace)){const ue=e.media||(oe?W==null?void 0:W.media:null);ue&&(ue.currentTime=fe)}else if(T){const ue=e.findItemIndex(T);if(B>ue){const Ze=e.schedule.findJumpRestrictedIndex(ue+1,B);if(Ze>ue){e.setSchedulePosition(Ze);return}}let Pe=0;if(xe)e.timelinePos=fe,e.checkBuffer();else{var le;const Ze=Q==null||(le=Q.event)==null?void 0:le.assetList;if(Ze){const ei=f-(Q[d]||Q).start;for(let wt=Ze.length;wt--;){const ht=Ze[wt];if(ht.duration&&ei>=ht.startOffset&&ei<ht.startOffset+ht.duration){Pe=wt;break}}}}e.setSchedulePosition(B,Pe)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const d=t();return e.isInterstitial(d)?d:null},h={get currentTime(){const f=u(),d=e.effectivePlayingItem;return d&&d===f?n(d,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-d.playout.start:0},set currentTime(f){const d=u(),v=e.effectivePlayingItem;v&&v===d&&c(f+v.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const d=(f=u())==null?void 0:f.event.assetList;return d?d.map(v=>e.getAssetPlayer(v.identifier)):[]},get playingIndex(){var f;const d=(f=u())==null?void 0:f.event;return d&&e.effectivePlayingAsset?d.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};this.manager={get events(){var f,d;return((f=e.schedule)==null||(d=f.events)==null?void 0:d.slice(0))||[]},get schedule(){var f,d;return((f=e.schedule)==null||(d=f.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return u()?h: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,d=f==null?void 0:f.event;if(d&&!d.restrictions.skip){const v=e.findItemIndex(f);if(d.appendInPlace){const E=f.playout.start+f.event.duration;c(E+.001,"playout")}else e.advanceAfterAssetEnded(d,v,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||!z(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} ${kt(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 h;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),h="Primary";else if(u){const v=this.getBufferingPlayer();v?(s=v.transferMedia(),h=`${v}`):h="detached MediaSource"}else h="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${kt(s)}`);else if(!this.detachedData||r.media===t){const v=this.playerQueue;v.length>1&&v.forEach(E=>{if(o&&E.interstitial.appendInPlace!==c){const A=E.interstitial;this.clearInterstitial(E.interstitial,null),A.appendInPlace=!1,A.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${A}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((n=s.mediaSource)==null?void 0:n.readyState)!=="closed",d=f&&s?s:t;if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${h}`),d===s){const v=o&&e.assetId===this.schedule.assetIdAtEnd;d.overrides={duration:this.schedule.duration,endOfStream:!o||v,cueRemoval:!o}}e.attachMedia(d)}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,h=this.playingAsset,f=h==null?void 0:h.identifier,d=f?this.getAssetPlayer(f):null;if(d&&f&&(!this.eventItemsMatch(s,n)||t!==void 0&&f!==((o=u.assetList)==null?void 0:o[t].identifier))){var c;const v=u.findAssetIndex(h);this.log(`INTERSTITIAL_ASSET_ENDED ${v+1}/${u.assetList.length} ${ca(h)}`),this.endedAsset=h,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:h,assetListIndex:v,event:u,schedule:i.slice(0),scheduleIndex:e,player:d}),this.retreiveMediaSource(f,n),d.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&d.detachMedia()}if(!this.eventItemsMatch(s,n)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${gs(s)}`),u.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){this.updateSchedule();const v=this.schedule.items;if(n&&v){const E=this.schedule.findItemIndex(n);this.advanceSchedule(E,v,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 h=u.interstitial,f=this.schedule.findEventIndex(h.identifier);(f<e||f>e+1)&&this.clearInterstitial(h,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 h=this.waitingItem;this.assetsBuffered(r,o)||this.setBufferingItem(r);let f=this.preloadAssets(u,i);if(this.eventItemsMatch(r,h||n)||(this.waitingItem=r,this.log(`INTERSTITIAL_STARTED ${gs(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 d=u.assetList[i];if(!d){const v=t[e+1],E=this.media;v&&E&&!this.isInterstitial(v)&&E.currentTime<v.start&&(E.currentTime=this.timelinePos=v.start),this.advanceAfterAssetEnded(u,e,i||0);return}if(f||(f=this.getAssetPlayer(d.identifier)),f===null||f.destroyed){const v=u.assetList.length;this.warn(`asset ${i+1}/${v} player destroyed ${u}`),f=this.createAssetPlayer(u,d,i)}if(!this.eventItemsMatch(r,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(d))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 ${gs(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 ${gs(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:vt.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=x(x({},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=x(x({},this.altSelection),{},{audio:i});return}const s=x(x({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=x(x({},this.altSelection),{},{subtitles:i});return}const s=x(x({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=Z(t);this.playerQueue.forEach(n=>n.hls.setAudioOption(t)||n.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=Z(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=vt.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,h;const f=this.findItemIndex(s),d=Math.min(f+1,t.length-1),v=t[d];if((c===-1&&s&&e>=s.end||(u=v.event)!=null&&u.appendInPlace&&e+.01>=v.start)&&(c=d),d-o>1&&(s==null||(h=s.event)==null?void 0:h.appendInPlace)===!1)return;if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(v);else{const E=this.primaryDetails;this.primaryLive&&E&&e>E.edge-E.targetduration&&v.start<E.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(v)&&this.preloadAssets(v.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 ${gs(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),r?e.event.assetList.forEach(u=>{const h=this.getAssetPlayer(u.identifier);h&&h.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 d=this.playingItem;!this.isInterstitial(d)&&(d==null||(o=d.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){const d=h-c;d>0&&(u=Math.round(d*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${u?` live-start: ${h} 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],h=this.getAssetPlayerQueueIndex(u.identifier);(h===-1||this.playerQueue[h].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:Ku(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=y({},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 h=0;if(this.primaryLive||e.appendInPlace){const W=this.timelinePos-t.timelineStart;if(W>1){const se=t.duration;se&&W<se&&(h=W)}}const f=t.identifier,d=x(x({},s),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:h,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:c||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(d.timelineOffset=t.timelineStart));const v=d.cmcd;v!=null&&v.sessionId&&v.contentId&&(d.cmcd=y({},v,{contentId:sr(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const E=new Hu(this.HlsPlayerClass,d,e,t);this.playerQueue.push(E),e.assetList[i]=t;const A=W=>{if(W.live){const ve=new Error(`Interstitials MUST be VOD assets ${e}`),le={fatal:!0,type:ee.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:ve};this.handleAssetItemError(le,e,this.schedule.findEventIndex(e.identifier),i,ve.message);return}const se=W.edge-W.fragmentStart,oe=t.duration;(oe===null||se>oe)&&(this.log(`Interstitial asset "${f}" duration change ${oe} > ${se}`),t.duration=se,this.updateSchedule())};E.on(p.LEVEL_UPDATED,(W,{details:se})=>A(se)),E.on(p.LEVEL_PTS_UPDATED,(W,{details:se})=>A(se));const T=(W,se)=>{const oe=this.getAssetPlayer(f);if(oe&&se.tracks){oe.off(p.BUFFER_CODECS,T),oe.tracks=se.tracks;const ve=this.primaryMedia;this.bufferingAsset===oe.assetItem&&ve&&!oe.media&&this.bufferAssetPlayer(oe,ve)}};E.on(p.BUFFER_CODECS,T);const B=()=>{var W;const se=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${se}`),!se)return;const oe=this.schedule.findEventIndex(e.identifier),ve=e.findAssetIndex(t),le=ve+1,fe=(W=this.schedule.items)==null?void 0:W[oe];if(this.isInterstitial(fe))if(ve!==-1&&!e.isAssetPastPlayoutLimit(le)&&!e.assetList[le].error)this.bufferedToItem(fe,le);else{var xe;const ue=(xe=this.schedule.items)==null?void 0:xe[oe+1];ue&&this.bufferedToItem(ue)}};E.on(p.BUFFERED_TO_END,B);const Q=W=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const oe=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,oe,W)};return E.once(p.MEDIA_ENDED,Q(i)),E.once(p.PLAYOUT_LIMIT_REACHED,Q(1/0)),E.on(p.ERROR,(W,se)=>{const oe=this.getAssetPlayer(f);if(se.details===M.BUFFER_STALLED_ERROR){if(oe!=null&&oe.media){const ve=oe.currentTime,le=oe.duration-ve;ve&&e.appendInPlace&&le/oe.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${oe.media.currentTime}`),B()):(this.warn(`Stalled at ${ve} of ${ve+le} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(se,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${se.error} ${e}`)}),E.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const se=new Error(`Asset player destroyed unexpectedly ${f}`),oe={fatal:!0,type:ee.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:se};this.handleAssetItemError(oe,e,this.schedule.findEventIndex(e.identifier),i,se.message)}),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:E}),E}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&&gs(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,h=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!h||h.identifier!==c)&&(h&&(this.clearAssetPlayer(h.identifier,i[n]),delete h.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 h=this.getBufferingPlayer();if(h===e)return;const f=s.appendInPlace;if(f&&(h==null?void 0:h.interstitial.appendInPlace)===!1)return;const d=(h==null?void 0:h.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(f&&r!==this.playingAsset){if(!e.tracks)return;if(d&&!Ee(d,e.tracks)){const v=new Error(`Asset "${o}" SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),E={fatal:!0,type:ee.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:v},A=s.findAssetIndex(r);this.handleAssetItemError(E,s,c,A,v.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,n,s){if(e.details===M.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=y({},e,{fatal:!1,errorAction:Ei(!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 h=new Error(s);r&&(this.playingAsset!==r&&this.clearAssetPlayer(r.identifier,null),r.error=h),t.assetList.some(f=>!f.error)?t.appendInPlace&&(t.error=h):t.error=h,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?gs(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((E,A)=>{const T=parseFloat(E.DURATION);this.createAsset(n,A,u,o+u,T,E.URI),u+=T}),n.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${c}) ${n}`);const h=this.waitingItem,f=(h==null?void 0:h.event.identifier)===s;this.updateSchedule();const d=(i=this.bufferingItem)==null?void 0:i.event;if(f){var v;const E=this.schedule.findEventIndex(s),A=(v=this.schedule.items)==null?void 0:v[E];if(A){if(!this.playingItem&&this.timelinePos>A.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==E){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(A)}this.setSchedulePosition(E)}else if((d==null?void 0:d.identifier)===s&&d.appendInPlace){const E=n.assetList[0],A=this.getAssetPlayer(E.identifier),T=this.primaryMedia;E&&A&&T&&this.bufferAssetPlayer(A,T)}}onError(e,t){switch(t.details){case M.ASSET_LIST_PARSING_ERROR:case M.ASSET_LIST_LOAD_ERROR:case M.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case M.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const vo=500;class Yu extends mn{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",Y.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=be.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(V(i)&&(this.fragPrevious=i),this.state=be.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,Y.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===Y.SUBTITLE&&(t.details===M.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==be.STOPPED&&(this.state=be.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Ja(this.levels,t)){this.levels=t.map(i=>new jt(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new jt(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Y.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!==be.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 d=f.fragments[0];if(!c.details)r.hasProgramDateTime&&f.hasProgramDateTime?(fi(r,f),u=r.fragmentStart):d&&(u=d.start,Ls(r,u));else{var h;u=this.alignPlaylists(r,c.details,(h=this.levelLastLoaded)==null?void 0:h.details),u===0&&d&&(u=d.start,Ls(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===be.IDLE&&(at(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&&bn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,xn(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.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=be.IDLE})}}doTick(){if(!this.media){this.state=be.IDLE;return}if(this.state===be.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=vt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:c}=r,u=i.details,h=this.hls.maxBufferLength+u.levelTargetDuration;if(c>h)return;const f=u.fragments,d=f.length,v=u.edge;let E=null;const A=this.fragPrevious;if(o<v){const Q=n.maxFragLookUpTolerance,W=o>v-Q?0:Q;E=at(A,f,Math.max(f[0].start,o),W),!E&&A&&A.start<f[0].start&&(E=f[0])}else E=f[d-1];if(E=this.filterReplacedPrimary(E,i.details),!E)return;const T=E.sn-u.startSN,B=f[T-1];if(B&&B.cc===E.cc&&this.fragmentTracker.getState(B)===Ht.NOT_LOADED&&(E=B),this.fragmentTracker.getState(E)===Ht.NOT_LOADED){const Q=this.mapToInitFragWhenRequired(E);Q&&this.loadFragment(Q,i,o)}}}loadFragment(e,t,i){V(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 Xu={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(Xu[a]||a),Yn=15,hs=100,qu={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Ju={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ec={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},tc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ic=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class nc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;X.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 sc{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 rc{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 sc);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 rc(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 = "+kt(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 = "+kt(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: "+kt(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 xo{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=oc(),this.logger=void 0;const n=this.logger=new nc;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(ac(n,s,c)){Lr(null,null,c),this.logger.log(3,()=>"Repeated command ("+Ts([n,s])+") is dropped");continue}Lr(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 Lr(null,null,c);if(!r&&(o=this.parseChars(n,s),o)){const h=this.currentChannel;h&&h>0?this.channels[h].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?qu[e]:ec[e]:i=r===1?Ju[e]:tc[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=ic[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()}Lr(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 Lr(a,e,t){t.a=a,t.b=e}function ac(a,e,t){return t.a===a&&t.b===e}function oc(){return{a:null,b:null}}var fa=function(){if(Ri!=null&&Ri.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 h=arguments[u];for(const f in h)o[f]=h[f]}return o}function r(o,c,u){const h=this,f={enumerable:!0};h.hasBeenReset=!1;let d="",v=!1,E=o,A=c,T=u,B=null,Q="",W=!0,se="auto",oe="start",ve=50,le="middle",fe=50,xe="middle";Object.defineProperty(h,"id",s({},f,{get:function(){return d},set:function(ue){d=""+ue}})),Object.defineProperty(h,"pauseOnExit",s({},f,{get:function(){return v},set:function(ue){v=!!ue}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return E},set:function(ue){if(typeof ue!="number")throw new TypeError("Start time must be set to a number.");E=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return A},set:function(ue){if(typeof ue!="number")throw new TypeError("End time must be set to a number.");A=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return T},set:function(ue){T=""+ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",s({},f,{get:function(){return B},set:function(ue){B=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return Q},set:function(ue){const Pe=i(ue);if(Pe===!1)throw new SyntaxError("An invalid or illegal string was specified.");Q=Pe,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return W},set:function(ue){W=!!ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",s({},f,{get:function(){return se},set:function(ue){if(typeof ue!="number"&&ue!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");se=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return oe},set:function(ue){const Pe=n(ue);if(!Pe)throw new SyntaxError("An invalid or illegal string was specified.");oe=Pe,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return ve},set:function(ue){if(ue<0||ue>100)throw new Error("Position must be between 0 and 100.");ve=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return le},set:function(ue){const Pe=n(ue);if(!Pe)throw new SyntaxError("An invalid or illegal string was specified.");le=Pe,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",s({},f,{get:function(){return fe},set:function(ue){if(ue<0||ue>100)throw new Error("Size must be between 0 and 100.");fe=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return xe},set:function(ue){const Pe=n(ue);if(!Pe)throw new SyntaxError("An invalid or illegal string was specified.");xe=Pe,this.hasBeenReset=!0}})),h.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class lc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function So(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 uc{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 da=new fa(0,0,""),Dr=da.align==="middle"?"middle":"center";function cc(a,e,t){const i=a;function n(){const o=So(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 uc;To(o,function(d,v){let E;switch(d){case"region":for(let A=t.length-1;A>=0;A--)if(t[A].id===v){u.set(d,t[A].region);break}break;case"vertical":u.alt(d,v,["rl","lr"]);break;case"line":E=v.split(","),u.integer(d,E[0]),u.percent(d,E[0])&&u.set("snapToLines",!1),u.alt(d,E[0],["auto"]),E.length===2&&u.alt("lineAlign",E[1],["start",Dr,"end"]);break;case"position":E=v.split(","),u.percent(d,E[0]),E.length===2&&u.alt("positionAlign",E[1],["start",Dr,"end","line-left","line-right","auto"]);break;case"size":u.percent(d,v);break;case"align":u.alt(d,v,["start",Dr,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let h=u.get("line","auto");h==="auto"&&da.line===-1&&(h=-1),c.line=h,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"&&da.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 hc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new lc,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 fa(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{cc(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},dc=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(!z(t)||!z(i)||!z(n)||!z(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function ga(a,e,t){return sr(a.toString())+sr(e.toString())+sr(t)}const pc=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 hc,c=et(new Uint8Array(a)).trim().replace(fc,`
`).split(`
`),u=[],h=e?Ul(e.baseTime,e.timescale):0;let f="00:00.000",d=0,v=0,E,A=!0;o.oncue=function(T){const B=t[i];let Q=t.ccOffset;const W=(d-h)/9e4;if(B!=null&&B.new&&(v!==void 0?Q=t.ccOffset=B.start:pc(t,i,W)),W){if(!e){E=new Error("Missing initPTS for VTT MPEGTS");return}Q=W-t.presentationOffset}const se=T.endTime-T.startTime,oe=Un((T.startTime+Q-v)*9e4,n*9e4)/9e4;T.startTime=Math.max(oe,0),T.endTime=Math.max(oe+se,0);const ve=T.text.trim();T.text=decodeURIComponent(encodeURIComponent(ve)),T.id||(T.id=ga(T.startTime,T.endTime,ve)),T.endTime>0&&u.push(T)},o.onparsingerror=function(T){E=T},o.onflush=function(){if(E){r(E);return}s(u)},c.forEach(T=>{if(A)if(pa(T,"X-TIMESTAMP-MAP=")){A=!1,T.slice(16).split(",").forEach(B=>{pa(B,"LOCAL:")?f=B.slice(6):pa(B,"MPEGTS:")&&(d=parseInt(B.slice(7)))});try{v=dc(f)/1e3}catch(B){E=B}return}else T===""&&(A=!1);o.parse(T+`
`)}),o.flush()}const ma="stpp.ttml.im1t",wo=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ro=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,mc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Io(a,e,t,i){const n=ne(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>et(o)),r=Bl(e.baseTime,1,e.timescale);try{s.forEach(o=>t(_c(o,r)))}catch(o){i(o)}}function _c(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,d)=>(f[d]=n.getAttribute(`ttp:${d}`)||s[d],f),{}),o=n.getAttribute("xml:space")!=="preserve",c=Lo(_a(n,"styling","style")),u=Lo(_a(n,"layout","region")),h=_a(n,"body","[begin]");return[].map.call(h,f=>{const d=Do(f,o);if(!d||!f.hasAttribute("begin"))return null;const v=ya(f.getAttribute("begin"),r),E=ya(f.getAttribute("dur"),r);let A=ya(f.getAttribute("end"),r);if(v===null)throw Co(f);if(A===null){if(E===null)throw Co(f);A=v+E}const T=new fa(v-e,A-e,d);T.id=ga(T.startTime,T.endTime,T.text);const B=u[f.getAttribute("region")],Q=c[f.getAttribute("style")],W=vc(B,Q,c),{textAlign:se}=W;if(se){const oe=mc[se];oe&&(T.lineAlign=oe),T.align=se}return y(T,W),T}).filter(f=>f!==null)}function _a(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Lo(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 vc(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=So(a);return t===null&&(wo.test(a)?t=yc(a,e):Ro.test(a)&&(t=Ec(a,e))),t}function yc(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 Ec(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 bc{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 xo(1,e,t),this.cea608Parser2=new xo(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===Y.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===ma);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 h;if(o){let f=null;for(let d=0;d<o.length;d++)if(o[d]&&Po(o[d],c)){f=o[d],o[d]=null;break}f&&(h=f)}if(h)Fs(h);else{const f=ko(c);h=this.createTextTrack(f,c.name,c.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),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===Y.MAIN){var i,n;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,h=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;s&&r&&(u!==o+1||u===o&&h!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===Y.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===ma?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;Io(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?dt(i.initSegment.data,new Uint8Array(n)).buffer:n;gc(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,h=>{this._appendCues(h,i.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},h=>{const f=h.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${h}`),!(f&&o>i.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:h})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Io(t,this.initPTS[e.cc],()=>{i.textCodec=ma,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===Y.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===Y.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 h=3&r;(h===0||h===1)&&(t[h].push(o),t[h].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 Sc=/\s/,Tc={newCue(a,e,t,i){const n=[];let s,r,o,c,u;const h=self.VTTCue||self.TextTrackCue;for(let d=0;d<i.rows.length;d++)if(s=i.rows[d],o=!0,c=0,u="",!s.isEmpty()){var f;for(let A=0;A<s.chars.length;A++)Sc.test(s.chars[A].uchar)&&o?c++:(u+=s.chars[A].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const v=Ao(u.trim()),E=ga(e,t,v);a!=null&&(f=a.cues)!=null&&f.getCueById(E)||(r=new h(e,t,v),r.id=E,r.line=d+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((d,v)=>d.line==="auto"||v.line==="auto"?0:d.line>8&&v.line>8?v.line-d.line:d.line-v.line),n.forEach(d=>po(a,d))),n}};function Ac(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const wc=/(\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||Dc,this.controller=new self.AbortController,this.stats=new _}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=Rc(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&&z(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 d;this.response=this.loader=f;const v=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-(v-n.loading.start)),!f.ok){const{status:A,statusText:T}=f;throw new Cc(T||"fetch, bad network response",A,f)}n.loading.first=v,n.total=Lc(f.headers)||n.total;const E=(d=this.callbacks)==null?void 0:d.onProgress;return E&&z(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,E):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var d,v;const E=this.response;if(!E)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const A=f[o];A&&(n.loaded=n.total=A);const T={url:E.url,data:f,code:E.status},B=(d=this.callbacks)==null?void 0:d.onProgress;B&&!z(t.highWaterMark)&&B(n,e,f,E),(v=this.callbacks)==null||v.onSuccess(T,n,e,E)}).catch(f=>{var d;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const v=f&&f.code||0,E=f?f.message:null;(d=this.callbacks)==null||d.onError({code:v,text:E},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 h=u.value,f=h.length;return t.loaded+=f,f<n||r.dataLength?(r.push(h),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,h.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Rc(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(y({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function Ic(a){const e=wc.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Lc(a){const e=a.get("Content-Range");if(e){const i=Ic(e);if(z(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function Dc(a,e){return new self.Request(a.url,e)}class Cc extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const kc=/^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 _,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&&z(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,h=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const E=h!=null?h:t.response;if(E!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=t.responseType==="arraybuffer"?E.byteLength:E.length;i.loaded=i.total=A,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const T=(r=this.callbacks)==null?void 0:r.onProgress;T&&T(i,e,E,t);const B={url:t.responseURL,data:E,code:u};(o=this.callbacks)==null||o.onSuccess(B,i,e,t);return}}const f=s.loadPolicy.errorRetry,d=i.retry,v={url:e.url,data:void 0,code:u};if(Wt(f,d,!1,v))this.retry(f);else{var c;X.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(Wt(e,t,!0))this.retry(e);else{var i;X.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=Ft(e,i.retry),i.retry++,X.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&&kc.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 Pc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Oc=x(x({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:Je,bufferController:eu,capLevelController:sa,errorController:Xi,fpsController:Bu,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Et,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:Pc},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},Mc()),{},{subtitleStreamController:Yu,subtitleTrackController:Gu,timelineController:bc,audioStreamController:Ql,audioTrackController:Xl,emeController:Ns,cmcdController:Mu,contentSteeringController:Fu,interstitialsController:Zu});function Mc(){return{cueHandler:Tc,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 Nc(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(h=>{const f=`${r}Loading${h}`,d=e[f];if(d!==void 0&&c){u.push(f);const v=i[o].default;switch(e[o]={default:v},h){case"TimeOut":v.maxLoadTimeMs=d,v.maxTimeToFirstByteMs=d;break;case"MaxRetry":v.errorRetry.maxNumRetry=d,v.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":v.errorRetry.retryDelayMs=d,v.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":v.errorRetry.maxRetryDelayMs=d,v.timeoutRetry.maxRetryDelayMs=d;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${kt(e[o])}`)}),x(x({},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 Fc(a,e){const t=a.loader;t!==Mo&&t!==No?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):Ac()&&(a.loader=Mo,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const kr=2,Bc=.1,Uc=.05,$c=100;class Gc extends un{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,h=!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(h||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(!vt.getBuffered(r).length){this.nudgeRetry=0;return}const d=vt.bufferInfo(r,e,0),v=d.nextStart||0,E=this.fragmentTracker;if(c&&E&&this.hls){const ve=Fo(this.hls.inFlightFragments,e),le=d.len>kr,fe=!v||ve||v-e>kr&&!E.getPartialFragment(e);if(le||fe)return;this.moved=!1}const A=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&E){if(!(d.len>0)&&!v)return;const le=Math.max(v,d.start||0)-e,xe=!!(A!=null&&A.live)?A.targetduration*2:kr,ue=E.getPartialFragment(e);if(le>0&&(le<=xe||ue)){r.paused||this._trySkipBufferHole(ue);return}}const T=s.detectStallWithCurrentTimeMs,B=self.performance.now(),Q=this.waiting;if(o===null){Q>0&&B-Q<T?this.stalled=Q:this.stalled=B;return}const W=B-o;if(!c&&(W>=T||Q)&&this.hls){var se;if(((se=this.mediaSource)==null?void 0:se.readyState)==="ended"&&!(A!=null&&A.live)&&Math.abs(e-((A==null?void 0:A.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const oe=vt.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(oe,W)}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=vt.bufferedInfo(vt.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=vt.timeRangesToArray(n),o=vt.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=vt.bufferedInfo(r,e,0).bufferedIndex,u=r[o].end,h=r[o+1].start;if((c===-1||c>o)&&h-u<1&&e-u<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${h} buffered index: ${c}`);this.warn(f.message),this.media.currentTime+=1e-6;const d=this.fragmentTracker.getPartialFragment(e)||void 0,v=vt.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:d,buffer:v.len,bufferInfo:v})}}}}}_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,h=s.getPartialFragment(c);if((h||u!=null&&u.live&&c<u.fragmentStart)&&(this._trySkipBufferHole(h)||!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 (${kt(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.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=vt.bufferInfo(n,r,0),c=r<o.start?o.start:o.nextStart;if(c&&this.hls){const h=o.len<=s.maxBufferHole,f=o.len>0&&o.len<1&&n.readyState<3,d=c-r;if(d>0&&(h||f)){if(d>s.maxBufferHole){let E=!1;if(r===0){const A=i.getAppendedFrag(0,Y.MAIN);A&&c<A.end&&(E=!0)}if(!E){const A=e||i.getAppendedFrag(r,Y.MAIN);if(A){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||Fo(this.hls.inFlightFragments,c))return 0;let B=!1,Q=A.end;for(;Q<c;){const W=i.getPartialFragment(Q);if(W)Q+=W.duration;else{B=!0;break}}if(B)return 0}}}const v=Math.max(c+Uc,r+Bc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${v}`),this.moved=!0,n.currentTime=v,!(e!=null&&e.gap)){const E=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${v}`);this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:E,reason:E.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return v}}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:ee.MEDIA_ERROR,details:M.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:ee.MEDIA_ERROR,details:M.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 be.IDLE:case be.STOPPED:case be.ENDED:case be.ERROR:return null}return a.frag}const Kc=.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,kt(n?x({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 Vc(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 h=s[o].pts;let f=h+s[o].duration;f>Pr&&(f=Pr),f-h<=0&&(f=h+Kc);for(let v=0;v<u.length;v++){const E=u[v];if(!Pa(E)){this.updateId3CueEnds(h,c);const A=Uo(r,h,f,E,c);A&&this.id3Track.addCue(A)}}}}}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=h=>h.type===Bn.audioId3&&c:n==="video"?u=h=>h.type===Bn.emsg&&o:u=h=>h.type===Bn.audioId3&&c||h.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 h=Object.keys(r).filter(f=>!s.includes(f));for(let f=h.length;f--;){const d=h[f],v=r[d].cues;delete r[d],Object.keys(v).forEach(E=>{try{const A=v[E];A.removeEventListener("enter",this.onEventCueEnter),i.removeCue(A)}catch(A){}})}}else r=this.dateRangeCuesAppended={}}const c=e.fragments[e.fragments.length-1];if(s.length===0||!z(c==null?void 0:c.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const u=ba();for(let h=0;h<s.length;h++){const f=s[h],d=n[f],v=d.startTime,E=r[f],A=(E==null?void 0:E.cues)||{};let T=(E==null?void 0:E.durationKnown)||!1,B=Pr;const{duration:Q,endDate:W}=d;if(W&&Q!==null)B=v+Q,T=!0;else if(d.endOnNext&&!T){const oe=s.reduce((ve,le)=>{if(le!==d.id){const fe=n[le];if(fe.class===d.class&&fe.startDate>d.startDate&&(!ve||d.startDate<ve.startDate))return fe}return ve},null);oe&&(B=oe.startTime,T=!0)}const se=Object.keys(d.attr);for(let oe=0;oe<se.length;oe++){const ve=se[oe];if(!En(ve))continue;const le=A[ve];if(le)T&&!E.durationKnown?le.endTime=B:Math.abs(le.startTime-v)>.01&&(le.startTime=v,le.endTime=B);else if(u){let fe=d.attr[ve];as(ve)&&(fe=Vc(fe));const ue=Uo(u,v,B,{key:ve,data:fe},Bn.dateRange);ue&&(ue.id=f,this.id3Track.addCue(ue),A[ve]=ue,this.hls.config.interstitialsController&&(ve==="X-ASSET-LIST"||ve==="X-ASSET-URL")&&ue.addEventListener("enter",this.onEventCueEnter))}}r[f]={cues:A,dateRange:d,durationKnown:T}}}}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)),d=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,v=Math.min(f,Math.max(1,d));this.changeMediaPlaybackRate(t,v)}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 h=n;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,h)}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===M.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 jc 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(h=>{var f;const d=h.attrs;let{audioCodec:v,videoCodec:E}=h;v&&(h.audioCodec=v=_t(v,i)||void 0),((f=E)==null?void 0:f.indexOf("avc1"))===0&&(E=h.videoCodec=Fi(E));const{width:A,height:T,unknownCodecs:B}=h;let Q=B?B.length:0;if(B)for(let Pe=Q;Pe--;){const Ze=B[Pe];this.isAudioSupported(Ze)?(h.audioCodec=v=v?`${v},${Ze}`:Ze,Q--,Qe.audio[v.substring(0,4)]=2):this.isVideoSupported(Ze)&&(h.videoCodec=E=E?`${E},${Ze}`:Ze,Q--,Qe.video[E.substring(0,4)]=2)}if(o||(o=!!(A&&T)),c||(c=!!E),u||(u=!!v),Q||v&&!this.isAudioSupported(v)||E&&!this.isVideoSupported(E)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:W,"FRAME-RATE":se,"HDCP-LEVEL":oe,"PATHWAY-ID":ve,RESOLUTION:le,"VIDEO-RANGE":fe}=d,ue=`${`${ve||"."}-`}${h.bitrate}-${le}-${se}-${W}-${fe}-${oe}`;if(s[ue])if(s[ue].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const Pe=r[ue]+=1;h.attrs["PATHWAY-ID"]=new Array(Pe+1).join(".");const Ze=this.createLevel(h);s[ue]=Ze,n.push(Ze)}else s[ue].addGroupId("audio",d.AUDIO),s[ue].addGroupId("text",d.SUBTITLES);else{const Pe=this.createLevel(h);s[ue]=Pe,r[ue]=1,n.push(Pe)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new jt(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=Bi(n,[])}return t}isAudioSupported(e){return Bt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Bt(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:T,videoRange:B,width:Q,height:W})=>(!!T||!!(Q&&W))&&Zi(B))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let T="no level with compatible codecs found in manifest",B=T;t.levels.length&&(B=`one or more CODECS in variant not supported: ${kt(t.levels.map(W=>W.attrs.CODECS).filter((W,se,oe)=>oe.indexOf(W)===se))}`,this.warn(B),T+=` (${B})`);const Q=new Error(T);this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:M.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:Q,reason:B})}});return}t.audioTracks&&(r=t.audioTracks.filter(T=>!T.audioCodec||this.isAudioSupported(T.audioCodec)),$o(r)),t.subtitles&&(o=t.subtitles,$o(o));const u=c.slice(0);c.sort((T,B)=>{if(T.attrs["HDCP-LEVEL"]!==B.attrs["HDCP-LEVEL"])return(T.attrs["HDCP-LEVEL"]||"")>(B.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&T.height!==B.height)return T.height-B.height;if(T.frameRate!==B.frameRate)return T.frameRate-B.frameRate;if(T.videoRange!==B.videoRange)return Ui.indexOf(T.videoRange)-Ui.indexOf(B.videoRange);if(T.videoCodec!==B.videoCodec){const Q=$e(T.videoCodec),W=$e(B.videoCodec);if(Q!==W)return W-Q}if(T.uri===B.uri&&T.codecSet!==B.codecSet){const Q=At(T.codecSet),W=At(B.codecSet);if(Q!==W)return W-Q}return T.averageBitrate!==B.averageBitrate?T.averageBitrate-B.averageBitrate:0});let h=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let T=0;T<u.length;T++)if(u[T].pathwayId===c[0].pathwayId){h=u[T];break}}this._levels=c;for(let T=0;T<c.length;T++)if(c[T]===h){var f;this._firstLevel=T;const B=h.bitrate,Q=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${B}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const W=Math.min(B,this.hls.config.abrEwmaDefaultEstimateMax);W>Q&&Q===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=W)}break}const d=s&&!n,v=this.hls.config,E=!!(v.audioStreamController&&v.audioTrackController),A={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:E&&!d&&r.some(T=>!!T.url)};this.hls.trigger(p.MANIFEST_PARSED,A)}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 h=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(p.ERROR,{type:ee.OTHER_ERROR,details:M.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:h,reason:h.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 h=this.switchParams(r.uri,n==null?void 0:n.details,u);this.loadPlaylist(h)}}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===ie.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Y.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 $o(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function Go(){return self.SourceBuffer||self.WebKitSourceBuffer}function Ko(){if(!ge())return!1;const e=Go();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function zc(){if(!Ko())return!1;const a=ge();return typeof(a==null?void 0:a.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(Ye(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(Ye(e,"audio"))))}function Zc(){var a;const e=Go();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Yc=100;class Qc extends mn{constructor(e,t,i){super(e,t,i,"stream-controller",Y.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||!z(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(n,s,Y.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(Yc),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=be.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=be.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case be.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=be.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=be.IDLE;break}break}case be.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=be.IDLE}}break}this.state===be.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 A={};this.altAudio===2&&(A.type="video"),this.hls.trigger(p.BUFFER_EOS,A),this.state=be.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===be.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=be.WAITING_LEVEL,this.startFragRequested=!1;return}const h=o.len,f=this.getMaxBufferLength(r.maxBitrate);if(h>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:o.end;let v=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&v&&V(v)&&this.fragmentTracker.getState(v)!==Ht.OK){var E;const T=((E=this.backtrackFragment)!=null?E:v).sn-u.startSN,B=u.fragments[T-1];B&&v.cc===B.cc&&(v=B,this.fragmentTracker.removeFragment(B))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,d)){if(!v.gap){const T=this.audioOnly&&!this.altAudio?g.AUDIO:g.VIDEO,B=(T===g.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;B&&this.afterBufferFlushed(B,T,Y.MAIN)}v=this.getNextFragmentLoopLoading(v,u,o,Y.MAIN,f)}v&&(v.initSegment&&!v.initSegment.data&&!this.bitrateTest&&(v=v.initSegment),this.loadFragment(v,r,d))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Ht.NOT_LOADED||n===Ht.PARTIAL?V(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,Y.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,h=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(h,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 be.KEY_LOADING:case be.FRAG_LOADING:case be.FRAG_LOADING_WAITING_RETRY:case be.PARSING:case be.PARSED:this.state=be.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&&!Zc(),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!==be.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=be.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,h=this.fragCurrent;h&&(this.state===be.FRAG_LOADING||this.state===be.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let f=0;if(o.live||(i=u.details)!=null&&i.live){var d;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(d=this.levelLastLoaded)==null?void 0:d.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===be.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=be.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,h=c.PTSKnown||!c.live,f=(t=i.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),v=this.transmuxer=this.transmuxer||new Xa(this.hls,Y.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),E=n?n.index:-1,A=E!==-1,T=new cn(i.level,i.sn,i.stats.chunkCount,s.byteLength,E,A),B=this.initPTS[i.cc];v.push(s,f,d,u,i,n,c.totalduration,h,T,B)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(re(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=re(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===Y.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===be.PARSED&&(this.state=be.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),V(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&vt.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=be.ERROR;return}switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.MAIN,t);break;case M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===be.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ie.LEVEL&&(this.state=be.IDLE);break;case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case M.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case M.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=be.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==g.AUDIO||!this.altAudio){const i=(t===g.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,Y.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=vt.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=be.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:h}=o,{video:f,text:d,id3:v,initSegment:E}=s,{details:A}=h,T=this.altAudio?void 0:s.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=be.PARSING,E){if(E!=null&&E.tracks){const W=c.initSegment||c;this._bufferInitSegment(h,E.tracks,W,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:i,tracks:E.tracks})}const B=E.initPTS,Q=E.timescale;z(B)&&(this.initPTS[c.cc]={baseTime:B,timescale:Q},n.trigger(p.INIT_PTS_FOUND,{frag:c,id:i,initPTS:B,timescale:Q}))}if(f&&A){T&&f.type==="audiovideo"&&this.logMuxedErr(c);const B=A.fragments[c.sn-1-A.startSN],Q=c.sn===A.startSN,W=!B||c.cc>B.cc;if(s.independent!==!1){const{startPTS:se,endPTS:oe,startDTS:ve,endDTS:le}=f;if(u)u.elementaryStreams[f.type]={startPTS:se,endPTS:oe,startDTS:ve,endDTS:le};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!W&&(this.couldBacktrack=!0),f.dropped&&f.independent){const fe=this.getMainFwdBufferInfo(),xe=(fe?fe.end:this.getLoadPosition())+this.config.maxBufferHole,ue=f.firstKeyFramePTS?f.firstKeyFramePTS:se;if(!Q&&xe<ue-this.config.maxBufferHole&&!W){this.backtrack(c);return}else W&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,oe,c.start,le,!0)}else Q&&se-(A.appliedTimelineOffset||0)>kr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,se,oe,ve,le),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,u,r,Q||W)}else if(Q||W)c.gap=!0;else{this.backtrack(c);return}}if(T){const{startPTS:B,endPTS:Q,startDTS:W,endDTS:se}=T;u&&(u.elementaryStreams[g.AUDIO]={startPTS:B,endPTS:Q,startDTS:W,endDTS:se}),c.setElementaryStreamInfo(g.AUDIO,B,Q,W,se),this.bufferFragmentData(T,c,u,r)}if(A&&v!=null&&(t=v.samples)!=null&&t.length){const B={id:i,frag:c,details:A,samples:v.samples};n.trigger(p.FRAG_PARSING_METADATA,B)}if(A&&d){const B={id:i,frag:c,details:A,samples:d.samples};n.trigger(p.FRAG_PARSING_USERDATA,B)}}logMuxedErr(e){this.warn(`${V(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==be.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=oi(s.codec,e.audioCodec);u==="mp4a"&&(u="mp4a.40.5");const h=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&&h.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&h.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=Y.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=Y.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,Y.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=be.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(vt.isBuffered(e,i)?t=this.getAppendedFrag(i):vt.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 z(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(z(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?at(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 Xc{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=M.KEY_LOAD_ERROR,i,n,s){return new ri({type:ee.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,M.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,M.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,M.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,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,v,E,A)=>{const{frag:T,keyInfo:B,url:Q}=E;if(!T.decryptdata||B!==this.keyUriToKeyInfo[Q])return o(this.createKeyLoadError(T,M.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),A));B.decryptdata.key=T.decryptdata.key=new Uint8Array(d.data),T.keyLoader=null,B.loader=null,r({frag:T,keyInfo:B})},onError:(d,v,E,A)=>{this.resetLoader(v),o(this.createKeyLoadError(t,M.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),E,x({url:c.url,data:void 0},d)))},onTimeout:(d,v,E)=>{this.resetLoader(v),o(this.createKeyLoadError(t,M.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),E))},onAbort:(d,v,E)=>{this.resetLoader(v),o(this.createKeyLoadError(t,M.INTERNAL_ABORTED,new Error("key loading aborted"),E))}};s.load(c,h,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 ie.AUDIO_TRACK:return Y.AUDIO;case ie.SUBTITLE_TRACK:return Y.SUBTITLE;default:return Y.MAIN}}function xa(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class qc{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:ie.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:ie.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:ie.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:ie.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[ie.LEVEL];if(i){const n=i.context;n&&!t.levels.some(s=>s===n.levelOrTrack)&&(i.abort(),delete this.loaders[ie.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const u=this.hls.logger,h=n.context;if(h&&h.levelOrTrack===e.levelOrTrack&&(h.url===e.url||h.deliveryDirectives&&!e.deliveryDirectives)){h.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${h.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let s;if(e.type===ie.MANIFEST?s=i.manifestLoadPolicy.default:s=y({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),z((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ie.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ie.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ie.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const h=u.partTarget,f=u.targetduration;if(h&&f){const d=Math.max(h*3,f*.8)*1e3;s=y({},s,{maxTimeToFirstByteMs:Math.min(d,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,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,h,f,d)=>{const v=this.getInternalLoader(f);this.resetInternalLoader(f.type);const E=u.data;if(E.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),d||null,h);return}h.parsing.start=performance.now(),Fn.isMediaPlaylist(E)||f.type!==ie.MANIFEST?this.handleTrackOrLevelPlaylist(u,h,f,d||null,v):this.handleMasterPlaylist(u,h,f,d)},onError:(u,h,f,d)=>{this.handleNetworkError(h,f,!1,u,d)},onTimeout:(u,h,f)=>{this.handleNetworkError(h,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=xa(e,i),c=Fn.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:u,levels:h,sessionData:f,sessionKeys:d,startTimeOffset:v,variableList:E}=c;this.variableList=E;const{AUDIO:A=[],SUBTITLES:T,"CLOSED-CAPTIONS":B}=Fn.parseMasterPlaylistMedia(r,o,c);A.length&&!A.some(W=>!W.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),A.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new mi({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:h,audioTracks:A,subtitles:T,captions:B,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:d,startTimeOffset:v,variableList:E})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:c,type:u}=i,h=xa(e,i),f=z(c)?c:z(o)?o:0,d=Vo(i),v=Fn.parseLevelPlaylist(e.data,h,f,d,0,this.variableList);if(u===ie.MANIFEST){const E={attrs:new mi({}),bitrate:0,details:v,name:"",url:h};v.requestScheduled=t.loading.start+Es(v,0),r.trigger(p.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:h,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=v,this.handlePlaylistLoaded(v,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:ee.NETWORK_ERROR,details:M.MANIFEST_PARSING_ERROR,fatal:t.type===ie.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===ie.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ie.AUDIO_TRACK||e.type===ie.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=M.UNKNOWN,u=!1;const h=this.getInternalLoader(e);switch(e.type){case ie.MANIFEST:c=i?M.MANIFEST_LOAD_TIMEOUT:M.MANIFEST_LOAD_ERROR,u=!0;break;case ie.LEVEL:c=i?M.LEVEL_LOAD_TIMEOUT:M.LEVEL_LOAD_ERROR,u=!1;break;case ie.AUDIO_TRACK:c=i?M.AUDIO_TRACK_LOAD_TIMEOUT:M.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ie.SUBTITLE_TRACK:c=i?M.SUBTITLE_TRACK_LOAD_TIMEOUT:M.SUBTITLE_LOAD_ERROR,u=!1;break}h&&this.resetInternalLoader(e.type);const f={type:ee.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:s};if(n){const d=(t==null?void 0:t.url)||e.url;f.response=x({url:d,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:h,groupId:f,deliveryDirectives:d}=n,v=xa(t,n),E=Vo(n),A=typeof n.level=="number"&&E===Y.MAIN?u:void 0;if(!e.fragments.length){const B=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:ee.NETWORK_ERROR,details:M.LEVEL_EMPTY_ERROR,fatal:!1,url:v,error:B,reason:B.message,response:t,context:n,level:A,parent:E,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const T=e.playlistParsingError;if(T){if(this.hls.logger.warn(T),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:ee.NETWORK_ERROR,details:M.LEVEL_PARSING_ERROR,fatal:!1,url:v,error:T,reason:T.message,response:t,context:n,level:A,parent:E,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 ie.MANIFEST:case ie.LEVEL:o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||o.levels[0],level:A||0,id:h||0,stats:i,networkDetails:s,deliveryDirectives:d,withoutMultiVariant:c===ie.MANIFEST});break;case ie.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:h||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:d});break;case ie.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:h||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:d});break}}}class ms{static get version(){return Xs}static isMSESupported(){return Ko()}static isSupported(){return zc()}static getMediaSource(){return ge()}static get Events(){return p}static get MetadataSchema(){return Bn}static get ErrorTypes(){return ee}static get ErrorDetails(){return M}static get DefaultConfig(){return ms.defaultConfig?ms.defaultConfig:Oc}static set DefaultConfig(e){ms.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 Qs,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=te(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=Nc(ms.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Fc(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=i,u=new o(this),h=this.abrController=new n(this),f=new Wi(this),d=i.interstitialsController,v=d?this.interstitialsController=new d(this,ms):null,E=this.bufferController=new s(this,f),A=this.capLevelController=new r(this),T=new c(this),B=new qc(this),Q=i.contentSteeringController,W=Q?new Q(this):null,se=this.levelController=new jc(this,W),oe=new Wc(this),ve=new Xc(this.config),le=this.streamController=new Qc(this,f,ve),fe=this.gapController=new Gc(this,f);A.setStreamController(le),T.setStreamController(le);const xe=[B,se,le];v&&xe.splice(1,0,v),W&&xe.splice(1,0,W),this.networkControllers=xe;const ue=[h,E,fe,A,T,oe,f];this.audioTrackController=this.createController(i.audioTrackController,xe);const Pe=i.audioStreamController;Pe&&xe.push(this.audioStreamController=new Pe(this,f,ve)),this.subtitleTrackController=this.createController(i.subtitleTrackController,xe);const Ze=i.subtitleStreamController;Ze&&xe.push(this.subtititleStreamController=new Ze(this,f,ve)),this.createController(i.timelineController,ue),ve.emeController=this.emeController=this.createController(i.emeController,ue),this.cmcdController=this.createController(i.cmcdController,ue),this.latencyController=this.createController(Hc,ue),this.coreComponents=ue,xe.push(u);const ei=u.onErrorOut;typeof ei=="function"&&this.on(p.ERROR,ei,u),this.on(p.MANIFEST_LOADED,B.onManifestLoaded,B)}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:ee.OTHER_ERROR,details:M.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:ee.OTHER_ERROR,details:M.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=N.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={[Y.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Y.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Y.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=dl()),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){Ki(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=yt(t);return Gi(e,i,navigator.mediaCapabilities)}}ms.defaultConfig=void 0}}]);
}());