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
881 KiB

!(function(){var Qo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[2524],{65966:function(Lt,Me,G){"use strict";G.d(Me,{Z:function(){return ri}});var z=G(20439),J=G(50298),Ee=G(62646),ee=G(43403),N=G(92310),p=G.n(N),ie=G(29301),Y=G(76846),u=G(96452),$=G(6089),b=G(80402),v=G(34280),m=G(49658),x=G(59301),S=G(14809),P=G(77900),C=G(8654);function k(ce){var Re=ce.prefixCls,se=ce.align,Ue=ce.arrow,Ve=ce.arrowPos,qe=Ue||{},K=qe.className,oe=qe.content,ye=Ve.x,Ae=ye===void 0?0:ye,Fe=Ve.y,$e=Fe===void 0?0:Fe,bt=x.useRef();if(!se||!se.points)return null;var We={position:"absolute"};if(se.autoArrow!==!1){var _t=se.points[0],Pt=se.points[1],ft=_t[0],Ot=_t[1],Zt=Pt[0],Bt=Pt[1];ft===Zt||!["t","b"].includes(ft)?We.top=$e:ft==="t"?We.top=0:We.bottom=0,Ot===Bt||!["l","r"].includes(Ot)?We.left=Ae:Ot==="l"?We.left=0:We.right=0}return x.createElement("div",{ref:bt,className:p()("".concat(Re,"-arrow"),K),style:We},oe)}function I(ce){var Re=ce.prefixCls,se=ce.open,Ue=ce.zIndex,Ve=ce.mask,qe=ce.motion;return Ve?x.createElement(P.default,(0,S.Z)({},qe,{motionAppear:!0,visible:se,removeOnLeave:!0}),function(K){var oe=K.className;return x.createElement("div",{style:{zIndex:Ue},className:p()("".concat(Re,"-mask"),oe)})}):null}var R=x.memo(function(ce){var Re=ce.children;return Re},function(ce,Re){return Re.cache}),B=R,j=x.forwardRef(function(ce,Re){var se=ce.popup,Ue=ce.className,Ve=ce.prefixCls,qe=ce.style,K=ce.target,oe=ce.onVisibleChanged,ye=ce.open,Ae=ce.keepDom,Fe=ce.fresh,$e=ce.onClick,bt=ce.mask,We=ce.arrow,_t=ce.arrowPos,Pt=ce.align,ft=ce.motion,Ot=ce.maskMotion,Zt=ce.forceRender,Bt=ce.getPopupContainer,qt=ce.autoDestroy,Jt=ce.portal,St=ce.zIndex,Ui=ce.onMouseEnter,Le=ce.onMouseLeave,Be=ce.onPointerEnter,je=ce.onPointerDownCapture,ti=ce.ready,Ye=ce.offsetX,et=ce.offsetY,gt=ce.offsetR,Ut=ce.offsetB,Je=ce.onAlign,ze=ce.onPrepare,De=ce.stretch,Mt=ce.targetWidth,$t=ce.targetHeight,vi=typeof se=="function"?se():se,dt=ye||Ae,Gt=(Bt==null?void 0:Bt.length)>0,Kt=x.useState(!Bt||!Gt),wi=(0,J.Z)(Kt,2),yi=wi[0],tn=wi[1];if((0,v.Z)(function(){!yi&&Gt&&K&&tn(!0)},[yi,Gt,K]),!yi)return null;var Oi="auto",bi={left:"-1000vw",top:"-1000vh",right:Oi,bottom:Oi};if(ti||!ye){var fi,$i=Pt.points,hn=Pt.dynamicInset||((fi=Pt._experimental)===null||fi===void 0?void 0:fi.dynamicInset),Li=hn&&$i[0][1]==="r",Hi=hn&&$i[0][0]==="b";Li?(bi.right=gt,bi.left=Oi):(bi.left=Ye,bi.right=Oi),Hi?(bi.bottom=Ut,bi.top=Oi):(bi.top=et,bi.bottom=Oi)}var xi={};return De&&(De.includes("height")&&$t?xi.height=$t:De.includes("minHeight")&&$t&&(xi.minHeight=$t),De.includes("width")&&Mt?xi.width=Mt:De.includes("minWidth")&&Mt&&(xi.minWidth=Mt)),ye||(xi.pointerEvents="none"),x.createElement(Jt,{open:Zt||dt,getContainer:Bt&&function(){return Bt(K)},autoDestroy:qt},x.createElement(I,{prefixCls:Ve,open:ye,zIndex:St,mask:bt,motion:Ot}),x.createElement(ie.Z,{onResize:Je,disabled:!ye},function(sn){return x.createElement(P.default,(0,S.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Zt,leavedClassName:"".concat(Ve,"-hidden")},ft,{onAppearPrepare:ze,onEnterPrepare:ze,visible:ye,onVisibleChanged:function(fn){var Si;ft==null||(Si=ft.onVisibleChanged)===null||Si===void 0||Si.call(ft,fn),oe(fn)}}),function(Di,fn){var Si=Di.className,dn=Di.style,zi=p()(Ve,Si,Ue);return x.createElement("div",{ref:(0,C.sQ)(sn,Re,fn),className:zi,style:(0,z.Z)((0,z.Z)((0,z.Z)((0,z.Z)({"--arrow-x":"".concat(_t.x||0,"px"),"--arrow-y":"".concat(_t.y||0,"px")},bi),xi),dn),{},{boxSizing:"border-box",zIndex:St},qe),onMouseEnter:Ui,onMouseLeave:Le,onPointerEnter:Be,onClick:$e,onPointerDownCapture:je},We&&x.createElement(k,{prefixCls:Ve,arrow:We,arrowPos:_t,align:Pt}),x.createElement(B,{cache:!ye&&!Fe},vi))})}))}),q=j,te=x.forwardRef(function(ce,Re){var se=ce.children,Ue=ce.getTriggerDOMNode,Ve=(0,C.Yr)(se),qe=x.useCallback(function(oe){(0,C.mH)(Re,Ue?Ue(oe):oe)},[Ue]),K=(0,C.x1)(qe,(0,C.C4)(se));return Ve?x.cloneElement(se,{ref:K}):se}),X=te,ve=x.createContext(null),Ie=ve;function xe(ce){return ce?Array.isArray(ce)?ce:[ce]:[]}function it(ce,Re,se,Ue){return x.useMemo(function(){var Ve=xe(se!=null?se:Re),qe=xe(Ue!=null?Ue:Re),K=new Set(Ve),oe=new Set(qe);return ce&&(K.has("hover")&&(K.delete("hover"),K.add("click")),oe.has("hover")&&(oe.delete("hover"),oe.add("click"))),[K,oe]},[ce,Re,se,Ue])}var U=G(29194);function w(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],se=arguments.length>2?arguments[2]:void 0;return se?ce[0]===Re[0]:ce[0]===Re[0]&&ce[1]===Re[1]}function L(ce,Re,se,Ue){for(var Ve=se.points,qe=Object.keys(ce),K=0;K<qe.length;K+=1){var oe,ye=qe[K];if(w((oe=ce[ye])===null||oe===void 0?void 0:oe.points,Ve,Ue))return"".concat(Re,"-placement-").concat(ye)}return""}function M(ce,Re,se,Ue){return Re||(se?{motionName:"".concat(ce,"-").concat(se)}:Ue?{motionName:Ue}:null)}function H(ce){return ce.ownerDocument.defaultView}function F(ce){for(var Re=[],se=ce==null?void 0:ce.parentElement,Ue=["hidden","scroll","clip","auto"];se;){var Ve=H(se).getComputedStyle(se),qe=Ve.overflowX,K=Ve.overflowY,oe=Ve.overflow;[qe,K,oe].some(function(ye){return Ue.includes(ye)})&&Re.push(se),se=se.parentElement}return Re}function _(ce){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(ce)?Re:ce}function g(ce){return _(parseFloat(ce),0)}function D(ce,Re){var se=(0,z.Z)({},ce);return(Re||[]).forEach(function(Ue){if(!(Ue instanceof HTMLBodyElement||Ue instanceof HTMLHtmlElement)){var Ve=H(Ue).getComputedStyle(Ue),qe=Ve.overflow,K=Ve.overflowClipMargin,oe=Ve.borderTopWidth,ye=Ve.borderBottomWidth,Ae=Ve.borderLeftWidth,Fe=Ve.borderRightWidth,$e=Ue.getBoundingClientRect(),bt=Ue.offsetHeight,We=Ue.clientHeight,_t=Ue.offsetWidth,Pt=Ue.clientWidth,ft=g(oe),Ot=g(ye),Zt=g(Ae),Bt=g(Fe),qt=_(Math.round($e.width/_t*1e3)/1e3),Jt=_(Math.round($e.height/bt*1e3)/1e3),St=(_t-Pt-Zt-Bt)*qt,Ui=(bt-We-ft-Ot)*Jt,Le=ft*Jt,Be=Ot*Jt,je=Zt*qt,ti=Bt*qt,Ye=0,et=0;if(qe==="clip"){var gt=g(K);Ye=gt*qt,et=gt*Jt}var Ut=$e.x+je-Ye,Je=$e.y+Le-et,ze=Ut+$e.width+2*Ye-je-ti-St,De=Je+$e.height+2*et-Le-Be-Ui;se.left=Math.max(se.left,Ut),se.top=Math.max(se.top,Je),se.right=Math.min(se.right,ze),se.bottom=Math.min(se.bottom,De)}}),se}function V(ce){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,se="".concat(Re),Ue=se.match(/^(.*)\%$/);return Ue?ce*(parseFloat(Ue[1])/100):parseFloat(se)}function de(ce,Re){var se=Re||[],Ue=(0,J.Z)(se,2),Ve=Ue[0],qe=Ue[1];return[V(ce.width,Ve),V(ce.height,qe)]}function Te(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[ce[0],ce[1]]}function Pe(ce,Re){var se=Re[0],Ue=Re[1],Ve,qe;return se==="t"?qe=ce.y:se==="b"?qe=ce.y+ce.height:qe=ce.y+ce.height/2,Ue==="l"?Ve=ce.x:Ue==="r"?Ve=ce.x+ce.width:Ve=ce.x+ce.width/2,{x:Ve,y:qe}}function Ne(ce,Re){var se={t:"b",b:"t",l:"r",r:"l"};return ce.map(function(Ue,Ve){return Ve===Re?se[Ue]||"c":Ue}).join("")}function Ze(ce,Re,se,Ue,Ve,qe,K){var oe=x.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Ve[Ue]||{}}),ye=(0,J.Z)(oe,2),Ae=ye[0],Fe=ye[1],$e=x.useRef(0),bt=x.useMemo(function(){return Re?F(Re):[]},[Re]),We=x.useRef({}),_t=function(){We.current={}};ce||_t();var Pt=(0,$.Z)(function(){if(Re&&se&&ce){let Vi=function(li,un){var Ln=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ni,Yn=dt.x+li,Qn=dt.y+un,Xn=Yn+Hi,is=Qn+Li,at=Math.max(Yn,Ln.left),At=Math.max(Qn,Ln.top),pi=Math.min(Xn,Ln.right),Ti=Math.min(is,Ln.bottom);return Math.max(0,(pi-at)*(Ti-At))},Et=function(){Ki=dt.y+wt,Ei=Ki+Li,Xi=dt.x+pt,Fi=Xi+Hi};var Zt,Bt,qt,Jt,St=Re,Ui=St.ownerDocument,Le=H(St),Be=Le.getComputedStyle(St),je=Be.position,ti=St.style.left,Ye=St.style.top,et=St.style.right,gt=St.style.bottom,Ut=St.style.overflow,Je=(0,z.Z)((0,z.Z)({},Ve[Ue]),qe),ze=Ui.createElement("div");(Zt=St.parentElement)===null||Zt===void 0||Zt.appendChild(ze),ze.style.left="".concat(St.offsetLeft,"px"),ze.style.top="".concat(St.offsetTop,"px"),ze.style.position=je,ze.style.height="".concat(St.offsetHeight,"px"),ze.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 De;if(Array.isArray(se))De={x:se[0],y:se[1],width:0,height:0};else{var Mt,$t,vi=se.getBoundingClientRect();vi.x=(Mt=vi.x)!==null&&Mt!==void 0?Mt:vi.left,vi.y=($t=vi.y)!==null&&$t!==void 0?$t:vi.top,De={x:vi.x,y:vi.y,width:vi.width,height:vi.height}}var dt=St.getBoundingClientRect(),Gt=Le.getComputedStyle(St),Kt=Gt.height,wi=Gt.width;dt.x=(Bt=dt.x)!==null&&Bt!==void 0?Bt:dt.left,dt.y=(qt=dt.y)!==null&&qt!==void 0?qt:dt.top;var yi=Ui.documentElement,tn=yi.clientWidth,Oi=yi.clientHeight,bi=yi.scrollWidth,fi=yi.scrollHeight,$i=yi.scrollTop,hn=yi.scrollLeft,Li=dt.height,Hi=dt.width,xi=De.height,sn=De.width,Di={left:0,top:0,right:tn,bottom:Oi},fn={left:-hn,top:-$i,right:bi-hn,bottom:fi-$i},Si=Je.htmlRegion,dn="visible",zi="visibleFirst";Si!=="scroll"&&Si!==zi&&(Si=dn);var Zi=Si===zi,gn=D(fn,bt),Vt=D(Di,bt),ni=Si===dn?Vt:gn,Ci=Zi?Vt:ni;St.style.left="auto",St.style.top="auto",St.style.right="0",St.style.bottom="0";var Qt=St.getBoundingClientRect();St.style.left=ti,St.style.top=Ye,St.style.right=et,St.style.bottom=gt,St.style.overflow=Ut,(Jt=St.parentElement)===null||Jt===void 0||Jt.removeChild(ze);var ki=_(Math.round(Hi/parseFloat(wi)*1e3)/1e3),di=_(Math.round(Li/parseFloat(Kt)*1e3)/1e3);if(ki===0||di===0||(0,Y.Sh)(se)&&!(0,U.Z)(se))return;var xn=Je.offset,Tt=Je.targetOffset,Nt=de(dt,xn),Z=(0,J.Z)(Nt,2),ge=Z[0],Se=Z[1],be=de(De,Tt),we=(0,J.Z)(be,2),ke=we[0],Ke=we[1];De.x-=ke,De.y-=Ke;var st=Je.points||[],ae=(0,J.Z)(st,2),tt=ae[0],zt=ae[1],ct=Te(zt),rt=Te(tt),It=Pe(De,ct),ii=Pe(dt,rt),Yt=(0,z.Z)({},Je),pt=It.x-ii.x+ge,wt=It.y-ii.y+Se,si=Vi(pt,wt),Ht=Vi(pt,wt,Vt),kt=Pe(De,["t","l"]),ci=Pe(dt,["t","l"]),yt=Pe(De,["b","r"]),jt=Pe(dt,["b","r"]),Gi=Je.overflow||{},oi=Gi.adjustX,ei=Gi.adjustY,Mi=Gi.shiftX,Ii=Gi.shiftY,Ni=function(un){return typeof un=="boolean"?un:un>=0},Ki,Ei,Xi,Fi;Et();var rn=Ni(ei),gi=rt[0]===ct[0];if(rn&&rt[0]==="t"&&(Ei>Ci.bottom||We.current.bt)){var qi=wt;gi?qi-=Li-xi:qi=kt.y-jt.y-Se;var An=Vi(pt,qi),mn=Vi(pt,qi,Vt);An>si||An===si&&(!Zi||mn>=Ht)?(We.current.bt=!0,wt=qi,Se=-Se,Yt.points=[Ne(rt,0),Ne(ct,0)]):We.current.bt=!1}if(rn&&rt[0]==="b"&&(Ki<Ci.top||We.current.tb)){var an=wt;gi?an+=Li-xi:an=yt.y-ci.y-Se;var wn=Vi(pt,an),Yi=Vi(pt,an,Vt);wn>si||wn===si&&(!Zi||Yi>=Ht)?(We.current.tb=!0,wt=an,Se=-Se,Yt.points=[Ne(rt,0),Ne(ct,0)]):We.current.tb=!1}var Ji=Ni(oi),Pn=rt[1]===ct[1];if(Ji&&rt[1]==="l"&&(Fi>Ci.right||We.current.rl)){var Bi=pt;Pn?Bi-=Hi-sn:Bi=kt.x-jt.x-ge;var on=Vi(Bi,wt),Pi=Vi(Bi,wt,Vt);on>si||on===si&&(!Zi||Pi>=Ht)?(We.current.rl=!0,pt=Bi,ge=-ge,Yt.points=[Ne(rt,1),Ne(ct,1)]):We.current.rl=!1}if(Ji&&rt[1]==="r"&&(Xi<Ci.left||We.current.lr)){var ji=pt;Pn?ji+=Hi-sn:ji=yt.x-ci.x-ge;var ln=Vi(ji,wt),mt=Vi(ji,wt,Vt);ln>si||ln===si&&(!Zi||mt>=Ht)?(We.current.lr=!0,pt=ji,ge=-ge,Yt.points=[Ne(rt,1),Ne(ct,1)]):We.current.lr=!1}Et();var Qi=Mi===!0?0:Mi;typeof Qi=="number"&&(Xi<Vt.left&&(pt-=Xi-Vt.left-ge,De.x+sn<Vt.left+Qi&&(pt+=De.x-Vt.left+sn-Qi)),Fi>Vt.right&&(pt-=Fi-Vt.right-ge,De.x>Vt.right-Qi&&(pt+=De.x-Vt.right+Qi)));var nn=Ii===!0?0:Ii;typeof nn=="number"&&(Ki<Vt.top&&(wt-=Ki-Vt.top-Se,De.y+xi<Vt.top+nn&&(wt+=De.y-Vt.top+xi-nn)),Ei>Vt.bottom&&(wt-=Ei-Vt.bottom-Se,De.y>Vt.bottom-nn&&(wt+=De.y-Vt.bottom+nn)));var _n=dt.x+pt,In=_n+Hi,Hn=dt.y+wt,jn=Hn+Li,Fn=De.x,ai=Fn+sn,ts=De.y,as=ts+xi,zn=Math.max(_n,Fn),pn=Math.min(In,ai),os=(zn+pn)/2,ls=os-_n,vn=Math.max(Hn,ts),Bn=Math.min(jn,as),On=(vn+Bn)/2,Rn=On-Hn;K==null||K(Re,Yt);var en=Qt.right-dt.x-(pt+dt.width),Sn=Qt.bottom-dt.y-(wt+dt.height);ki===1&&(pt=Math.round(pt),en=Math.round(en)),di===1&&(wt=Math.round(wt),Sn=Math.round(Sn));var Zn={ready:!0,offsetX:pt/ki,offsetY:wt/di,offsetR:en/ki,offsetB:Sn/di,arrowX:ls/ki,arrowY:Rn/di,scaleX:ki,scaleY:di,align:Yt};Fe(Zn)}}),ft=function(){$e.current+=1;var Bt=$e.current;Promise.resolve().then(function(){$e.current===Bt&&Pt()})},Ot=function(){Fe(function(Bt){return(0,z.Z)((0,z.Z)({},Bt),{},{ready:!1})})};return(0,v.Z)(Ot,[Ue]),(0,v.Z)(function(){ce||Ot()},[ce]),[Ae.ready,Ae.offsetX,Ae.offsetY,Ae.offsetR,Ae.offsetB,Ae.arrowX,Ae.arrowY,Ae.scaleX,Ae.scaleY,Ae.align,ft]}var Dt=G(95190);function Rt(ce,Re,se,Ue,Ve){(0,v.Z)(function(){if(ce&&Re&&se){let $e=function(){Ue(),Ve()};var qe=Re,K=se,oe=F(qe),ye=F(K),Ae=H(K),Fe=new Set([Ae].concat((0,Dt.Z)(oe),(0,Dt.Z)(ye)));return Fe.forEach(function(bt){bt.addEventListener("scroll",$e,{passive:!0})}),Ae.addEventListener("resize",$e,{passive:!0}),Ue(),function(){Fe.forEach(function(bt){bt.removeEventListener("scroll",$e),Ae.removeEventListener("resize",$e)})}}},[ce,Re,se])}var nt=G(48736);function xt(ce,Re,se,Ue,Ve,qe,K,oe){var ye=x.useRef(ce);ye.current=ce;var Ae=x.useRef(!1);x.useEffect(function(){if(Re&&Ue&&(!Ve||qe)){var $e=function(){Ae.current=!1},bt=function(qt){var Jt;ye.current&&!K(((Jt=qt.composedPath)===null||Jt===void 0||(Jt=Jt.call(qt))===null||Jt===void 0?void 0:Jt[0])||qt.target)&&!Ae.current&&oe(!1)},We=H(Ue);We.addEventListener("pointerdown",$e,!0),We.addEventListener("mousedown",bt,!0),We.addEventListener("contextmenu",bt,!0);var _t=(0,u.A)(se);if(_t&&(_t.addEventListener("mousedown",bt,!0),_t.addEventListener("contextmenu",bt,!0)),0)var Pt,ft,Ot,Zt;return function(){We.removeEventListener("pointerdown",$e,!0),We.removeEventListener("mousedown",bt,!0),We.removeEventListener("contextmenu",bt,!0),_t&&(_t.removeEventListener("mousedown",bt,!0),_t.removeEventListener("contextmenu",bt,!0))}}},[Re,se,Ue,Ve,qe]);function Fe(){Ae.current=!0}return Fe}var He=["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 Wt(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ee.Z,Re=x.forwardRef(function(se,Ue){var Ve=se.prefixCls,qe=Ve===void 0?"rc-trigger-popup":Ve,K=se.children,oe=se.action,ye=oe===void 0?"hover":oe,Ae=se.showAction,Fe=se.hideAction,$e=se.popupVisible,bt=se.defaultPopupVisible,We=se.onPopupVisibleChange,_t=se.afterPopupVisibleChange,Pt=se.mouseEnterDelay,ft=se.mouseLeaveDelay,Ot=ft===void 0?.1:ft,Zt=se.focusDelay,Bt=se.blurDelay,qt=se.mask,Jt=se.maskClosable,St=Jt===void 0?!0:Jt,Ui=se.getPopupContainer,Le=se.forceRender,Be=se.autoDestroy,je=se.destroyPopupOnHide,ti=se.popup,Ye=se.popupClassName,et=se.popupStyle,gt=se.popupPlacement,Ut=se.builtinPlacements,Je=Ut===void 0?{}:Ut,ze=se.popupAlign,De=se.zIndex,Mt=se.stretch,$t=se.getPopupClassNameFromAlign,vi=se.fresh,dt=se.alignPoint,Gt=se.onPopupClick,Kt=se.onPopupAlign,wi=se.arrow,yi=se.popupMotion,tn=se.maskMotion,Oi=se.popupTransitionName,bi=se.popupAnimation,fi=se.maskTransitionName,$i=se.maskAnimation,hn=se.className,Li=se.getTriggerDOMNode,Hi=(0,Ee.Z)(se,He),xi=Be||je||!1,sn=x.useState(!1),Di=(0,J.Z)(sn,2),fn=Di[0],Si=Di[1];(0,v.Z)(function(){Si((0,m.Z)())},[]);var dn=x.useRef({}),zi=x.useContext(Ie),Zi=x.useMemo(function(){return{registerSubPopup:function(At,pi){dn.current[At]=pi,zi==null||zi.registerSubPopup(At,pi)}}},[zi]),gn=(0,b.Z)(),Vt=x.useState(null),ni=(0,J.Z)(Vt,2),Ci=ni[0],Qt=ni[1],ki=x.useRef(null),di=(0,$.Z)(function(at){ki.current=at,(0,Y.Sh)(at)&&Ci!==at&&Qt(at),zi==null||zi.registerSubPopup(gn,at)}),xn=x.useState(null),Tt=(0,J.Z)(xn,2),Nt=Tt[0],Z=Tt[1],ge=x.useRef(null),Se=(0,$.Z)(function(at){(0,Y.Sh)(at)&&Nt!==at&&(Z(at),ge.current=at)}),be=x.Children.only(K),we=(be==null?void 0:be.props)||{},ke={},Ke=(0,$.Z)(function(at){var At,pi,Ti=Nt;return(Ti==null?void 0:Ti.contains(at))||((At=(0,u.A)(Ti))===null||At===void 0?void 0:At.host)===at||at===Ti||(Ci==null?void 0:Ci.contains(at))||((pi=(0,u.A)(Ci))===null||pi===void 0?void 0:pi.host)===at||at===Ci||Object.values(dn.current).some(function(mi){return(mi==null?void 0:mi.contains(at))||at===mi})}),st=M(qe,yi,bi,Oi),ae=M(qe,tn,$i,fi),tt=x.useState(bt||!1),zt=(0,J.Z)(tt,2),ct=zt[0],rt=zt[1],It=$e!=null?$e:ct,ii=(0,$.Z)(function(at){$e===void 0&&rt(at)});(0,v.Z)(function(){rt($e||!1)},[$e]);var Yt=x.useRef(It);Yt.current=It;var pt=x.useRef([]);pt.current=[];var wt=(0,$.Z)(function(at){var At;ii(at),((At=pt.current[pt.current.length-1])!==null&&At!==void 0?At:It)!==at&&(pt.current.push(at),We==null||We(at))}),si=x.useRef(),Ht=function(){clearTimeout(si.current)},kt=function(At){var pi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ht(),pi===0?wt(At):si.current=setTimeout(function(){wt(At)},pi*1e3)};x.useEffect(function(){return Ht},[]);var ci=x.useState(!1),yt=(0,J.Z)(ci,2),jt=yt[0],Gi=yt[1];(0,v.Z)(function(at){(!at||It)&&Gi(!0)},[It]);var oi=x.useState(null),ei=(0,J.Z)(oi,2),Mi=ei[0],Ii=ei[1],Ni=x.useState(null),Ki=(0,J.Z)(Ni,2),Ei=Ki[0],Xi=Ki[1],Fi=function(At){Xi([At.clientX,At.clientY])},rn=Ze(It,Ci,dt&&Ei!==null?Ei:Nt,gt,Je,ze,Kt),gi=(0,J.Z)(rn,11),qi=gi[0],An=gi[1],mn=gi[2],an=gi[3],wn=gi[4],Yi=gi[5],Ji=gi[6],Pn=gi[7],Bi=gi[8],on=gi[9],Pi=gi[10],ji=it(fn,ye,Ae,Fe),ln=(0,J.Z)(ji,2),mt=ln[0],Qi=ln[1],nn=mt.has("click"),_n=Qi.has("click")||Qi.has("contextMenu"),In=(0,$.Z)(function(){jt||Pi()}),Hn=function(){Yt.current&&dt&&_n&&kt(!1)};Rt(It,Nt,Ci,In,Hn),(0,v.Z)(function(){In()},[Ei,gt]),(0,v.Z)(function(){It&&!(Je!=null&&Je[gt])&&In()},[JSON.stringify(ze)]);var jn=x.useMemo(function(){var at=L(Je,qe,on,dt);return p()(at,$t==null?void 0:$t(on))},[on,$t,Je,qe,dt]);x.useImperativeHandle(Ue,function(){return{nativeElement:ge.current,popupElement:ki.current,forceAlign:In}});var Fn=x.useState(0),ai=(0,J.Z)(Fn,2),ts=ai[0],as=ai[1],zn=x.useState(0),pn=(0,J.Z)(zn,2),os=pn[0],ls=pn[1],vn=function(){if(Mt&&Nt){var At=Nt.getBoundingClientRect();as(At.width),ls(At.height)}},Bn=function(){vn(),In()},On=function(At){Gi(!1),Pi(),_t==null||_t(At)},Rn=function(){return new Promise(function(At){vn(),Ii(function(){return At})})};(0,v.Z)(function(){Mi&&(Pi(),Mi(),Ii(null))},[Mi]);function en(at,At,pi,Ti){ke[at]=function(mi){var Un;Ti==null||Ti(mi),kt(At,pi);for(var ps=arguments.length,Dn=new Array(ps>1?ps-1:0),us=1;us<ps;us++)Dn[us-1]=arguments[us];(Un=we[at])===null||Un===void 0||Un.call.apply(Un,[we,mi].concat(Dn))}}(nn||_n)&&(ke.onClick=function(at){var At;Yt.current&&_n?kt(!1):!Yt.current&&nn&&(Fi(at),kt(!0));for(var pi=arguments.length,Ti=new Array(pi>1?pi-1:0),mi=1;mi<pi;mi++)Ti[mi-1]=arguments[mi];(At=we.onClick)===null||At===void 0||At.call.apply(At,[we,at].concat(Ti))});var Sn=xt(It,_n,Nt,Ci,qt,St,Ke,kt),Zn=mt.has("hover"),Vi=Qi.has("hover"),Et,li;Zn&&(en("onMouseEnter",!0,Pt,function(at){Fi(at)}),en("onPointerEnter",!0,Pt,function(at){Fi(at)}),Et=function(At){(It||jt)&&Ci!==null&&Ci!==void 0&&Ci.contains(At.target)&&kt(!0,Pt)},dt&&(ke.onMouseMove=function(at){var At;(At=we.onMouseMove)===null||At===void 0||At.call(we,at)})),Vi&&(en("onMouseLeave",!1,Ot),en("onPointerLeave",!1,Ot),li=function(){kt(!1,Ot)}),mt.has("focus")&&en("onFocus",!0,Zt),Qi.has("focus")&&en("onBlur",!1,Bt),mt.has("contextMenu")&&(ke.onContextMenu=function(at){var At;Yt.current&&Qi.has("contextMenu")?kt(!1):(Fi(at),kt(!0)),at.preventDefault();for(var pi=arguments.length,Ti=new Array(pi>1?pi-1:0),mi=1;mi<pi;mi++)Ti[mi-1]=arguments[mi];(At=we.onContextMenu)===null||At===void 0||At.call.apply(At,[we,at].concat(Ti))}),hn&&(ke.className=p()(we.className,hn));var un=(0,z.Z)((0,z.Z)({},we),ke),Ln={},Yn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Yn.forEach(function(at){Hi[at]&&(Ln[at]=function(){for(var At,pi=arguments.length,Ti=new Array(pi),mi=0;mi<pi;mi++)Ti[mi]=arguments[mi];(At=un[at])===null||At===void 0||At.call.apply(At,[un].concat(Ti)),Hi[at].apply(Hi,Ti)})});var Qn=x.cloneElement(be,(0,z.Z)((0,z.Z)({},un),Ln)),Xn={x:Yi,y:Ji},is=wi?(0,z.Z)({},wi!==!0?wi:{}):null;return x.createElement(x.Fragment,null,x.createElement(ie.Z,{disabled:!It,ref:Se,onResize:Bn},x.createElement(X,{getTriggerDOMNode:Li},Qn)),x.createElement(Ie.Provider,{value:Zi},x.createElement(q,{portal:ce,ref:di,prefixCls:qe,popup:ti,className:p()(Ye,jn),style:et,target:Nt,onMouseEnter:Et,onMouseLeave:li,onPointerEnter:Et,zIndex:De,open:It,keepDom:jt,fresh:vi,onClick:Gt,onPointerDownCapture:Sn,mask:qt,motion:st,maskMotion:ae,onVisibleChanged:On,onPrepare:Rn,forceRender:Le,autoDestroy:xi,getPopupContainer:Ui,align:on,arrow:is,arrowPos:Xn,ready:qi,offsetX:An,offsetY:mn,offsetR:an,offsetB:wn,onAlign:In,stretch:Mt,targetWidth:ts/Pn,targetHeight:os/Bi})))});return Re}var ri=Wt(ee.Z)},80109:function(Lt,Me,G){"use strict";G.r(Me),G.d(Me,{default:function(){return Ui}});var z=G(51257),J=G(25399),Ee=G(96599),ee=G(60242),N=G(37285),p=G(29787),ie=G(91882),Y=G(82326),u=G(45685),$=G(62957),b=G(59301),v=G(25690),m=G(90356),x=G(45937),S=G(36714),P=G(91297),C=Object.defineProperty,k=Object.defineProperties,I=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,q=(Le,Be,je)=>Be in Le?C(Le,Be,{enumerable:!0,configurable:!0,writable:!0,value:je}):Le[Be]=je,te=(Le,Be)=>{for(var je in Be||(Be={}))B.call(Be,je)&&q(Le,je,Be[je]);if(R)for(var je of R(Be))j.call(Be,je)&&q(Le,je,Be[je]);return Le},X=(Le,Be)=>k(Le,I(Be)),ve=(Le,Be,je)=>new Promise((ti,Ye)=>{var et=Je=>{try{Ut(je.next(Je))}catch(ze){Ye(ze)}},gt=Je=>{try{Ut(je.throw(Je))}catch(ze){Ye(ze)}},Ut=Je=>Je.done?ti(Je.value):Promise.resolve(Je.value).then(et,gt);Ut((je=je.apply(Le,Be)).next())});const Ie=[{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"}],xe=(Le,Be)=>{const je={};let ti=null;return Le.forEach(Ye=>{je[Ye.properties.uuid]=X(te({},Ye),{id:Ye.properties.uuid,children:[]})}),Be.forEach(Ye=>{const et=je[Ye.startNodeUuid],gt=je[Ye.endNodeUuid];et&&(et.id=et.properties.uuid),et&&gt&&et.children.push(gt)}),Le.forEach(Ye=>{!Be.some(gt=>gt.endNodeUuid===Ye.properties.uuid)&&(ti=je[Ye.properties.uuid])}),ti},it=(Le,Be)=>{const je=Le.getParentData(Be.id,"tree");return je?Be.style.x>je.style.x?"right":"left":"center"};var w=({loading:Le,nodes:Be=[],relationships:je=[]})=>{const ti=(0,b.useRef)(null),Ye=(0,b.useRef)(),et=(0,b.useRef)(0);(0,b.useEffect)(()=>{(Be==null?void 0:Be.length)>0&&gt()},[]);const gt=()=>ve(void 0,null,function*(){var Je,ze,De;const Mt=xe(Be==null?void 0:Be.map((Gt,Kt)=>{var wi,yi,tn,Oi,bi;return X(te({},Gt),{key:Kt,title:(wi=Gt==null?void 0:Gt.properties)==null?void 0:wi.name,newcolor:parseInt((yi=Gt==null?void 0:Gt.properties)==null?void 0:yi.color)===1?"#CC7CF5":((tn=Ie==null?void 0:Ie.find(fi=>{var $i;return(fi==null?void 0:fi.name)===(($i=Gt==null?void 0:Gt.properties)==null?void 0:$i.nodeType)}))==null?void 0:tn.color)||"#2D947C",colornodeType:parseInt((Oi=Gt==null?void 0:Gt.properties)==null?void 0:Oi.color)===1?"\u6839\u8282\u70B9":((bi=Ie==null?void 0:Ie.find(fi=>{var $i;return(fi==null?void 0:fi.name)===(($i=Gt==null?void 0:Gt.properties)==null?void 0:$i.nodeType)}))==null?void 0:bi.name)||"\u5176\u4ED6"})}),je==null?void 0:je.filter(Gt=>Gt.type==="\u5305\u542B"));Ye!=null&&Ye.current&&((Je=Ye==null?void 0:Ye.current)==null||Je.destroy());const $t=(0,P.RN)(Mt),vi=(ze=$t.nodes)==null?void 0:ze.filter((Gt,Kt,wi)=>Kt===wi.findIndex(yi=>yi.id===Gt.id)),dt=(De=$t.edges)==null?void 0:De.filter((Gt,Kt,wi)=>Kt===wi.findIndex(yi=>yi.source===Gt.source&&yi.target===Gt.target));Ut({nodes:vi,edges:dt})}),Ut=Je=>{var ze,De;Ye.current=null,Ye.current=new P.kJ({container:ti.current,autoResize:!0,autoFit:{type:((ze=Je==null?void 0:Je.nodes)==null?void 0:ze.length)>20?"view":"center",options:{direction:"both",when:"always"}},animation:!(((De=Je==null?void 0:Je.nodes)==null?void 0:De.length)>300),data:Je,node:{style:{labelText:Mt=>Mt.title,labelFill:"#333333",fill:Mt=>Mt.newcolor,labelBackground:!1,labelPlacement:function(Mt){const $t=it(this,Mt);return $t==="center"?"right":$t},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:Mt=>(et.current++,et.current%2==0?"left":"right")},behaviors:["zoom-canvas","collapse-expand","drag-canvas"]}),Ye.current.render()};return b.createElement("div",{style:{height:"100%"}},b.createElement(p.Z,{spinning:Le,className:"mt60 w100",tip:"\u52A0\u8F7D\u4E2D..."}),b.createElement("div",{style:{height:"100%"},ref:ti}))},L=G(9148),M=G(38986),H=G(346),F=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=",de="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=",Te="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==",Pe="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",Dt="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=",nt=Object.defineProperty,xt=Object.defineProperties,He=Object.getOwnPropertyDescriptors,Wt=Object.getOwnPropertySymbols,ri=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,Re=(Le,Be,je)=>Be in Le?nt(Le,Be,{enumerable:!0,configurable:!0,writable:!0,value:je}):Le[Be]=je,se=(Le,Be)=>{for(var je in Be||(Be={}))ri.call(Be,je)&&Re(Le,je,Be[je]);if(Wt)for(var je of Wt(Be))ce.call(Be,je)&&Re(Le,je,Be[je]);return Le},Ue=(Le,Be)=>xt(Le,He(Be));const Ve={\u5B9E\u8BAD:g,\u8BD5\u5377:D,\u8BFE\u4EF6:V,\u89C6\u9891:de,\u4E3B\u80FD\u529B:Pe,\u5B50\u80FD\u529B:Ne,\u77E5\u8BC6\u70B9:Ze,\u8D44\u6E90:Dt,\u603B\u6570:Te,\u6559\u6750:Rt};var K=({type:Le,ImgProps:Be})=>b.createElement("img",Ue(se({src:(Ve==null?void 0:Ve[Le])||(Ve==null?void 0:Ve.\u8BFE\u4EF6)},Be),{width:"16rem",style:se({width:"16rem"},(Be==null?void 0:Be.style)||{})})),oe=G(70453),ye=G(3736),Ae=G(81722),Fe=Object.defineProperty,$e=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable,ft=(Le,Be,je)=>Be in Le?Fe(Le,Be,{enumerable:!0,configurable:!0,writable:!0,value:je}):Le[Be]=je,Ot=(Le,Be)=>{for(var je in Be||(Be={}))_t.call(Be,je)&&ft(Le,je,Be[je]);if(We)for(var je of We(Be))Pt.call(Be,je)&&ft(Le,je,Be[je]);return Le},Zt=(Le,Be)=>$e(Le,bt(Be)),Bt=(Le,Be,je)=>new Promise((ti,Ye)=>{var et=Je=>{try{Ut(je.next(Je))}catch(ze){Ye(ze)}},gt=Je=>{try{Ut(je.throw(Je))}catch(ze){Ye(ze)}},Ut=Je=>Je.done?ti(Je.value):Promise.resolve(Je.value).then(et,gt);Ut((je=je.apply(Le,Be)).next())});const qt=({children:Le,cout:Be=1})=>{const je=(0,b.useRef)(null),[ti,Ye]=(0,b.useState)(0),[et,gt]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{je.current&&setTimeout(()=>{const Ut=(0,z.ZR)(je.current,"rem",1);Ye(Ut)},500)},[je.current]),b.createElement("div",{className:"relative flex item-end "},b.createElement("div",{style:{height:et?"auto":`${Be*23.25}rem`,overflow:"hidden"}},b.createElement("div",{ref:je,style:{fontSize:"14rem"}},Le)),ti>=Be*23.25&&b.createElement("div",{className:"current c-blue",style:{whiteSpace:"nowrap"},onClick:()=>{gt(!et)}},et?"\u6536\u8D77":"\u5C55\u793A"))},Jt=({DataProps:Le,pathsDetail:Be,getUrl:je})=>{var ti,Ye,et,gt;const{detail:Ut}=Be,[Je,ze]=(0,b.useState)(!1);return b.createElement("div",{id:`${Le==null?void 0:Le.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:Le==null?void 0:Le.name},b.createElement("div",{className:"multi_ellipsis1 minW-0"},Le==null?void 0:Le.name)),b.createElement("div",{className:"flex item-center",style:{gap:"5rem"}},(ti=Le==null?void 0:Le.ability_tags)==null?void 0:ti.map(De=>b.createElement(Ee.default,{color:"orange",style:{fontSize:"12rem"}},De)))),(Le==null?void 0:Le.description)&&b.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},b.createElement(qt,null,Le==null?void 0:Le.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"}}})," ",Le==null?void 0:Le.knowledge_count,"\u4E2A\u77E5\u8BC6\u70B9",b.createElement("span",{style:{marginLeft:"40rem"}},b.createElement(K,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),Le==null?void 0:Le.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",Le==null?void 0:Le.knowledge_count,"\u4E2A"),b.createElement("div",{style:{height:"320rem",background:"#F6F7F9"}},b.createElement(w,{loading:!1,nodes:Le==null?void 0:Le.nodes,relationships:Le==null?void 0:Le.relationships})),b.createElement("div",{style:{margin:"30rem 0 10rem"}},b.createElement(K,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),"\u8986\u76D6\u8D44\u6E90\u6570",Le==null?void 0:Le.resource_count,"\u4E2A"),b.createElement("div",{className:"flex-wrap",style:{gap:"10rem",display:"grid",gridTemplateColumns:"1fr 1fr"}},(gt=((Ye=Le==null?void 0:Le.resource_knowledge_graphs)==null?void 0:Ye.length)>4&&!Je?(et=Le==null?void 0:Le.resource_knowledge_graphs)==null?void 0:et.slice(0,4):Le==null?void 0:Le.resource_knowledge_graphs)==null?void 0:gt.map(De=>b.createElement("div",{key:De==null?void 0:De.id,className:"flex relative current",style:{gap:"10rem",padding:"25rem",background:"#f6f6f6",borderRadius:"10rem"},onClick:()=>Bt(void 0,null,function*(){yield je==null?void 0:je(De)})},!(Ut!=null&&Ut.can_managed)&&b.createElement("div",{className:"absolute c-white",style:{top:0,right:0,padding:"2rem 10rem",borderRadius:"0 10rem 0 10rem",color:(De==null?void 0:De.complete_rate)!=100&&"#7C3100",background:(De==null?void 0:De.complete_rate)!=100?"#FFC86B":"#37AD83"}},(De==null?void 0:De.complete_rate)==100?"\u5DF2\u5B8C\u6210":"\u672A\u5B8C\u6210"),b.createElement(ee.Z,{type:"circle",percent:De==null?void 0:De.complete_rate,size:60,status:"success",format:Mt=>`${Mt}%`,strokeWidth:10}),b.createElement(K,{type:De==null?void 0:De.node_type,ImgProps:{style:{width:"16rem",height:"16rem",marginTop:"3rem"}}}),b.createElement("div",{className:"flex-1 minW-0"},b.createElement(J.Z,{title:De==null?void 0:De.name,placement:"topLeft"},b.createElement("div",{className:"multi_ellipsis1 c-grey-333 blod",style:{fontSize:"16rem"}},De==null?void 0:De.name)),b.createElement("div",{className:"c-grey-333",style:{marginTop:"10rem",fontSize:"14rem"}},"\u77E5\u8BC6\u70B9\uFF1A",(De==null?void 0:De.knowledge_text)||"--"),(Ut==null?void 0:Ut.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",De==null?void 0:De.study_count,"\u4EBA"),b.createElement("div",null,"\u638C\u63E1\u4EBA\u6570\uFF1A",De==null?void 0:De.complete_count,"\u4EBA"),b.createElement("div",null,"\u638C\u63E1\u7387\uFF1A",De==null?void 0:De.complete_rate,"%")))))),(Le==null?void 0:Le.resource_knowledge_graphs.length)>4&&b.createElement("div",{className:"flex item-center justify-center",style:{padding:"0 220rem"},onClick:()=>{ze(!Je)}},b.createElement(N.Z,{style:{borderColor:"#3061D0",marginBottom:"0rem",cursor:"pointer"},dashed:!0},b.createElement("span",{style:{color:"#3061D0"}},Je?"\u70B9\u51FB\u6536\u8D77":"\u70B9\u51FB\u5C55\u5F00\u66F4\u591A"))))},St=({pathsDetail:Le,dispatch:Be,user:je})=>{var ti,Ye,et,gt,Ut,Je,ze,De,Mt,$t,vi,dt,Gt,Kt,wi,yi,tn,Oi,bi,fi,$i,hn,Li,Hi,xi,sn,Di,fn,Si,dn,zi,Zi,gn;const{detail:Vt}=Le,ni=(0,v.useParams)(),[Ci]=(0,v.useSearchParams)(),[Qt,ki]=(0,b.useState)({}),[di,xn]=(0,b.useState)({id:null,open:!1,resourceUrl:""}),[,Tt,Nt,Z]=(0,x.U)(S.Ju,{subject_id:ni.pathId,id:ni==null?void 0:ni.abilityId}),[ge,Se]=(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)"}}]),be=new URLSearchParams(window.location.search),we=()=>Bt(void 0,null,function*(){const ae=yield Nt({subject_id:ni==null?void 0:ni.pathId,id:ni==null?void 0:ni.abilityId})}),ke=ae=>Be({type:"userDetail/logWatchHistory",payload:Ot({},ae)});function Ke(ae){return Bt(this,null,function*(){var tt,zt,ct;let rt=yield(0,M.ZP)("/api/knowledge/v2/get_container_type.json",{method:"get",params:{url:ae==null?void 0:ae.resourceUrl}});if(localStorage.setItem("container_type_tupu",rt==null?void 0:rt.container_type),(rt==null?void 0:rt.status)===0){if((ae==null?void 0:ae.node_type)=="\u8BD5\u5377"){const It=yield(0,Ae.Mb)({categoryId:rt==null?void 0:rt.examination_bank_id});It!=null&&It.exercise_id&&(0,z.xg)(`/classrooms/coursesId/exercise/${It.exercise_id}/${(tt=je.userInfo)==null?void 0:tt.login}/initate_answer`);return}(rt==null?void 0:rt.container_type)==="video"?xn({id:rt==null?void 0:rt.id,open:!0,resourceUrl:ae==null?void 0:ae.resourceUrl}):(rt==null?void 0:rt.container_type)==="att"?ki({url:H.Z.API_SERVER+((zt=rt==null?void 0:rt.attachment)==null?void 0:zt.url),file_type:(ct=rt==null?void 0:rt.attachment)==null?void 0:ct.file_type}):window.open(ae==null?void 0:ae.resourceUrl)}})}const st=ae=>Bt(void 0,null,function*(){(ae==null?void 0:ae.resourceOrigin)===3?(0,z.xg)(ae==null?void 0:ae.resourceUrl):Ke(ae),!(Vt!=null&&Vt.can_managed)&&(yield(0,M.ZP)("/api/subject_knowledge/create_study.json",{method:"post",body:{subject_id:ni==null?void 0:ni.pathId,uuid:(ae==null?void 0:ae.last_knowledge_uuid)||(ae==null?void 0:ae.knowledge_uuid)}}))});return(0,b.useEffect)(()=>{var ae,tt;if((Z==null?void 0:Z.status)==0&&(Vt!=null&&Vt.can_managed)){const zt=(tt=Object==null?void 0:Object.entries(((ae=Z==null?void 0:Z.data)==null?void 0:ae.study_grasp_hash)||{}))==null?void 0:tt.map(([ct,rt],It)=>({name:ct,value:rt,itemStyle:ge[It].itemStyle}));Se(zt)}},[Vt==null?void 0:Vt.can_managed,Z]),(0,b.useEffect)(()=>{we()},[ni==null?void 0:ni.abilityId]),(0,b.useEffect)(()=>{Be({type:"pathsDetail/getKnowledgeGraphs",payload:{graphable_type:Ci.get("type")=="classrooms"?"course":"subject",graphable_id:ni==null?void 0:ni.pathId}}),be.set("tabs","5")},[]),(0,b.useEffect)(()=>(Be({type:"globalSetting/footerToggle",payload:!1}),()=>{Be({type:"globalSetting/footerToggle",payload:!0})}),[]),b.createElement(p.Z,{spinning:Tt},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:()=>{v.history.push(`/knowledgegraph/${ni.pathId}?${be}`)}},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(oe.Z,{isShow:!0,className:"c-grey-333",DataProps:((ti=Z==null?void 0:Z.data)==null?void 0:ti.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(ni==null?void 0:ni.abilityId),style:{marginTop:"10rem"},onChange:ae=>{v.history.push(`/knowledgegraph/${ni.pathId}/abilityMap/detail/${ae}?${be}`)},options:((et=(Ye=Z==null?void 0:Z.data)==null?void 0:Ye.ability_goals)==null?void 0:et.map(ae=>({label:ae==null?void 0:ae.name,value:ae==null?void 0:ae.id})))||[],size:"large"})),b.createElement(u.default,{className:_.AnchorDomStyle,items:(Ut=(gt=Z==null?void 0:Z.data)==null?void 0:gt.children_ability_goals)==null?void 0:Ut.map(ae=>{var tt;return{key:ae==null?void 0:ae.id,href:`#${ae==null?void 0:ae.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"}},ae==null?void 0:ae.name),b.createElement("span",{style:{color:"#464F66",fontSize:"12rem"}},Vt!=null&&Vt.can_managed?b.createElement(b.Fragment,null,b.createElement("span",{className:"iconfont icon-a-60-kejian",style:{marginRight:"5rem",fontSize:"12rem"}}),ae==null?void 0:ae.knowledge_count):b.createElement("span",{style:{color:"#00C088"}},b.createElement("span",{className:"iconfont icon-xuesheng2",style:{marginRight:"5rem",fontSize:"12rem"}}),(ae==null?void 0:ae.grasp_rate)||0,"%"))),b.createElement("div",{className:"flex flex-wrap",style:{gap:"5rem",marginTop:"10rem"}},(tt=ae==null?void 0:ae.ability_tags)==null?void 0:tt.map(zt=>b.createElement(Ee.default,{color:"orange",style:{fontSize:"12rem"},key:zt},zt))),b.createElement("div",{className:"multi_ellipsis2",style:{marginTop:"20rem",color:"#464F66",fontSize:"12rem"}},ae==null?void 0:ae.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"}},((ze=(Je=Z==null?void 0:Z.data)==null?void 0:Je.next_ability_goal)==null?void 0:ze.id)&&b.createElement("div",{className:"absolute current",style:{right:0,top:0},onClick:()=>{var ae,tt;v.history.push(`/knowledgegraph/${ni.pathId}/abilityMap/detail/${(tt=(ae=Z==null?void 0:Z.data)==null?void 0:ae.next_ability_goal)==null?void 0:tt.id}?${be}`)}},b.createElement("div",{className:_.NextAbility},b.createElement("div",{className:"multi_ellipsis1"},(Mt=(De=Z==null?void 0:Z.data)==null?void 0:De.next_ability_goal)==null?void 0:Mt.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"}},($t=Z==null?void 0:Z.data)==null?void 0:$t.name),((vi=Z==null?void 0:Z.data)==null?void 0:vi.description)&&b.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},b.createElement(qt,null,(dt=Z==null?void 0:Z.data)==null?void 0:dt.description)),(Vt==null?void 0:Vt.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:(Gt=Z==null?void 0:Z.data)==null?void 0:Gt.children_ability_goal_grasp_rate,unit:"%",img:G(46016),bg:"#E3F1FF"},{title:"\u8986\u76D6\u77E5\u8BC6\u70B9",value:(Kt=Z==null?void 0:Z.data)==null?void 0:Kt.total_knowledge_count,unit:"\u4E2A",img:G(99755),bg:"#F1FDEF",ProgressTitle:"\u5360\u603B\u77E5\u8BC6\u70B9",percent:(wi=Z==null?void 0:Z.data)==null?void 0:wi.knowledge_rate,trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u8986\u76D6\u8D44\u6E90\u6570",value:(yi=Z==null?void 0:Z.data)==null?void 0:yi.total_resource_count,unit:"\u4E2A",img:G(92691),bg:"#FFF9F4",ProgressTitle:"\u5360\u603B\u8D44\u6E90\u6570",percent:(tn=Z==null?void 0:Z.data)==null?void 0:tn.resource_rate,trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((ae,tt)=>b.createElement("div",{key:tt,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:ae==null?void 0:ae.bg,padding:"20rem 30rem"}},b.createElement("img",{src:ae==null?void 0:ae.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),b.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},ae==null?void 0:ae.title),b.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},ae==null?void 0:ae.value,b.createElement("span",{style:{fontSize:"14rem"}},ae==null?void 0:ae.unit)),(ae==null?void 0:ae.ProgressTitle)&&b.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},b.createElement("div",null,ae==null?void 0:ae.ProgressTitle,ae==null?void 0:ae.percent,"%"),b.createElement(ee.Z,{percent:ae==null?void 0:ae.percent,showInfo:!1,trailColor:ae==null?void 0:ae.trailColor,strokeColor:ae==null?void 0:ae.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:(Oi=Z==null?void 0:Z.data)==null?void 0:Oi.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:(fi=Z==null?void 0:Z.data)==null?void 0:fi.grasp_rate,unit:"%",img:G(55303),bg:"rgba(6, 145, 127, .1)"}].map((ae,tt)=>b.createElement("div",{key:tt,className:"relative",style:{borderRadius:"6rem",padding:"20rem",background:ae==null?void 0:ae.bg}},b.createElement("div",{style:{fontSize:"14rem"}},ae==null?void 0:ae.title),b.createElement("div",{className:"blod",style:{fontSize:"26rem"}},ae==null?void 0:ae.value,b.createElement("span",{style:{fontSize:"14rem"}},ae==null?void 0:ae.unit)),b.createElement("img",{className:"absolute",style:{right:"6rem",bottom:"6rem"},height:"35rem",src:ae==null?void 0:ae.img})))),b.createElement("div",{className:"flex-1 minW-0"},b.createElement(m.Z,{dataSource:ge,legend:{top:null,icon:"roundRect",bottom:10,itemWidth:14,itemGap:50,left:"center",formatter:ae=>ae}})))),!(Vt!=null&&Vt.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:($i=Z==null?void 0:Z.data)==null?void 0:$i.total_knowledge_count,unit:"\u4E2A",percent:(hn=Z==null?void 0:Z.data)==null?void 0:hn.knowledge_rate,percenttitle:"\u5360\u603B\u77E5\u8BC6\u70B9",trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u8986\u76D6\u8D44\u6E90\u6570",value:(Li=Z==null?void 0:Z.data)==null?void 0:Li.total_resource_count,unit:"\u4E2A",percent:(Hi=Z==null?void 0:Z.data)==null?void 0:Hi.resource_rate,percenttitle:"\u5360\u603B\u8D44\u6E90\u6570",trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((ae,tt)=>b.createElement("div",{key:tt,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"}},ae==null?void 0:ae.title),b.createElement("div",{className:"blod",style:{fontSize:"26rem"}},ae==null?void 0:ae.value,b.createElement("span",{style:{fontSize:"14rem"}},ae==null?void 0:ae.unit))),b.createElement("div",{className:"relative",style:{width:"133rem",height:"75rem"}},b.createElement(ee.Z,{type:"dashboard",percent:ae==null?void 0:ae.percent,gapDegree:178,strokeWidth:10,className:"absolute",style:{right:0,top:0},trailColor:ae==null?void 0:ae.trailColor,strokeColor:ae==null?void 0:ae.strokeColor,strokeLinecap:"round",format:zt=>b.createElement("div",{className:"c-grey-333",style:{fontSize:"12rem",textAlign:"center",marginTop:"-35rem"}},zt,"%",b.createElement("br",null),b.createElement("br",null),ae==null?void 0:ae.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:(xi=Z==null?void 0:Z.data)==null?void 0:xi.children_ability_goal_grasp_rate,unit:"%",img:G(46016),bg:"#E3F1FF"},{title:"\u5DF2\u638C\u63E1\u77E5\u8BC6\u70B9",value:((sn=Z==null?void 0:Z.data)==null?void 0:sn.knowledge_grasp_count)||0,unit:"\u4E2A",img:G(99755),bg:"#F1FDEF",ProgressTitle:"\u77E5\u8BC6\u70B9\u638C\u63E1\u7387",percent:((Di=Z==null?void 0:Z.data)==null?void 0:Di.knowledge_grasp_rate)||0,trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u5DF2\u5B8C\u6210\u8D44\u6E90\u6570",value:((fn=Z==null?void 0:Z.data)==null?void 0:fn.resource_complete_count)||0,unit:"\u4E2A",img:G(92691),bg:"#FFF9F4",ProgressTitle:"\u5B8C\u6210\u8D44\u6E90\u7387",percent:((Si=Z==null?void 0:Z.data)==null?void 0:Si.resource_complete_rate)||0,trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((ae,tt)=>b.createElement("div",{key:tt,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:ae==null?void 0:ae.bg,padding:"20rem 30rem"}},b.createElement("img",{src:ae==null?void 0:ae.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),b.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},ae==null?void 0:ae.title),b.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},ae==null?void 0:ae.value,b.createElement("span",{style:{fontSize:"14rem"}},ae==null?void 0:ae.unit)),(ae==null?void 0:ae.ProgressTitle)&&b.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},b.createElement("div",null,ae==null?void 0:ae.ProgressTitle,ae==null?void 0:ae.percent,"%"),b.createElement(ee.Z,{percent:ae==null?void 0:ae.percent,showInfo:!1,trailColor:ae==null?void 0:ae.trailColor,strokeColor:ae==null?void 0:ae.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"}},(zi=(dn=Z==null?void 0:Z.data)==null?void 0:dn.children_ability_goals)==null?void 0:zi.map(ae=>b.createElement("div",{key:ae==null?void 0:ae.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:ae==null?void 0:ae.name,placement:"topLeft"},b.createElement("div",{className:"multi_ellipsis1"},ae==null?void 0:ae.name))),b.createElement("div",{className:"flex item-center",style:{gap:"10rem",marginTop:"15rem",fontSize:"14rem"}},b.createElement(Ee.default,{color:"orange",style:{fontSize:"12rem",lineHeight:"1.5"}},"\u8282\u70B9"),b.createElement("span",{className:"c-grey-333"},ae==null?void 0:ae.last_knowledge_name),ae!=null&&ae.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:()=>Bt(void 0,null,function*(){yield st(ae)})},(ae==null?void 0:ae.complete_rate)==0?"\u5F00\u59CB\u5B66\u4E60":"\u7EE7\u7EED\u5B66\u4E60")))))),(gn=(Zi=Z==null?void 0:Z.data)==null?void 0:Zi.children_ability_goals)==null?void 0:gn.map(ae=>b.createElement(Jt,{key:ae==null?void 0:ae.id,DataProps:ae,pathsDetail:Le,getUrl:st}))))),b.createElement($.default,{open:di==null?void 0:di.open,title:"\u89C6\u9891",width:800,centered:!0,onCancel:()=>{xn(Zt(Ot({},di),{open:!1}))},onOk:()=>{xn(Zt(Ot({},di),{open:!1}))}},b.createElement(ye.Z,{allow_skip:!0,videoId:di.id,toLog:!0,src:di==null?void 0:di.resourceUrl,logWatchHistory:ae=>ke(Zt(Ot({},ae),{container_type:localStorage.getItem("container_type_tupu")}))})),b.createElement(F.Z,{close:!0,style:{zIndex:1300,background:"rgba(1, 10, 35, 0.5)"},data:Qt==null?void 0:Qt.url,type:Qt==null?void 0:Qt.file_type,disabledDownload:!0,onClose:()=>ki({})}))};var Ui=(0,v.connect)(({pathsDetail:Le,user:Be})=>({pathsDetail:Le,user:Be}))(St)},45685:function(Lt,Me,G){"use strict";G.d(Me,{default:function(){return U}});var z=G(95190),J=G(59301),Ee=G(92310),ee=G.n(Ee),N=G(6089),p=G(16722),ie=G(97224),Y=G(83010),u=G(48608),$=G(48755),b=G(83397),m=J.createContext(void 0),S=w=>{const{href:L,title:M,prefixCls:H,children:F,className:_,target:g,replace:D}=w,V=J.useContext(m),{registerLink:de,unregisterLink:Te,scrollTo:Pe,onClick:Ne,activeLink:Ze,direction:Dt}=V||{};J.useEffect(()=>(de==null||de(L),()=>{Te==null||Te(L)}),[L]);const Rt=ce=>{Ne==null||Ne(ce,{title:M,href:L}),Pe==null||Pe(L),D&&(ce.preventDefault(),window.location.replace(L))},{getPrefixCls:nt}=J.useContext($.E_),xt=nt("anchor",H),He=Ze===L,Wt=ee()(`${xt}-link`,_,{[`${xt}-link-active`]:He}),ri=ee()(`${xt}-link-title`,{[`${xt}-link-title-active`]:He});return J.createElement("div",{className:Wt},J.createElement("a",{className:ri,href:L,title:typeof M=="string"?M:"",target:g,onClick:Rt},M),Dt!=="horizontal"?F:null)},P=G(93083),C=G(63356),k=G(16931),I=G(51636);const R=w=>{const{componentCls:L,holderOffsetBlock:M,motionDurationSlow:H,lineWidthBold:F,colorPrimary:_,lineType:g,colorSplit:D,calc:V}=w;return{[`${L}-wrapper`]:{marginBlockStart:V(M).mul(-1).equal(),paddingBlockStart:M,[L]:Object.assign(Object.assign({},(0,C.Wf)(w)),{position:"relative",paddingInlineStart:F,[`${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)(F)} ${g} ${D}`,content:'" "'},[`${L}-ink`]:{position:"absolute",insetInlineStart:0,display:"none",transform:"translateY(-50%)",transition:`top ${H} ease-in-out`,width:F,backgroundColor:_,[`&${L}-ink-visible`]:{display:"inline-block"}}}},[`${L}-fixed ${L}-ink ${L}-ink`]:{display:"none"}}}},B=w=>{const{componentCls:L,motionDurationSlow:M,lineWidthBold:H,colorPrimary:F}=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 ${M} ease-in-out, width ${M} ease-in-out`,height:H,backgroundColor:F}}}}},j=w=>({linkPaddingBlock:w.paddingXXS,linkPaddingInlineStart:w.padding});var q=(0,k.I$)("Anchor",w=>{const{fontSize:L,fontSizeLG:M,paddingXXS:H,calc:F}=w,_=(0,I.mergeToken)(w,{holderOffsetBlock:H,anchorPaddingBlockSecondary:F(H).div(2).equal(),anchorTitleBlock:F(L).div(14).mul(3).equal(),anchorBallSize:F(M).div(2).equal()});return[R(_),B(_)]},j);function te(){return window}function X(w,L){if(!w.getClientRects().length)return 0;const M=w.getBoundingClientRect();return M.width||M.height?L===window?M.top-w.ownerDocument.documentElement.clientTop:M.top-L.getBoundingClientRect().top:M.top}const ve=/#([\S ]+)$/;var xe=w=>{var L;const{rootClassName:M,prefixCls:H,className:F,style:_,offsetTop:g,affix:D=!0,showInkInFixed:V=!1,children:de,items:Te,direction:Pe="vertical",bounds:Ne,targetOffset:Ze,onClick:Dt,onChange:Rt,getContainer:nt,getCurrentAnchor:xt,replace:He}=w,[Wt,ri]=J.useState([]),[ce,Re]=J.useState(null),se=J.useRef(ce),Ue=J.useRef(null),Ve=J.useRef(null),qe=J.useRef(!1),{direction:K,getPrefixCls:oe,className:ye,style:Ae}=(0,$.dj)("anchor"),{getTargetContainer:Fe}=J.useContext($.E_),$e=oe("anchor",H),bt=(0,b.Z)($e),[We,_t,Pt]=q($e,bt),ft=(L=nt!=null?nt:Fe)!==null&&L!==void 0?L:te,Ot=JSON.stringify(Wt),Zt=(0,N.Z)(ze=>{Wt.includes(ze)||ri(De=>[].concat((0,z.Z)(De),[ze]))}),Bt=(0,N.Z)(ze=>{Wt.includes(ze)&&ri(De=>De.filter(Mt=>Mt!==ze))}),qt=()=>{var ze;const De=(ze=Ue.current)===null||ze===void 0?void 0:ze.querySelector(`.${$e}-link-title-active`);if(De&&Ve.current){const{style:Mt}=Ve.current,$t=Pe==="horizontal";Mt.top=$t?"":`${De.offsetTop+De.clientHeight/2}px`,Mt.height=$t?"":`${De.clientHeight}px`,Mt.left=$t?`${De.offsetLeft}px`:"",Mt.width=$t?`${De.clientWidth}px`:"",$t&&(0,p.Z)(De,{scrollMode:"if-needed",block:"nearest"})}},Jt=function(ze){let De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Mt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;const $t=[],vi=ft();return ze.forEach(dt=>{const Gt=ve.exec(dt==null?void 0:dt.toString());if(!Gt)return;const Kt=document.getElementById(Gt[1]);if(Kt){const wi=X(Kt,vi);wi<=De+Mt&&$t.push({link:dt,top:wi})}}),$t.length?$t.reduce((Gt,Kt)=>Kt.top>Gt.top?Kt:Gt).link:""},St=(0,N.Z)(ze=>{if(se.current===ze)return;const De=typeof xt=="function"?xt(ze):ze;Re(De),se.current=De,Rt==null||Rt(ze)}),Ui=J.useCallback(()=>{if(qe.current)return;const ze=Jt(Wt,Ze!==void 0?Ze:g||0,Ne);St(ze)},[Ot,Ze,g]),Le=J.useCallback(ze=>{St(ze);const De=ve.exec(ze);if(!De)return;const Mt=document.getElementById(De[1]);if(!Mt)return;const $t=ft(),vi=(0,ie.Z)($t),dt=X(Mt,$t);let Gt=vi+dt;Gt-=Ze!==void 0?Ze:g||0,qe.current=!0,(0,Y.Z)(Gt,{getContainer:ft,callback(){qe.current=!1}})},[Ze,g]),Be=ee()(_t,Pt,bt,M,`${$e}-wrapper`,{[`${$e}-wrapper-horizontal`]:Pe==="horizontal",[`${$e}-rtl`]:K==="rtl"},F,ye),je=ee()($e,{[`${$e}-fixed`]:!D&&!V}),ti=ee()(`${$e}-ink`,{[`${$e}-ink-visible`]:ce}),Ye=Object.assign(Object.assign({maxHeight:g?`calc(100vh - ${g}px)`:"100vh"},Ae),_),et=ze=>Array.isArray(ze)?ze.map(De=>J.createElement(S,Object.assign({replace:He},De,{key:De.key}),Pe==="vertical"&&et(De.children))):null,gt=J.createElement("div",{ref:Ue,className:Be,style:Ye},J.createElement("div",{className:je},J.createElement("span",{className:ti,ref:Ve}),"items"in w?et(Te):de));J.useEffect(()=>{const ze=ft();return Ui(),ze==null||ze.addEventListener("scroll",Ui),()=>{ze==null||ze.removeEventListener("scroll",Ui)}},[Ot]),J.useEffect(()=>{typeof xt=="function"&&St(xt(se.current||""))},[xt]),J.useEffect(()=>{qt()},[Pe,xt,Ot,ce]);const Ut=J.useMemo(()=>({registerLink:Zt,unregisterLink:Bt,scrollTo:Le,activeLink:ce,onClick:Dt,direction:Pe}),[ce,Dt,Le,Pe]),Je=D&&typeof D=="object"?D:void 0;return We(J.createElement(m.Provider,{value:Ut},D?J.createElement(u.Z,Object.assign({offsetTop:g,target:ft},Je),gt):gt))};const it=xe;it.Link=S;var U=it},25769:function(Lt,Me,G){"use strict";var z=G(98040),J={"text/plain":"Text","text/html":"Url",default:"Text"},Ee="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 N(p,ie){var Y,u,$,b,v,m,x=!1;ie||(ie={}),Y=ie.debug||!1;try{$=z(),b=document.createRange(),v=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),v.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"),u=ee("message"in ie?ie.message:Ee),window.prompt(u,p)}}finally{v&&(typeof v.removeRange=="function"?v.removeRange(b):v.removeAllRanges()),m&&document.body.removeChild(m),$()}return x}Lt.exports=N},53184:function(Lt,Me,G){"use strict";var z,J;function Ee(ee,N,p){var ie=function(Y,u){return ee.js_beautify(Y,u)};return ie.js=ee.js_beautify,ie.css=N.css_beautify,ie.html=p.html_beautify,ie.js_beautify=ee.js_beautify,ie.css_beautify=N.css_beautify,ie.html_beautify=p.html_beautify,ie}z=[G(58553),G(87804),G(40998)],J=function(ee,N,p){return Ee(ee,N,p)}.apply(Me,z),J!==void 0&&(Lt.exports=J)},87804:function(Lt,Me){var G,z;(function(){var J;(function(){"use strict";var ee=[,,function(Y){function u(v){this.__parent=v,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=[]}u.prototype.clone_empty=function(){var v=new u(this.__parent);return v.set_indent(this.__indent_count,this.__alignment_count),v},u.prototype.item=function(v){return v<0?this.__items[this.__items.length+v]:this.__items[v]},u.prototype.has_match=function(v){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(v))return!0;return!1},u.prototype.set_indent=function(v,m){this.is_empty()&&(this.__indent_count=v||0,this.__alignment_count=m||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},u.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)},u.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},u.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var v=this.__parent.current_line;return v.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),v.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),v.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,v.__items[0]===" "&&(v.__items.splice(0,1),v.__character_count-=1),!0}return!1},u.prototype.is_empty=function(){return this.__items.length===0},u.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},u.prototype.push=function(v){this.__items.push(v);var m=v.lastIndexOf(`
`);m!==-1?this.__character_count=v.length-m:this.__character_count+=v.length},u.prototype.pop=function(){var v=null;return this.is_empty()||(v=this.__items.pop(),this.__character_count-=v.length),v},u.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},u.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},u.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},u.prototype.toString=function(){var v="";return this.is_empty()?this.__parent.indent_empty_lines&&(v=this.__parent.get_indent_string(this.__indent_count)):(v=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),v+=this.__items.join("")),v};function $(v,m){this.__cache=[""],this.__indent_size=v.indent_size,this.__indent_string=v.indent_char,v.indent_with_tabs||(this.__indent_string=new Array(v.indent_size+1).join(v.indent_char)),m=m||"",v.indent_level>0&&(m=new Array(v.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}$.prototype.get_indent_size=function(v,m){var x=this.__base_string_length;return m=m||0,v<0&&(x=0),x+=v*this.__indent_size,x+=m,x},$.prototype.get_indent_string=function(v,m){var x=this.__base_string;return m=m||0,v<0&&(v=0,x=""),m+=v*this.__indent_size,this.__ensure_cache(m),x+=this.__cache[m],x},$.prototype.__ensure_cache=function(v){for(;v>=this.__cache.length;)this.__add_column()},$.prototype.__add_column=function(){var v=this.__cache.length,m=0,x="";this.__indent_size&&v>=this.__indent_size&&(m=Math.floor(v/this.__indent_size),v-=m*this.__indent_size,x=new Array(m+1).join(this.__indent_string)),v&&(x+=new Array(v+1).join(" ")),this.__cache.push(x)};function b(v,m){this.__indent_cache=new $(v,m),this.raw=!1,this._end_with_newline=v.end_with_newline,this.indent_size=v.indent_size,this.wrap_line_length=v.wrap_line_length,this.indent_empty_lines=v.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new u(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(v,m){return this.__indent_cache.get_indent_string(v,m)},b.prototype.get_indent_size=function(v,m){return this.__indent_cache.get_indent_size(v,m)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(v){return this.is_empty()||!v&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(v){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 v!==`
`&&(x=x.replace(/[\n]/g,v)),x},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(v,m){return v=v||0,m=m||0,this.next_line.set_indent(v,m),this.__lines.length>1?(this.current_line.set_indent(v,m),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(v){for(var m=0;m<v.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(v.whitespace_before),this.current_line.push(v.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(v){this.__add_space_before_token(),this.current_line.push(v),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(v){for(var m=this.__lines.length;v<m;)this.__lines[v]._remove_indent(),v++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(v){for(v=v===void 0?!1:v,this.current_line.trim();v&&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(v,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(v)!==0&&S.item(-1)!==m){this.__lines.splice(x+1,0,new u(this)),this.previous_line=this.__lines[this.__lines.length-2];break}x--}},Y.exports.Output=b},,,,function(Y){function u(v,m){this.raw_options=$(v,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"])}u.prototype._get_array=function(v,m){var x=this.raw_options[v],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},u.prototype._get_boolean=function(v,m){var x=this.raw_options[v],S=x===void 0?!!m:!!x;return S},u.prototype._get_characters=function(v,m){var x=this.raw_options[v],S=m||"";return typeof x=="string"&&(S=x.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},u.prototype._get_number=function(v,m){var x=this.raw_options[v];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(x,10);return isNaN(S)&&(S=m),S},u.prototype._get_selection=function(v,m,x){var S=this._get_selection_list(v,m,x);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+v+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[v]+"'");return S[0]},u.prototype._get_selection_list=function(v,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(v,x);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+v+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[v]+"'");return S},u.prototype._is_valid_selection=function(v,m){return v.length&&m.length&&!v.some(function(x){return m.indexOf(x)===-1})};function $(v,m){var x={};v=b(v);var S;for(S in v)S!==m&&(x[S]=v[S]);if(m&&v[m])for(S in v[m])x[S]=v[m][S];return x}function b(v){var m={},x;for(x in v){var S=x.replace(/-/g,"_");m[S]=v[x]}return m}Y.exports.Options=u,Y.exports.normalizeOpts=b,Y.exports.mergeOpts=$},,function(Y){var u=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 v=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(v=this.__input.charAt(b)),v},$.prototype.__match=function(b,v){b.lastIndex=v;var m=b.exec(this.__input);return m&&!(u&&b.sticky)&&m.index!==v&&(m=null),m},$.prototype.test=function(b,v){return v=v||0,v+=this.__position,v>=0&&v<this.__input_length?!!this.__match(b,v):!1},$.prototype.testChar=function(b,v){var m=this.peek(v);return b.lastIndex=0,m!==null&&b.test(m)},$.prototype.match=function(b){var v=this.__match(b,this.__position);return v?this.__position+=v[0].length:v=null,v},$.prototype.read=function(b,v,m){var x="",S;return b&&(S=this.match(b),S&&(x+=S[0])),v&&(S||!b)&&(x+=this.readUntil(v,m)),x},$.prototype.readUntil=function(b,v){var m="",x=this.__position;b.lastIndex=this.__position;var S=b.exec(this.__input);return S?(x=S.index,v&&(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,v){var m=null,x="g";return v&&u&&(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 v=this.__position,m=this.readUntilAfter(b);return this.__position=v,m},$.prototype.lookBack=function(b){var v=this.__position-1;return v>=b.length&&this.__input.substring(v-b.length,v).toLowerCase()===b},Y.exports.InputScanner=$},,,,,function(Y){function u($,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")}u.prototype.get_directives=function($){if(!$.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var v=this.__directive_pattern.exec($);v;)b[v[1]]=v[2],v=this.__directive_pattern.exec($);return b},u.prototype.readIgnored=function($){return $.readUntilAfter(this.__directives_end_ignore_pattern)},Y.exports.Directives=u},,function(Y,u,$){var b=$(16).Beautifier,v=$(17).Options;function m(x,S){var P=new b(x,S);return P.beautify()}Y.exports=m,Y.exports.defaultOptions=function(){return new v}},function(Y,u,$){var b=$(17).Options,v=$(2).Output,m=$(8).InputScanner,x=$(13).Directives,S=new x(/\/\*/,/\*\//),P=/\r\n|[\r\n]/,C=/\r\n|[\r\n]/g,k=/\s/,I=/(?:\s|\n)+/g,R=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,B=/\/\/(?:[^\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 v(this._options,X),this._input=new m(q),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ve=0,Ie=!1,xe=!1,it=!1,U=!1,w=!1,L=this._ch,M=!1,H,F,_;H=this._input.read(I),F=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(R),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(B)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(F),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),ve===0&&V.indexOf(":")!==-1&&(xe=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(F),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var de=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);de.match(/[ :]$/)&&(de=this.eatString(": ").replace(/\s+$/,""),this.print_string(de),this._output.space_before_token=!0),ve===0&&de.indexOf(":")!==-1?(xe=!0,this.indent()):de in this.NESTED_AT_RULE?(this._nestedLevel+=1,de in this.CONDITIONAL_GROUP_RULE&&(it=!0)):ve===0&&!xe&&(U=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(F),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")xe&&(xe=!1,this.outdent()),U=!1,it?(it=!1,Ie=this._indentLevel>=this._nestedLevel):Ie=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&Ie&&this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(_==="("?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),xe&&(this.outdent(),xe=!1),this.print_string(this._ch),Ie=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&this._input.peek()!=="}"&&this._output.add_new_line(!0),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var Te=0;Te<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Te++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Te])){M=!0;break}(Ie||it)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!U&&ve===0?(this.print_string(":"),xe||(xe=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Pe=_==='"'||_==="'";this.preserveSingleSpace(Pe||F),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")M=!1,ve===0?(xe&&(this.outdent(),xe=!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(),ve++,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(")")),ve&&(ve--,this.outdent()));else{var Ne=!1;this._input.lookBack("with")&&(Ne=!0),this.preserveSingleSpace(F||Ne),this.print_string(this._ch),xe&&_==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),w=!0):(this.eatWhitespace(),ve++,this.indent())}else if(this._ch===")")ve&&(ve--,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&&(!xe||w)&&ve===0&&!U?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!xe&&ve===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(F),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||F),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&M&&this._output.add_new_line()}var Dt=this._output.get_code(te);return Dt},Y.exports.Beautifier=j},function(Y,u,$){var b=$(6).Options;function v(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]}v.prototype=new b,Y.exports.Options=v}],N={};function p(Y){var u=N[Y];if(u!==void 0)return u.exports;var $=N[Y]={exports:{}};return ee[Y]($,$.exports,p),$.exports}var ie=p(15);J=ie})();var Ee=J;G=[],z=function(){return{css_beautify:Ee}}.apply(Me,G),z!==void 0&&(Lt.exports=z)})()},40998:function(Lt,Me,G){var z,J;(function(){var Ee;(function(){"use strict";var ie=[,,function(b){function v(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=[]}v.prototype.clone_empty=function(){var S=new v(this.__parent);return S.set_indent(this.__indent_count,this.__alignment_count),S},v.prototype.item=function(S){return S<0?this.__items[this.__items.length+S]:this.__items[S]},v.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},v.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))},v.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)},v.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},v.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},v.prototype.is_empty=function(){return this.__items.length===0},v.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},v.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},v.prototype.pop=function(){var S=null;return this.is_empty()||(S=this.__items.pop(),this.__character_count-=S.length),S},v.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},v.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},v.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},v.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 v(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 v(this)),this.previous_line=this.__lines[this.__lines.length-2];break}C--}},b.exports.Output=x},function(b){function v(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=v},,,function(b){function v(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"])}v.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},v.prototype._get_boolean=function(S,P){var C=this.raw_options[S],k=C===void 0?!!P:!!C;return k},v.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},v.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},v.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]},v.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},v.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=v,b.exports.normalizeOpts=x,b.exports.mergeOpts=m},,function(b){var v=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&&!(v&&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&&v&&(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,v,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"},I=function(R,B){this._input=new x(R),this._options=B||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new C(this._input)};I.prototype.tokenize=function(){this._input.restart(),this.__tokens=new P,this._reset();for(var R,B=new S(k.START,""),j=null,q=[],te=new P;B.type!==k.EOF;){for(R=this._get_next_token(B,j);this._is_comment(R);)te.add(R),R=this._get_next_token(B,j);te.isEmpty()||(R.comments_before=te,te=new P),R.parent=j,this._is_opening(R)?(q.push(j),j=R):j&&this._is_closing(R,j)&&(R.opened=j,j.closed=R,j=q.pop(),R.parent=j),R.previous=B,B.next=R,this.__tokens.add(R),B=R}return this.__tokens},I.prototype._is_first_token=function(){return this.__tokens.isEmpty()},I.prototype._reset=function(){},I.prototype._get_next_token=function(R,B){this._readWhitespace();var j=this._input.read(/.+/g);return j?this._create_token(k.RAW,j):this._create_token(k.EOF,"")},I.prototype._is_comment=function(R){return!1},I.prototype._is_opening=function(R){return!1},I.prototype._is_closing=function(R,B){return!1},I.prototype._create_token=function(R,B){var j=new S(R,B,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return j},I.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},b.exports.Tokenizer=I,b.exports.TOKEN=k},function(b){function v(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}v.prototype.restart=function(){this.__position=0},v.prototype.isEmpty=function(){return this.__tokens_length===0},v.prototype.hasNext=function(){return this.__position<this.__tokens_length},v.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},v.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},v.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},b.exports.TokenStream=v},function(b,v,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,I=[],R=P.exec(C);R;)I.push(C.substring(k,R.index)),k=R.index+R[0].length,R=P.exec(C);return k<C.length?I.push(C.substring(k,C.length)):I.push(""),I},b.exports.WhitespacePattern=S},function(b){function v(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)}v.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},v.prototype.read_match=function(){return this._input.match(this._match_pattern)},v.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},v.prototype.until=function(m){var x=this._create();return x._until_after=!1,x._until_pattern=this._input.get_regexp(m),x._update(),x},v.prototype.starting_with=function(m){var x=this._create();return x._starting_pattern=this._input.get_regexp(m,!0),x._update(),x},v.prototype.matching=function(m){var x=this._create();return x._match_pattern=this._input.get_regexp(m,!0),x._update(),x},v.prototype._create=function(){return new v(this._input,this)},v.prototype._update=function(){},b.exports.Pattern=v},function(b){function v(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")}v.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},v.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},b.exports.Directives=v},function(b,v,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 I=new x(C);this.__patterns={handlebars_comment:I.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:I.starting_with(/{{{/).until_after(/}}}/),handlebars:I.starting_with(/{{/).until_after(/}}/),php:I.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:I.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:I.starting_with(/{%/).until_after(/%}/),django_value:I.starting_with(/{{/).until_after(/}}/),django_comment:I.starting_with(/{#/).until_after(/#}/),smarty:I.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:I.starting_with(/{\*/).until_after(/\*}/),smarty_literal:I.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 I in S)k._disabled[I]=C.templating.indexOf(I)===-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 I=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&I==="?"&&(C=C||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&I==="%"&&(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,v,m){var x=m(19).Beautifier,S=m(20).Options;function P(C,k,I,R){var B=new x(C,k,I,R);return B.beautify()}b.exports=P,b.exports.defaultOptions=function(){return new S}},function(b,v,m){var x=m(20).Options,S=m(2).Output,P=m(21).Tokenizer,C=m(21).TOKEN,k=/\r\n|[\r\n]/,I=/\r\n|[\r\n]/g,R=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)};R.prototype.current_line_has_match=function(U){return this._output.current_line.has_match(U)},R.prototype.set_space_before_token=function(U,w){this._output.space_before_token=U,this._output.non_breaking_space=w},R.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},R.prototype.add_raw_token=function(U){this._output.add_raw_token(U)},R.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},R.prototype.traverse_whitespace=function(U){return U.whitespace_before||U.newlines?(this.print_preserved_newlines(U)||(this._output.space_before_token=!0),!0):!1},R.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},R.prototype.print_newline=function(U){this._output.add_new_line(U)},R.prototype.print_token=function(U){U.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(U.text))},R.prototype.indent=function(){this.indent_level++},R.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},R.prototype.get_full_indent=function(U){return U=this.indent_level+(U||0),U<1?"":this._output.get_indent_string(U)};var B=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,M=null;return w.closed?(U==="script"?L="text/javascript":U==="style"&&(L="text/css"),L=B(w)||L,L.search("text/css")>-1?M="css":L.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?M="javascript":L.search(/(text|application|dojo)\/(x-)?(html)/)>-1?M="html":L.search(/test\/null/)>-1&&(M="null"),M):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 ve(U,w,L,M){this._source_text=U||"",w=w||{},this._js_beautify=L,this._css_beautify=M,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"}ve.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(I,`
`);var L=U.match(/^[\t ]*/)[0],M={text:"",type:""},H=new Ie(this._options),F=new R(this._options,L),_=new P(U,this._options).tokenize();this._tag_stack=new X(F);for(var g=null,D=_.next();D.type!==C.EOF;)D.type===C.TAG_OPEN||D.type===C.COMMENT?(g=this._handle_tag_open(F,D,H,M,_),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(F,D,H,M):D.type===C.TAG_CLOSE?g=this._handle_tag_close(F,D,H):D.type===C.TEXT?g=this._handle_text(F,D,H):D.type===C.CONTROL_FLOW_OPEN?g=this._handle_control_flow_open(F,D):D.type===C.CONTROL_FLOW_CLOSE?g=this._handle_control_flow_close(F,D):F.add_raw_token(D),M=g,D=_.next();var V=F._output.get_code(w);return V},ve.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},ve.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},ve.prototype._handle_tag_close=function(U,w,L){var M={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(),M},ve.prototype._handle_inside_tag=function(U,w,L,M){var H=L.has_wrapped_attrs,F={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&&(M.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),F},ve.prototype._handle_text=function(U,w,L){var M={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)),M},ve.prototype._print_custom_beatifier_text=function(U,w,L){var M=this;if(w.text!==""){var H=w.text,F,_=1,g="",D="";L.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?F=this._js_beautify:L.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?F=this._css_beautify:L.custom_beautifier_name==="html"&&(F=function(Ze,Dt){var Rt=new ve(Ze,Dt,M._js_beautify,M._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 de=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(H);if(!de){U.add_raw_token(w);return}g=V+de[1]+`
`,H=de[4],de[5]&&(D=V+de[5]),H=H.replace(/\n[ \t]*$/,""),(de[2]||de[3].indexOf(`
`)!==-1)&&(de=de[3].match(/[ \t]+$/),de&&(w.whitespace_before=de[0]))}if(H)if(F){var Te=function(){this.eol=`
`};Te.prototype=this._options.raw_options;var Pe=new Te;H=F(V+H,Pe)}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))}},ve.prototype._handle_tag_open=function(U,w,L,M,H){var F=this._get_tag_open_token(w);if((L.is_unformatted||L.is_content_unformatted)&&!L.is_empty_element&&w.type===C.TAG_OPEN&&!F.is_start_tag?(U.add_raw_token(w),F.start_tag_token=this._tag_stack.try_pop(F.tag_name)):(U.traverse_whitespace(w),this._set_tag_position(U,w,F,L,M),F.is_inline_element||U.set_wrap_point(),U.print_token(w)),F.is_start_tag&&this._is_wrap_attributes_force){var _=0,g;do g=H.peek(_),g.type===C.ATTRIBUTE&&(F.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)&&(F.alignment_size=w.text.length+1),!F.tag_complete&&!F.is_unformatted&&(U.alignment_size=F.alignment_size),F};var Ie=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 M;this.tag_start_char=L.text[0],this.text=L.text,this.tag_start_char==="<"?(M=L.text.match(/^<([^\s>]*)/),this.tag_check=M?M[1]:""):(M=L.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=M?M[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)))}};ve.prototype._get_tag_open_token=function(U){var w=new Ie(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},ve.prototype._set_tag_position=function(U,w,L,M,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 F=U.current_line_has_match(/{{#if/);F||U.print_newline(!1)}L.tag_name==="!--"&&H.type===C.TAG_CLOSE&&M.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&&!(M.is_inline_element||M.is_unformatted)&&!(H.type===C.TAG_CLOSE&&L.start_tag_token===M)&&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)},ve.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 xe=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","menu","nav","ol","p","pre","section","table","ul"],it=["a","audio","del","ins","map","noscript","video"];ve.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"&&xe.indexOf(U.tag_name)!==-1){var L=U.parent.parent;(!L||it.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=ve},function(b,v,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,v,m){var x=m(9).Tokenizer,S=m(9).TOKEN,P=m(13).Directives,C=m(14).TemplatablePattern,k=m(12).Pattern,I={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},R=new P(/<\!--/,/-->/),B=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 ve=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=X.matching(ve).until_after(ve)}};B.prototype=new x,B.prototype._is_comment=function(j){return!1},B.prototype._is_opening=function(j){return j.type===I.TAG_OPEN||j.type===I.CONTROL_FLOW_OPEN},B.prototype._is_closing=function(j,q){return j.type===I.TAG_CLOSE&&q&&((j.text===">"||j.text==="/>")&&q.text[0]==="<"||j.text==="}}"&&q.text[0]==="{"&&q.text[1]==="{")||j.type===I.CONTROL_FLOW_CLOSE&&j.text==="}"&&q.text.endsWith("{")},B.prototype._reset=function(){this._current_tag_name=""},B.prototype._get_next_token=function(j,q){var te=null;this._readWhitespace();var X=this._input.peek();return X===null?this._create_token(I.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(I.UNKNOWN,this._input.next()),te)},B.prototype._read_comment_or_cdata=function(j){var q=null,te=null,X=null;if(j==="<"){var ve=this._input.peek(1);ve==="!"&&(te=this.__patterns.comment.read(),te?(X=R.get_directives(te),X&&X.ignore==="start"&&(te+=R.readIgnored(this._input))):te=this.__patterns.cdata.read()),te&&(q=this._create_token(I.COMMENT,te),q.directives=X)}return q},B.prototype._read_processing=function(j){var q=null,te=null,X=null;if(j==="<"){var ve=this._input.peek(1);(ve==="!"||ve==="?")&&(te=this.__patterns.conditional_comment.read(),te=te||this.__patterns.processing.read()),te&&(q=this._create_token(I.COMMENT,te),q.directives=X)}return q},B.prototype._read_open=function(j,q){var te=null,X=null;return(!q||q.type===I.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(I.TAG_OPEN,te)),X},B.prototype._read_open_handlebars=function(j,q){var te=null,X=null;return(!q||q.type===I.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(I.COMMENT,te)):(te=this.__patterns.handlebars_open.read(),X=this._create_token(I.TAG_OPEN,te))),X},B.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 ve=te.endsWith("(")?1:0,Ie=0;!(te.endsWith("{")&&ve===Ie);){var xe=this._input.next();if(xe===null)break;xe==="("?ve++:xe===")"&&Ie++,te+=xe}X=this._create_token(I.CONTROL_FLOW_OPEN,te)}else j==="}"&&q&&q.type===I.CONTROL_FLOW_OPEN&&(te=this._input.next(),X=this._create_token(I.CONTROL_FLOW_CLOSE,te));return X},B.prototype._read_close=function(j,q){var te=null,X=null;return q&&q.type===I.TAG_OPEN&&(q.text[0]==="<"&&(j===">"||j==="/"&&this._input.peek(1)===">")?(te=this._input.next(),j==="/"&&(te+=this._input.next()),X=this._create_token(I.TAG_CLOSE,te)):q.text[0]==="{"&&j==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),X=this._create_token(I.TAG_CLOSE,"}}"))),X},B.prototype._read_attribute=function(j,q,te){var X=null,ve="";if(te&&te.text[0]==="<")if(j==="=")X=this._create_token(I.EQUALS,this._input.next());else if(j==='"'||j==="'"){var Ie=this._input.next();j==='"'?Ie+=this.__patterns.double_quote.read():Ie+=this.__patterns.single_quote.read(),X=this._create_token(I.VALUE,Ie)}else ve=this.__patterns.attribute.read(),ve&&(q.type===I.EQUALS?X=this._create_token(I.VALUE,ve):X=this._create_token(I.ATTRIBUTE,ve));return X},B.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)},B.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===I.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var ve=q.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ve)&&(X=this._input.readUntil(new RegExp("</"+ve+"[\\n\\r\\t ]*?>","ig")))}return X?this._create_token(I.TEXT,X):null},B.prototype._read_script_and_style=function(j,q){if(q.type===I.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=I.TEXT,X;var ve=this._input.readUntil(new RegExp("</"+te+"[\\n\\r\\t ]*?>","ig"));if(ve)return this._create_token(I.TEXT,ve)}}return null},B.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===I.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),te?this._create_token(I.TEXT,te):null},b.exports.Tokenizer=B,b.exports.TOKEN=I}],Y={};function u(b){var v=Y[b];if(v!==void 0)return v.exports;var m=Y[b]={exports:{}};return ie[b](m,m.exports,u),m.exports}var $=u(18);Ee=$})();var ee=Ee;if(1)z=[G,G(58553),G(87804)],J=function(ie){var Y=G(58553),u=G(87804);return{html_beautify:function($,b){return ee($,b,Y.js_beautify,u.css_beautify)}}}.apply(Me,z),J!==void 0&&(Lt.exports=J);else var N,p})()},58553:function(Lt,Me){var G,z;(function(){var J;(function(){"use strict";var ee=[function(Y,u,$){var b=$(1).Beautifier,v=$(5).Options;function m(x,S){var P=new b(x,S);return P.beautify()}Y.exports=m,Y.exports.defaultOptions=function(){return new v}},function(Y,u,$){var b=$(2).Output,v=$(3).Token,m=$(4),x=$(5).Options,S=$(7).Tokenizer,P=$(7).line_starters,C=$(7).positionable_operators,k=$(7).TOKEN;function I(g,D){return D.indexOf(g)!==-1}function R(g){return g.replace(/^\s+/g,"")}function B(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&&I(g.text,D)}var te=["case","return","do","if","throw","else","await","break","continue","async"],X=["before-newline","after-newline","preserve-newline"],ve=B(X),Ie=[ve.before_newline,ve.preserve_newline],xe={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function it(g,D){D.multiline_frame||D.mode===xe.ForInitializer||D.mode===xe.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===xe.ArrayLiteral}function L(g){return I(g,[xe.Expression,xe.ForInitializer,xe.Conditional])}function M(g,D){for(var V=0;V<g.length;V++){var de=g[V].trim();if(de.charAt(0)!==D)return!1}return!0}function H(g,D){for(var V=0,de=g.length,Te;V<de;V++)if(Te=g[V],Te&&Te.indexOf(D)!==0)return!1;return!0}function F(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)}F.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 de={mode:D,parent:g,last_token:g?g.last_token:new v(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 de},F.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(xe.BlockStatement);var V=new S(g,this._options);return this._tokens=V.tokenize(),g},F.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 de=this._tokens.next();de;)this.handle_token(de),this._last_last_text=this._flags.last_token.text,this._flags.last_token=de,de=this._tokens.next();return g=this._output.get_code(V),g},F.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)},F.prototype.handle_whitespace_and_comments=function(g,D){var V=g.newlines,de=this._options.keep_array_indentation&&w(this._flags.mode);if(g.comments_before)for(var Te=g.comments_before.next();Te;)this.handle_whitespace_and_comments(Te,D),this.handle_token(Te,D),Te=g.comments_before.next();if(de)for(var Pe=0;Pe<V;Pe+=1)this.print_newline(Pe>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"];F.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,de=I(this._flags.last_token.text,C)||I(g.text,C);if(de){var Te=I(this._flags.last_token.text,C)&&I(this._options.operator_position,Ie)||I(g.text,C);V=V&&Te}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()}}},F.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===xe.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)},F.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))},F.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)},F.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},F.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))},F.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)},F.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===xe.Statement&&it(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},F.prototype.start_of_object_property=function(){return this._flags.parent.mode===xe.ObjectLiteral&&this._flags.mode===xe.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"]))},F.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===xe.ObjectLiteral&&this._flags.mode===xe.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===xe.ForInitializer||this._previous_flags.mode===xe.Conditional),D=D||this._flags.last_token.type===k.WORD&&this._flags.mode===xe.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===xe.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"])),D?(this.set_mode(xe.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},F.prototype.handle_start_expr=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g);var D=xe.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=xe.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()),I(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=xe.ForInitializer):I(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,D=xe.Conditional):I(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:(I(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 de=this._tokens.peek(-4);q(V,["async","function"])||V.text==="*"&&q(de,["async","function"])?this._output.space_before_token=!0:this._flags.mode===xe.ObjectLiteral?(V.text==="{"||V.text===","||V.text==="*"&&(de.text==="{"||de.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==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===xe.ObjectLiteral&&I(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()},F.prototype.handle_end_expr=function(g){for(;this._flags.mode===xe.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(),it(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===xe.Conditional&&(this._previous_flags.mode=xe.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},F.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(xe.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(xe.BlockStatement):V&&(I(V.text,[":",","])&&I(D.type,[k.STRING,k.WORD,k.RESERVED])||I(D.text,["get","set","..."])&&I(V.type,[k.WORD,k.RESERVED]))?I(this._last_last_text,["class","interface"])&&!I(V.text,[":",","])?this.set_mode(xe.BlockStatement):this.set_mode(xe.ObjectLiteral):this._flags.last_token.type===k.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(xe.BlockStatement):I(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(xe.ObjectLiteral):this.set_mode(xe.BlockStatement),this._flags.last_token&&q(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var de=!D.comments_before&&D.text==="}",Te=de&&this._flags.last_word==="function"&&this._flags.last_token.type===k.END_EXPR;if(this._options.brace_preserve_inline){var Pe=0,Ne=null;this._flags.inline_frame=!0;do if(Pe+=1,Ne=this._tokens.peek(Pe-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&&(Te||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&&(I(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(),!de&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},F.prototype.handle_end_block=function(g){for(this.handle_whitespace_and_comments(g);this._flags.mode===xe.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)},F.prototype.handle_word=function(g){if(g.type===k.RESERVED){if(I(g.text,["set","get"])&&this._flags.mode!==xe.ObjectLiteral)g.type=k.WORD;else if(g.text==="import"&&I(this._tokens.peek().text,["(","."]))g.type=k.WORD;else if(I(g.text,["as","from"])&&!this._flags.import_block)g.type=k.WORD;else if(this._flags.mode===xe.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===xe.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()&&!(I(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===xe.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(g),j(g,"function")){(I(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(I(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===xe.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==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===xe.ObjectLiteral&&I(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===xe.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 de=this._output.current_line;de.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))},F.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===xe.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)},F.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)},F.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},F.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===xe.ObjectLiteral||this._flags.mode===xe.Statement&&this._flags.parent.mode===xe.ObjectLiteral?(this._flags.mode===xe.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(g)},F.prototype.handle_operator=function(g){var D=g.text==="*"&&(q(this._flags.last_token,["function","yield"])||I(this._flags.last_token.type,[k.START_BLOCK,k.COMMA,k.END_BLOCK,k.SEMICOLON])),V=I(g.text,["-","+"])&&(I(this._flags.last_token.type,[k.START_BLOCK,k.START_EXPR,k.EQUALS,k.OPERATOR])||I(this._flags.last_token.text,P)||this._flags.last_token.text===",");if(!this.start_of_statement(g)){var de=!D;this.handle_whitespace_and_comments(g,de)}if(g.text==="*"&&this._flags.last_token.type===k.DOT){this.print_token(g);return}if(g.text==="::"){this.print_token(g);return}if(I(g.text,["-","+"])&&this.start_of_object_property()){this.print_token(g);return}if(this._flags.last_token.type===k.OPERATOR&&I(this._options.operator_position,Ie)&&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 Te=!0,Pe=!0,Ne=!1;if(g.text===":"?this._flags.ternary_depth===0?Te=!1:(this._flags.ternary_depth-=1,Ne=!0):g.text==="?"&&(this._flags.ternary_depth+=1),!V&&!D&&this._options.preserve_newlines&&I(g.text,C)){var Ze=g.text===":",Dt=Ze&&Ne,Rt=Ze&&!Ne;switch(this._options.operator_position){case ve.before_newline:this._output.space_before_token=!Rt,this.print_token(g),(!Ze||Dt)&&this.allow_wrap_or_preserved_newline(g),this._output.space_before_token=!0;return;case ve.after_newline:this._output.space_before_token=!0,!Ze||Dt?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 ve.preserve_newline:Rt||this.allow_wrap_or_preserved_newline(g),Te=!(this._output.just_added_newline()||Rt),this._output.space_before_token=Te,this.print_token(g),this._output.space_before_token=!0;return}}if(D){this.allow_wrap_or_preserved_newline(g),Te=!1;var nt=this._tokens.peek();Pe=nt&&I(nt.type,[k.WORD,k.RESERVED])}else if(g.text==="...")this.allow_wrap_or_preserved_newline(g),Te=this._flags.last_token.type===k.START_BLOCK,Pe=!1;else if(I(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),Te=!1,Pe=!1,g.newlines&&(g.text==="--"||g.text==="++"||g.text==="~")){var xt=q(this._flags.last_token,te)&&g.newlines;xt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(xt,!0)}this._flags.last_token.text===";"&&L(this._flags.mode)&&(Te=!0),this._flags.last_token.type===k.RESERVED?Te=!0:this._flags.last_token.type===k.END_EXPR?Te=!(this._flags.last_token.text==="]"&&(g.text==="--"||g.text==="++")):this._flags.last_token.type===k.OPERATOR&&(Te=I(g.text,["--","-","++","+"])&&I(this._flags.last_token.text,["--","-","++","+"]),I(g.text,["+","-"])&&I(this._flags.last_token.text,["--","++"])&&(Pe=!0)),(this._flags.mode===xe.BlockStatement&&!this._flags.inline_frame||this._flags.mode===xe.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Te,this.print_token(g),this._output.space_before_token=Pe},F.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)},F.prototype.print_block_commment=function(g,D){var V=U(g.text),de,Te=!1,Pe=!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),Te=M(V,"*"),Pe=H(V,Ne),Te&&(this._flags.alignment=1),de=0;de<V.length;de++)Te?(this.print_token_line_indentation(g),this._output.add_token(R(V[de]))):Pe&&V[de]?(this.print_token_line_indentation(g),this._output.add_token(V[de].substring(Ze))):(this._output.current_line.set_indent(-1),this._output.add_token(V[de])),this.print_newline(!1,D);this._flags.alignment=0}},F.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)},F.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)},F.prototype.handle_unknown=function(g,D){this.print_token(g),g.text[g.text.length-1]===`
`&&this.print_newline(!1,D)},F.prototype.handle_eof=function(g){for(;this._flags.mode===xe.Statement;)this.restore_mode();this.handle_whitespace_and_comments(g)},Y.exports.Beautifier=F},function(Y){function u(v){this.__parent=v,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=[]}u.prototype.clone_empty=function(){var v=new u(this.__parent);return v.set_indent(this.__indent_count,this.__alignment_count),v},u.prototype.item=function(v){return v<0?this.__items[this.__items.length+v]:this.__items[v]},u.prototype.has_match=function(v){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(v))return!0;return!1},u.prototype.set_indent=function(v,m){this.is_empty()&&(this.__indent_count=v||0,this.__alignment_count=m||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},u.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)},u.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},u.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var v=this.__parent.current_line;return v.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),v.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),v.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,v.__items[0]===" "&&(v.__items.splice(0,1),v.__character_count-=1),!0}return!1},u.prototype.is_empty=function(){return this.__items.length===0},u.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},u.prototype.push=function(v){this.__items.push(v);var m=v.lastIndexOf(`
`);m!==-1?this.__character_count=v.length-m:this.__character_count+=v.length},u.prototype.pop=function(){var v=null;return this.is_empty()||(v=this.__items.pop(),this.__character_count-=v.length),v},u.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},u.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},u.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},u.prototype.toString=function(){var v="";return this.is_empty()?this.__parent.indent_empty_lines&&(v=this.__parent.get_indent_string(this.__indent_count)):(v=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),v+=this.__items.join("")),v};function $(v,m){this.__cache=[""],this.__indent_size=v.indent_size,this.__indent_string=v.indent_char,v.indent_with_tabs||(this.__indent_string=new Array(v.indent_size+1).join(v.indent_char)),m=m||"",v.indent_level>0&&(m=new Array(v.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}$.prototype.get_indent_size=function(v,m){var x=this.__base_string_length;return m=m||0,v<0&&(x=0),x+=v*this.__indent_size,x+=m,x},$.prototype.get_indent_string=function(v,m){var x=this.__base_string;return m=m||0,v<0&&(v=0,x=""),m+=v*this.__indent_size,this.__ensure_cache(m),x+=this.__cache[m],x},$.prototype.__ensure_cache=function(v){for(;v>=this.__cache.length;)this.__add_column()},$.prototype.__add_column=function(){var v=this.__cache.length,m=0,x="";this.__indent_size&&v>=this.__indent_size&&(m=Math.floor(v/this.__indent_size),v-=m*this.__indent_size,x=new Array(m+1).join(this.__indent_string)),v&&(x+=new Array(v+1).join(" ")),this.__cache.push(x)};function b(v,m){this.__indent_cache=new $(v,m),this.raw=!1,this._end_with_newline=v.end_with_newline,this.indent_size=v.indent_size,this.wrap_line_length=v.wrap_line_length,this.indent_empty_lines=v.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new u(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(v,m){return this.__indent_cache.get_indent_string(v,m)},b.prototype.get_indent_size=function(v,m){return this.__indent_cache.get_indent_size(v,m)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(v){return this.is_empty()||!v&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(v){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 v!==`
`&&(x=x.replace(/[\n]/g,v)),x},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(v,m){return v=v||0,m=m||0,this.next_line.set_indent(v,m),this.__lines.length>1?(this.current_line.set_indent(v,m),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(v){for(var m=0;m<v.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(v.whitespace_before),this.current_line.push(v.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(v){this.__add_space_before_token(),this.current_line.push(v),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(v){for(var m=this.__lines.length;v<m;)this.__lines[v]._remove_indent(),v++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(v){for(v=v===void 0?!1:v,this.current_line.trim();v&&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(v,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(v)!==0&&S.item(-1)!==m){this.__lines.splice(x+1,0,new u(this)),this.previous_line=this.__lines[this.__lines.length-2];break}x--}},Y.exports.Output=b},function(Y){function u($,b,v,m){this.type=$,this.text=b,this.comments_before=null,this.newlines=v||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=u},function(Y,u){var $="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",b="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",v="\\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+"|["+$+v+"])",P="(?:"+x+"|["+b+v+m+"])*";u.identifier=new RegExp(S+P,"g"),u.identifierStart=new RegExp(S),u.identifierMatch=new RegExp("(?:"+x+"|["+b+v+m+"])+");var C=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;u.newline=/[\n\r\u2028\u2029]/,u.lineBreak=new RegExp(`\r
|`+u.newline.source),u.allLineBreaks=new RegExp(u.lineBreak.source,"g")},function(Y,u,$){var b=$(6).Options,v=["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",v),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 u(v,m){this.raw_options=$(v,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"])}u.prototype._get_array=function(v,m){var x=this.raw_options[v],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},u.prototype._get_boolean=function(v,m){var x=this.raw_options[v],S=x===void 0?!!m:!!x;return S},u.prototype._get_characters=function(v,m){var x=this.raw_options[v],S=m||"";return typeof x=="string"&&(S=x.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},u.prototype._get_number=function(v,m){var x=this.raw_options[v];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(x,10);return isNaN(S)&&(S=m),S},u.prototype._get_selection=function(v,m,x){var S=this._get_selection_list(v,m,x);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+v+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[v]+"'");return S[0]},u.prototype._get_selection_list=function(v,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(v,x);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+v+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[v]+"'");return S},u.prototype._is_valid_selection=function(v,m){return v.length&&m.length&&!v.some(function(x){return m.indexOf(x)===-1})};function $(v,m){var x={};v=b(v);var S;for(S in v)S!==m&&(x[S]=v[S]);if(m&&v[m])for(S in v[m])x[S]=v[m][S];return x}function b(v){var m={},x;for(x in v){var S=x.replace(/-/g,"_");m[S]=v[x]}return m}Y.exports.Options=u,Y.exports.normalizeOpts=b,Y.exports.mergeOpts=$},function(Y,u,$){var b=$(8).InputScanner,v=$(9).Tokenizer,m=$(9).TOKEN,x=$(13).Directives,S=$(4),P=$(12).Pattern,C=$(14).TemplatablePattern;function k(M,H){return H.indexOf(M)!==-1}var I={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},R=new x(/\/\*/,/\*\//),B=/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 ve=new RegExp(X),Ie="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),xe=Ie.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),it=new RegExp("^(?:"+xe.join("|")+")$"),U,w=function(M,H){v.call(this,M,H),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var F=new P(this._input),_=new C(this._input).read_options(this._options);this.__patterns={template:_,identifier:_.starting_with(S.identifier).matching(S.identifierMatch),number:F.matching(B),punct:F.matching(ve),comment:F.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:F.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:F.matching(/<!--/),html_comment_end:F.matching(/-->/),include:F.starting_with(/#include/).until_after(S.lineBreak),shebang:F.starting_with(/#!/).until_after(S.lineBreak),xml:F.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 v,w.prototype._is_comment=function(M){return M.type===I.COMMENT||M.type===I.BLOCK_COMMENT||M.type===I.UNKNOWN},w.prototype._is_opening=function(M){return M.type===I.START_BLOCK||M.type===I.START_EXPR},w.prototype._is_closing=function(M,H){return(M.type===I.END_BLOCK||M.type===I.END_EXPR)&&H&&(M.text==="]"&&H.text==="["||M.text===")"&&H.text==="("||M.text==="}"&&H.text==="{")},w.prototype._reset=function(){U=!1},w.prototype._get_next_token=function(M,H){var F=null;this._readWhitespace();var _=this._input.peek();return _===null?this._create_token(I.EOF,""):(F=F||this._read_non_javascript(_),F=F||this._read_string(_),F=F||this._read_pair(_,this._input.peek(1)),F=F||this._read_word(M),F=F||this._read_singles(_),F=F||this._read_comment(_),F=F||this._read_regexp(_,M),F=F||this._read_xml(_,M),F=F||this._read_punctuation(),F=F||this._create_token(I.UNKNOWN,this._input.next()),F)},w.prototype._read_word=function(M){var H;if(H=this.__patterns.identifier.read(),H!=="")return H=H.replace(S.allLineBreaks,`
`),!(M.type===I.DOT||M.type===I.RESERVED&&(M.text==="set"||M.text==="get"))&&it.test(H)?(H==="in"||H==="of")&&(M.type===I.WORD||M.type===I.STRING)?this._create_token(I.OPERATOR,H):this._create_token(I.RESERVED,H):this._create_token(I.WORD,H);if(H=this.__patterns.number.read(),H!=="")return this._create_token(I.WORD,H)},w.prototype._read_singles=function(M){var H=null;return M==="("||M==="["?H=this._create_token(I.START_EXPR,M):M===")"||M==="]"?H=this._create_token(I.END_EXPR,M):M==="{"?H=this._create_token(I.START_BLOCK,M):M==="}"?H=this._create_token(I.END_BLOCK,M):M===";"?H=this._create_token(I.SEMICOLON,M):M==="."&&q.test(this._input.peek(1))?H=this._create_token(I.DOT,M):M===","&&(H=this._create_token(I.COMMA,M)),H&&this._input.next(),H},w.prototype._read_pair=function(M,H){var F=null;return M==="#"&&H==="{"&&(F=this._create_token(I.START_BLOCK,M+H)),F&&(this._input.next(),this._input.next()),F},w.prototype._read_punctuation=function(){var M=this.__patterns.punct.read();if(M!=="")return M==="="?this._create_token(I.EQUALS,M):M==="?."?this._create_token(I.DOT,M):this._create_token(I.OPERATOR,M)},w.prototype._read_non_javascript=function(M){var H="";if(M==="#"){if(this._is_first_token()&&(H=this.__patterns.shebang.read(),H))return this._create_token(I.UNKNOWN,H.trim()+`
`);if(H=this.__patterns.include.read(),H)return this._create_token(I.UNKNOWN,H.trim()+`
`);M=this._input.next();var F="#";if(this._input.hasNext()&&this._input.testChar(j)){do M=this._input.next(),F+=M;while(this._input.hasNext()&&M!=="#"&&M!=="=");return M==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(F+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(F+="{}",this._input.next(),this._input.next())),this._create_token(I.WORD,F)}this._input.back()}else if(M==="<"&&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(I.COMMENT,H)}}else if(U&&M==="-"&&(H=this.__patterns.html_comment_end.read(),H))return U=!1,this._create_token(I.COMMENT,H);return null},w.prototype._read_comment=function(M){var H=null;if(M==="/"){var F="";if(this._input.peek(1)==="*"){F=this.__patterns.block_comment.read();var _=R.get_directives(F);_&&_.ignore==="start"&&(F+=R.readIgnored(this._input)),F=F.replace(S.allLineBreaks,`
`),H=this._create_token(I.BLOCK_COMMENT,F),H.directives=_}else this._input.peek(1)==="/"&&(F=this.__patterns.comment.read(),H=this._create_token(I.COMMENT,F))}return H},w.prototype._read_string=function(M){if(M==="`"||M==="'"||M==='"'){var H=this._input.next();return this.has_char_escapes=!1,M==="`"?H+=this._read_string_recursive("`",!0,"${"):H+=this._read_string_recursive(M),this.has_char_escapes&&this._options.unescape_strings&&(H=L(H)),this._input.peek()===M&&(H+=this._input.next()),H=H.replace(S.allLineBreaks,`
`),this._create_token(I.STRING,H)}return null},w.prototype._allow_regexp_or_xml=function(M){return M.type===I.RESERVED&&k(M.text,["return","case","throw","else","do","typeof","yield"])||M.type===I.END_EXPR&&M.text===")"&&M.opened.previous.type===I.RESERVED&&k(M.opened.previous.text,["if","while","for"])||k(M.type,[I.COMMENT,I.START_EXPR,I.START_BLOCK,I.START,I.END_BLOCK,I.OPERATOR,I.EQUALS,I.EOF,I.SEMICOLON,I.COMMA])},w.prototype._read_regexp=function(M,H){if(M==="/"&&this._allow_regexp_or_xml(H)){for(var F=this._input.next(),_=!1,g=!1;this._input.hasNext()&&(_||g||this._input.peek()!==M)&&!this._input.testChar(S.newline);)F+=this._input.peek(),_?_=!1:(_=this._input.peek()==="\\",this._input.peek()==="["?g=!0:this._input.peek()==="]"&&(g=!1)),this._input.next();return this._input.peek()===M&&(F+=this._input.next(),F+=this._input.read(S.identifier)),this._create_token(I.STRING,F)}return null},w.prototype._read_xml=function(M,H){if(this._options.e4x&&M==="<"&&this._allow_regexp_or_xml(H)){var F="",_=this.__patterns.xml.read_match();if(_){for(var g=_[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),D=g.indexOf("{")===0,V=0;_;){var de=!!_[1],Te=_[2],Pe=!!_[_.length-1]||Te.slice(0,8)==="![CDATA[";if(!Pe&&(Te===g||D&&Te.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(de?--V:++V),F+=_[0],V<=0)break;_=this.__patterns.xml.read_match()}return _||(F+=this._input.match(/[\s\S]*/g)[0]),F=F.replace(S.allLineBreaks,`
`),this._create_token(I.STRING,F)}}return null};function L(M){for(var H="",F=0,_=new b(M),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||(F=parseInt(g[1],16),F>126&&F<=255&&g[0].indexOf("x")===0))return M;F>=0&&F<32||F>1114111?H+="\\"+g[0]:F===34||F===39||F===92?H+="\\"+String.fromCharCode(F):H+=String.fromCharCode(F)}return H}w.prototype._read_string_recursive=function(M,H,F){var _,g;M==="'"?g=this.__patterns.single_quote:M==='"'?g=this.__patterns.double_quote:M==="`"?g=this.__patterns.template_text:M==="}"&&(g=this.__patterns.template_expression);for(var D=g.read(),V="";this._input.hasNext();){if(V=this._input.next(),V===M||!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()):F&&(F==="${"&&V==="$"&&this._input.peek()==="{"&&(V+=this._input.next()),F===V&&(M==="`"?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=I,Y.exports.positionable_operators=te.slice(),Y.exports.line_starters=Ie.slice()},function(Y){var u=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 v=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(v=this.__input.charAt(b)),v},$.prototype.__match=function(b,v){b.lastIndex=v;var m=b.exec(this.__input);return m&&!(u&&b.sticky)&&m.index!==v&&(m=null),m},$.prototype.test=function(b,v){return v=v||0,v+=this.__position,v>=0&&v<this.__input_length?!!this.__match(b,v):!1},$.prototype.testChar=function(b,v){var m=this.peek(v);return b.lastIndex=0,m!==null&&b.test(m)},$.prototype.match=function(b){var v=this.__match(b,this.__position);return v?this.__position+=v[0].length:v=null,v},$.prototype.read=function(b,v,m){var x="",S;return b&&(S=this.match(b),S&&(x+=S[0])),v&&(S||!b)&&(x+=this.readUntil(v,m)),x},$.prototype.readUntil=function(b,v){var m="",x=this.__position;b.lastIndex=this.__position;var S=b.exec(this.__input);return S?(x=S.index,v&&(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,v){var m=null,x="g";return v&&u&&(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 v=this.__position,m=this.readUntilAfter(b);return this.__position=v,m},$.prototype.lookBack=function(b){var v=this.__position-1;return v>=b.length&&this.__input.substring(v-b.length,v).toLowerCase()===b},Y.exports.InputScanner=$},function(Y,u,$){var b=$(8).InputScanner,v=$(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 v(S.START,""),I=null,R=[],B=new m;k.type!==S.EOF;){for(C=this._get_next_token(k,I);this._is_comment(C);)B.add(C),C=this._get_next_token(k,I);B.isEmpty()||(C.comments_before=B,B=new m),C.parent=I,this._is_opening(C)?(R.push(I),I=C):I&&this._is_closing(C,I)&&(C.opened=I,I.closed=C,I=R.pop(),C.parent=I),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 I=this._input.read(/.+/g);return I?this._create_token(S.RAW,I):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 I=new v(C,k,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return I},P.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},Y.exports.Tokenizer=P,Y.exports.TOKEN=S},function(Y){function u($){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=$}u.prototype.restart=function(){this.__position=0},u.prototype.isEmpty=function(){return this.__tokens_length===0},u.prototype.hasNext=function(){return this.__position<this.__tokens_length},u.prototype.next=function(){var $=null;return this.hasNext()&&($=this.__tokens[this.__position],this.__position+=1),$},u.prototype.peek=function($){var b=null;return $=$||0,$+=this.__position,$>=0&&$<this.__tokens_length&&(b=this.__tokens[$]),b},u.prototype.add=function($){this.__parent_token&&($.parent=this.__parent_token),this.__tokens.push($),this.__tokens_length+=1},Y.exports.TokenStream=u},function(Y,u,$){var b=$(12).Pattern;function v(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=""}v.prototype=new b,v.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+"]")},v.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},v.prototype.matching=function(m,x){var S=this._create();return S.__set_whitespace_patterns(m,x),S._update(),S},v.prototype._create=function(){return new v(this._input,this)},v.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=v},function(Y){function u($,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)}u.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)),$},u.prototype.read_match=function(){return this._input.match(this._match_pattern)},u.prototype.until_after=function($){var b=this._create();return b._until_after=!0,b._until_pattern=this._input.get_regexp($),b._update(),b},u.prototype.until=function($){var b=this._create();return b._until_after=!1,b._until_pattern=this._input.get_regexp($),b._update(),b},u.prototype.starting_with=function($){var b=this._create();return b._starting_pattern=this._input.get_regexp($,!0),b._update(),b},u.prototype.matching=function($){var b=this._create();return b._match_pattern=this._input.get_regexp($,!0),b._update(),b},u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){},Y.exports.Pattern=u},function(Y){function u($,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")}u.prototype.get_directives=function($){if(!$.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var v=this.__directive_pattern.exec($);v;)b[v[1]]=v[2],v=this.__directive_pattern.exec($);return b},u.prototype.readIgnored=function($){return $.readUntilAfter(this.__directives_end_ignore_pattern)},Y.exports.Directives=u},function(Y,u,$){var b=$(12).Pattern,v={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({},v),this._excluded=Object.assign({},v),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 v)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}],N={};function p(Y){var u=N[Y];if(u!==void 0)return u.exports;var $=N[Y]={exports:{}};return ee[Y]($,$.exports,p),$.exports}var ie=p(0);J=ie})();var Ee=J;G=[],z=function(){return{js_beautify:Ee}}.apply(Me,G),z!==void 0&&(Lt.exports=z)})()},75918:function(Lt,Me,G){"use strict";G.d(Me,{Wi:function(){return p},Z0:function(){return ie},aU:function(){return N},eZ:function(){return u},wY:function(){return Y}});var z=G(4348),J=G(69323),Ee=G(13268),ee=function($,b,v,m){function x(S){return S instanceof v?S:new v(function(P){P(S)})}return new(v||(v=Promise))(function(S,P){function C(R){try{I(m.next(R))}catch(B){P(B)}}function k(R){try{I(m.throw(R))}catch(B){P(B)}}function I(R){R.done?S(R.value):x(R.value).then(C,k)}I((m=m.apply($,b||[])).next())})};class N extends J.JT{constructor(b,v="",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=v,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,v){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,v){return ee(this,void 0,void 0,function*(){if(!b.enabled)return;this._onBeforeRun.fire({action:b});let m;try{yield this.runAction(b,v)}catch(x){m=x}this._onDidRun.fire({action:b,error:m})})}runAction(b,v){return ee(this,void 0,void 0,function*(){yield b.run(v)})}}class ie extends N{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,v,m,x){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=b,this.label=v,this.class=x,this._actions=m}get actions(){return this._actions}dispose(){}run(){return ee(this,void 0,void 0,function*(){})}}class u extends N{constructor(){super(u.ID,Ee.N("submenu.empty","(empty)"),void 0,!1)}}u.ID="vs.actions.empty"},76068:function(Lt,Me,G){"use strict";G.d(Me,{ok:function(){return z}});function z(J,Ee){if(!J)throw new Error(Ee?`Assertion failed (${Ee})`:"Assertion Failed")}},52615:function(Lt,Me,G){"use strict";G.d(Me,{CM:function(){return N},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 Ee=new J,ee=Ee;function N(u,$){return new ie(u,$)}function p(u){return u?u.replace(/\$\((.*?)\)/g,($,b)=>` ${b} `).trim():""}class ie{constructor($,b,v){this.id=$,this.definition=b,this.description=v,Ee.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(u){u.iconNameSegment="[A-Za-z0-9]+",u.iconNameExpression="[A-Za-z0-9\\-]+",u.iconModifierExpression="~[A-Za-z]+";const $=new RegExp(`^(${u.iconNameExpression})(${u.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}u.asClassNameArray=b;function v(x){return b(x).join(" ")}u.asClassName=v;function m(x){return"."+b(x).join(".")}u.asCSSSelector=m})(Y||(Y={})),function(u){u.add=new u("add",{fontCharacter:"\\ea60"}),u.plus=new u("plus",u.add.definition),u.gistNew=new u("gist-new",u.add.definition),u.repoCreate=new u("repo-create",u.add.definition),u.lightbulb=new u("lightbulb",{fontCharacter:"\\ea61"}),u.lightBulb=new u("light-bulb",{fontCharacter:"\\ea61"}),u.repo=new u("repo",{fontCharacter:"\\ea62"}),u.repoDelete=new u("repo-delete",{fontCharacter:"\\ea62"}),u.gistFork=new u("gist-fork",{fontCharacter:"\\ea63"}),u.repoForked=new u("repo-forked",{fontCharacter:"\\ea63"}),u.gitPullRequest=new u("git-pull-request",{fontCharacter:"\\ea64"}),u.gitPullRequestAbandoned=new u("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),u.recordKeys=new u("record-keys",{fontCharacter:"\\ea65"}),u.keyboard=new u("keyboard",{fontCharacter:"\\ea65"}),u.tag=new u("tag",{fontCharacter:"\\ea66"}),u.tagAdd=new u("tag-add",{fontCharacter:"\\ea66"}),u.tagRemove=new u("tag-remove",{fontCharacter:"\\ea66"}),u.person=new u("person",{fontCharacter:"\\ea67"}),u.personFollow=new u("person-follow",{fontCharacter:"\\ea67"}),u.personOutline=new u("person-outline",{fontCharacter:"\\ea67"}),u.personFilled=new u("person-filled",{fontCharacter:"\\ea67"}),u.gitBranch=new u("git-branch",{fontCharacter:"\\ea68"}),u.gitBranchCreate=new u("git-branch-create",{fontCharacter:"\\ea68"}),u.gitBranchDelete=new u("git-branch-delete",{fontCharacter:"\\ea68"}),u.sourceControl=new u("source-control",{fontCharacter:"\\ea68"}),u.mirror=new u("mirror",{fontCharacter:"\\ea69"}),u.mirrorPublic=new u("mirror-public",{fontCharacter:"\\ea69"}),u.star=new u("star",{fontCharacter:"\\ea6a"}),u.starAdd=new u("star-add",{fontCharacter:"\\ea6a"}),u.starDelete=new u("star-delete",{fontCharacter:"\\ea6a"}),u.starEmpty=new u("star-empty",{fontCharacter:"\\ea6a"}),u.comment=new u("comment",{fontCharacter:"\\ea6b"}),u.commentAdd=new u("comment-add",{fontCharacter:"\\ea6b"}),u.alert=new u("alert",{fontCharacter:"\\ea6c"}),u.warning=new u("warning",{fontCharacter:"\\ea6c"}),u.search=new u("search",{fontCharacter:"\\ea6d"}),u.searchSave=new u("search-save",{fontCharacter:"\\ea6d"}),u.logOut=new u("log-out",{fontCharacter:"\\ea6e"}),u.signOut=new u("sign-out",{fontCharacter:"\\ea6e"}),u.logIn=new u("log-in",{fontCharacter:"\\ea6f"}),u.signIn=new u("sign-in",{fontCharacter:"\\ea6f"}),u.eye=new u("eye",{fontCharacter:"\\ea70"}),u.eyeUnwatch=new u("eye-unwatch",{fontCharacter:"\\ea70"}),u.eyeWatch=new u("eye-watch",{fontCharacter:"\\ea70"}),u.circleFilled=new u("circle-filled",{fontCharacter:"\\ea71"}),u.primitiveDot=new u("primitive-dot",{fontCharacter:"\\ea71"}),u.closeDirty=new u("close-dirty",{fontCharacter:"\\ea71"}),u.debugBreakpoint=new u("debug-breakpoint",{fontCharacter:"\\ea71"}),u.debugBreakpointDisabled=new u("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),u.debugHint=new u("debug-hint",{fontCharacter:"\\ea71"}),u.primitiveSquare=new u("primitive-square",{fontCharacter:"\\ea72"}),u.edit=new u("edit",{fontCharacter:"\\ea73"}),u.pencil=new u("pencil",{fontCharacter:"\\ea73"}),u.info=new u("info",{fontCharacter:"\\ea74"}),u.issueOpened=new u("issue-opened",{fontCharacter:"\\ea74"}),u.gistPrivate=new u("gist-private",{fontCharacter:"\\ea75"}),u.gitForkPrivate=new u("git-fork-private",{fontCharacter:"\\ea75"}),u.lock=new u("lock",{fontCharacter:"\\ea75"}),u.mirrorPrivate=new u("mirror-private",{fontCharacter:"\\ea75"}),u.close=new u("close",{fontCharacter:"\\ea76"}),u.removeClose=new u("remove-close",{fontCharacter:"\\ea76"}),u.x=new u("x",{fontCharacter:"\\ea76"}),u.repoSync=new u("repo-sync",{fontCharacter:"\\ea77"}),u.sync=new u("sync",{fontCharacter:"\\ea77"}),u.clone=new u("clone",{fontCharacter:"\\ea78"}),u.desktopDownload=new u("desktop-download",{fontCharacter:"\\ea78"}),u.beaker=new u("beaker",{fontCharacter:"\\ea79"}),u.microscope=new u("microscope",{fontCharacter:"\\ea79"}),u.vm=new u("vm",{fontCharacter:"\\ea7a"}),u.deviceDesktop=new u("device-desktop",{fontCharacter:"\\ea7a"}),u.file=new u("file",{fontCharacter:"\\ea7b"}),u.fileText=new u("file-text",{fontCharacter:"\\ea7b"}),u.more=new u("more",{fontCharacter:"\\ea7c"}),u.ellipsis=new u("ellipsis",{fontCharacter:"\\ea7c"}),u.kebabHorizontal=new u("kebab-horizontal",{fontCharacter:"\\ea7c"}),u.mailReply=new u("mail-reply",{fontCharacter:"\\ea7d"}),u.reply=new u("reply",{fontCharacter:"\\ea7d"}),u.organization=new u("organization",{fontCharacter:"\\ea7e"}),u.organizationFilled=new u("organization-filled",{fontCharacter:"\\ea7e"}),u.organizationOutline=new u("organization-outline",{fontCharacter:"\\ea7e"}),u.newFile=new u("new-file",{fontCharacter:"\\ea7f"}),u.fileAdd=new u("file-add",{fontCharacter:"\\ea7f"}),u.newFolder=new u("new-folder",{fontCharacter:"\\ea80"}),u.fileDirectoryCreate=new u("file-directory-create",{fontCharacter:"\\ea80"}),u.trash=new u("trash",{fontCharacter:"\\ea81"}),u.trashcan=new u("trashcan",{fontCharacter:"\\ea81"}),u.history=new u("history",{fontCharacter:"\\ea82"}),u.clock=new u("clock",{fontCharacter:"\\ea82"}),u.folder=new u("folder",{fontCharacter:"\\ea83"}),u.fileDirectory=new u("file-directory",{fontCharacter:"\\ea83"}),u.symbolFolder=new u("symbol-folder",{fontCharacter:"\\ea83"}),u.logoGithub=new u("logo-github",{fontCharacter:"\\ea84"}),u.markGithub=new u("mark-github",{fontCharacter:"\\ea84"}),u.github=new u("github",{fontCharacter:"\\ea84"}),u.terminal=new u("terminal",{fontCharacter:"\\ea85"}),u.console=new u("console",{fontCharacter:"\\ea85"}),u.repl=new u("repl",{fontCharacter:"\\ea85"}),u.zap=new u("zap",{fontCharacter:"\\ea86"}),u.symbolEvent=new u("symbol-event",{fontCharacter:"\\ea86"}),u.error=new u("error",{fontCharacter:"\\ea87"}),u.stop=new u("stop",{fontCharacter:"\\ea87"}),u.variable=new u("variable",{fontCharacter:"\\ea88"}),u.symbolVariable=new u("symbol-variable",{fontCharacter:"\\ea88"}),u.array=new u("array",{fontCharacter:"\\ea8a"}),u.symbolArray=new u("symbol-array",{fontCharacter:"\\ea8a"}),u.symbolModule=new u("symbol-module",{fontCharacter:"\\ea8b"}),u.symbolPackage=new u("symbol-package",{fontCharacter:"\\ea8b"}),u.symbolNamespace=new u("symbol-namespace",{fontCharacter:"\\ea8b"}),u.symbolObject=new u("symbol-object",{fontCharacter:"\\ea8b"}),u.symbolMethod=new u("symbol-method",{fontCharacter:"\\ea8c"}),u.symbolFunction=new u("symbol-function",{fontCharacter:"\\ea8c"}),u.symbolConstructor=new u("symbol-constructor",{fontCharacter:"\\ea8c"}),u.symbolBoolean=new u("symbol-boolean",{fontCharacter:"\\ea8f"}),u.symbolNull=new u("symbol-null",{fontCharacter:"\\ea8f"}),u.symbolNumeric=new u("symbol-numeric",{fontCharacter:"\\ea90"}),u.symbolNumber=new u("symbol-number",{fontCharacter:"\\ea90"}),u.symbolStructure=new u("symbol-structure",{fontCharacter:"\\ea91"}),u.symbolStruct=new u("symbol-struct",{fontCharacter:"\\ea91"}),u.symbolParameter=new u("symbol-parameter",{fontCharacter:"\\ea92"}),u.symbolTypeParameter=new u("symbol-type-parameter",{fontCharacter:"\\ea92"}),u.symbolKey=new u("symbol-key",{fontCharacter:"\\ea93"}),u.symbolText=new u("symbol-text",{fontCharacter:"\\ea93"}),u.symbolReference=new u("symbol-reference",{fontCharacter:"\\ea94"}),u.goToFile=new u("go-to-file",{fontCharacter:"\\ea94"}),u.symbolEnum=new u("symbol-enum",{fontCharacter:"\\ea95"}),u.symbolValue=new u("symbol-value",{fontCharacter:"\\ea95"}),u.symbolRuler=new u("symbol-ruler",{fontCharacter:"\\ea96"}),u.symbolUnit=new u("symbol-unit",{fontCharacter:"\\ea96"}),u.activateBreakpoints=new u("activate-breakpoints",{fontCharacter:"\\ea97"}),u.archive=new u("archive",{fontCharacter:"\\ea98"}),u.arrowBoth=new u("arrow-both",{fontCharacter:"\\ea99"}),u.arrowDown=new u("arrow-down",{fontCharacter:"\\ea9a"}),u.arrowLeft=new u("arrow-left",{fontCharacter:"\\ea9b"}),u.arrowRight=new u("arrow-right",{fontCharacter:"\\ea9c"}),u.arrowSmallDown=new u("arrow-small-down",{fontCharacter:"\\ea9d"}),u.arrowSmallLeft=new u("arrow-small-left",{fontCharacter:"\\ea9e"}),u.arrowSmallRight=new u("arrow-small-right",{fontCharacter:"\\ea9f"}),u.arrowSmallUp=new u("arrow-small-up",{fontCharacter:"\\eaa0"}),u.arrowUp=new u("arrow-up",{fontCharacter:"\\eaa1"}),u.bell=new u("bell",{fontCharacter:"\\eaa2"}),u.bold=new u("bold",{fontCharacter:"\\eaa3"}),u.book=new u("book",{fontCharacter:"\\eaa4"}),u.bookmark=new u("bookmark",{fontCharacter:"\\eaa5"}),u.debugBreakpointConditionalUnverified=new u("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),u.debugBreakpointConditional=new u("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),u.debugBreakpointConditionalDisabled=new u("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),u.debugBreakpointDataUnverified=new u("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),u.debugBreakpointData=new u("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),u.debugBreakpointDataDisabled=new u("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),u.debugBreakpointLogUnverified=new u("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),u.debugBreakpointLog=new u("debug-breakpoint-log",{fontCharacter:"\\eaab"}),u.debugBreakpointLogDisabled=new u("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),u.briefcase=new u("briefcase",{fontCharacter:"\\eaac"}),u.broadcast=new u("broadcast",{fontCharacter:"\\eaad"}),u.browser=new u("browser",{fontCharacter:"\\eaae"}),u.bug=new u("bug",{fontCharacter:"\\eaaf"}),u.calendar=new u("calendar",{fontCharacter:"\\eab0"}),u.caseSensitive=new u("case-sensitive",{fontCharacter:"\\eab1"}),u.check=new u("check",{fontCharacter:"\\eab2"}),u.checklist=new u("checklist",{fontCharacter:"\\eab3"}),u.chevronDown=new u("chevron-down",{fontCharacter:"\\eab4"}),u.dropDownButton=new u("drop-down-button",u.chevronDown.definition),u.chevronLeft=new u("chevron-left",{fontCharacter:"\\eab5"}),u.chevronRight=new u("chevron-right",{fontCharacter:"\\eab6"}),u.chevronUp=new u("chevron-up",{fontCharacter:"\\eab7"}),u.chromeClose=new u("chrome-close",{fontCharacter:"\\eab8"}),u.chromeMaximize=new u("chrome-maximize",{fontCharacter:"\\eab9"}),u.chromeMinimize=new u("chrome-minimize",{fontCharacter:"\\eaba"}),u.chromeRestore=new u("chrome-restore",{fontCharacter:"\\eabb"}),u.circleOutline=new u("circle-outline",{fontCharacter:"\\eabc"}),u.debugBreakpointUnverified=new u("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),u.circleSlash=new u("circle-slash",{fontCharacter:"\\eabd"}),u.circuitBoard=new u("circuit-board",{fontCharacter:"\\eabe"}),u.clearAll=new u("clear-all",{fontCharacter:"\\eabf"}),u.clippy=new u("clippy",{fontCharacter:"\\eac0"}),u.closeAll=new u("close-all",{fontCharacter:"\\eac1"}),u.cloudDownload=new u("cloud-download",{fontCharacter:"\\eac2"}),u.cloudUpload=new u("cloud-upload",{fontCharacter:"\\eac3"}),u.code=new u("code",{fontCharacter:"\\eac4"}),u.collapseAll=new u("collapse-all",{fontCharacter:"\\eac5"}),u.colorMode=new u("color-mode",{fontCharacter:"\\eac6"}),u.commentDiscussion=new u("comment-discussion",{fontCharacter:"\\eac7"}),u.compareChanges=new u("compare-changes",{fontCharacter:"\\eafd"}),u.creditCard=new u("credit-card",{fontCharacter:"\\eac9"}),u.dash=new u("dash",{fontCharacter:"\\eacc"}),u.dashboard=new u("dashboard",{fontCharacter:"\\eacd"}),u.database=new u("database",{fontCharacter:"\\eace"}),u.debugContinue=new u("debug-continue",{fontCharacter:"\\eacf"}),u.debugDisconnect=new u("debug-disconnect",{fontCharacter:"\\ead0"}),u.debugPause=new u("debug-pause",{fontCharacter:"\\ead1"}),u.debugRestart=new u("debug-restart",{fontCharacter:"\\ead2"}),u.debugStart=new u("debug-start",{fontCharacter:"\\ead3"}),u.debugStepInto=new u("debug-step-into",{fontCharacter:"\\ead4"}),u.debugStepOut=new u("debug-step-out",{fontCharacter:"\\ead5"}),u.debugStepOver=new u("debug-step-over",{fontCharacter:"\\ead6"}),u.debugStop=new u("debug-stop",{fontCharacter:"\\ead7"}),u.debug=new u("debug",{fontCharacter:"\\ead8"}),u.deviceCameraVideo=new u("device-camera-video",{fontCharacter:"\\ead9"}),u.deviceCamera=new u("device-camera",{fontCharacter:"\\eada"}),u.deviceMobile=new u("device-mobile",{fontCharacter:"\\eadb"}),u.diffAdded=new u("diff-added",{fontCharacter:"\\eadc"}),u.diffIgnored=new u("diff-ignored",{fontCharacter:"\\eadd"}),u.diffModified=new u("diff-modified",{fontCharacter:"\\eade"}),u.diffRemoved=new u("diff-removed",{fontCharacter:"\\eadf"}),u.diffRenamed=new u("diff-renamed",{fontCharacter:"\\eae0"}),u.diff=new u("diff",{fontCharacter:"\\eae1"}),u.discard=new u("discard",{fontCharacter:"\\eae2"}),u.editorLayout=new u("editor-layout",{fontCharacter:"\\eae3"}),u.emptyWindow=new u("empty-window",{fontCharacter:"\\eae4"}),u.exclude=new u("exclude",{fontCharacter:"\\eae5"}),u.extensions=new u("extensions",{fontCharacter:"\\eae6"}),u.eyeClosed=new u("eye-closed",{fontCharacter:"\\eae7"}),u.fileBinary=new u("file-binary",{fontCharacter:"\\eae8"}),u.fileCode=new u("file-code",{fontCharacter:"\\eae9"}),u.fileMedia=new u("file-media",{fontCharacter:"\\eaea"}),u.filePdf=new u("file-pdf",{fontCharacter:"\\eaeb"}),u.fileSubmodule=new u("file-submodule",{fontCharacter:"\\eaec"}),u.fileSymlinkDirectory=new u("file-symlink-directory",{fontCharacter:"\\eaed"}),u.fileSymlinkFile=new u("file-symlink-file",{fontCharacter:"\\eaee"}),u.fileZip=new u("file-zip",{fontCharacter:"\\eaef"}),u.files=new u("files",{fontCharacter:"\\eaf0"}),u.filter=new u("filter",{fontCharacter:"\\eaf1"}),u.flame=new u("flame",{fontCharacter:"\\eaf2"}),u.foldDown=new u("fold-down",{fontCharacter:"\\eaf3"}),u.foldUp=new u("fold-up",{fontCharacter:"\\eaf4"}),u.fold=new u("fold",{fontCharacter:"\\eaf5"}),u.folderActive=new u("folder-active",{fontCharacter:"\\eaf6"}),u.folderOpened=new u("folder-opened",{fontCharacter:"\\eaf7"}),u.gear=new u("gear",{fontCharacter:"\\eaf8"}),u.gift=new u("gift",{fontCharacter:"\\eaf9"}),u.gistSecret=new u("gist-secret",{fontCharacter:"\\eafa"}),u.gist=new u("gist",{fontCharacter:"\\eafb"}),u.gitCommit=new u("git-commit",{fontCharacter:"\\eafc"}),u.gitCompare=new u("git-compare",{fontCharacter:"\\eafd"}),u.gitMerge=new u("git-merge",{fontCharacter:"\\eafe"}),u.githubAction=new u("github-action",{fontCharacter:"\\eaff"}),u.githubAlt=new u("github-alt",{fontCharacter:"\\eb00"}),u.globe=new u("globe",{fontCharacter:"\\eb01"}),u.grabber=new u("grabber",{fontCharacter:"\\eb02"}),u.graph=new u("graph",{fontCharacter:"\\eb03"}),u.gripper=new u("gripper",{fontCharacter:"\\eb04"}),u.heart=new u("heart",{fontCharacter:"\\eb05"}),u.home=new u("home",{fontCharacter:"\\eb06"}),u.horizontalRule=new u("horizontal-rule",{fontCharacter:"\\eb07"}),u.hubot=new u("hubot",{fontCharacter:"\\eb08"}),u.inbox=new u("inbox",{fontCharacter:"\\eb09"}),u.issueClosed=new u("issue-closed",{fontCharacter:"\\eba4"}),u.issueReopened=new u("issue-reopened",{fontCharacter:"\\eb0b"}),u.issues=new u("issues",{fontCharacter:"\\eb0c"}),u.italic=new u("italic",{fontCharacter:"\\eb0d"}),u.jersey=new u("jersey",{fontCharacter:"\\eb0e"}),u.json=new u("json",{fontCharacter:"\\eb0f"}),u.kebabVertical=new u("kebab-vertical",{fontCharacter:"\\eb10"}),u.key=new u("key",{fontCharacter:"\\eb11"}),u.law=new u("law",{fontCharacter:"\\eb12"}),u.lightbulbAutofix=new u("lightbulb-autofix",{fontCharacter:"\\eb13"}),u.linkExternal=new u("link-external",{fontCharacter:"\\eb14"}),u.link=new u("link",{fontCharacter:"\\eb15"}),u.listOrdered=new u("list-ordered",{fontCharacter:"\\eb16"}),u.listUnordered=new u("list-unordered",{fontCharacter:"\\eb17"}),u.liveShare=new u("live-share",{fontCharacter:"\\eb18"}),u.loading=new u("loading",{fontCharacter:"\\eb19"}),u.location=new u("location",{fontCharacter:"\\eb1a"}),u.mailRead=new u("mail-read",{fontCharacter:"\\eb1b"}),u.mail=new u("mail",{fontCharacter:"\\eb1c"}),u.markdown=new u("markdown",{fontCharacter:"\\eb1d"}),u.megaphone=new u("megaphone",{fontCharacter:"\\eb1e"}),u.mention=new u("mention",{fontCharacter:"\\eb1f"}),u.milestone=new u("milestone",{fontCharacter:"\\eb20"}),u.mortarBoard=new u("mortar-board",{fontCharacter:"\\eb21"}),u.move=new u("move",{fontCharacter:"\\eb22"}),u.multipleWindows=new u("multiple-windows",{fontCharacter:"\\eb23"}),u.mute=new u("mute",{fontCharacter:"\\eb24"}),u.noNewline=new u("no-newline",{fontCharacter:"\\eb25"}),u.note=new u("note",{fontCharacter:"\\eb26"}),u.octoface=new u("octoface",{fontCharacter:"\\eb27"}),u.openPreview=new u("open-preview",{fontCharacter:"\\eb28"}),u.package_=new u("package",{fontCharacter:"\\eb29"}),u.paintcan=new u("paintcan",{fontCharacter:"\\eb2a"}),u.pin=new u("pin",{fontCharacter:"\\eb2b"}),u.play=new u("play",{fontCharacter:"\\eb2c"}),u.run=new u("run",{fontCharacter:"\\eb2c"}),u.plug=new u("plug",{fontCharacter:"\\eb2d"}),u.preserveCase=new u("preserve-case",{fontCharacter:"\\eb2e"}),u.preview=new u("preview",{fontCharacter:"\\eb2f"}),u.project=new u("project",{fontCharacter:"\\eb30"}),u.pulse=new u("pulse",{fontCharacter:"\\eb31"}),u.question=new u("question",{fontCharacter:"\\eb32"}),u.quote=new u("quote",{fontCharacter:"\\eb33"}),u.radioTower=new u("radio-tower",{fontCharacter:"\\eb34"}),u.reactions=new u("reactions",{fontCharacter:"\\eb35"}),u.references=new u("references",{fontCharacter:"\\eb36"}),u.refresh=new u("refresh",{fontCharacter:"\\eb37"}),u.regex=new u("regex",{fontCharacter:"\\eb38"}),u.remoteExplorer=new u("remote-explorer",{fontCharacter:"\\eb39"}),u.remote=new u("remote",{fontCharacter:"\\eb3a"}),u.remove=new u("remove",{fontCharacter:"\\eb3b"}),u.replaceAll=new u("replace-all",{fontCharacter:"\\eb3c"}),u.replace=new u("replace",{fontCharacter:"\\eb3d"}),u.repoClone=new u("repo-clone",{fontCharacter:"\\eb3e"}),u.repoForcePush=new u("repo-force-push",{fontCharacter:"\\eb3f"}),u.repoPull=new u("repo-pull",{fontCharacter:"\\eb40"}),u.repoPush=new u("repo-push",{fontCharacter:"\\eb41"}),u.report=new u("report",{fontCharacter:"\\eb42"}),u.requestChanges=new u("request-changes",{fontCharacter:"\\eb43"}),u.rocket=new u("rocket",{fontCharacter:"\\eb44"}),u.rootFolderOpened=new u("root-folder-opened",{fontCharacter:"\\eb45"}),u.rootFolder=new u("root-folder",{fontCharacter:"\\eb46"}),u.rss=new u("rss",{fontCharacter:"\\eb47"}),u.ruby=new u("ruby",{fontCharacter:"\\eb48"}),u.saveAll=new u("save-all",{fontCharacter:"\\eb49"}),u.saveAs=new u("save-as",{fontCharacter:"\\eb4a"}),u.save=new u("save",{fontCharacter:"\\eb4b"}),u.screenFull=new u("screen-full",{fontCharacter:"\\eb4c"}),u.screenNormal=new u("screen-normal",{fontCharacter:"\\eb4d"}),u.searchStop=new u("search-stop",{fontCharacter:"\\eb4e"}),u.server=new u("server",{fontCharacter:"\\eb50"}),u.settingsGear=new u("settings-gear",{fontCharacter:"\\eb51"}),u.settings=new u("settings",{fontCharacter:"\\eb52"}),u.shield=new u("shield",{fontCharacter:"\\eb53"}),u.smiley=new u("smiley",{fontCharacter:"\\eb54"}),u.sortPrecedence=new u("sort-precedence",{fontCharacter:"\\eb55"}),u.splitHorizontal=new u("split-horizontal",{fontCharacter:"\\eb56"}),u.splitVertical=new u("split-vertical",{fontCharacter:"\\eb57"}),u.squirrel=new u("squirrel",{fontCharacter:"\\eb58"}),u.starFull=new u("star-full",{fontCharacter:"\\eb59"}),u.starHalf=new u("star-half",{fontCharacter:"\\eb5a"}),u.symbolClass=new u("symbol-class",{fontCharacter:"\\eb5b"}),u.symbolColor=new u("symbol-color",{fontCharacter:"\\eb5c"}),u.symbolConstant=new u("symbol-constant",{fontCharacter:"\\eb5d"}),u.symbolEnumMember=new u("symbol-enum-member",{fontCharacter:"\\eb5e"}),u.symbolField=new u("symbol-field",{fontCharacter:"\\eb5f"}),u.symbolFile=new u("symbol-file",{fontCharacter:"\\eb60"}),u.symbolInterface=new u("symbol-interface",{fontCharacter:"\\eb61"}),u.symbolKeyword=new u("symbol-keyword",{fontCharacter:"\\eb62"}),u.symbolMisc=new u("symbol-misc",{fontCharacter:"\\eb63"}),u.symbolOperator=new u("symbol-operator",{fontCharacter:"\\eb64"}),u.symbolProperty=new u("symbol-property",{fontCharacter:"\\eb65"}),u.wrench=new u("wrench",{fontCharacter:"\\eb65"}),u.wrenchSubaction=new u("wrench-subaction",{fontCharacter:"\\eb65"}),u.symbolSnippet=new u("symbol-snippet",{fontCharacter:"\\eb66"}),u.tasklist=new u("tasklist",{fontCharacter:"\\eb67"}),u.telescope=new u("telescope",{fontCharacter:"\\eb68"}),u.textSize=new u("text-size",{fontCharacter:"\\eb69"}),u.threeBars=new u("three-bars",{fontCharacter:"\\eb6a"}),u.thumbsdown=new u("thumbsdown",{fontCharacter:"\\eb6b"}),u.thumbsup=new u("thumbsup",{fontCharacter:"\\eb6c"}),u.tools=new u("tools",{fontCharacter:"\\eb6d"}),u.triangleDown=new u("triangle-down",{fontCharacter:"\\eb6e"}),u.triangleLeft=new u("triangle-left",{fontCharacter:"\\eb6f"}),u.triangleRight=new u("triangle-right",{fontCharacter:"\\eb70"}),u.triangleUp=new u("triangle-up",{fontCharacter:"\\eb71"}),u.twitter=new u("twitter",{fontCharacter:"\\eb72"}),u.unfold=new u("unfold",{fontCharacter:"\\eb73"}),u.unlock=new u("unlock",{fontCharacter:"\\eb74"}),u.unmute=new u("unmute",{fontCharacter:"\\eb75"}),u.unverified=new u("unverified",{fontCharacter:"\\eb76"}),u.verified=new u("verified",{fontCharacter:"\\eb77"}),u.versions=new u("versions",{fontCharacter:"\\eb78"}),u.vmActive=new u("vm-active",{fontCharacter:"\\eb79"}),u.vmOutline=new u("vm-outline",{fontCharacter:"\\eb7a"}),u.vmRunning=new u("vm-running",{fontCharacter:"\\eb7b"}),u.watch=new u("watch",{fontCharacter:"\\eb7c"}),u.whitespace=new u("whitespace",{fontCharacter:"\\eb7d"}),u.wholeWord=new u("whole-word",{fontCharacter:"\\eb7e"}),u.window=new u("window",{fontCharacter:"\\eb7f"}),u.wordWrap=new u("word-wrap",{fontCharacter:"\\eb80"}),u.zoomIn=new u("zoom-in",{fontCharacter:"\\eb81"}),u.zoomOut=new u("zoom-out",{fontCharacter:"\\eb82"}),u.listFilter=new u("list-filter",{fontCharacter:"\\eb83"}),u.listFlat=new u("list-flat",{fontCharacter:"\\eb84"}),u.listSelection=new u("list-selection",{fontCharacter:"\\eb85"}),u.selection=new u("selection",{fontCharacter:"\\eb85"}),u.listTree=new u("list-tree",{fontCharacter:"\\eb86"}),u.debugBreakpointFunctionUnverified=new u("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),u.debugBreakpointFunction=new u("debug-breakpoint-function",{fontCharacter:"\\eb88"}),u.debugBreakpointFunctionDisabled=new u("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),u.debugStackframeActive=new u("debug-stackframe-active",{fontCharacter:"\\eb89"}),u.debugStackframeDot=new u("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),u.debugStackframe=new u("debug-stackframe",{fontCharacter:"\\eb8b"}),u.debugStackframeFocused=new u("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),u.debugBreakpointUnsupported=new u("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),u.symbolString=new u("symbol-string",{fontCharacter:"\\eb8d"}),u.debugReverseContinue=new u("debug-reverse-continue",{fontCharacter:"\\eb8e"}),u.debugStepBack=new u("debug-step-back",{fontCharacter:"\\eb8f"}),u.debugRestartFrame=new u("debug-restart-frame",{fontCharacter:"\\eb90"}),u.callIncoming=new u("call-incoming",{fontCharacter:"\\eb92"}),u.callOutgoing=new u("call-outgoing",{fontCharacter:"\\eb93"}),u.menu=new u("menu",{fontCharacter:"\\eb94"}),u.expandAll=new u("expand-all",{fontCharacter:"\\eb95"}),u.feedback=new u("feedback",{fontCharacter:"\\eb96"}),u.groupByRefType=new u("group-by-ref-type",{fontCharacter:"\\eb97"}),u.ungroupByRefType=new u("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),u.account=new u("account",{fontCharacter:"\\eb99"}),u.bellDot=new u("bell-dot",{fontCharacter:"\\eb9a"}),u.debugConsole=new u("debug-console",{fontCharacter:"\\eb9b"}),u.library=new u("library",{fontCharacter:"\\eb9c"}),u.output=new u("output",{fontCharacter:"\\eb9d"}),u.runAll=new u("run-all",{fontCharacter:"\\eb9e"}),u.syncIgnored=new u("sync-ignored",{fontCharacter:"\\eb9f"}),u.pinned=new u("pinned",{fontCharacter:"\\eba0"}),u.githubInverted=new u("github-inverted",{fontCharacter:"\\eba1"}),u.debugAlt=new u("debug-alt",{fontCharacter:"\\eb91"}),u.serverProcess=new u("server-process",{fontCharacter:"\\eba2"}),u.serverEnvironment=new u("server-environment",{fontCharacter:"\\eba3"}),u.pass=new u("pass",{fontCharacter:"\\eba4"}),u.stopCircle=new u("stop-circle",{fontCharacter:"\\eba5"}),u.playCircle=new u("play-circle",{fontCharacter:"\\eba6"}),u.record=new u("record",{fontCharacter:"\\eba7"}),u.debugAltSmall=new u("debug-alt-small",{fontCharacter:"\\eba8"}),u.vmConnect=new u("vm-connect",{fontCharacter:"\\eba9"}),u.cloud=new u("cloud",{fontCharacter:"\\ebaa"}),u.merge=new u("merge",{fontCharacter:"\\ebab"}),u.exportIcon=new u("export",{fontCharacter:"\\ebac"}),u.graphLeft=new u("graph-left",{fontCharacter:"\\ebad"}),u.magnet=new u("magnet",{fontCharacter:"\\ebae"}),u.notebook=new u("notebook",{fontCharacter:"\\ebaf"}),u.redo=new u("redo",{fontCharacter:"\\ebb0"}),u.checkAll=new u("check-all",{fontCharacter:"\\ebb1"}),u.pinnedDirty=new u("pinned-dirty",{fontCharacter:"\\ebb2"}),u.passFilled=new u("pass-filled",{fontCharacter:"\\ebb3"}),u.circleLargeFilled=new u("circle-large-filled",{fontCharacter:"\\ebb4"}),u.circleLargeOutline=new u("circle-large-outline",{fontCharacter:"\\ebb5"}),u.combine=new u("combine",{fontCharacter:"\\ebb6"}),u.gather=new u("gather",{fontCharacter:"\\ebb6"}),u.table=new u("table",{fontCharacter:"\\ebb7"}),u.variableGroup=new u("variable-group",{fontCharacter:"\\ebb8"}),u.typeHierarchy=new u("type-hierarchy",{fontCharacter:"\\ebb9"}),u.typeHierarchySub=new u("type-hierarchy-sub",{fontCharacter:"\\ebba"}),u.typeHierarchySuper=new u("type-hierarchy-super",{fontCharacter:"\\ebbb"}),u.gitPullRequestCreate=new u("git-pull-request-create",{fontCharacter:"\\ebbc"}),u.runAbove=new u("run-above",{fontCharacter:"\\ebbd"}),u.runBelow=new u("run-below",{fontCharacter:"\\ebbe"}),u.notebookTemplate=new u("notebook-template",{fontCharacter:"\\ebbf"}),u.debugRerun=new u("debug-rerun",{fontCharacter:"\\ebc0"}),u.workspaceTrusted=new u("workspace-trusted",{fontCharacter:"\\ebc1"}),u.workspaceUntrusted=new u("workspace-untrusted",{fontCharacter:"\\ebc2"}),u.workspaceUnspecified=new u("workspace-unspecified",{fontCharacter:"\\ebc3"}),u.terminalCmd=new u("terminal-cmd",{fontCharacter:"\\ebc4"}),u.terminalDebian=new u("terminal-debian",{fontCharacter:"\\ebc5"}),u.terminalLinux=new u("terminal-linux",{fontCharacter:"\\ebc6"}),u.terminalPowershell=new u("terminal-powershell",{fontCharacter:"\\ebc7"}),u.terminalTmux=new u("terminal-tmux",{fontCharacter:"\\ebc8"}),u.terminalUbuntu=new u("terminal-ubuntu",{fontCharacter:"\\ebc9"}),u.terminalBash=new u("terminal-bash",{fontCharacter:"\\ebca"}),u.arrowSwap=new u("arrow-swap",{fontCharacter:"\\ebcb"}),u.copy=new u("copy",{fontCharacter:"\\ebcc"}),u.personAdd=new u("person-add",{fontCharacter:"\\ebcd"}),u.filterFilled=new u("filter-filled",{fontCharacter:"\\ebce"}),u.wand=new u("wand",{fontCharacter:"\\ebcf"}),u.debugLineByLine=new u("debug-line-by-line",{fontCharacter:"\\ebd0"}),u.inspect=new u("inspect",{fontCharacter:"\\ebd1"}),u.layers=new u("layers",{fontCharacter:"\\ebd2"}),u.layersDot=new u("layers-dot",{fontCharacter:"\\ebd3"}),u.layersActive=new u("layers-active",{fontCharacter:"\\ebd4"}),u.compass=new u("compass",{fontCharacter:"\\ebd5"}),u.compassDot=new u("compass-dot",{fontCharacter:"\\ebd6"}),u.compassActive=new u("compass-active",{fontCharacter:"\\ebd7"}),u.azure=new u("azure",{fontCharacter:"\\ebd8"}),u.issueDraft=new u("issue-draft",{fontCharacter:"\\ebd9"}),u.gitPullRequestClosed=new u("git-pull-request-closed",{fontCharacter:"\\ebda"}),u.gitPullRequestDraft=new u("git-pull-request-draft",{fontCharacter:"\\ebdb"}),u.debugAll=new u("debug-all",{fontCharacter:"\\ebdc"}),u.debugCoverage=new u("debug-coverage",{fontCharacter:"\\ebdd"}),u.runErrors=new u("run-errors",{fontCharacter:"\\ebde"}),u.folderLibrary=new u("folder-library",{fontCharacter:"\\ebdf"}),u.debugContinueSmall=new u("debug-continue-small",{fontCharacter:"\\ebe0"}),u.beakerStop=new u("beaker-stop",{fontCharacter:"\\ebe1"}),u.graphLine=new u("graph-line",{fontCharacter:"\\ebe2"}),u.graphScatter=new u("graph-scatter",{fontCharacter:"\\ebe3"}),u.pieChart=new u("pie-chart",{fontCharacter:"\\ebe4"}),u.bracket=new u("bracket",u.json.definition),u.bracketDot=new u("bracket-dot",{fontCharacter:"\\ebe5"}),u.bracketError=new u("bracket-error",{fontCharacter:"\\ebe6"}),u.lockSmall=new u("lock-small",{fontCharacter:"\\ebe7"}),u.azureDevops=new u("azure-devops",{fontCharacter:"\\ebe8"}),u.verifiedFilled=new u("verified-filled",{fontCharacter:"\\ebe9"})}(ie||(ie={}))},79881:function(Lt,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 u},dL:function(){return Ee},ri:function(){return N}});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 Ee(v){ie(v)||J.onUnexpectedError(v)}function ee(v){ie(v)||J.onUnexpectedExternalError(v)}function N(v){if(v instanceof Error){let{name:m,message:x}=v;const S=v.stacktrace||v.stack;return{$isError:!0,name:m,message:x,stack:S}}return v}const p="Canceled";function ie(v){return v instanceof Error&&v.name===p&&v.message===p}function Y(){const v=new Error(p);return v.name=v.message,v}function u(v){return v?new Error(`Illegal argument: ${v}`):new Error("Illegal argument")}function $(v){return v?new Error(`Illegal state: ${v}`):new Error("Illegal state")}class b extends Error{constructor(m){super("NotSupported"),m&&(this.message=m)}}},4348:function(Lt,Me,G){"use strict";G.d(Me,{D0:function(){return b},E7:function(){return v},K3:function(){return $},Q5:function(){return u},ZD:function(){return m},ju:function(){return N}});var z=G(79881),J=G(69323),Ee=G(34502),ee=G(95830),N;(function(x){x.None=()=>J.JT.None;function S(L){return(M,H=null,F)=>{let _=!1,g;return g=L(D=>{if(!_)return g?g.dispose():_=!0,M.call(H,D)},null,F),_&&g.dispose(),g}}x.once=S;function P(L,M){return j((H,F=null,_)=>L(g=>H.call(F,M(g)),null,_))}x.map=P;function C(L,M){return j((H,F=null,_)=>L(g=>{M(g),H.call(F,g)},null,_))}x.forEach=C;function k(L,M){return j((H,F=null,_)=>L(g=>M(g)&&H.call(F,g),null,_))}x.filter=k;function I(L){return L}x.signal=I;function R(...L){return(M,H=null,F)=>(0,J.F8)(...L.map(_=>_(g=>M.call(H,g),null,F)))}x.any=R;function B(L,M,H){let F=H;return P(L,_=>(F=M(F,_),F))}x.reduce=B;function j(L){let M;const H=new u({onFirstListenerAdd(){M=L(H.fire,H)},onLastListenerRemove(){M.dispose()}});return H.event}function q(L,M,H=100,F=!1,_){let g,D,V,de=0;const Te=new u({leakWarningThreshold:_,onFirstListenerAdd(){g=L(Pe=>{de++,D=M(D,Pe),F&&!V&&(Te.fire(D),D=void 0),clearTimeout(V),V=setTimeout(()=>{const Ne=D;D=void 0,V=void 0,(!F||de>1)&&Te.fire(Ne),de=0},H)})},onLastListenerRemove(){g.dispose()}});return Te.event}x.debounce=q;function te(L,M=(H,F)=>H===F){let H=!0,F;return k(L,_=>{const g=H||!M(_,F);return H=!1,F=_,g})}x.latch=te;function X(L,M){return[x.filter(L,M),x.filter(L,H=>!M(H))]}x.split=X;function ve(L,M=!1,H=[]){let F=H.slice(),_=L(V=>{F?F.push(V):D.fire(V)});const g=()=>{F&&F.forEach(V=>D.fire(V)),F=null},D=new u({onFirstListenerAdd(){_||(_=L(V=>D.fire(V)))},onFirstListenerDidAdd(){F&&(M?setTimeout(g):g())},onLastListenerRemove(){_&&_.dispose(),_=null}});return D.event}x.buffer=ve;class Ie{constructor(M){this.event=M}map(M){return new Ie(P(this.event,M))}forEach(M){return new Ie(C(this.event,M))}filter(M){return new Ie(k(this.event,M))}reduce(M,H){return new Ie(B(this.event,M,H))}latch(){return new Ie(te(this.event))}debounce(M,H=100,F=!1,_){return new Ie(q(this.event,M,H,F,_))}on(M,H,F){return this.event(M,H,F)}once(M,H,F){return S(this.event)(M,H,F)}}function xe(L){return new Ie(L)}x.chain=xe;function it(L,M,H=F=>F){const F=(...V)=>D.fire(H(...V)),_=()=>L.on(M,F),g=()=>L.removeListener(M,F),D=new u({onFirstListenerAdd:_,onLastListenerRemove:g});return D.event}x.fromNodeEventEmitter=it;function U(L,M,H=F=>F){const F=(...V)=>D.fire(H(...V)),_=()=>L.addEventListener(M,F),g=()=>L.removeEventListener(M,F),D=new u({onFirstListenerAdd:_,onLastListenerRemove:g});return D.event}x.fromDOMEventEmitter=U;function w(L){return new Promise(M=>S(L)(M))}x.toPromise=w})(N||(N={}));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 I,R=0;for(const[B,j]of this._stacks)(!I||R<j)&&(I=B,R=j);console.warn(`[${this.name}] potential listener LEAK detected, having ${S} listeners already. MOST frequent listener (${R}):`),console.warn(I)}return()=>{const I=this._stacks.get(C)||0;this._stacks.set(C,I-1)}}}class u{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 Ee.S);const I=this._listeners.isEmpty();I&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const R=this._listeners.push(P?[S,P]:S);I&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,S,P);const B=(k=this._leakageMon)===null||k===void 0?void 0:k.check(this._listeners.size),j=(0,J.OF)(()=>{B&&B(),this._disposed||(R(),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 Ee.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,I]=this._deliveryQueue.shift();try{typeof k=="function"?k.call(void 0,I):k[0].call(k[1],I)}catch(R){(0,z.dL)(R)}}(C=this._perfMon)===null||C===void 0||C.stop()}}dispose(){var S,P,C,k,I;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),(I=this._leakageMon)===null||I===void 0||I.dispose())}}class $ extends u{constructor(S){super(S),this._isPaused=0,this._eventQueue=new Ee.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 v{constructor(){this.buffers=[]}wrapEvent(S){return(P,C,k)=>S(I=>{const R=this.buffers[this.buffers.length-1];R?R.push(()=>P.call(C,I)):P.call(C,I)},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=N.None,this.inputEventListener=J.JT.None,this.emitter=new u({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(Lt,Me,G){"use strict";G.d(Me,{I:function(){return z}});function z(J){const Ee=this;let ee=!1,N;return function(){return ee||(ee=!0,N=J.apply(Ee,arguments)),N}}},88226:function(Lt,Me,G){"use strict";G.d(Me,{$:function(){return z}});var z;(function(J){function Ee(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}J.is=Ee;const ee=Object.freeze([]);function N(){return ee}J.empty=N;function*p(R){yield R}J.single=p;function ie(R){return R||ee}J.from=ie;function Y(R){return!R||R[Symbol.iterator]().next().done===!0}J.isEmpty=Y;function u(R){return R[Symbol.iterator]().next().value}J.first=u;function $(R,B){for(const j of R)if(B(j))return!0;return!1}J.some=$;function b(R,B){for(const j of R)if(B(j))return j}J.find=b;function*v(R,B){for(const j of R)B(j)&&(yield j)}J.filter=v;function*m(R,B){let j=0;for(const q of R)yield B(q,j++)}J.map=m;function*x(...R){for(const B of R)for(const j of B)yield j}J.concat=x;function*S(R){for(const B of R)for(const j of B)yield j}J.concatNested=S;function P(R,B,j){let q=j;for(const te of R)q=B(q,te);return q}J.reduce=P;function*C(R,B,j=R.length){for(B<0&&(B+=R.length),j<0?j+=R.length:j>R.length&&(j=R.length);B<j;B++)yield R[B]}J.slice=C;function k(R,B=Number.POSITIVE_INFINITY){const j=[];if(B===0)return[j,R];const q=R[Symbol.iterator]();for(let te=0;te<B;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 I(R,B,j=(q,te)=>q===te){const q=R[Symbol.iterator](),te=B[Symbol.iterator]();for(;;){const X=q.next(),ve=te.next();if(X.done!==ve.done)return!1;if(X.done)return!0;if(!j(X.value,ve.value))return!1}}J.equals=I})(z||(z={}))},69323:function(Lt,Me,G){"use strict";G.d(Me,{B9:function(){return m},F8:function(){return x},JT:function(){return C},Jz:function(){return I},OF:function(){return S},SL:function(){return P},Wf:function(){return v},XK:function(){return k},dk:function(){return $}});var z=G(17845),J=G(88226);const Ee=!1;let ee=null;function N(R){ee=R}if(Ee){const R="__is_disposable_tracked__";N(new class{trackDisposable(B){const j=new Error("Potentially leaked disposable").stack;setTimeout(()=>{B[R]||console.log(j)},3e3)}setParent(B,j){if(B&&B!==C.None)try{B[R]=!0}catch(q){}}markAsDisposed(B){if(B&&B!==C.None)try{B[R]=!0}catch(j){}}markAsSingleton(B){}})}function p(R){return ee==null||ee.trackDisposable(R),R}function ie(R){ee==null||ee.markAsDisposed(R)}function Y(R,B){ee==null||ee.setParent(R,B)}function u(R,B){if(ee)for(const j of R)ee.setParent(j,B)}function $(R){return ee==null||ee.markAsSingleton(R),R}class b extends Error{constructor(B){super(`Encountered errors while disposing of store. Errors: [${B.join(", ")}]`),this.errors=B}}function v(R){return typeof R.dispose=="function"&&R.dispose.length===0}function m(R){if(J.$.is(R)){let B=[];for(const j of R)if(j)try{j.dispose()}catch(q){B.push(q)}if(B.length===1)throw B[0];if(B.length>1)throw new b(B);return Array.isArray(R)?[]:R}else if(R)return R.dispose(),R}function x(...R){const B=S(()=>m(R));return u(R,B),B}function S(R){const B=p({dispose:(0,z.I)(()=>{ie(B),R()})});return B}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(B){if(!B)return B;if(B===this)throw new Error("Cannot register a disposable on itself!");return Y(B,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(B),B}}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(B){if(B===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(B)}}C.None=Object.freeze({dispose(){}});class k{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(B){var j;this._isDisposed||B===this._value||((j=this._value)===null||j===void 0||j.dispose(),B&&Y(B,this),this._value=B)}clear(){this.value=void 0}dispose(){var B;this._isDisposed=!0,ie(this),(B=this._value)===null||B===void 0||B.dispose(),this._value=void 0}clearAndLeak(){const B=this._value;return this._value=void 0,B&&Y(B,null),B}}class I{constructor(B){this.object=B}dispose(){}}},34502:function(Lt,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 N=ee.next;ee.prev=z.Undefined,ee.next=z.Undefined,ee=N}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,N){const p=new z(ee);if(this._first===z.Undefined)this._first=p,this._last=p;else if(N){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 N=ee.prev;N.next=ee.next,ee.next.prev=N}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(Lt,Me,G){"use strict";G.d(Me,{$L:function(){return q},ED:function(){return I},IJ:function(){return B},OS:function(){return Ie},WE:function(){return X},dz:function(){return R},gn:function(){return te},li:function(){return S},r:function(){return U},tY:function(){return j},xS:function(){return ve}});var z=G(97671),J;const Ee="en";let ee=!1,N=!1,p=!1,ie=!1,Y=!1,u=!1,$=!1,b,v=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,N=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,u=!0,b=navigator.language,v=b;else if(typeof P=="object"){ee=P.platform==="win32",N=P.platform==="darwin",p=P.platform==="linux",ie=p&&!!P.env.SNAP&&!!P.env.SNAP_REVISION,b=Ee,v=Ee;const w=P.env.VSCODE_NLS_CONFIG;if(w)try{const L=JSON.parse(w),M=L.availableLanguages["*"];b=L.locale,v=M||Ee,m=L._translationsConfigFile}catch(L){}Y=!0}else console.error("Unable to resolve platform.");let k=0;N?k=1:ee?k=3:p&&(k=2);const I=ee,R=N,B=p,j=Y,q=u,te=$,X=x,ve=function(){if(S.setImmediate)return S.setImmediate.bind(S);if(typeof S.postMessage=="function"&&!S.importScripts){let M=[];S.addEventListener("message",F=>{if(F.data&&F.data.vscodeSetImmediateId)for(let _=0,g=M.length;_<g;_++){const D=M[_];if(D.id===F.data.vscodeSetImmediateId){M.splice(_,1),D.callback();return}}});let H=0;return F=>{const _=++H;M.push({id:_,callback:F}),S.postMessage({vscodeSetImmediateId:_},"*")}}if(typeof(P==null?void 0:P.nextTick)=="function")return P.nextTick.bind(P);const L=Promise.resolve();return M=>L.then(M)}(),Ie=N||$?2:ee?1:3;let xe=!0,it=!1;function U(){if(!it){it=!0;const w=new Uint8Array(2);w[0]=1,w[1]=2,xe=new Uint16Array(w.buffer)[0]===513}return xe}},95830:function(Lt,Me,G){"use strict";G.d(Me,{G:function(){return Ee}});var z=G(23345);const J=z.li.performance&&typeof z.li.performance.now=="function";class Ee{constructor(N){this._highResolution=J&&N,this._startTime=this._now(),this._stopTime=-1}static create(N=!0){return new Ee(N)}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(Lt,Me,G){"use strict";G.d(Me,{$i:function(){return de},C8:function(){return Dt},GF:function(){return b},HO:function(){return H},IO:function(){return v},K7:function(){return Ze},Kw:function(){return xt},LC:function(){return S},Mh:function(){return ve},P1:function(){return Ie},PJ:function(){return He},Qe:function(){return Te},R1:function(){return $},RP:function(){return D},S6:function(){return Wt},TT:function(){return I},Ut:function(){return _},V8:function(){return P},WU:function(){return Ee},YK:function(){return it},YU:function(){return ee},ZG:function(){return xe},ZH:function(){return w},ab:function(){return Pe},c1:function(){return Rt},df:function(){return q},ec:function(){return N},fi:function(){return ri},fy:function(){return p},j3:function(){return ie},j_:function(){return B},m5:function(){return z},mK:function(){return j},mr:function(){return m},oH:function(){return se},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 nt},un:function(){return u},uq:function(){return x},vH:function(){return M},xe:function(){return Ne},zY:function(){return R}});function z(K){return!K||typeof K!="string"?!0:K.trim().length===0}const J=/{(\d+)}/g;function Ee(K,...oe){return oe.length===0?K:K.replace(J,function(ye,Ae){const Fe=parseInt(Ae,10);return isNaN(Fe)||Fe<0||Fe>=oe.length?ye:oe[Fe]})}function ee(K){return K.replace(/[<>&]/g,function(oe){switch(oe){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return oe}})}function N(K){return K.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(K,oe=" "){const ye=ie(K,oe);return Y(ye,oe)}function ie(K,oe){if(!K||!oe)return K;const ye=oe.length;if(ye===0||K.length===0)return K;let Ae=0;for(;K.indexOf(oe,Ae)===Ae;)Ae=Ae+ye;return K.substring(Ae)}function Y(K,oe){if(!K||!oe)return K;const ye=oe.length,Ae=K.length;if(ye===0||Ae===0)return K;let Fe=Ae,$e=-1;for(;$e=K.lastIndexOf(oe,Fe-1),!($e===-1||$e+ye!==Fe);){if($e===0)return"";Fe=$e}return K.substring(0,Fe)}function u(K){return K.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function $(K){return K.replace(/\*/g,"")}function b(K,oe,ye={}){if(!K)throw new Error("Cannot create regex from empty string");oe||(K=N(K)),ye.wholeWord&&(/\B/.test(K.charAt(0))||(K="\\b"+K),/\B/.test(K.charAt(K.length-1))||(K=K+"\\b"));let Ae="";return ye.global&&(Ae+="g"),ye.matchCase||(Ae+="i"),ye.multiline&&(Ae+="m"),ye.unicode&&(Ae+="u"),new RegExp(K,Ae)}function v(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 oe=0,ye=K.length;oe<ye;oe++){const Ae=K.charCodeAt(oe);if(Ae!==32&&Ae!==9)return oe}return-1}function P(K,oe=0,ye=K.length){for(let Ae=oe;Ae<ye;Ae++){const Fe=K.charCodeAt(Ae);if(Fe!==32&&Fe!==9)return K.substring(oe,Ae)}return K.substring(oe,ye)}function C(K,oe=K.length-1){for(let ye=oe;ye>=0;ye--){const Ae=K.charCodeAt(ye);if(Ae!==32&&Ae!==9)return ye}return-1}function k(K,oe){return K<oe?-1:K>oe?1:0}function I(K,oe,ye=0,Ae=K.length,Fe=0,$e=oe.length){for(;ye<Ae&&Fe<$e;ye++,Fe++){let _t=K.charCodeAt(ye),Pt=oe.charCodeAt(Fe);if(_t<Pt)return-1;if(_t>Pt)return 1}const bt=Ae-ye,We=$e-Fe;return bt<We?-1:bt>We?1:0}function R(K,oe){return B(K,oe,0,K.length,0,oe.length)}function B(K,oe,ye=0,Ae=K.length,Fe=0,$e=oe.length){for(;ye<Ae&&Fe<$e;ye++,Fe++){let _t=K.charCodeAt(ye),Pt=oe.charCodeAt(Fe);if(_t===Pt)continue;if(_t>=128||Pt>=128)return I(K.toLowerCase(),oe.toLowerCase(),ye,Ae,Fe,$e);j(_t)&&(_t-=32),j(Pt)&&(Pt-=32);const ft=_t-Pt;if(ft!==0)return ft}const bt=Ae-ye,We=$e-Fe;return bt<We?-1:bt>We?1:0}function j(K){return K>=97&&K<=122}function q(K){return K>=65&&K<=90}function te(K,oe){return K.length===oe.length&&B(K,oe)===0}function X(K,oe){const ye=oe.length;return oe.length>K.length?!1:B(K,oe,0,ye)===0}function ve(K,oe){let ye,Ae=Math.min(K.length,oe.length);for(ye=0;ye<Ae;ye++)if(K.charCodeAt(ye)!==oe.charCodeAt(ye))return ye;return Ae}function Ie(K,oe){let ye,Ae=Math.min(K.length,oe.length);const Fe=K.length-1,$e=oe.length-1;for(ye=0;ye<Ae;ye++)if(K.charCodeAt(Fe-ye)!==oe.charCodeAt($e-ye))return ye;return Ae}function xe(K){return 55296<=K&&K<=56319}function it(K){return 56320<=K&&K<=57343}function U(K,oe){return(K-55296<<10)+(oe-56320)+65536}function w(K,oe,ye){const Ae=K.charCodeAt(ye);if(xe(Ae)&&ye+1<oe){const Fe=K.charCodeAt(ye+1);if(it(Fe))return U(Ae,Fe)}return Ae}function L(K,oe){const ye=K.charCodeAt(oe-1);if(it(ye)&&oe>1){const Ae=K.charCodeAt(oe-2);if(xe(Ae))return U(Ae,ye)}return ye}function M(K,oe){const ye=ce.getInstance(),Ae=oe,Fe=K.length,$e=w(K,Fe,oe);oe+=$e>=65536?2:1;let bt=ye.getGraphemeBreakType($e);for(;oe<Fe;){const We=w(K,Fe,oe),_t=ye.getGraphemeBreakType(We);if(ri(bt,_t))break;oe+=We>=65536?2:1,bt=_t}return oe-Ae}function H(K,oe){const ye=ce.getInstance(),Ae=oe,Fe=L(K,oe);oe-=Fe>=65536?2:1;let $e=ye.getGraphemeBreakType(Fe);for(;oe>0;){const bt=L(K,oe),We=ye.getGraphemeBreakType(bt);if(ri(We,$e))break;oe-=bt>=65536?2:1,$e=We}return Ae-oe}const F=/(?:[\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 F.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 de(K){return V.test(K)}const Te=/[\u2028\u2029]/;function Pe(K){return Te.test(K)}function Ne(K){for(let oe=0,ye=K.length;oe<ye;oe++)if(Ze(K.charCodeAt(oe)))return!0;return!1}function Ze(K){return K=+K,K>=11904&&K<=55215||K>=63744&&K<=64255||K>=65281&&K<=65374}function Dt(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 nt(K){return!!(K&&K.length>0&&K.charCodeAt(0)===65279)}function xt(K,oe=!1){return K?(oe&&(K=K.replace(/\\./g,"")),K.toLowerCase()!==K):!1}function He(K){return K=K%(2*26),K<26?String.fromCharCode(97+K):String.fromCharCode(65+K-26)}function Wt(K){return ce.getInstance().getGraphemeBreakType(K)}function ri(K,oe){return K===0?oe!==5&&oe!==7:K===2&&oe===3?!1:K===4||K===2||K===3||oe===4||oe===2||oe===3?!0:!(K===8&&(oe===8||oe===9||oe===11||oe===12)||(K===11||K===9)&&(oe===9||oe===10)||(K===12||K===10)&&oe===10||oe===5||oe===13||oe===7||K===1||K===13&&oe===14||K===6&&oe===6)}class ce{constructor(){this._data=Re()}static getInstance(){return ce._INSTANCE||(ce._INSTANCE=new ce),ce._INSTANCE}getGraphemeBreakType(oe){if(oe<32)return oe===10?3:oe===13?2:4;if(oe<127)return 0;const ye=this._data,Ae=ye.length/3;let Fe=1;for(;Fe<=Ae;)if(oe<ye[3*Fe])Fe=2*Fe;else if(oe>ye[3*Fe+1])Fe=2*Fe+1;else return ye[3*Fe+2];return 0}}ce._INSTANCE=null;function Re(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function se(K,oe){if(K===0)return 0;const ye=Ue(K,oe);if(ye!==void 0)return ye;const Ae=L(oe,K);return K-=Ve(Ae),K}function Ue(K,oe){let ye=L(oe,K);for(K-=Ve(ye);qe(ye)||ye===65039||ye===8419;){if(K===0)return;ye=L(oe,K),K-=Ve(ye)}if(Dt(ye)){if(K>=0){const Ae=L(oe,K);Ae===8205&&(K-=Ve(Ae))}return K}}function Ve(K){return K>=65536?2:1}function qe(K){return 127995<=K&&K<=127999}},72999:function(Lt,Me,G){"use strict";G.d(Me,{$E:function(){return S},$K:function(){return ie},D8:function(){return v},HD:function(){return J},IU:function(){return P},Jp:function(){return Y},Kn:function(){return Ee},cW:function(){return $},f6:function(){return C},hj:function(){return ee},jn:function(){return N},kJ:function(){return z},mf:function(){return b},o8:function(){return p},p_:function(){return u},vE:function(){return k}});function z(I){return Array.isArray(I)}function J(I){return typeof I=="string"}function Ee(I){return typeof I=="object"&&I!==null&&!Array.isArray(I)&&!(I instanceof RegExp)&&!(I instanceof Date)}function ee(I){return typeof I=="number"&&!isNaN(I)}function N(I){return I===!0||I===!1}function p(I){return typeof I=="undefined"}function ie(I){return!Y(I)}function Y(I){return p(I)||I===null}function u(I,R){if(!I)throw new Error(R?`Unexpected type, expected '${R}'`:"Unexpected type")}function $(I){if(Y(I))throw new Error("Assertion Failed: argument is undefined or null");return I}function b(I){return typeof I=="function"}function v(I,R){const B=Math.min(I.length,R.length);for(let j=0;j<B;j++)m(I[j],R[j])}function m(I,R){if(J(R)){if(typeof I!==R)throw new Error(`argument does not match constraint: typeof ${R}`)}else if(b(R)){try{if(I instanceof R)return}catch(B){}if(!Y(I)&&I.constructor===R||R.length===1&&R.call(void 0,I)===!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(I){let R=[],B=Object.getPrototypeOf(I);for(;Object.prototype!==B;)R=R.concat(Object.getOwnPropertyNames(B)),B=Object.getPrototypeOf(B);return R}function S(I){const R=[];for(const B of x(I))typeof I[B]=="function"&&R.push(B);return R}function P(I,R){const B=q=>function(){const te=Array.prototype.slice.call(arguments,0);return R(q,te)};let j={};for(const q of I)j[q]=B(q);return j}function C(I){return I===null?void 0:I}function k(I,R="Unreachable"){throw new Error(R)}},13268:function(Lt,Me,G){"use strict";G.d(Me,{N:function(){return J}});function z(Ee,ee){let N;return ee.length===0?N=Ee:N=Ee.replace(/\{(\d+)\}/g,function(p,ie){const Y=ie[0];return typeof ee[Y]!="undefined"?ee[Y]:p}),N}function J(Ee,ee,...N){return z(ee,N)}},96236:function(Lt,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),Ee=G(4348),ee=G(88226),N=G(69323),p=G(34502),ie=G(35884),Y=G(90689),u=G(16925),$=G(49055),b=function(I,R,B,j){var q=arguments.length,te=q<3?R:j===null?j=Object.getOwnPropertyDescriptor(R,B):j,X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate(I,R,B,j);else for(var ve=I.length-1;ve>=0;ve--)(X=I[ve])&&(te=(q<3?X(te):q>3?X(R,B,te):X(R,B))||te);return q>3&&te&&Object.defineProperty(R,B,te),te},v=function(I,R){return function(B,j){R(B,j,I)}};function m(I){return I.command!==void 0}class x{constructor(R){this.id=x._idPool++,this._debugName=R}}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,u.yh)("menuService"),P=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Ee.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:I=>I===x.CommandPalette}}addCommand(I){return this.addCommands(ee.$.single(I))}addCommands(I){for(const R of I)this._commands.set(R.id,R);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,N.OF)(()=>{let R=!1;for(const B of I)R=this._commands.delete(B.id)||R;R&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(I){return this._commands.get(I)}getCommands(){const I=new Map;return this._commands.forEach((R,B)=>I.set(B,R)),I}appendMenuItem(I,R){return this.appendMenuItems(ee.$.single({id:I,item:R}))}appendMenuItems(I){const R=new Set,B=new p.S;for(const{id:j,item:q}of I){let te=this._menuItems.get(j);te||(te=new p.S,this._menuItems.set(j,te)),B.push(te.push(q)),R.add(j)}return this._onDidChangeMenu.fire(R),(0,N.OF)(()=>{if(B.size>0){for(let j of B)j();this._onDidChangeMenu.fire(R),B.clear()}})}getMenuItems(I){let R;return this._menuItems.has(I)?R=[...this._menuItems.get(I)]:R=[],I===x.CommandPalette&&this._appendImplicitItems(R),R}_appendImplicitItems(I){const R=new Set;for(const B of I)m(B)&&(R.add(B.command.id),B.alt&&R.add(B.alt.id));this._commands.forEach((B,j)=>{R.has(j)||I.push({command:B})})}};class C extends z.wY{constructor(R,B,j,q){super(`submenuitem.${R.submenu.id}`,typeof R.title=="string"?R.title:R.title.value,[],"submenu"),this.item=R,this._menuService=B,this._contextKeyService=j,this._options=q}get actions(){const R=[],B=this._menuService.createMenu(this.item.submenu,this._contextKeyService),j=B.getActions(this._options);B.dispose();for(const[,q]of j)q.length>0&&(R.push(...q),R.push(new z.Z0));return R.length&&R.pop(),R}}let k=class Xo{constructor(R,B,j,q,te){var X,ve;if(this._commandService=te,this.id=R.id,this.label=j!=null&&j.renderShortTitle&&R.shortTitle?typeof R.shortTitle=="string"?R.shortTitle:R.shortTitle.value:typeof R.title=="string"?R.title:R.title.value,this.tooltip=(ve=typeof R.tooltip=="string"?R.tooltip:(X=R.tooltip)===null||X===void 0?void 0:X.value)!==null&&ve!==void 0?ve:"",this.enabled=!R.precondition||q.contextMatchesRules(R.precondition),this.checked=void 0,R.toggled){const Ie=R.toggled.condition?R.toggled:{condition:R.toggled};this.checked=q.contextMatchesRules(Ie.condition),this.checked&&Ie.tooltip&&(this.tooltip=typeof Ie.tooltip=="string"?Ie.tooltip:Ie.tooltip.value),Ie.title&&(this.label=typeof Ie.title=="string"?Ie.title:Ie.title.value)}this.item=R,this.alt=B?new Xo(B,void 0,j,q,te):void 0,this._options=j,$.kS.isThemeIcon(R.icon)&&(this.class=J.dT.asClassName(R.icon))}dispose(){}run(...R){var B,j;let q=[];return!((B=this._options)===null||B===void 0)&&B.arg&&(q=[...q,this._options.arg]),!((j=this._options)===null||j===void 0)&&j.shouldForwardArgs&&(q=[...q,...R]),this._commandService.executeCommand(this.id,...q)}};k=b([v(3,Y.i6),v(4,ie.H)],k)},35884:function(Lt,Me,G){"use strict";G.d(Me,{H:function(){return ie},P:function(){return Y}});var z=G(4348),J=G(88226),Ee=G(69323),ee=G(34502),N=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(u,$){if(!u)throw new Error("invalid command");if(typeof u=="string"){if(!$)throw new Error("invalid command");return this.registerCommand({id:u,handler:$})}if(u.description){const S=[];for(let C of u.description.args)S.push(C.constraint);const P=u.handler;u.handler=function(C,...k){return(0,N.D8)(k,S),P(C,...k)}}const{id:b}=u;let v=this._commands.get(b);v||(v=new ee.S,this._commands.set(b,v));let m=v.unshift(u),x=(0,Ee.OF)(()=>{m();const S=this._commands.get(b);S!=null&&S.isEmpty()&&this._commands.delete(b)});return this._onDidRegisterCommand.fire(b),x}registerCommandAlias(u,$){return Y.registerCommand(u,(b,...v)=>b.get(ie).executeCommand($,...v))}getCommand(u){const $=this._commands.get(u);if(!(!$||$.isEmpty()))return J.$.first($)}getCommands(){const u=new Map;for(const $ of this._commands.keys()){const b=this.getCommand($);b&&u.set($,b)}return u}};Y.registerCommand("noop",()=>{})},90689:function(Lt,Me,G){"use strict";G.d(Me,{Ao:function(){return ie},Eq:function(){return U},Fb:function(){return Y},K8:function(){return M},i6:function(){return it},uy:function(){return xe}});var z=G(23345),J=G(82983),Ee=G(16925);let ee=z.WE||"";const N=new Map;N.set("false",!1),N.set("true",!0),N.set("isMac",z.dz),N.set("isLinux",z.IJ),N.set("isWindows",z.ED),N.set("isWeb",z.$L),N.set("isMacNative",z.dz&&!z.$L),N.set("isEdge",ee.indexOf("Edg/")>=0),N.set("isFirefox",ee.indexOf("Firefox")>=0),N.set("isChrome",ee.indexOf("Chrome")>=0),N.set("isSafari",ee.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class ie{static has(_){return v.create(_)}static equals(_,g){return m.create(_,g)}static regex(_,g){return q.create(_,g)}static not(_){return C.create(_)}static and(..._){return ve.create(_,null)}static or(..._){return Ie.create(_,null,!0)}static deserialize(_,g=!1){if(_)return this._deserializeOrExpression(_,g)}static _deserializeOrExpression(_,g){let D=_.split("||");return Ie.create(D.map(V=>this._deserializeAndExpression(V,g)),null,!0)}static _deserializeAndExpression(_,g){let D=_.split("&&");return ve.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 R.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 j.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(_)){const D=_.split("<");return B.create(D[0].trim(),D[1].trim())}return/^\!\s*/.test(_)?C.create(_.substr(1).trim()):v.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 de=_.slice(D+1,V),Te=_[V+1]==="i"?"i":"";try{return new RegExp(de,Te)}catch(Pe){if(g)throw new Error(`bad regexp-value '${_}', parse error: ${Pe}`);return console.warn(`bad regexp-value '${_}', parse error: ${Pe}`),null}}}function Y(F,_){const g=F?F.substituteConstants():void 0,D=_?_.substituteConstants():void 0;return!g&&!D?!0:!g||!D?!1:g.equals(D)}function u(F,_){return F.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 v{constructor(_,g){this.key=_,this.negated=g,this.type=2}static create(_,g=null){const D=N.get(_);return typeof D=="boolean"?D?b.INSTANCE:$.INSTANCE:new v(_,g)}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,_.key)}equals(_){return _.type===this.type?this.key===_.key:!1}substituteConstants(){const _=N.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?v.create(_,D):C.create(_,D);const V=N.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 _=N.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):v.create(_,D);const V=N.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 _=N.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=N.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 _=N.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=v.create(this.key,this)),this.negated}}function k(F,_){if(typeof F=="string"){const g=parseFloat(F);isNaN(g)||(F=g)}return typeof F=="string"||typeof F=="number"?_(F):$.INSTANCE}class I{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=12}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=j.create(this.key,this.value,this)),this.negated}}class R{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=13}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=B.create(this.key,this.value,this)),this.negated}}class B{constructor(_,g,D){this.key=_,this.value=g,this.negated=D,this.type=14}static create(_,g,D=null){return k(g,V=>new B(_,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 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=I.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(F){let _=null;for(let g=0,D=F.length;g<D;g++){const V=F[g].substituteConstants();if(F[g]!==V&&_===null){_=[];for(let de=0;de<g;de++)_[de]=F[de]}_!==null&&(_[g]=V)}return _===null?F:_}class ve{constructor(_,g){this.expr=_,this.negated=g,this.type=6}static create(_,g){return ve._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=u(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:ve.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 de of _)if(de){if(de.type===1){V=!0;continue}if(de.type===0)return $.INSTANCE;if(de.type===6){D.push(...de.expr);continue}D.push(de)}if(D.length===0&&V)return b.INSTANCE;if(D.length!==0){if(D.length===1)return D[0];D.sort(u);for(let de=1;de<D.length;de++)D[de-1].equals(D[de])&&(D.splice(de,1),de--);if(D.length===1)return D[0];for(;D.length>1;){const de=D[D.length-1];if(de.type!==9)break;D.pop();const Te=D.pop(),Pe=D.length===0,Ne=Ie.create(de.expr.map(Ze=>ve.create([Ze,Te],null)),null,Pe);Ne&&(D.push(Ne),D.sort(u))}return D.length===1?D[0]:new ve(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=Ie.create(_,this,!0)}return this.negated}}class Ie{constructor(_,g){this.expr=_,this.negated=g,this.type=9}static create(_,g,D){return Ie._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=u(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:Ie.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=[],de=!1;if(_){for(let Te=0,Pe=_.length;Te<Pe;Te++){const Ne=_[Te];if(Ne){if(Ne.type===0){de=!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&&de)return $.INSTANCE;V.sort(u)}if(V.length!==0){if(V.length===1)return V[0];for(let Te=1;Te<V.length;Te++)V[Te-1].equals(V[Te])&&(V.splice(Te,1),Te--);if(V.length===1)return V[0];if(D){for(let Te=0;Te<V.length;Te++)for(let Pe=Te+1;Pe<V.length;Pe++)M(V[Te],V[Pe])&&(V.splice(Pe,1),Pe--);if(V.length===1)return V[0]}return new Ie(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 Te of H(g))for(const Pe of H(D))V.push(ve.create([Te,Pe],null));const de=_.length===0;_.unshift(Ie.create(V,null,de))}this.negated=_[0]}return this.negated}}class xe extends v{constructor(_,g,D){super(_,null),this._defaultValue=g,typeof D=="object"?xe._info.push(Object.assign(Object.assign({},D),{key:_})):D!==!0&&xe._info.push({key:_,description:D,type:g!=null?typeof g:void 0})}static all(){return xe._info.values()}bindTo(_){return _.createKey(this.key,this._defaultValue)}getValue(_){return _.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(_){return m.create(this.key,_)}}xe._info=[];const it=(0,Ee.yh)("contextKeyService"),U="setContext";function w(F,_){return F<_?-1:F>_?1:0}function L(F,_,g,D){return F<g?-1:F>g?1:_<D?-1:_>D?1:0}function M(F,_){if(_.type===6&&F.type!==9&&F.type!==6){for(const V of _.expr)if(F.equals(V))return!0}const g=F.negate(),D=H(g).concat(H(_));D.sort(u);for(let V=0;V<D.length;V++){const Te=D[V].negate();for(let Pe=V+1;Pe<D.length;Pe++){const Ne=D[Pe];if(Te.equals(Ne))return!0}}return!1}function H(F){return F.type===9?F.expr:[F]}},16925:function(Lt,Me,G){"use strict";G.d(Me,{I8:function(){return z},TG:function(){return J},jt:function(){return N},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 Ee(p,ie,Y,u){ie[z.DI_TARGET]===ie?ie[z.DI_DEPENDENCIES].push({id:p,index:Y,optional:u}):(ie[z.DI_DEPENDENCIES]=[{id:p,index:Y,optional:u}],ie[z.DI_TARGET]=ie)}function ee(p){if(z.serviceIds.has(p))return z.serviceIds.get(p);const ie=function(Y,u,$){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ee(ie,Y,$,!1)};return ie.toString=()=>p,z.serviceIds.set(p,ie),ie}function N(p){return function(ie,Y,u){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Ee(p,ie,u,!0)}}},44650:function(Lt,Me,G){"use strict";G.d(Me,{B:function(){return ee}});var z=G(76068),J=G(72999);class Ee{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 Ee},66213:function(Lt,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(Lt,Me,G){"use strict";G.d(Me,{EN:function(){return u},IP:function(){return v},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),Ee=G(69323),ee=G(16925),N=G(44650),p=G(66213);const ie=(0,ee.yh)("themeService");var Y;(function(C){function k(I){return I&&typeof I=="object"&&typeof I.id=="string"}C.isThemeColor=k})(Y||(Y={}));function u(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 I=new RegExp(`^\\$\\((${z.dT.iconNameExpression}(?:${z.dT.iconModifierExpression})?)\\)$`);function R(te){const X=I.exec(te);if(!X)return;let[,ve]=X;return{id:ve}}C.fromString=R;function B(te,X){let ve=te.id;const Ie=ve.lastIndexOf("~");return Ie!==-1&&(ve=ve.substring(0,Ie)),X&&(ve=`${ve}~${X}`),{id:ve}}C.modify=B;function j(te,X){var ve,Ie;return te.id===X.id&&((ve=te.color)===null||ve===void 0?void 0:ve.id)===((Ie=X.color)===null||Ie===void 0?void 0:Ie.id)}C.isEqual=j;function q(te,X){return{id:te.id,color:X?u(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 v={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,Ee.OF)(()=>{const I=this.themingParticipants.indexOf(k);this.themingParticipants.splice(I,1)})}getThemingParticipants(){return this.themingParticipants}}let x=new m;N.B.add(v.ThemingContribution,x);function S(C){return x.onColorThemeChange(C)}class P extends Ee.JT{constructor(k){super(),this.themeService=k,this.theme=k.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(I=>this.onThemeChange(I)))}onThemeChange(k){this.theme=k,this.updateStyles()}updateStyles(){}}},96478:function(Lt,Me,G){"use strict";G.d(Me,{Z:function(){return te}});var z=G(14809),J=G(4635),Ee=G(50298),ee=G(62646),N=G(65966),p=G(92310),ie=G.n(p),Y=G(8654),u=G(59301),$=G(10228),b=G(16089),v=$.Z.ESC,m=$.Z.TAB;function x(X){var ve=X.visible,Ie=X.triggerRef,xe=X.onVisibleChange,it=X.autoFocus,U=X.overlayRef,w=u.useRef(!1),L=function(){if(ve){var _,g;(_=Ie.current)===null||_===void 0||(g=_.focus)===null||g===void 0||g.call(_),xe==null||xe(!1)}},M=function(){var _;return(_=U.current)!==null&&_!==void 0&&_.focus?(U.current.focus(),w.current=!0,!0):!1},H=function(_){switch(_.keyCode){case v:L();break;case m:{var g=!1;w.current||(g=M()),g?_.preventDefault():L();break}}};u.useEffect(function(){return ve?(window.addEventListener("keydown",H),it&&(0,b.Z)(M,3),function(){window.removeEventListener("keydown",H),w.current=!1}):function(){w.current=!1}},[ve])}var S=(0,u.forwardRef)(function(X,ve){var Ie=X.overlay,xe=X.arrow,it=X.prefixCls,U=(0,u.useMemo)(function(){var L;return typeof Ie=="function"?L=Ie():L=Ie,L},[Ie]),w=(0,Y.sQ)(ve,(0,Y.C4)(U));return u.createElement(u.Fragment,null,xe&&u.createElement("div",{className:"".concat(it,"-arrow")}),u.cloneElement(U,{ref:(0,Y.Yr)(U)?w:void 0}))}),P=S,C={adjustX:1,adjustY:1},k=[0,0],I={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}},R=I,B=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function j(X,ve){var Ie,xe=X.arrow,it=xe===void 0?!1:xe,U=X.prefixCls,w=U===void 0?"rc-dropdown":U,L=X.transitionName,M=X.animation,H=X.align,F=X.placement,_=F===void 0?"bottomLeft":F,g=X.placements,D=g===void 0?R:g,V=X.getPopupContainer,de=X.showAction,Te=X.hideAction,Pe=X.overlayClassName,Ne=X.overlayStyle,Ze=X.visible,Dt=X.trigger,Rt=Dt===void 0?["hover"]:Dt,nt=X.autoFocus,xt=X.overlay,He=X.children,Wt=X.onVisibleChange,ri=(0,ee.Z)(X,B),ce=u.useState(),Re=(0,Ee.Z)(ce,2),se=Re[0],Ue=Re[1],Ve="visible"in X?Ze:se,qe=u.useRef(null),K=u.useRef(null),oe=u.useRef(null);u.useImperativeHandle(ve,function(){return qe.current});var ye=function(Ot){Ue(Ot),Wt==null||Wt(Ot)};x({visible:Ve,triggerRef:oe,onVisibleChange:ye,autoFocus:nt,overlayRef:K});var Ae=function(Ot){var Zt=X.onOverlayClick;Ue(!1),Zt&&Zt(Ot)},Fe=function(){return u.createElement(P,{ref:K,overlay:xt,prefixCls:w,arrow:it})},$e=function(){return typeof xt=="function"?Fe:Fe()},bt=function(){var Ot=X.minOverlayWidthMatchTrigger,Zt=X.alignPoint;return"minOverlayWidthMatchTrigger"in X?Ot:!Zt},We=function(){var Ot=X.openClassName;return Ot!==void 0?Ot:"".concat(w,"-open")},_t=u.cloneElement(He,{className:ie()((Ie=He.props)===null||Ie===void 0?void 0:Ie.className,Ve&&We()),ref:(0,Y.Yr)(He)?(0,Y.sQ)(oe,(0,Y.C4)(He)):void 0}),Pt=Te;return!Pt&&Rt.indexOf("contextMenu")!==-1&&(Pt=["click"]),u.createElement(N.Z,(0,z.Z)({builtinPlacements:D},ri,{prefixCls:w,ref:qe,popupClassName:ie()(Pe,(0,J.Z)({},"".concat(w,"-show-arrow"),it)),popupStyle:Ne,action:Rt,showAction:de,hideAction:Pt,popupPlacement:_,popupAlign:H,popupTransitionName:L,popupAnimation:M,popupVisible:Ve,stretch:bt()?"minWidth":"",popup:$e(),onPopupVisibleChange:ye,onPopupClick:Ae,getPopupContainer:V}),_t)}var q=u.forwardRef(j),te=q},66003:function(Lt,Me,G){"use strict";G.d(Me,{Z:function(){return ie}});var z=G(62646),J=G(20439),Ee=G(93664),ee=G(59301),N=["show"];function p(Y,u){if(!u.max)return!0;var $=u.strategy(Y);return $<=u.max}function ie(Y,u){return ee.useMemo(function(){var $={};u&&($.show=(0,Ee.Z)(u)==="object"&&u.formatter?u.formatter:!!u),$=(0,J.Z)((0,J.Z)({},$),Y);var b=$,v=b.show,m=(0,z.Z)(b,N);return(0,J.Z)((0,J.Z)({},m),{},{show:!!v,showFormatter:typeof v=="function"?v:void 0,strategy:m.strategy||function(x){return x.length}})},[Y,u])}},36901:function(Lt,Me,G){"use strict";G.r(Me),G.d(Me,{BaseInput:function(){return $},default:function(){return R}});var z=G(20439),J=G(14809),Ee=G(4635),ee=G(93664),N=G(92310),p=G.n(N),ie=G(59301),Y=G(30292),u=ie.forwardRef(function(B,j){var q,te,X,ve=B.inputElement,Ie=B.children,xe=B.prefixCls,it=B.prefix,U=B.suffix,w=B.addonBefore,L=B.addonAfter,M=B.className,H=B.style,F=B.disabled,_=B.readOnly,g=B.focused,D=B.triggerFocus,V=B.allowClear,de=B.value,Te=B.handleReset,Pe=B.hidden,Ne=B.classes,Ze=B.classNames,Dt=B.dataAttrs,Rt=B.styles,nt=B.components,xt=B.onClear,He=Ie!=null?Ie:ve,Wt=(nt==null?void 0:nt.affixWrapper)||"span",ri=(nt==null?void 0:nt.groupWrapper)||"span",ce=(nt==null?void 0:nt.wrapper)||"span",Re=(nt==null?void 0:nt.groupAddon)||"span",se=(0,ie.useRef)(null),Ue=function(qt){var Jt;(Jt=se.current)!==null&&Jt!==void 0&&Jt.contains(qt.target)&&(D==null||D())},Ve=(0,Y.X3)(B),qe=(0,ie.cloneElement)(He,{value:de,className:p()((q=He.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||se.current}}),Ve){var oe=null;if(V){var ye=!F&&!_&&de,Ae="".concat(xe,"-clear-icon"),Fe=(0,ee.Z)(V)==="object"&&V!==null&&V!==void 0&&V.clearIcon?V.clearIcon:"\u2716";oe=ie.createElement("button",{type:"button",tabIndex:-1,onClick:function(qt){Te==null||Te(qt),xt==null||xt()},onMouseDown:function(qt){return qt.preventDefault()},className:p()(Ae,(0,Ee.Z)((0,Ee.Z)({},"".concat(Ae,"-hidden"),!ye),"".concat(Ae,"-has-suffix"),!!U))},Fe)}var $e="".concat(xe,"-affix-wrapper"),bt=p()($e,(0,Ee.Z)((0,Ee.Z)((0,Ee.Z)((0,Ee.Z)((0,Ee.Z)({},"".concat(xe,"-disabled"),F),"".concat($e,"-disabled"),F),"".concat($e,"-focused"),g),"".concat($e,"-readonly"),_),"".concat($e,"-input-with-clear-btn"),U&&V&&de),Ne==null?void 0:Ne.affixWrapper,Ze==null?void 0:Ze.affixWrapper,Ze==null?void 0:Ze.variant),We=(U||V)&&ie.createElement("span",{className:p()("".concat(xe,"-suffix"),Ze==null?void 0:Ze.suffix),style:Rt==null?void 0:Rt.suffix},oe,U);qe=ie.createElement(Wt,(0,J.Z)({className:bt,style:Rt==null?void 0:Rt.affixWrapper,onClick:Ue},Dt==null?void 0:Dt.affixWrapper,{ref:se}),it&&ie.createElement("span",{className:p()("".concat(xe,"-prefix"),Ze==null?void 0:Ze.prefix),style:Rt==null?void 0:Rt.prefix},it),qe,We)}if((0,Y.He)(B)){var _t="".concat(xe,"-group"),Pt="".concat(_t,"-addon"),ft="".concat(_t,"-wrapper"),Ot=p()("".concat(xe,"-wrapper"),_t,Ne==null?void 0:Ne.wrapper,Ze==null?void 0:Ze.wrapper),Zt=p()(ft,(0,Ee.Z)({},"".concat(ft,"-disabled"),F),Ne==null?void 0:Ne.group,Ze==null?void 0:Ze.groupWrapper);qe=ie.createElement(ri,{className:Zt,ref:K},ie.createElement(ce,{className:Ot},w&&ie.createElement(Re,{className:Pt},w),qe,L&&ie.createElement(Re,{className:Pt},L)))}return ie.cloneElement(qe,{className:p()((te=qe.props)===null||te===void 0?void 0:te.className,M)||null,style:(0,z.Z)((0,z.Z)({},(X=qe.props)===null||X===void 0?void 0:X.style),H),hidden:Pe})}),$=u,b=G(95190),v=G(50298),m=G(62646),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(B,j){var q=B.autoComplete,te=B.onChange,X=B.onFocus,ve=B.onBlur,Ie=B.onPressEnter,xe=B.onKeyDown,it=B.onKeyUp,U=B.prefixCls,w=U===void 0?"rc-input":U,L=B.disabled,M=B.htmlSize,H=B.className,F=B.maxLength,_=B.suffix,g=B.showCount,D=B.count,V=B.type,de=V===void 0?"text":V,Te=B.classes,Pe=B.classNames,Ne=B.styles,Ze=B.onCompositionStart,Dt=B.onCompositionEnd,Rt=(0,m.Z)(B,C),nt=(0,ie.useState)(!1),xt=(0,v.Z)(nt,2),He=xt[0],Wt=xt[1],ri=(0,ie.useRef)(!1),ce=(0,ie.useRef)(!1),Re=(0,ie.useRef)(null),se=(0,ie.useRef)(null),Ue=function(et){Re.current&&(0,Y.nH)(Re.current,et)},Ve=(0,x.Z)(B.defaultValue,{value:B.value}),qe=(0,v.Z)(Ve,2),K=qe[0],oe=qe[1],ye=K==null?"":String(K),Ae=(0,ie.useState)(null),Fe=(0,v.Z)(Ae,2),$e=Fe[0],bt=Fe[1],We=(0,P.Z)(D,g),_t=We.max||F,Pt=We.strategy(ye),ft=!!_t&&Pt>_t;(0,ie.useImperativeHandle)(j,function(){var Ye;return{focus:Ue,blur:function(){var gt;(gt=Re.current)===null||gt===void 0||gt.blur()},setSelectionRange:function(gt,Ut,Je){var ze;(ze=Re.current)===null||ze===void 0||ze.setSelectionRange(gt,Ut,Je)},select:function(){var gt;(gt=Re.current)===null||gt===void 0||gt.select()},input:Re.current,nativeElement:((Ye=se.current)===null||Ye===void 0?void 0:Ye.nativeElement)||Re.current}}),(0,ie.useEffect)(function(){ce.current&&(ce.current=!1),Wt(function(Ye){return Ye&&L?!1:Ye})},[L]);var Ot=function(et,gt,Ut){var Je=gt;if(!ri.current&&We.exceedFormatter&&We.max&&We.strategy(gt)>We.max){if(Je=We.exceedFormatter(gt,{max:We.max}),gt!==Je){var ze,De;bt([((ze=Re.current)===null||ze===void 0?void 0:ze.selectionStart)||0,((De=Re.current)===null||De===void 0?void 0:De.selectionEnd)||0])}}else if(Ut.source==="compositionEnd")return;oe(Je),Re.current&&(0,Y.rJ)(Re.current,et,te,Je)};(0,ie.useEffect)(function(){if($e){var Ye;(Ye=Re.current)===null||Ye===void 0||Ye.setSelectionRange.apply(Ye,(0,b.Z)($e))}},[$e]);var Zt=function(et){Ot(et,et.target.value,{source:"change"})},Bt=function(et){ri.current=!1,Ot(et,et.currentTarget.value,{source:"compositionEnd"}),Dt==null||Dt(et)},qt=function(et){Ie&&et.key==="Enter"&&!ce.current&&(ce.current=!0,Ie(et)),xe==null||xe(et)},Jt=function(et){et.key==="Enter"&&(ce.current=!1),it==null||it(et)},St=function(et){Wt(!0),X==null||X(et)},Ui=function(et){ce.current&&(ce.current=!1),Wt(!1),ve==null||ve(et)},Le=function(et){oe(""),Ue(),Re.current&&(0,Y.rJ)(Re.current,et,te)},Be=ft&&"".concat(w,"-out-of-range"),je=function(){var et=(0,S.Z)(B,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return ie.createElement("input",(0,J.Z)({autoComplete:q},et,{onChange:Zt,onFocus:St,onBlur:Ui,onKeyDown:qt,onKeyUp:Jt,className:p()(w,(0,Ee.Z)({},"".concat(w,"-disabled"),L),Pe==null?void 0:Pe.input),style:Ne==null?void 0:Ne.input,ref:Re,size:M,type:de,onCompositionStart:function(Ut){ri.current=!0,Ze==null||Ze(Ut)},onCompositionEnd:Bt}))},ti=function(){var et=Number(_t)>0;if(_||We.show){var gt=We.showFormatter?We.showFormatter({value:ye,count:Pt,maxLength:_t}):"".concat(Pt).concat(et?" / ".concat(_t):"");return ie.createElement(ie.Fragment,null,We.show&&ie.createElement("span",{className:p()("".concat(w,"-show-count-suffix"),(0,Ee.Z)({},"".concat(w,"-show-count-has-suffix"),!!_),Pe==null?void 0:Pe.count),style:(0,z.Z)({},Ne==null?void 0:Ne.count)},gt),_)}return null};return ie.createElement($,(0,J.Z)({},Rt,{prefixCls:w,className:p()(H,Be),handleReset:Le,value:ye,focused:He,triggerFocus:Ue,suffix:ti(),disabled:L,classes:Te,classNames:Pe,styles:Ne}),je())}),I=k,R=I},30292:function(Lt,Me,G){"use strict";G.d(Me,{He:function(){return z},X3:function(){return J},nH:function(){return N},rJ:function(){return ee}});function z(p){return!!(p.addonBefore||p.addonAfter)}function J(p){return!!(p.prefix||p.suffix||p.allowClear)}function Ee(p,ie,Y){var u=ie.cloneNode(!0),$=Object.create(p,{target:{value:u},currentTarget:{value:u}});return u.value=Y,typeof ie.selectionStart=="number"&&typeof ie.selectionEnd=="number"&&(u.selectionStart=ie.selectionStart,u.selectionEnd=ie.selectionEnd),u.setSelectionRange=function(){ie.setSelectionRange.apply(ie,arguments)},$}function ee(p,ie,Y,u){if(Y){var $=ie;if(ie.type==="click"){$=Ee(ie,p,""),Y($);return}if(p.type!=="file"&&u!==void 0){$=Ee(ie,p,u),Y($);return}Y($)}}function N(p,ie){if(p){p.focus(ie);var Y=ie||{},u=Y.cursor;if(u){var $=p.value.length;switch(u){case"start":p.setSelectionRange(0,0);break;case"end":p.setSelectionRange($,$);break;default:p.setSelectionRange(0,$)}}}}},28321:function(Lt,Me,G){"use strict";G.d(Me,{iz:function(){return Si},ck:function(){return Je},BW:function(){return gn},sN:function(){return Je},Wd:function(){return Di},ZP:function(){return Nt},Xl:function(){return Ie}});var z=G(14809),J=G(4635),Ee=G(20439),ee=G(95190),N=G(50298),p=G(62646),ie=G(92310),Y=G.n(ie),u=G(11780),$=G(18929),b=G(13697),v=G(48736),m=G(59301),x=G(4676),S=m.createContext(null);function P(Z,ge){return Z===void 0?null:"".concat(Z,"-").concat(ge)}function C(Z){var ge=m.useContext(S);return P(ge,Z)}var k=G(80547),I=["children","locked"],R=m.createContext(null);function B(Z,ge){var Se=(0,Ee.Z)({},Z);return Object.keys(ge).forEach(function(be){var we=ge[be];we!==void 0&&(Se[be]=we)}),Se}function j(Z){var ge=Z.children,Se=Z.locked,be=(0,p.Z)(Z,I),we=m.useContext(R),ke=(0,k.Z)(function(){return B(we,be)},[we,be],function(Ke,st){return!Se&&(Ke[0]!==st[0]||!(0,b.Z)(Ke[1],st[1],!0))});return m.createElement(R.Provider,{value:ke},ge)}var q=[],te=m.createContext(null);function X(){return m.useContext(te)}var ve=m.createContext(q);function Ie(Z){var ge=m.useContext(ve);return m.useMemo(function(){return Z!==void 0?[].concat((0,ee.Z)(ge),[Z]):ge},[ge,Z])}var xe=m.createContext(null),it=m.createContext({}),U=it,w=G(29194);function L(Z){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,w.Z)(Z)){var Se=Z.nodeName.toLowerCase(),be=["input","select","textarea","button"].includes(Se)||Z.isContentEditable||Se==="a"&&!!Z.getAttribute("href"),we=Z.getAttribute("tabindex"),ke=Number(we),Ke=null;return we&&!Number.isNaN(ke)?Ke=ke:be&&Ke===null&&(Ke=0),be&&Z.disabled&&(Ke=null),Ke!==null&&(Ke>=0||ge&&Ke<0)}return!1}function M(Z){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=(0,ee.Z)(Z.querySelectorAll("*")).filter(function(be){return L(be,ge)});return L(Z,ge)&&Se.unshift(Z),Se}var H=null;function F(){H=document.activeElement}function _(){H=null}function g(){if(H)try{H.focus()}catch(Z){}}function D(Z,ge){if(ge.keyCode===9){var Se=M(Z),be=Se[ge.shiftKey?0:Se.length-1],we=be===document.activeElement||Z===document.activeElement;if(we){var ke=Se[ge.shiftKey?Se.length-1:0];ke.focus(),ge.preventDefault()}}}var V=G(10228),de=G(16089),Te=V.Z.LEFT,Pe=V.Z.RIGHT,Ne=V.Z.UP,Ze=V.Z.DOWN,Dt=V.Z.ENTER,Rt=V.Z.ESC,nt=V.Z.HOME,xt=V.Z.END,He=[Ne,Ze,Te,Pe];function Wt(Z,ge,Se,be){var we,ke="prev",Ke="next",st="children",ae="parent";if(Z==="inline"&&be===Dt)return{inlineTrigger:!0};var tt=(0,J.Z)((0,J.Z)({},Ne,ke),Ze,Ke),zt=(0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)({},Te,Se?Ke:ke),Pe,Se?ke:Ke),Ze,st),Dt,st),ct=(0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)({},Ne,ke),Ze,Ke),Dt,st),Rt,ae),Te,Se?st:ae),Pe,Se?ae:st),rt={inline:tt,horizontal:zt,vertical:ct,inlineSub:tt,horizontalSub:ct,verticalSub:ct},It=(we=rt["".concat(Z).concat(ge?"":"Sub")])===null||we===void 0?void 0:we[be];switch(It){case ke:return{offset:-1,sibling:!0};case Ke:return{offset:1,sibling:!0};case ae:return{offset:-1,sibling:!1};case st:return{offset:1,sibling:!1};default:return null}}function ri(Z){for(var ge=Z;ge;){if(ge.getAttribute("data-menu-list"))return ge;ge=ge.parentElement}return null}function ce(Z,ge){for(var Se=Z||document.activeElement;Se;){if(ge.has(Se))return Se;Se=Se.parentElement}return null}function Re(Z,ge){var Se=M(Z,!0);return Se.filter(function(be){return ge.has(be)})}function se(Z,ge,Se){var be=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Z)return null;var we=Re(Z,ge),ke=we.length,Ke=we.findIndex(function(st){return Se===st});return be<0?Ke===-1?Ke=ke-1:Ke-=1:be>0&&(Ke+=1),Ke=(Ke+ke)%ke,we[Ke]}var Ue=function(ge,Se){var be=new Set,we=new Map,ke=new Map;return ge.forEach(function(Ke){var st=document.querySelector("[data-menu-id='".concat(P(Se,Ke),"']"));st&&(be.add(st),ke.set(st,Ke),we.set(Ke,st))}),{elements:be,key2element:we,element2key:ke}};function Ve(Z,ge,Se,be,we,ke,Ke,st,ae,tt){var zt=m.useRef(),ct=m.useRef();ct.current=ge;var rt=function(){de.Z.cancel(zt.current)};return m.useEffect(function(){return function(){rt()}},[]),function(It){var ii=It.which;if([].concat(He,[Dt,Rt,nt,xt]).includes(ii)){var Yt=ke(),pt=Ue(Yt,be),wt=pt,si=wt.elements,Ht=wt.key2element,kt=wt.element2key,ci=Ht.get(ge),yt=ce(ci,si),jt=kt.get(yt),Gi=Wt(Z,Ke(jt,!0).length===1,Se,ii);if(!Gi&&ii!==nt&&ii!==xt)return;(He.includes(ii)||[nt,xt].includes(ii))&&It.preventDefault();var oi=function(Fi){if(Fi){var rn=Fi,gi=Fi.querySelector("a");gi!=null&&gi.getAttribute("href")&&(rn=gi);var qi=kt.get(Fi);st(qi),rt(),zt.current=(0,de.Z)(function(){ct.current===qi&&rn.focus()})}};if([nt,xt].includes(ii)||Gi.sibling||!yt){var ei;!yt||Z==="inline"?ei=we.current:ei=ri(yt);var Mi,Ii=Re(ei,si);ii===nt?Mi=Ii[0]:ii===xt?Mi=Ii[Ii.length-1]:Mi=se(ei,si,yt,Gi.offset),oi(Mi)}else if(Gi.inlineTrigger)ae(jt);else if(Gi.offset>0)ae(jt,!0),rt(),zt.current=(0,de.Z)(function(){pt=Ue(Yt,be);var Xi=yt.getAttribute("aria-controls"),Fi=document.getElementById(Xi),rn=se(Fi,pt.elements);oi(rn)},5);else if(Gi.offset<0){var Ni=Ke(jt,!0),Ki=Ni[Ni.length-2],Ei=Ht.get(Ki);ae(Ki,!1),oi(Ei)}}tt==null||tt(It)}}function qe(Z){Promise.resolve().then(Z)}var K="__RC_UTIL_PATH_SPLIT__",oe=function(ge){return ge.join(K)},ye=function(ge){return ge.split(K)},Ae="rc-menu-more";function Fe(){var Z=m.useState({}),ge=(0,N.Z)(Z,2),Se=ge[1],be=(0,m.useRef)(new Map),we=(0,m.useRef)(new Map),ke=m.useState([]),Ke=(0,N.Z)(ke,2),st=Ke[0],ae=Ke[1],tt=(0,m.useRef)(0),zt=(0,m.useRef)(!1),ct=function(){zt.current||Se({})},rt=(0,m.useCallback)(function(Ht,kt){var ci=oe(kt);we.current.set(ci,Ht),be.current.set(Ht,ci),tt.current+=1;var yt=tt.current;qe(function(){yt===tt.current&&ct()})},[]),It=(0,m.useCallback)(function(Ht,kt){var ci=oe(kt);we.current.delete(ci),be.current.delete(Ht)},[]),ii=(0,m.useCallback)(function(Ht){ae(Ht)},[]),Yt=(0,m.useCallback)(function(Ht,kt){var ci=be.current.get(Ht)||"",yt=ye(ci);return kt&&st.includes(yt[0])&&yt.unshift(Ae),yt},[st]),pt=(0,m.useCallback)(function(Ht,kt){return Ht.filter(function(ci){return ci!==void 0}).some(function(ci){var yt=Yt(ci,!0);return yt.includes(kt)})},[Yt]),wt=function(){var kt=(0,ee.Z)(be.current.keys());return st.length&&kt.push(Ae),kt},si=(0,m.useCallback)(function(Ht){var kt="".concat(be.current.get(Ht)).concat(K),ci=new Set;return(0,ee.Z)(we.current.keys()).forEach(function(yt){yt.startsWith(kt)&&ci.add(we.current.get(yt))}),ci},[]);return m.useEffect(function(){return function(){zt.current=!0}},[]),{registerPath:rt,unregisterPath:It,refreshOverflowKeys:ii,isSubPathKey:pt,getKeyPath:Yt,getKeys:wt,getSubPathKeys:si}}function $e(Z){var ge=m.useRef(Z);ge.current=Z;var Se=m.useCallback(function(){for(var be,we=arguments.length,ke=new Array(we),Ke=0;Ke<we;Ke++)ke[Ke]=arguments[Ke];return(be=ge.current)===null||be===void 0?void 0:be.call.apply(be,[ge].concat(ke))},[]);return Z?Se:void 0}var bt=Math.random().toFixed(5).toString().slice(2),We=0;function _t(Z){var ge=(0,$.Z)(Z,{value:Z}),Se=(0,N.Z)(ge,2),be=Se[0],we=Se[1];return m.useEffect(function(){We+=1;var ke="".concat(bt,"-").concat(We);we("rc-menu-uuid-".concat(ke))},[]),be}var Pt=G(99153),ft=G(84851),Ot=G(19257),Zt=G(93046),Bt=G(2738),qt=G(8654);function Jt(Z,ge,Se,be){var we=m.useContext(R),ke=we.activeKey,Ke=we.onActive,st=we.onInactive,ae={active:ke===Z};return ge||(ae.onMouseEnter=function(tt){Se==null||Se({key:Z,domEvent:tt}),Ke(Z)},ae.onMouseLeave=function(tt){be==null||be({key:Z,domEvent:tt}),st(Z)}),ae}function St(Z){var ge=m.useContext(R),Se=ge.mode,be=ge.rtl,we=ge.inlineIndent;if(Se!=="inline")return null;var ke=Z;return be?{paddingRight:ke*we}:{paddingLeft:ke*we}}function Ui(Z){var ge=Z.icon,Se=Z.props,be=Z.children,we;return ge===null||ge===!1?null:(typeof ge=="function"?we=m.createElement(ge,(0,Ee.Z)({},Se)):typeof ge!="boolean"&&(we=ge),we||be||null)}var Le=["item"];function Be(Z){var ge=Z.item,Se=(0,p.Z)(Z,Le);return Object.defineProperty(Se,"item",{get:function(){return(0,v.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),ge}}),Se}var je=["title","attribute","elementRef"],ti=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Ye=["active"],et=function(Z){(0,Ot.Z)(Se,Z);var ge=(0,Zt.Z)(Se);function Se(){return(0,Pt.Z)(this,Se),ge.apply(this,arguments)}return(0,ft.Z)(Se,[{key:"render",value:function(){var we=this.props,ke=we.title,Ke=we.attribute,st=we.elementRef,ae=(0,p.Z)(we,je),tt=(0,Bt.Z)(ae,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,v.ZP)(!Ke,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),m.createElement(u.Z.Item,(0,z.Z)({},Ke,{title:typeof ke=="string"?ke:void 0},tt,{ref:st}))}}]),Se}(m.Component),gt=m.forwardRef(function(Z,ge){var Se=Z.style,be=Z.className,we=Z.eventKey,ke=Z.warnKey,Ke=Z.disabled,st=Z.itemIcon,ae=Z.children,tt=Z.role,zt=Z.onMouseEnter,ct=Z.onMouseLeave,rt=Z.onClick,It=Z.onKeyDown,ii=Z.onFocus,Yt=(0,p.Z)(Z,ti),pt=C(we),wt=m.useContext(R),si=wt.prefixCls,Ht=wt.onItemClick,kt=wt.disabled,ci=wt.overflowDisabled,yt=wt.itemIcon,jt=wt.selectedKeys,Gi=wt.onActive,oi=m.useContext(U),ei=oi._internalRenderMenuItem,Mi="".concat(si,"-item"),Ii=m.useRef(),Ni=m.useRef(),Ki=kt||Ke,Ei=(0,qt.x1)(ge,Ni),Xi=Ie(we),Fi=function(Pi){return{key:we,keyPath:(0,ee.Z)(Xi).reverse(),item:Ii.current,domEvent:Pi}},rn=st||yt,gi=Jt(we,Ki,zt,ct),qi=gi.active,An=(0,p.Z)(gi,Ye),mn=jt.includes(we),an=St(Xi.length),wn=function(Pi){if(!Ki){var ji=Fi(Pi);rt==null||rt(Be(ji)),Ht(ji)}},Yi=function(Pi){if(It==null||It(Pi),Pi.which===V.Z.ENTER){var ji=Fi(Pi);rt==null||rt(Be(ji)),Ht(ji)}},Ji=function(Pi){Gi(we),ii==null||ii(Pi)},Pn={};Z.role==="option"&&(Pn["aria-selected"]=mn);var Bi=m.createElement(et,(0,z.Z)({ref:Ii,elementRef:Ei,role:tt===null?"none":tt||"menuitem",tabIndex:Ke?null:-1,"data-menu-id":ci&&pt?null:pt},(0,Bt.Z)(Yt,["extra"]),An,Pn,{component:"li","aria-disabled":Ke,style:(0,Ee.Z)((0,Ee.Z)({},an),Se),className:Y()(Mi,(0,J.Z)((0,J.Z)((0,J.Z)({},"".concat(Mi,"-active"),qi),"".concat(Mi,"-selected"),mn),"".concat(Mi,"-disabled"),Ki),be),onClick:wn,onKeyDown:Yi,onFocus:Ji}),ae,m.createElement(Ui,{props:(0,Ee.Z)((0,Ee.Z)({},Z),{},{isSelected:mn}),icon:rn}));return ei&&(Bi=ei(Bi,Z,{selected:mn})),Bi});function Ut(Z,ge){var Se=Z.eventKey,be=X(),we=Ie(Se);return m.useEffect(function(){if(be)return be.registerPath(Se,we),function(){be.unregisterPath(Se,we)}},[we]),be?null:m.createElement(gt,(0,z.Z)({},Z,{ref:ge}))}var Je=m.forwardRef(Ut),ze=["className","children"],De=function(ge,Se){var be=ge.className,we=ge.children,ke=(0,p.Z)(ge,ze),Ke=m.useContext(R),st=Ke.prefixCls,ae=Ke.mode,tt=Ke.rtl;return m.createElement("ul",(0,z.Z)({className:Y()(st,tt&&"".concat(st,"-rtl"),"".concat(st,"-sub"),"".concat(st,"-").concat(ae==="inline"?"inline":"vertical"),be),role:"menu"},ke,{"data-menu-list":!0,ref:Se}),we)},Mt=m.forwardRef(De);Mt.displayName="SubMenuList";var $t=Mt,vi=G(11592);function dt(Z,ge){return(0,vi.Z)(Z).map(function(Se,be){if(m.isValidElement(Se)){var we,ke,Ke=Se.key,st=(we=(ke=Se.props)===null||ke===void 0?void 0:ke.eventKey)!==null&&we!==void 0?we:Ke,ae=st==null;ae&&(st="tmp_key-".concat([].concat((0,ee.Z)(ge),[be]).join("-")));var tt={key:st,eventKey:st};return m.cloneElement(Se,tt)}return Se})}var Gt=G(65966),Kt={adjustX:1,adjustY:1},wi={topLeft:{points:["bl","tl"],overflow:Kt},topRight:{points:["br","tr"],overflow:Kt},bottomLeft:{points:["tl","bl"],overflow:Kt},bottomRight:{points:["tr","br"],overflow:Kt},leftTop:{points:["tr","tl"],overflow:Kt},leftBottom:{points:["br","bl"],overflow:Kt},rightTop:{points:["tl","tr"],overflow:Kt},rightBottom:{points:["bl","br"],overflow:Kt}},yi={topLeft:{points:["bl","tl"],overflow:Kt},topRight:{points:["br","tr"],overflow:Kt},bottomLeft:{points:["tl","bl"],overflow:Kt},bottomRight:{points:["tr","br"],overflow:Kt},rightTop:{points:["tr","tl"],overflow:Kt},rightBottom:{points:["br","bl"],overflow:Kt},leftTop:{points:["tl","tr"],overflow:Kt},leftBottom:{points:["bl","br"],overflow:Kt}},tn=null;function Oi(Z,ge,Se){if(ge)return ge;if(Se)return Se[Z]||Se.other}var bi={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function fi(Z){var ge=Z.prefixCls,Se=Z.visible,be=Z.children,we=Z.popup,ke=Z.popupStyle,Ke=Z.popupClassName,st=Z.popupOffset,ae=Z.disabled,tt=Z.mode,zt=Z.onVisibleChange,ct=m.useContext(R),rt=ct.getPopupContainer,It=ct.rtl,ii=ct.subMenuOpenDelay,Yt=ct.subMenuCloseDelay,pt=ct.builtinPlacements,wt=ct.triggerSubMenuAction,si=ct.forceSubMenuRender,Ht=ct.rootClassName,kt=ct.motion,ci=ct.defaultMotions,yt=m.useState(!1),jt=(0,N.Z)(yt,2),Gi=jt[0],oi=jt[1],ei=It?(0,Ee.Z)((0,Ee.Z)({},yi),pt):(0,Ee.Z)((0,Ee.Z)({},wi),pt),Mi=bi[tt],Ii=Oi(tt,kt,ci),Ni=m.useRef(Ii);tt!=="inline"&&(Ni.current=Ii);var Ki=(0,Ee.Z)((0,Ee.Z)({},Ni.current),{},{leavedClassName:"".concat(ge,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Ei=m.useRef();return m.useEffect(function(){return Ei.current=(0,de.Z)(function(){oi(Se)}),function(){de.Z.cancel(Ei.current)}},[Se]),m.createElement(Gt.Z,{prefixCls:ge,popupClassName:Y()("".concat(ge,"-popup"),(0,J.Z)({},"".concat(ge,"-rtl"),It),Ke,Ht),stretch:tt==="horizontal"?"minWidth":null,getPopupContainer:rt,builtinPlacements:ei,popupPlacement:Mi,popupVisible:Gi,popup:we,popupStyle:ke,popupAlign:st&&{offset:st},action:ae?[]:[wt],mouseEnterDelay:ii,mouseLeaveDelay:Yt,onPopupVisibleChange:zt,forceRender:si,popupMotion:Ki,fresh:!0},be)}var $i=G(77900);function hn(Z){var ge=Z.id,Se=Z.open,be=Z.keyPath,we=Z.children,ke="inline",Ke=m.useContext(R),st=Ke.prefixCls,ae=Ke.forceSubMenuRender,tt=Ke.motion,zt=Ke.defaultMotions,ct=Ke.mode,rt=m.useRef(!1);rt.current=ct===ke;var It=m.useState(!rt.current),ii=(0,N.Z)(It,2),Yt=ii[0],pt=ii[1],wt=rt.current?Se:!1;m.useEffect(function(){rt.current&&pt(!1)},[ct]);var si=(0,Ee.Z)({},Oi(ke,tt,zt));be.length>1&&(si.motionAppear=!1);var Ht=si.onVisibleChanged;return si.onVisibleChanged=function(kt){return!rt.current&&!kt&&pt(!0),Ht==null?void 0:Ht(kt)},Yt?null:m.createElement(j,{mode:ke,locked:!rt.current},m.createElement($i.default,(0,z.Z)({visible:wt},si,{forceRender:ae,removeOnLeave:!1,leavedClassName:"".concat(st,"-hidden")}),function(kt){var ci=kt.className,yt=kt.style;return m.createElement($t,{id:ge,className:ci,style:yt},we)}))}var Li=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],Hi=["active"],xi=m.forwardRef(function(Z,ge){var Se=Z.style,be=Z.className,we=Z.title,ke=Z.eventKey,Ke=Z.warnKey,st=Z.disabled,ae=Z.internalPopupClose,tt=Z.children,zt=Z.itemIcon,ct=Z.expandIcon,rt=Z.popupClassName,It=Z.popupOffset,ii=Z.popupStyle,Yt=Z.onClick,pt=Z.onMouseEnter,wt=Z.onMouseLeave,si=Z.onTitleClick,Ht=Z.onTitleMouseEnter,kt=Z.onTitleMouseLeave,ci=(0,p.Z)(Z,Li),yt=C(ke),jt=m.useContext(R),Gi=jt.prefixCls,oi=jt.mode,ei=jt.openKeys,Mi=jt.disabled,Ii=jt.overflowDisabled,Ni=jt.activeKey,Ki=jt.selectedKeys,Ei=jt.itemIcon,Xi=jt.expandIcon,Fi=jt.onItemClick,rn=jt.onOpenChange,gi=jt.onActive,qi=m.useContext(U),An=qi._internalRenderSubMenuItem,mn=m.useContext(xe),an=mn.isSubPathKey,wn=Ie(),Yi="".concat(Gi,"-submenu"),Ji=Mi||st,Pn=m.useRef(),Bi=m.useRef(),on=zt!=null?zt:Ei,Pi=ct!=null?ct:Xi,ji=ei.includes(ke),ln=!Ii&&ji,mt=an(Ki,ke),Qi=Jt(ke,Ji,Ht,kt),nn=Qi.active,_n=(0,p.Z)(Qi,Hi),In=m.useState(!1),Hn=(0,N.Z)(In,2),jn=Hn[0],Fn=Hn[1],ai=function(li){Ji||Fn(li)},ts=function(li){ai(!0),pt==null||pt({key:ke,domEvent:li})},as=function(li){ai(!1),wt==null||wt({key:ke,domEvent:li})},zn=m.useMemo(function(){return nn||(oi!=="inline"?jn||an([Ni],ke):!1)},[oi,nn,Ni,jn,ke,an]),pn=St(wn.length),os=function(li){Ji||(si==null||si({key:ke,domEvent:li}),oi==="inline"&&rn(ke,!ji))},ls=$e(function(Et){Yt==null||Yt(Be(Et)),Fi(Et)}),vn=function(li){oi!=="inline"&&rn(ke,li)},Bn=function(){gi(ke)},On=yt&&"".concat(yt,"-popup"),Rn=m.useMemo(function(){return m.createElement(Ui,{icon:oi!=="horizontal"?Pi:void 0,props:(0,Ee.Z)((0,Ee.Z)({},Z),{},{isOpen:ln,isSubMenu:!0})},m.createElement("i",{className:"".concat(Yi,"-arrow")}))},[oi,Pi,Z,ln,Yi]),en=m.createElement("div",(0,z.Z)({role:"menuitem",style:pn,className:"".concat(Yi,"-title"),tabIndex:Ji?null:-1,ref:Pn,title:typeof we=="string"?we:null,"data-menu-id":Ii&&yt?null:yt,"aria-expanded":ln,"aria-haspopup":!0,"aria-controls":On,"aria-disabled":Ji,onClick:os,onFocus:Bn},_n),we,Rn),Sn=m.useRef(oi);if(oi!=="inline"&&wn.length>1?Sn.current="vertical":Sn.current=oi,!Ii){var Zn=Sn.current;en=m.createElement(fi,{mode:Zn,prefixCls:Yi,visible:!ae&&ln&&oi!=="inline",popupClassName:rt,popupOffset:It,popupStyle:ii,popup:m.createElement(j,{mode:Zn==="horizontal"?"vertical":Zn},m.createElement($t,{id:On,ref:Bi},tt)),disabled:Ji,onVisibleChange:vn},en)}var Vi=m.createElement(u.Z.Item,(0,z.Z)({ref:ge,role:"none"},ci,{component:"li",style:Se,className:Y()(Yi,"".concat(Yi,"-").concat(oi),be,(0,J.Z)((0,J.Z)((0,J.Z)((0,J.Z)({},"".concat(Yi,"-open"),ln),"".concat(Yi,"-active"),zn),"".concat(Yi,"-selected"),mt),"".concat(Yi,"-disabled"),Ji)),onMouseEnter:ts,onMouseLeave:as}),en,!Ii&&m.createElement(hn,{id:On,open:ln,keyPath:wn},tt));return An&&(Vi=An(Vi,Z,{selected:mt,active:zn,open:ln,disabled:Ji})),m.createElement(j,{onItemClick:ls,mode:oi==="horizontal"?"vertical":oi,itemIcon:on,expandIcon:Pi},Vi)}),sn=m.forwardRef(function(Z,ge){var Se=Z.eventKey,be=Z.children,we=Ie(Se),ke=dt(be,we),Ke=X();m.useEffect(function(){if(Ke)return Ke.registerPath(Se,we),function(){Ke.unregisterPath(Se,we)}},[we]);var st;return Ke?st=ke:st=m.createElement(xi,(0,z.Z)({ref:ge},Z),ke),m.createElement(ve.Provider,{value:we},st)}),Di=sn,fn=G(93664);function Si(Z){var ge=Z.className,Se=Z.style,be=m.useContext(R),we=be.prefixCls,ke=X();return ke?null:m.createElement("li",{role:"separator",className:Y()("".concat(we,"-item-divider"),ge),style:Se})}var dn=["className","title","eventKey","children"],zi=m.forwardRef(function(Z,ge){var Se=Z.className,be=Z.title,we=Z.eventKey,ke=Z.children,Ke=(0,p.Z)(Z,dn),st=m.useContext(R),ae=st.prefixCls,tt="".concat(ae,"-item-group");return m.createElement("li",(0,z.Z)({ref:ge,role:"presentation"},Ke,{onClick:function(ct){return ct.stopPropagation()},className:Y()(tt,Se)}),m.createElement("div",{role:"presentation",className:"".concat(tt,"-title"),title:typeof be=="string"?be:void 0},be),m.createElement("ul",{role:"group",className:"".concat(tt,"-list")},ke))}),Zi=m.forwardRef(function(Z,ge){var Se=Z.eventKey,be=Z.children,we=Ie(Se),ke=dt(be,we),Ke=X();return Ke?ke:m.createElement(zi,(0,z.Z)({ref:ge},(0,Bt.Z)(Z,["warnKey"])),ke)}),gn=Zi,Vt=["label","children","key","type","extra"];function ni(Z,ge,Se){var be=ge.item,we=ge.group,ke=ge.submenu,Ke=ge.divider;return(Z||[]).map(function(st,ae){if(st&&(0,fn.Z)(st)==="object"){var tt=st,zt=tt.label,ct=tt.children,rt=tt.key,It=tt.type,ii=tt.extra,Yt=(0,p.Z)(tt,Vt),pt=rt!=null?rt:"tmp-".concat(ae);return ct||It==="group"?It==="group"?m.createElement(we,(0,z.Z)({key:pt},Yt,{title:zt}),ni(ct,ge,Se)):m.createElement(ke,(0,z.Z)({key:pt},Yt,{title:zt}),ni(ct,ge,Se)):It==="divider"?m.createElement(Ke,(0,z.Z)({key:pt},Yt)):m.createElement(be,(0,z.Z)({key:pt},Yt,{extra:ii}),zt,(!!ii||ii===0)&&m.createElement("span",{className:"".concat(Se,"-item-extra")},ii))}return null}).filter(function(st){return st})}function Ci(Z,ge,Se,be,we){var ke=Z,Ke=(0,Ee.Z)({divider:Si,item:Je,group:gn,submenu:Di},be);return ge&&(ke=ni(ge,Ke,we)),dt(ke,Se)}var Qt=["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"],ki=[],di=m.forwardRef(function(Z,ge){var Se,be=Z,we=be.prefixCls,ke=we===void 0?"rc-menu":we,Ke=be.rootClassName,st=be.style,ae=be.className,tt=be.tabIndex,zt=tt===void 0?0:tt,ct=be.items,rt=be.children,It=be.direction,ii=be.id,Yt=be.mode,pt=Yt===void 0?"vertical":Yt,wt=be.inlineCollapsed,si=be.disabled,Ht=be.disabledOverflow,kt=be.subMenuOpenDelay,ci=kt===void 0?.1:kt,yt=be.subMenuCloseDelay,jt=yt===void 0?.1:yt,Gi=be.forceSubMenuRender,oi=be.defaultOpenKeys,ei=be.openKeys,Mi=be.activeKey,Ii=be.defaultActiveFirst,Ni=be.selectable,Ki=Ni===void 0?!0:Ni,Ei=be.multiple,Xi=Ei===void 0?!1:Ei,Fi=be.defaultSelectedKeys,rn=be.selectedKeys,gi=be.onSelect,qi=be.onDeselect,An=be.inlineIndent,mn=An===void 0?24:An,an=be.motion,wn=be.defaultMotions,Yi=be.triggerSubMenuAction,Ji=Yi===void 0?"hover":Yi,Pn=be.builtinPlacements,Bi=be.itemIcon,on=be.expandIcon,Pi=be.overflowedIndicator,ji=Pi===void 0?"...":Pi,ln=be.overflowedIndicatorPopupClassName,mt=be.getPopupContainer,Qi=be.onClick,nn=be.onOpenChange,_n=be.onKeyDown,In=be.openAnimation,Hn=be.openTransitionName,jn=be._internalRenderMenuItem,Fn=be._internalRenderSubMenuItem,ai=be._internalComponents,ts=(0,p.Z)(be,Qt),as=m.useMemo(function(){return[Ci(rt,ct,ki,ai,ke),Ci(rt,ct,ki,{},ke)]},[rt,ct,ai]),zn=(0,N.Z)(as,2),pn=zn[0],os=zn[1],ls=m.useState(!1),vn=(0,N.Z)(ls,2),Bn=vn[0],On=vn[1],Rn=m.useRef(),en=_t(ii),Sn=It==="rtl",Zn=(0,$.Z)(oi,{value:ei,postState:function(pe){return pe||ki}}),Vi=(0,N.Z)(Zn,2),Et=Vi[0],li=Vi[1],un=function(pe){var Ai=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function yn(){li(pe),nn==null||nn(pe)}Ai?(0,x.flushSync)(yn):yn()},Ln=m.useState(Et),Yn=(0,N.Z)(Ln,2),Qn=Yn[0],Xn=Yn[1],is=m.useRef(!1),at=m.useMemo(function(){return(pt==="inline"||pt==="vertical")&&wt?["vertical",wt]:[pt,!1]},[pt,wt]),At=(0,N.Z)(at,2),pi=At[0],Ti=At[1],mi=pi==="inline",Un=m.useState(pi),ps=(0,N.Z)(Un,2),Dn=ps[0],us=ps[1],Br=m.useState(Ti),Ls=(0,N.Z)(Br,2),Ur=Ls[0],$n=Ls[1];m.useEffect(function(){us(pi),$n(Ti),is.current&&(mi?li(Qn):un(ki))},[pi,Ti]);var nr=m.useState(0),sr=(0,N.Z)(nr,2),bs=sr[0],rr=sr[1],Ds=bs>=pn.length-1||Dn!=="horizontal"||Ht;m.useEffect(function(){mi&&Xn(Et)},[Et]),m.useEffect(function(){return is.current=!0,function(){is.current=!1}},[]);var ns=Fe(),ar=ns.registerPath,Cs=ns.unregisterPath,or=ns.refreshOverflowKeys,Vs=ns.isSubPathKey,qn=ns.getKeyPath,Ws=ns.getKeys,Hs=ns.getSubPathKeys,lr=m.useMemo(function(){return{registerPath:ar,unregisterPath:Cs}},[ar,Cs]),$r=m.useMemo(function(){return{isSubPathKey:Vs}},[Vs]);m.useEffect(function(){or(Ds?ki:pn.slice(bs+1).map(function(Wi){return Wi.key}))},[bs,Ds]);var Gr=(0,$.Z)(Mi||Ii&&((Se=pn[0])===null||Se===void 0?void 0:Se.key),{value:Mi}),ur=(0,N.Z)(Gr,2),xs=ur[0],ks=ur[1],cr=$e(function(Wi){ks(Wi)}),js=$e(function(){ks(void 0)});(0,m.useImperativeHandle)(ge,function(){return{list:Rn.current,focus:function(pe){var Ai,yn=Ws(),En=Ue(yn,en),Os=En.elements,As=En.key2element,vr=En.element2key,yr=Re(Rn.current,Os),Er=xs!=null?xs:yr[0]?vr.get(yr[0]):(Ai=pn.find(function(gs){return!gs.props.disabled}))===null||Ai===void 0?void 0:Ai.key,cs=As.get(Er);if(Er&&cs){var hs;cs==null||(hs=cs.focus)===null||hs===void 0||hs.call(cs,pe)}}}});var hr=(0,$.Z)(Fi||[],{value:rn,postState:function(pe){return Array.isArray(pe)?pe:pe==null?ki:[pe]}}),zs=(0,N.Z)(hr,2),Ss=zs[0],fr=zs[1],dr=function(pe){if(Ki){var Ai=pe.key,yn=Ss.includes(Ai),En;Xi?yn?En=Ss.filter(function(As){return As!==Ai}):En=[].concat((0,ee.Z)(Ss),[Ai]):En=[Ai],fr(En);var Os=(0,Ee.Z)((0,Ee.Z)({},pe),{},{selectedKeys:En});yn?qi==null||qi(Os):gi==null||gi(Os)}!Xi&&Et.length&&Dn!=="inline"&&un(ki)},Ts=$e(function(Wi){Qi==null||Qi(Be(Wi)),dr(Wi)}),pr=$e(function(Wi,pe){var Ai=Et.filter(function(En){return En!==Wi});if(pe)Ai.push(Wi);else if(Dn!=="inline"){var yn=Hs(Wi);Ai=Ai.filter(function(En){return!yn.has(En)})}(0,b.Z)(Et,Ai,!0)||un(Ai,!0)}),gr=function(pe,Ai){var yn=Ai!=null?Ai:!Et.includes(pe);pr(pe,yn)},mr=Ve(Dn,xs,Sn,en,Rn,Ws,qn,ks,gr,_n);m.useEffect(function(){On(!0)},[]);var Kr=m.useMemo(function(){return{_internalRenderMenuItem:jn,_internalRenderSubMenuItem:Fn}},[jn,Fn]),_r=Dn!=="horizontal"||Ht?pn:pn.map(function(Wi,pe){return m.createElement(j,{key:Wi.key,overflowDisabled:pe>bs},Wi)}),Ps=m.createElement(u.Z,(0,z.Z)({id:ii,ref:Rn,prefixCls:"".concat(ke,"-overflow"),component:"ul",itemComponent:Je,className:Y()(ke,"".concat(ke,"-root"),"".concat(ke,"-").concat(Dn),ae,(0,J.Z)((0,J.Z)({},"".concat(ke,"-inline-collapsed"),Ur),"".concat(ke,"-rtl"),Sn),Ke),dir:It,style:st,role:"menu",tabIndex:zt,data:_r,renderRawItem:function(pe){return pe},renderRawRest:function(pe){var Ai=pe.length,yn=Ai?pn.slice(-Ai):null;return m.createElement(Di,{eventKey:Ae,title:ji,disabled:Ds,internalPopupClose:Ai===0,popupClassName:ln},yn)},maxCount:Dn!=="horizontal"||Ht?u.Z.INVALIDATE:u.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(pe){rr(pe)},onKeyDown:mr},ts));return m.createElement(U.Provider,{value:Kr},m.createElement(S.Provider,{value:en},m.createElement(j,{prefixCls:ke,rootClassName:Ke,mode:Dn,openKeys:Et,rtl:Sn,disabled:si,motion:Bn?an:null,defaultMotions:Bn?wn:null,activeKey:xs,onActive:cr,onInactive:js,selectedKeys:Ss,inlineIndent:mn,subMenuOpenDelay:ci,subMenuCloseDelay:jt,forceSubMenuRender:Gi,builtinPlacements:Pn,triggerSubMenuAction:Ji,getPopupContainer:mt,itemIcon:Bi,expandIcon:on,onItemClick:Ts,onOpenChange:pr},m.createElement(xe.Provider,{value:$r},Ps),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(te.Provider,{value:lr},os)))))}),xn=di,Tt=xn;Tt.Item=Je,Tt.SubMenu=Di,Tt.ItemGroup=gn,Tt.Divider=Si;var Nt=Tt},11780:function(Lt,Me,G){"use strict";G.d(Me,{Z:function(){return F}});var z=G(14809),J=G(20439),Ee=G(50298),ee=G(62646),N=G(59301),p=G(92310),ie=G.n(p),Y=G(29301),u=G(34280),$=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],b=void 0;function v(_,g){var D=_.prefixCls,V=_.invalidate,de=_.item,Te=_.renderItem,Pe=_.responsive,Ne=_.responsiveDisabled,Ze=_.registerSize,Dt=_.itemKey,Rt=_.className,nt=_.style,xt=_.children,He=_.display,Wt=_.order,ri=_.component,ce=ri===void 0?"div":ri,Re=(0,ee.Z)(_,$),se=Pe&&!He;function Ue(ye){Ze(Dt,ye)}N.useEffect(function(){return function(){Ue(null)}},[]);var Ve=Te&&de!==b?Te(de,{index:Wt}):xt,qe;V||(qe={opacity:se?0:1,height:se?0:b,overflowY:se?"hidden":b,order:Pe?Wt:b,pointerEvents:se?"none":b,position:se?"absolute":b});var K={};se&&(K["aria-hidden"]=!0);var oe=N.createElement(ce,(0,z.Z)({className:ie()(!V&&D,Rt),style:(0,J.Z)((0,J.Z)({},qe),nt)},K,Re,{ref:g}),Ve);return Pe&&(oe=N.createElement(Y.Z,{onResize:function(Ae){var Fe=Ae.offsetWidth;Ue(Fe)},disabled:Ne},oe)),oe}var m=N.forwardRef(v);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 I(){var _=N.useRef(null),g=function(V){_.current||(_.current=[],k(function(){(0,P.unstable_batchedUpdates)(function(){_.current.forEach(function(de){de()}),_.current=null})})),_.current.push(V)};return g}function R(_,g){var D=N.useState(g),V=(0,Ee.Z)(D,2),de=V[0],Te=V[1],Pe=(0,S.Z)(function(Ne){_(function(){Te(Ne)})});return[de,Pe]}var B=N.createContext(null),j=["component"],q=["className"],te=["className"],X=function(g,D){var V=N.useContext(B);if(!V){var de=g.component,Te=de===void 0?"div":de,Pe=(0,ee.Z)(g,j);return N.createElement(Te,(0,z.Z)({},Pe,{ref:D}))}var Ne=V.className,Ze=(0,ee.Z)(V,q),Dt=g.className,Rt=(0,ee.Z)(g,te);return N.createElement(B.Provider,{value:null},N.createElement(x,(0,z.Z)({ref:D,className:ie()(Ne,Dt)},Ze,Rt)))},ve=N.forwardRef(X);ve.displayName="RawItem";var Ie=ve,xe=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],it="responsive",U="invalidate";function w(_){return"+ ".concat(_.length," ...")}function L(_,g){var D=_.prefixCls,V=D===void 0?"rc-overflow":D,de=_.data,Te=de===void 0?[]:de,Pe=_.renderItem,Ne=_.renderRawItem,Ze=_.itemKey,Dt=_.itemWidth,Rt=Dt===void 0?10:Dt,nt=_.ssr,xt=_.style,He=_.className,Wt=_.maxCount,ri=_.renderRest,ce=_.renderRawRest,Re=_.suffix,se=_.component,Ue=se===void 0?"div":se,Ve=_.itemComponent,qe=_.onVisibleChange,K=(0,ee.Z)(_,xe),oe=nt==="full",ye=I(),Ae=R(ye,null),Fe=(0,Ee.Z)(Ae,2),$e=Fe[0],bt=Fe[1],We=$e||0,_t=R(ye,new Map),Pt=(0,Ee.Z)(_t,2),ft=Pt[0],Ot=Pt[1],Zt=R(ye,0),Bt=(0,Ee.Z)(Zt,2),qt=Bt[0],Jt=Bt[1],St=R(ye,0),Ui=(0,Ee.Z)(St,2),Le=Ui[0],Be=Ui[1],je=R(ye,0),ti=(0,Ee.Z)(je,2),Ye=ti[0],et=ti[1],gt=(0,N.useState)(null),Ut=(0,Ee.Z)(gt,2),Je=Ut[0],ze=Ut[1],De=(0,N.useState)(null),Mt=(0,Ee.Z)(De,2),$t=Mt[0],vi=Mt[1],dt=N.useMemo(function(){return $t===null&&oe?Number.MAX_SAFE_INTEGER:$t||0},[$t,$e]),Gt=(0,N.useState)(!1),Kt=(0,Ee.Z)(Gt,2),wi=Kt[0],yi=Kt[1],tn="".concat(V,"-item"),Oi=Math.max(qt,Le),bi=Wt===it,fi=Te.length&&bi,$i=Wt===U,hn=fi||typeof Wt=="number"&&Te.length>Wt,Li=(0,N.useMemo)(function(){var Tt=Te;return fi?$e===null&&oe?Tt=Te:Tt=Te.slice(0,Math.min(Te.length,We/Rt)):typeof Wt=="number"&&(Tt=Te.slice(0,Wt)),Tt},[Te,Rt,$e,Wt,fi]),Hi=(0,N.useMemo)(function(){return fi?Te.slice(dt+1):Te.slice(Li.length)},[Te,Li,fi,dt]),xi=(0,N.useCallback)(function(Tt,Nt){var Z;return typeof Ze=="function"?Ze(Tt):(Z=Ze&&(Tt==null?void 0:Tt[Ze]))!==null&&Z!==void 0?Z:Nt},[Ze]),sn=(0,N.useCallback)(Pe||function(Tt){return Tt},[Pe]);function Di(Tt,Nt,Z){$t===Tt&&(Nt===void 0||Nt===Je)||(vi(Tt),Z||(yi(Tt<Te.length-1),qe==null||qe(Tt)),Nt!==void 0&&ze(Nt))}function fn(Tt,Nt){bt(Nt.clientWidth)}function Si(Tt,Nt){Ot(function(Z){var ge=new Map(Z);return Nt===null?ge.delete(Tt):ge.set(Tt,Nt),ge})}function dn(Tt,Nt){Be(Nt),Jt(Le)}function zi(Tt,Nt){et(Nt)}function Zi(Tt){return ft.get(xi(Li[Tt],Tt))}(0,u.Z)(function(){if(We&&typeof Oi=="number"&&Li){var Tt=Ye,Nt=Li.length,Z=Nt-1;if(!Nt){Di(0,null);return}for(var ge=0;ge<Nt;ge+=1){var Se=Zi(ge);if(oe&&(Se=Se||0),Se===void 0){Di(ge-1,void 0,!0);break}if(Tt+=Se,Z===0&&Tt<=We||ge===Z-1&&Tt+Zi(Z)<=We){Di(Z,null);break}else if(Tt+Oi>We){Di(ge-1,Tt-Se-Ye+Le);break}}Re&&Zi(0)+Ye>We&&ze(null)}},[We,ft,Le,Ye,xi,Li]);var gn=wi&&!!Hi.length,Vt={};Je!==null&&fi&&(Vt={position:"absolute",left:Je,top:0});var ni={prefixCls:tn,responsive:fi,component:Ve,invalidate:$i},Ci=Ne?function(Tt,Nt){var Z=xi(Tt,Nt);return N.createElement(B.Provider,{key:Z,value:(0,J.Z)((0,J.Z)({},ni),{},{order:Nt,item:Tt,itemKey:Z,registerSize:Si,display:Nt<=dt})},Ne(Tt,Nt))}:function(Tt,Nt){var Z=xi(Tt,Nt);return N.createElement(x,(0,z.Z)({},ni,{order:Nt,key:Z,item:Tt,renderItem:sn,itemKey:Z,registerSize:Si,display:Nt<=dt}))},Qt={order:gn?dt:Number.MAX_SAFE_INTEGER,className:"".concat(tn,"-rest"),registerSize:dn,display:gn},ki=ri||w,di=ce?N.createElement(B.Provider,{value:(0,J.Z)((0,J.Z)({},ni),Qt)},ce(Hi)):N.createElement(x,(0,z.Z)({},ni,Qt),typeof ki=="function"?ki(Hi):ki),xn=N.createElement(Ue,(0,z.Z)({className:ie()(!$i&&V,He),style:xt,ref:g},K),Li.map(Ci),hn?di:null,Re&&N.createElement(x,(0,z.Z)({},ni,{responsive:bi,responsiveDisabled:!fi,order:dt,className:"".concat(tn,"-suffix"),registerSize:zi,display:!0,style:Vt}),Re));return bi?N.createElement(Y.Z,{onResize:fn,disabled:!fi},xn):xn}var M=N.forwardRef(L);M.displayName="Overflow",M.Item=Ie,M.RESPONSIVE=it,M.INVALIDATE=U;var H=M,F=H},29301:function(Lt,Me,G){"use strict";G.d(Me,{Z:function(){return U}});var z=G(14809),J=G(59301),Ee=G(11592),ee=G(48736),N=G(20439),p=G(93664),ie=G(76846),Y=G(8654),u=J.createContext(null);function $(w){var L=w.children,M=w.onBatchResize,H=J.useRef(0),F=J.useRef([]),_=J.useContext(u),g=J.useCallback(function(D,V,de){H.current+=1;var Te=H.current;F.current.push({size:D,element:V,data:de}),Promise.resolve().then(function(){Te===H.current&&(M==null||M(F.current),F.current=[])}),_==null||_(D,V,de)},[M,_]);return J.createElement(u.Provider,{value:g},L)}var b=G(76374),v=new Map;function m(w){w.forEach(function(L){var M,H=L.target;(M=v.get(H))===null||M===void 0||M.forEach(function(F){return F(H)})})}var x=new b.Z(m),S=null,P=null;function C(w,L){v.has(w)||(v.set(w,new Set),x.observe(w)),v.get(w).add(L)}function k(w,L){v.has(w)&&(v.get(w).delete(L),v.get(w).size||(x.unobserve(w),v.delete(w)))}var I=G(99153),R=G(84851),B=G(19257),j=G(93046),q=function(w){(0,B.Z)(M,w);var L=(0,j.Z)(M);function M(){return(0,I.Z)(this,M),L.apply(this,arguments)}return(0,R.Z)(M,[{key:"render",value:function(){return this.props.children}}]),M}(J.Component);function te(w,L){var M=w.children,H=w.disabled,F=J.useRef(null),_=J.useRef(null),g=J.useContext(u),D=typeof M=="function",V=D?M(F):M,de=J.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Te=!D&&J.isValidElement(V)&&(0,Y.Yr)(V),Pe=Te?(0,Y.C4)(V):null,Ne=(0,Y.x1)(Pe,F),Ze=function(){var xt;return(0,ie.ZP)(F.current)||(F.current&&(0,p.Z)(F.current)==="object"?(0,ie.ZP)((xt=F.current)===null||xt===void 0?void 0:xt.nativeElement):null)||(0,ie.ZP)(_.current)};J.useImperativeHandle(L,function(){return Ze()});var Dt=J.useRef(w);Dt.current=w;var Rt=J.useCallback(function(nt){var xt=Dt.current,He=xt.onResize,Wt=xt.data,ri=nt.getBoundingClientRect(),ce=ri.width,Re=ri.height,se=nt.offsetWidth,Ue=nt.offsetHeight,Ve=Math.floor(ce),qe=Math.floor(Re);if(de.current.width!==Ve||de.current.height!==qe||de.current.offsetWidth!==se||de.current.offsetHeight!==Ue){var K={width:Ve,height:qe,offsetWidth:se,offsetHeight:Ue};de.current=K;var oe=se===Math.round(ce)?ce:se,ye=Ue===Math.round(Re)?Re:Ue,Ae=(0,N.Z)((0,N.Z)({},K),{},{offsetWidth:oe,offsetHeight:ye});g==null||g(Ae,nt,Wt),He&&Promise.resolve().then(function(){He(Ae,nt)})}},[]);return J.useEffect(function(){var nt=Ze();return nt&&!H&&C(nt,Rt),function(){return k(nt,Rt)}},[F.current,H]),J.createElement(q,{ref:_},Te?J.cloneElement(V,{ref:Ne}):V)}var X=J.forwardRef(te),ve=X,Ie="rc-observer-key";function xe(w,L){var M=w.children,H=typeof M=="function"?[M]:(0,Ee.Z)(M);return H.map(function(F,_){var g=(F==null?void 0:F.key)||"".concat(Ie,"-").concat(_);return J.createElement(ve,(0,z.Z)({},w,{key:g,ref:_===0?L:void 0}),F)})}var it=J.forwardRef(xe);it.Collection=$;var U=it},29125:function(Lt,Me,G){"use strict";G.d(Me,{G:function(){return ee},Z:function(){return k}});var z=G(92310),J=G.n(z),Ee=G(59301);function ee(I){var R=I.children,B=I.prefixCls,j=I.id,q=I.overlayInnerStyle,te=I.bodyClassName,X=I.className,ve=I.style;return Ee.createElement("div",{className:J()("".concat(B,"-content"),X),style:ve},Ee.createElement("div",{className:J()("".concat(B,"-inner"),te),id:j,role:"tooltip",style:q},typeof R=="function"?R():R))}var N=G(14809),p=G(20439),ie=G(62646),Y=G(65966),u={shiftX:64,adjustY:1},$={adjustX:1,shiftY:!0},b=[0,0],v={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:u,offset:[0,-4],targetOffset:b},bottom:{points:["tc","bc"],overflow:u,offset:[0,4],targetOffset:b},topLeft:{points:["bl","tl"],overflow:u,offset:[0,-4],targetOffset:b},leftTop:{points:["tr","tl"],overflow:$,offset:[-4,0],targetOffset:b},topRight:{points:["br","tr"],overflow:u,offset:[0,-4],targetOffset:b},rightTop:{points:["tl","tr"],overflow:$,offset:[4,0],targetOffset:b},bottomRight:{points:["tr","br"],overflow:u,offset:[0,4],targetOffset:b},rightBottom:{points:["bl","br"],overflow:$,offset:[4,0],targetOffset:b},bottomLeft:{points:["tl","bl"],overflow:u,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(R,B){var j=R.overlayClassName,q=R.trigger,te=q===void 0?["hover"]:q,X=R.mouseEnterDelay,ve=X===void 0?0:X,Ie=R.mouseLeaveDelay,xe=Ie===void 0?.1:Ie,it=R.overlayStyle,U=R.prefixCls,w=U===void 0?"rc-tooltip":U,L=R.children,M=R.onVisibleChange,H=R.afterVisibleChange,F=R.transitionName,_=R.animation,g=R.motion,D=R.placement,V=D===void 0?"right":D,de=R.align,Te=de===void 0?{}:de,Pe=R.destroyTooltipOnHide,Ne=Pe===void 0?!1:Pe,Ze=R.defaultVisible,Dt=R.getTooltipContainer,Rt=R.overlayInnerStyle,nt=R.arrowContent,xt=R.overlay,He=R.id,Wt=R.showArrow,ri=Wt===void 0?!0:Wt,ce=R.classNames,Re=R.styles,se=(0,ie.Z)(R,S),Ue=(0,x.Z)(He),Ve=(0,Ee.useRef)(null);(0,Ee.useImperativeHandle)(B,function(){return Ve.current});var qe=(0,p.Z)({},se);"visible"in R&&(qe.popupVisible=R.visible);var K=function(){return Ee.createElement(ee,{key:"content",prefixCls:w,id:Ue,bodyClassName:ce==null?void 0:ce.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},Rt),Re==null?void 0:Re.body)},xt)},oe=function(){var Ae=Ee.Children.only(L),Fe=(Ae==null?void 0:Ae.props)||{},$e=(0,p.Z)((0,p.Z)({},Fe),{},{"aria-describedby":xt?Ue:null});return Ee.cloneElement(L,$e)};return Ee.createElement(Y.Z,(0,N.Z)({popupClassName:J()(j,ce==null?void 0:ce.root),prefixCls:w,popup:K,action:te,builtinPlacements:v,popupPlacement:V,ref:Ve,popupAlign:Te,getPopupContainer:Dt,onPopupVisibleChange:M,afterPopupVisibleChange:H,popupTransitionName:F,popupAnimation:_,popupMotion:g,defaultPopupVisible:Ze,autoDestroy:Ne,mouseLeaveDelay:xe,popupStyle:(0,p.Z)((0,p.Z)({},it),Re==null?void 0:Re.root),mouseEnterDelay:ve,arrow:ri},qe),oe())},C=(0,Ee.forwardRef)(P),k=C},49658:function(Lt,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(Lt,Me,G){"use strict";Object.defineProperty(Me,"__esModule",{value:!0}),Me.CopyToClipboard=void 0;var z=Ee(G(59301)),J=Ee(G(25769));function Ee(I){return I&&I.__esModule?I:{default:I}}function ee(I){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ee=function(B){return typeof B}:ee=function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B},ee(I)}function N(I,R){var B=Object.keys(I);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(I);R&&(j=j.filter(function(q){return Object.getOwnPropertyDescriptor(I,q).enumerable})),B.push.apply(B,j)}return B}function p(I){for(var R=1;R<arguments.length;R++){var B=arguments[R]!=null?arguments[R]:{};R%2?N(B,!0).forEach(function(j){C(I,j,B[j])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(B)):N(B).forEach(function(j){Object.defineProperty(I,j,Object.getOwnPropertyDescriptor(B,j))})}return I}function ie(I,R){if(I==null)return{};var B=Y(I,R),j,q;if(Object.getOwnPropertySymbols){var te=Object.getOwnPropertySymbols(I);for(q=0;q<te.length;q++)j=te[q],!(R.indexOf(j)>=0)&&Object.prototype.propertyIsEnumerable.call(I,j)&&(B[j]=I[j])}return B}function Y(I,R){if(I==null)return{};var B={},j=Object.keys(I),q,te;for(te=0;te<j.length;te++)q=j[te],!(R.indexOf(q)>=0)&&(B[q]=I[q]);return B}function u(I,R){if(!(I instanceof R))throw new TypeError("Cannot call a class as a function")}function $(I,R){for(var B=0;B<R.length;B++){var j=R[B];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(I,j.key,j)}}function b(I,R,B){return R&&$(I.prototype,R),B&&$(I,B),I}function v(I,R){return R&&(ee(R)==="object"||typeof R=="function")?R:x(I)}function m(I){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(B){return B.__proto__||Object.getPrototypeOf(B)},m(I)}function x(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function S(I,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(R&&R.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),R&&P(I,R)}function P(I,R){return P=Object.setPrototypeOf||function(j,q){return j.__proto__=q,j},P(I,R)}function C(I,R,B){return R in I?Object.defineProperty(I,R,{value:B,enumerable:!0,configurable:!0,writable:!0}):I[R]=B,I}var k=function(I){S(R,I);function R(){var B,j;u(this,R);for(var q=arguments.length,te=new Array(q),X=0;X<q;X++)te[X]=arguments[X];return j=v(this,(B=m(R)).call.apply(B,[this].concat(te))),C(x(j),"onClick",function(ve){var Ie=j.props,xe=Ie.text,it=Ie.onCopy,U=Ie.children,w=Ie.options,L=z.default.Children.only(U),M=(0,J.default)(xe,w);it&&it(xe,M),L&&L.props&&typeof L.props.onClick=="function"&&L.props.onClick(ve)}),j}return b(R,[{key:"render",value:function(){var j=this.props,q=j.text,te=j.onCopy,X=j.options,ve=j.children,Ie=ie(j,["text","onCopy","options","children"]),xe=z.default.Children.only(ve);return z.default.cloneElement(xe,p({},Ie,{onClick:this.onClick}))}}]),R}(z.default.PureComponent);Me.CopyToClipboard=k,C(k,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Lt,Me,G){"use strict";var z=G(83145),J=z.CopyToClipboard;J.CopyToClipboard=J,Lt.exports=J},76374:function(Lt,Me,G){"use strict";var z=function(){if(typeof Map!="undefined")return Map;function U(w,L){var M=-1;return w.some(function(H,F){return H[0]===L?(M=F,!0):!1}),M}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 M=U(this.__entries__,L),H=this.__entries__[M];return H&&H[1]},w.prototype.set=function(L,M){var H=U(this.__entries__,L);~H?this.__entries__[H][1]=M:this.__entries__.push([L,M])},w.prototype.delete=function(L){var M=this.__entries__,H=U(M,L);~H&&M.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,M){M===void 0&&(M=null);for(var H=0,F=this.__entries__;H<F.length;H++){var _=F[H];L.call(M,_[1],_[0])}},w}()}(),J=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Ee=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(Ee):function(U){return setTimeout(function(){return U(Date.now())},1e3/60)}}(),N=2;function p(U,w){var L=!1,M=!1,H=0;function F(){L&&(L=!1,U()),M&&g()}function _(){ee(F)}function g(){var D=Date.now();if(L){if(D-H<N)return;M=!0}else L=!0,M=!1,setTimeout(_,w);H=D}return g}var ie=20,Y=["top","right","bottom","left","width","height","size","weight"],u=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_,M=L.indexOf(w);~M&&L.splice(M,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),u?(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,M=L===void 0?"":L,H=Y.some(function(F){return!!~M.indexOf(F)});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,M=Object.keys(w);L<M.length;L++){var H=M[L];Object.defineProperty(U,H,{value:w[H],enumerable:!1,writable:!1,configurable:!0})}return U},v=function(U){var w=U&&U.ownerDocument&&U.ownerDocument.defaultView;return w||Ee},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(M,H){var F=U["border-"+H+"-width"];return M+x(F)},0)}function P(U){for(var w=["top","right","bottom","left"],L={},M=0,H=w;M<H.length;M++){var F=H[M],_=U["padding-"+F];L[F]=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 M=v(U).getComputedStyle(U),H=P(M),F=H.left+H.right,_=H.top+H.bottom,g=x(M.width),D=x(M.height);if(M.boxSizing==="border-box"&&(Math.round(g+F)!==w&&(g-=S(M,"left","right")+F),Math.round(D+_)!==L&&(D-=S(M,"top","bottom")+_)),!R(U)){var V=Math.round(g+F)-w,de=Math.round(D+_)-L;Math.abs(V)!==1&&(g-=V),Math.abs(de)!==1&&(D-=de)}return q(H.left,H.top,g,D)}var I=function(){return typeof SVGGraphicsElement!="undefined"?function(U){return U instanceof v(U).SVGGraphicsElement}:function(U){return U instanceof v(U).SVGElement&&typeof U.getBBox=="function"}}();function R(U){return U===v(U).document.documentElement}function B(U){return J?I(U)?C(U):k(U):m}function j(U){var w=U.x,L=U.y,M=U.width,H=U.height,F=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,_=Object.create(F.prototype);return b(_,{x:w,y:L,width:M,height:H,top:L,right:w+M,bottom:H+L,left:w}),_}function q(U,w,L,M){return{x:U,y:w,width:L,height:M}}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=B(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 M=j(L);b(this,{target:w,contentRect:M})}return U}(),ve=function(){function U(w,L,M){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_=M}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 v(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 v(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(M){return new X(M.target,M.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}(),Ie=typeof WeakMap!="undefined"?new WeakMap:new z,xe=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(),M=new ve(w,L,this);Ie.set(this,M)}return U}();["observe","unobserve","disconnect"].forEach(function(U){xe.prototype[U]=function(){var w;return(w=Ie.get(this))[U].apply(w,arguments)}});var it=function(){return typeof Ee.ResizeObserver!="undefined"?Ee.ResizeObserver:xe}();Me.Z=it},98040:function(Lt){Lt.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(Ee){Me.addRange(Ee)}),G&&G.focus()}}},15360:function(Lt,Me,G){"use strict";G.d(Me,{ZP:function(){return ys}});const z=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},J=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Ee},Ee=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}({}),N=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 u{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 u(e),this.fast_=new u(t),this.defaultTTFB_=n,this.ttfb_=new u(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new u(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new u(t,n.getEstimate(),n.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new u(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 v(){return v=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},v.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(){},I={trace:k,debug:k,log:k,warn:k,info:k,error:k};function R(){return v({},I)}function B(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):B(a,t)}const q=R();function te(a,e,t){const i=R();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.5`)}catch(s){return R()}n.forEach(s=>{q[s]=j(s,a)})}else v(q,i);return i}const X=q;function ve(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ie(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function xe(a,e){const t=Object.keys(a),i=Object.keys(e),n=t.length,s=i.length;return!n||!s||n===s&&!t.some(r=>i.indexOf(r)===-1)}function it(a,e=!1){if(typeof TextDecoder!="undefined"){const l=new TextDecoder("utf-8").decode(a);if(e){const h=l.indexOf("\0");return h!==-1?l.substring(0,h):l}return l.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:{}},M;function H(){return M||(M=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,l,h){if(h=h||{},c=c.trim(),l=l.trim(),!l){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(l);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)):l;var E=o.parseURL(c);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var y=n.exec(E.path);E.netLoc=y[1],E.path=y[2]}E.netLoc&&!E.path&&(E.path="/");var A={scheme:E.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(A.netLoc=E.netLoc,d.path[0]!=="/"))if(!d.path)A.path=E.path,d.params||(A.params=E.params,d.query||(A.query=E.query));else{var T=E.path,O=T.substring(0,T.lastIndexOf("/")+1)+d.path;A.path=o.normalizePath(O)}return A.path===null&&(A.path=h.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(A)},parseURL:function(c){var l=i.exec(c);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[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 F=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=F.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 de 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 Te 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 Pe(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Pe(t,e)}}function Ne(a,e){const t=Pe(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const Ze=Math.pow(2,32)-1,Dt=[].push,Rt={video:1,audio:2,id3:3,text:4};function nt(a){return String.fromCharCode.apply(null,a)}function xt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function He(a,e){const t=ri(a,e);return t<0?4294967296+t:t}function Wt(a,e){let t=He(a,e);return t*=Math.pow(2,32),t+=He(a,e+4),t}function ri(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 Re(a){const e=a.byteLength;for(let t=0;t<e;){const i=He(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function se(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=He(a,n),r=nt(a.subarray(n+4,n+8)),o=s>1?n+s:i;if(r===e[0])if(e.length===1)t.push(a.subarray(n+8,o));else{const c=se(a.subarray(n+8,o),e.slice(1));c.length&&Dt.apply(t,c)}n=o}return t}function Ue(a){const e=[],t=a[0];let i=8;const n=He(a,i);i+=4;let s=0,r=0;t===0?(s=He(a,i),r=He(a,i+4),i+=8):(s=Wt(a,i),r=Wt(a,i+8),i+=16),i+=2;let o=a.length+r;const c=xt(a,i);i+=2;for(let l=0;l<c;l++){let h=i;const f=He(a,h);h+=4;const d=f&2147483647;if((f&2147483648)>>>31===1)return X.warn("SIDX has hierarchical references (not supported)"),null;const y=He(a,h);h+=4,e.push({referenceSize:d,subsegmentDuration:y,info:{duration:y/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=se(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=se(s,["tkhd"])[0];if(r){let o=r[0];const c=He(r,o===0?12:20),l=se(s,["mdia","mdhd"])[0];if(l){o=l[0];const h=He(l,o===0?12:20),f=se(s,["mdia","hdlr"])[0];if(f){const d=nt(f.subarray(8,12)),E={soun:g.AUDIO,vide:g.VIDEO}[d],y=se(s,["mdia","minf","stbl","stsd"])[0],A=qe(y);E?(e[c]={timescale:h,type:E,stsd:A},e[E]=x({timescale:h,id:c},A)):e[c]={timescale:h,type:d,stsd:A}}}}}return se(a,["moov","mvex","trex"]).forEach(n=>{const s=He(n,4),r=e[s];r&&(r.default={duration:He(n,12),flags:He(n,20)})}),e}function qe(a){const e=a.subarray(8),t=e.subarray(86),i=nt(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const l=se(e,[i])[0].subarray(i==="enca"?28:78);se(l,["sinf"]).forEach(f=>{const d=se(f,["schm"])[0];if(d){const E=nt(d.subarray(4,8));if(E==="cbcs"||E==="cenc"){const y=se(f,["frma"])[0];y&&(n=nt(y))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=se(t,["avcC"])[0];c&&c.length>3&&(n+="."+Ae(c[1])+Ae(c[2])+Ae(c[3]),s=K(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=se(e,[i])[0],l=se(c.subarray(28),["esds"])[0];if(l&&l.length>7){let h=4;if(l[h++]!==3)break;h=ye(l,h),h+=2;const f=l[h++];if(f&128&&(h+=2),f&64&&(h+=l[h++]),l[h++]!==4)break;h=ye(l,h);const d=l[h++];if(d===64)n+="."+Ae(d);else break;if(h+=12,l[h++]!==5)break;h=ye(l,h);const E=l[h++];let y=(E&248)>>3;y===31&&(y+=1+((E&7)<<3)+((l[h]&224)>>5)),n+="."+y}break}case"hvc1":case"hev1":{const c=se(t,["hvcC"])[0];if(c&&c.length>12){const l=c[1],h=["","A","B","C"][l>>6],f=l&31,d=He(c,2),E=(l&32)>>5?"H":"L",y=c[12],A=c.subarray(6,12);n+="."+h+f,n+="."+oe(d).toString(16).toUpperCase(),n+="."+E+y;let T="";for(let O=A.length;O--;){const Q=A[O];(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=se(t,["vpcC"])[0];if(c&&c.length>6){const l=c[4],h=c[5],f=c[6]>>4&15;n+="."+Fe(l)+"."+Fe(h)+"."+Fe(f)}break}case"av01":{const c=se(t,["av1C"])[0];if(c&&c.length>2){const l=c[1]>>>5,h=c[1]&31,f=c[2]>>>7?"H":"M",d=(c[2]&64)>>6,E=(c[2]&32)>>5,y=l===2&&d?E?12:10:d?10:8,A=(c[2]&16)>>4,T=(c[2]&8)>>3,O=(c[2]&4)>>2,Q=c[2]&3;n+="."+l+"."+Fe(h)+f+"."+Fe(y)+"."+A+"."+T+O+Q+"."+Fe(1)+"."+Fe(1)+"."+Fe(1)+"."+0,s=K("dav1",t)}break}}return{codec:n,encrypted:r,supplemental:s}}function K(a,e){const t=se(e,["dvvC"]),i=t.length?t[0]:se(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+Fe(n)+"."+Fe(s)}}function oe(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function ye(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function Ae(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function Fe(a){return(a<10?"0":"")+a}function $e(a,e){if(!a||!e)return a;const t=e.keyId;return t&&e.isCommonEncryption&&se(a,["moov","trak"]).forEach(n=>{const r=se(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=se(r,["enca"]);const c=o.length>0;c||(o=se(r,["encv"])),o.forEach(l=>{const h=c?l.subarray(28):l.subarray(78);se(h,["sinf"]).forEach(d=>{const E=bt(d);if(E){const y=E.subarray(8,24);y.some(A=>A!==0)||(X.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${U.hexDump(y)} -> ${U.hexDump(t)}`),E.set(t,8))}})})}),a}function bt(a){const e=se(a,["schm"])[0];if(e){const t=nt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return se(a,["schi","tenc"])[0]}return null}function We(a,e,t){const i={},n=se(a,["moof","traf"]);for(let s=0;s<n.length;s++){const r=n[s],o=se(r,["tfhd"])[0],c=He(o,4),l=e[c];if(!l)continue;const h=i[c]||(i[c]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type}),f=se(r,["tfdt"])[0];if(f){const W=f[0];let ne=He(f,4);W===1&&(ne===Ze?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(ne*=Ze+1,ne+=He(f,8))),z(ne)&&(!z(h.start)||ne<h.start)&&(h.start=ne)}const d=l.default,E=He(o,0)|(d==null?void 0:d.flags);let y=(d==null?void 0:d.duration)||0;E&8&&(E&2?y=He(o,12):y=He(o,8));const A=se(r,["trun"]);let T=h.start||0,O=0,Q=y;for(let W=0;W<A.length;W++){const ne=A[W],re=He(ne,4),_e=h.sampleCount;h.sampleCount+=re;const le=ne[3]&1,fe=ne[3]&4,me=ne[2]&1,ue=ne[2]&2,Ce=ne[2]&4,Qe=ne[2]&8;let vt=8,ot=re;for(le&&(vt+=4),fe&&re&&(!(ne[vt+1]&1)&&h.keyFrameIndex===void 0&&(h.keyFrameIndex=_e),vt+=4,me?(Q=He(ne,vt),vt+=4):Q=y,ue&&(vt+=4),Qe&&(vt+=4),T+=Q,O+=Q,ot--);ot--;)me?(Q=He(ne,vt),vt+=4):Q=y,ue&&(vt+=4),Ce&&(ne[vt+1]&1||h.keyFrameIndex===void 0&&(h.keyFrameIndex=h.sampleCount-(ot+1),h.keyFrameStart=T),vt+=4),Qe&&(vt+=4),T+=Q,O+=Q;!O&&y&&(O+=y*re)}h.duration+=O}if(!Object.keys(i).some(s=>i[s].duration)){let s=1/0,r=0;const o=se(a,["sidx"]);for(let c=0;c<o.length;c++){const l=Ue(o[c]);if(l!=null&&l.references){s=Math.min(s,l.earliestPresentationTime/l.timescale);const h=l.references.reduce((f,d)=>f+d.info.duration||0,0);r=Math.max(r,h+l.earliestPresentationTime/l.timescale)}}r&&z(r)&&Object.keys(i).forEach(c=>{i[c].duration||(i[c].duration=r*i[c].timescale-i[c].start)})}return i}function _t(a,e,t){se(e,["moof","traf"]).forEach(i=>{se(i,["tfhd"]).forEach(n=>{const s=He(n,4),r=a[s];if(!r)return;const o=r.timescale||9e4;se(i,["tfdt"]).forEach(c=>{const l=c[0],h=t*o;if(h){let f=He(c,4);if(l===0)f-=h,f=Math.max(f,0),ce(c,4,f);else{f*=Math.pow(2,32),f+=He(c,8),f-=h,f=Math.max(f,0);const d=Math.floor(f/(Ze+1)),E=Math.floor(f%(Ze+1));ce(c,4,d),ce(c,8,E)}}})})})}function Pt(a){const e={valid:null,remainder:null},t=se(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=a.slice(0,i.byteOffset-8),e.remainder=a.slice(i.byteOffset-8),e}function ft(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Ot(a,e){const t=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return se(i,["moof"]).map(c=>{const l=c.byteOffset-8;se(c,["traf"]).map(f=>{const d=se(f,["tfdt"]).map(E=>{const y=E[0];let A=He(E,4);return y===1&&(A*=Math.pow(2,32),A+=He(E,8)),A/n})[0];return d!==void 0&&(a=d),se(f,["tfhd"]).map(E=>{const y=He(E,4),A=He(E,0)&16777215,T=(A&1)!==0,O=(A&2)!==0,Q=(A&8)!==0;let W=0;const ne=(A&16)!==0;let re=0;const _e=(A&32)!==0;let le=8;y===s&&(T&&(le+=8),O&&(le+=4),Q&&(W=He(E,le),le+=4),ne&&(re=He(E,le),le+=4),_e&&(le+=4),e.type==="video"&&(r=Zt(e.codec)),se(f,["trun"]).map(fe=>{const me=fe[0],ue=He(fe,0)&16777215,Ce=(ue&1)!==0;let Qe=0;const vt=(ue&4)!==0,ot=(ue&256)!==0;let lt=0;const Xe=(ue&512)!==0;let ut=0;const ht=(ue&1024)!==0,Oe=(ue&2048)!==0;let Ge=0;const Ft=He(fe,4);let Ct=8;Ce&&(Qe=He(fe,Ct),Ct+=4),vt&&(Ct+=4);let Xt=Qe+l;for(let ui=0;ui<Ft;ui++){if(ot?(lt=He(fe,Ct),Ct+=4):lt=W,Xe?(ut=He(fe,Ct),Ct+=4):ut=re,ht&&(Ct+=4),Oe&&(me===0?Ge=He(fe,Ct):Ge=ri(fe,Ct),Ct+=4),e.type===g.VIDEO){let _i=0;for(;_i<ut;){const Ri=He(i,Xt);if(Xt+=4,Bt(r,i[Xt])){const Tn=i.subarray(Xt,Xt+Ri);qt(Tn,r?2:1,a+Ge/n,t)}Xt+=Ri,_i+=Ri+4}}a+=lt/n}}))})})}),t}function Zt(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Bt(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function qt(a,e,t,i){const n=Jt(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 l=n.length-s;let h=s;if(o<l)s+=o;else if(o>l){X.error(`Malformed SEI payload. ${o} is too small, only ${l} bytes left to parse.`);break}if(r===4){if(n[h++]===181){const d=xt(n,h);if(h+=2,d===49){const E=He(n,h);if(h+=4,E===1195456820){const y=n[h++];if(y===3){const A=n[h++],T=31&A,O=64&A,Q=O?2+T*3:0,W=new Uint8Array(Q);if(O){W[0]=A;for(let ne=1;ne<Q;ne++)W[ne]=n[h++]}i.push({type:y,payloadType:r,pts:t,bytes:W})}}}}}else if(r===5&&o>16){const f=[];for(let y=0;y<16;y++){const A=n[h++].toString(16);f.push(A.length==1?"0"+A:A),(y===3||y===5||y===7||y===9)&&f.push("-")}const d=o-16,E=new Uint8Array(d);for(let y=0;y<d;y++)E[y]=n[h++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:it(E),userDataBytes:E})}}}function Jt(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 St(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,l=0;if(e===0){for(;nt(a.subarray(l,l+1))!=="\0";)t+=nt(a.subarray(l,l+1)),l+=1;for(t+=nt(a.subarray(l,l+1)),l+=1;nt(a.subarray(l,l+1))!=="\0";)i+=nt(a.subarray(l,l+1)),l+=1;i+=nt(a.subarray(l,l+1)),l+=1,n=He(a,12),s=He(a,16),o=He(a,20),c=He(a,24),l=28}else if(e===1){l+=4,n=He(a,l),l+=4;const f=He(a,l);l+=4;const d=He(a,l);for(l+=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=He(a,l),l+=4,c=He(a,l),l+=4;nt(a.subarray(l,l+1))!=="\0";)t+=nt(a.subarray(l,l+1)),l+=1;for(t+=nt(a.subarray(l,l+1)),l+=1;nt(a.subarray(l,l+1))!=="\0";)i+=nt(a.subarray(l,l+1)),l+=1;i+=nt(a.subarray(l,l+1)),l+=1}const h=a.subarray(l,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:h}}function Ui(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 Le(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),Ui([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t||new Uint8Array)}function Be(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=je(n);e.push(s),i+=s.size}}return e}function je(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 l=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};l=[];for(let f=0;f<c;f++)l.push(new Uint8Array(r,t+32+f*16,16))}return{version:s,systemId:o,kids:l,data:h,offset:t,size:e}}const ti=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ye={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 et(a,e){const t=Ye[e];return!!t&&!!t[a.slice(0,4)]}function gt(a,e,t=!0){return!a.split(",").some(i=>!Ut(i,e,t))}function Ut(a,e,t=!0){var i;const n=ve(t);return(i=n==null?void 0:n.isTypeSupported(Je(a,e)))!=null?i:!1}function Je(a,e){return`${e}/mp4;codecs=${a}`}function ze(a){if(a){const e=a.substring(0,4);return Ye.video[e]}return 2}function De(a){const e=ti();return a.split(",").reduce((t,i)=>{const s=e&&Zt(i)?9:Ye.video[i];return s?(s*2+t)/(t?3:2):(Ye.audio[i]+t)/(t?2:1)},0)}const Mt={};function $t(a,e=!0){if(Mt[a])return Mt[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(Ut(t[n],"audio",e))return Mt[a]=t[n],t[n];if(t[n]==="mp3"&&(i=ve(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const vi=/flac|opus|mp4a\.40\.34/i;function dt(a,e=!0){return a.replace(vi,t=>$t(t.toLowerCase(),e))}function Gt(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)et(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function Kt(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 wi(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function yi(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 tn(a){const e=ve(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 Oi(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const bi={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function fi(a,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const $i={};function hn(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,l=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 E=e.groups[d];if(!E)throw new Error(`Audio track group ${d} not found`);Object.keys(E.channels).forEach(y=>{f[y]=(f[y]||0)+E.channels[y]})}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(l)&&Object.keys(h).some(f=>parseInt(f)>l)}function Li(a,e,t){const i=a.videoCodec,n=a.audioCodec;if(!i&&!n||!t)return Promise.resolve(bi);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(","),l=navigator.userAgent;if(c.some(h=>Zt(h))&&ti())return Promise.resolve(fi(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${l})`),s));s.push.apply(s,c.map(h=>({type:"media-source",video:x(x({},r),{},{contentType:Je(yi(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 l=c.channels||"",h=parseFloat(l);z(h)&&h>2&&s.push.apply(s,n.split(",").map(f=>({type:"media-source",audio:{contentType:Je(f,"audio"),channels:""+h}})))}}))}),Promise.all(s.map(r=>{const o=Hi(r);return $i[o]||($i[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 Hi(a){const{audio:e,video:t}=a,i=t||e;if(i){const n=Oi(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 xi=["NONE","TYPE-0","TYPE-1",null];function sn(a){return xi.indexOf(a)>-1}const Di=["SDR","PQ","HLG"];function fn(a){return!!a&&Di.indexOf(a)>-1}var Si={No:"",Yes:"YES",v2:"v2"};function dn(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?Si.v2:Si.Yes:Si.No}class zi{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 Zi{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 gn(this._audioGroups,e)}hasSubtitleGroup(e){return gn(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 gn(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Vt(){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 ni(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||Di.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&Vt(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Ci=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}},Qt=(a,e)=>JSON.stringify(a,Ci(e));function ki(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,l=r&&parseInt(r)===2;let h=!1,f=!1,d=1/0,E=1/0,y=1/0,A=1/0,T=0,O=[];const{preferHDR:Q,allowedVideoRanges:W}=ni(e,n);for(let fe=s.length;fe--;){const me=a[s[fe]];h||(h=me.channels[2]>0),d=Math.min(d,me.minHeight),E=Math.min(E,me.minFramerate),y=Math.min(y,me.minBitrate),W.filter(Ce=>me.videoRanges[Ce]>0).length>0&&(f=!0)}d=z(d)?d:0,E=z(E)?E:0;const ne=Math.max(1080,d),re=Math.max(30,E);y=z(y)?y:t,t=Math.max(y,t),f||(e=void 0);const _e=s.length>1;return{codecSet:s.reduce((fe,me)=>{const ue=a[me];if(me===fe)return fe;if(O=f?W.filter(Ce=>ue.videoRanges[Ce]>0):[],_e){if(ue.minBitrate>t)return di(me,`min bitrate of ${ue.minBitrate} > current estimate of ${t}`),fe;if(!ue.hasDefaultAudio)return di(me,"no renditions with default or auto-select sound found"),fe;if(o&&me.indexOf(o.substring(0,4))%5!==0)return di(me,`audio codec preference "${o}" not found`),fe;if(r&&!l){if(!ue.channels[r])return di(me,`no renditions with ${r} channel sound found (channels options: ${Object.keys(ue.channels)})`),fe}else if((!o||l)&&h&&ue.channels[2]===0)return di(me,"no renditions with stereo sound found"),fe;if(ue.minHeight>ne)return di(me,`min resolution of ${ue.minHeight} > maximum of ${ne}`),fe;if(ue.minFramerate>re)return di(me,`min framerate of ${ue.minFramerate} > maximum of ${re}`),fe;if(!O.some(Ce=>ue.videoRanges[Ce]>0))return di(me,`no variants with VIDEO-RANGE of ${Qt(O)} found`),fe;if(c&&me.indexOf(c.substring(0,4))%5!==0)return di(me,`video codec preference "${c}" not found`),fe;if(ue.maxScore<T)return di(me,`max score of ${ue.maxScore} < selected max of ${T}`),fe}return fe&&(De(me)>=De(fe)||ue.fragmentError>a[fe].fragmentError)?fe:(A=ue.minIndex,T=ue.maxScore,me)},void 0),videoRanges:O,preferHDR:Q,minFramerate:E,minBitrate:y,minIndex:A}}function di(a,e){X.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function xn(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 Tt(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 l=Math.min(s.height,s.width);return c.minHeight=Math.min(c.minHeight,l),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 Nt(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 Z(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(ge(a,n,t))return i}return-1}function ge(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||Se(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||be(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function Se(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function be(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function we(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 ke(a,e,t,i,n){const s=e[i],o=e.reduce((d,E,y)=>{const A=E.uri;return(d[A]||(d[A]=[])).push(y),d},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=s.videoRange,l=s.frameRate,h=s.codecSet.substring(0,4),f=Ke(e,i,d=>{if(d.videoRange!==c||d.frameRate!==l||d.codecSet.substring(0,4)!==h)return!1;const E=d.audioGroups,y=t.filter(A=>!E||E.indexOf(A.groupId)!==-1);return Z(a,y,n)>-1});return f>-1?f:Ke(e,i,d=>{const E=d.audioGroups,y=t.filter(A=>!E||E.indexOf(A.groupId)!==-1);return Z(a,y,n)>-1})}function Ke(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 st(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class ae 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 l=performance.now(),h=s?s.stats:n.stats,f=s?s.duration:n.duration,d=l-h.loading.start,E=r.minAutoLevel,y=n.level,A=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||y<=E){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const T=A>-1&&A!==y,O=!!t||T;if(!O&&(c.paused||!c.playbackRate||!c.readyState))return;const Q=r.mainForwardBufferInfo;if(!O&&Q===null)return;const W=this.bwEstimator.getEstimateTTFB(),ne=Math.abs(c.playbackRate);if(d<=Math.max(W,1e3*(f/(ne*2))))return;const re=Q?Q.len/ne:0,_e=h.loading.first?h.loading.first-h.loading.start:-1,le=h.loaded&&_e>-1,fe=this.getBwEstimate(),me=r.levels,ue=me[y],Ce=Math.max(h.loaded,Math.round(f*(n.bitrate||ue.averageBitrate)/8));let Qe=le?d-_e:d;Qe<1&&le&&(Qe=Math.min(d,h.loaded*8/fe));const vt=le?h.loaded*1e3/Qe:0,ot=W/1e3,lt=vt?(Ce-h.loaded)/vt:Ce*8/fe+ot;if(lt<=re)return;const Xe=vt?vt*8:fe,ut=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,ht=this.hls.config.abrBandWidthUpFactor;let Oe=Number.POSITIVE_INFINITY,Ge;for(Ge=y-1;Ge>E;Ge--){const ui=me[Ge].maxBitrate,_i=!me[Ge].details||ut;if(Oe=this.getTimeToLoadFrag(ot,Xe,f*ui,_i),Oe<Math.min(re,f+ot))break}if(Oe>=lt||Oe>f*10)return;le?this.bwEstimator.sample(d-Math.min(W,_e),h.loaded):this.bwEstimator.sampleTTFB(d);const Ft=me[Ge].maxBitrate;this.getBwEstimate()*ht>Ft&&this.resetEstimator(Ft);const Ct=this.findBestLevel(Ft,E,Ge,0,re,1,1);Ct>-1&&(Ge=Ct),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${y} is loading too slowly;
Fragment duration: ${n.duration.toFixed(3)}
Time to underbuffer: ${re.toFixed(3)} s
Estimated load time for current fragment: ${lt.toFixed(3)} s
Estimated load time for down switch fragment: ${Oe.toFixed(3)} s
TTFB estimate: ${_e|0} ms
Current BW estimate: ${z(fe)?fe|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${Ge} @ ${Ft|0} bps`),r.nextLoadLevel=r.nextAutoLevel=Ge,this.clearTimer();const Xt=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===Ge&&Ge>0){const ui=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Ge>0?"and switching down":""}
Fragment duration: ${n.duration.toFixed(3)} s
Time to underbuffer: ${ui.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,Ge>E){let _i=this.findBestLevel(this.hls.levels[E].bitrate,E,Ge,0,ui,1,1);_i===-1&&(_i=E),this.hls.nextLoadLevel=this.hls.nextAutoLevel=_i,this.resetEstimator(this.hls.levels[_i].bitrate)}}};T||lt>Oe*2?Xt():this.timer=self.setInterval(Xt,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 N.BUFFER_ADD_CODEC_ERROR:case N.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case N.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,l=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&l>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(f,l),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(),l=this.getStarvationDelay();let h=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(l){const T=this.findBestLevel(c,r,n,l,0,h,f);if(T>=0)return this.rebufferNotice=-1,T}let d=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!l){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 E=this.findBestLevel(c,r,n,l,d,h,f);if(this.rebufferNotice!==E&&(this.rebufferNotice=E,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${E}`)),E>-1)return E;const y=i.levels[r],A=i.loadLevelObj;return A&&(y==null?void 0:y.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 l=n+s,h=this.lastLoadedFragLevel,f=h===-1?this.hls.firstLevel:h,{fragCurrent:d,partCurrent:E}=this,{levels:y,allAudioTracks:A,loadLevel:T,config:O}=this.hls;if(y.length===1)return 0;const Q=y[f],W=!!((c=this.hls.latestLevelDetails)!=null&&c.live),ne=T===-1||h===-1;let re,_e="SDR",le=(Q==null?void 0:Q.frameRate)||0;const{audioPreference:fe,videoPreference:me}=O,ue=this.audioTracksByGroup||(this.audioTracksByGroup=xn(A));let Ce=-1;if(ne){if(this.firstSelection!==-1)return this.firstSelection;const Xe=this.codecTiers||(this.codecTiers=Tt(y,ue,t,i)),ut=ki(Xe,_e,e,fe,me),{codecSet:ht,videoRanges:Oe,minFramerate:Ge,minBitrate:Ft,minIndex:Ct,preferHDR:Xt}=ut;Ce=Ct,re=ht,_e=Xt?Oe[Oe.length-1]:Oe[0],le=Ge,e=Math.max(e,Ft),this.log(`picked start tier ${Qt(ut)}`)}else re=Q==null?void 0:Q.codecSet,_e=Q==null?void 0:Q.videoRange;const Qe=E?E.duration:d?d.duration:0,vt=this.bwEstimator.getEstimateTTFB()/1e3,ot=[];for(let Xe=i;Xe>=t;Xe--){var lt;const ut=y[Xe],ht=Xe>f;if(!ut)continue;if(O.useMediaCapabilities&&!ut.supportedResult&&!ut.supportedPromise){const _i=navigator.mediaCapabilities;typeof(_i==null?void 0:_i.decodingInfo)=="function"&&(hn(ut,ue,_e,le,e,fe)||Zt(ut.videoCodec))?(ut.supportedPromise=Li(ut,ue,_i),ut.supportedPromise.then(Ri=>{if(!this.hls)return;ut.supportedResult=Ri;const Tn=this.hls.levels,kn=Tn.indexOf(ut);Ri.error?this.warn(`MediaCapabilities decodingInfo error: "${Ri.error}" for level ${kn} ${Qt(Ri)}`):Ri.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${kn} ${Qt(Ri)}`),kn>-1&&Tn.length>1&&(this.log(`Removing unsupported level ${kn}`),this.hls.removeLevel(kn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):ut.supportedResult=bi}if((re&&ut.codecSet!==re||_e&&ut.videoRange!==_e||ht&&le>ut.frameRate||!ht&&le>0&&le<ut.frameRate||ut.supportedResult&&!((lt=ut.supportedResult.decodingInfoResults)!=null&&lt[0].smooth))&&(!ne||Xe!==Ce)){ot.push(Xe);continue}const Oe=ut.details,Ge=(E?Oe==null?void 0:Oe.partTarget:Oe==null?void 0:Oe.averagetargetduration)||Qe;let Ft;ht?Ft=o*e:Ft=r*e;const Ct=Qe&&n>=Qe*2&&s===0?ut.averageBitrate:ut.maxBitrate,Xt=this.getTimeToLoadFrag(vt,Ft,Ct*Ge,Oe===void 0);if(Ft>=Ct&&(Xe===h||ut.loadError===0&&ut.fragmentError===0)&&(Xt<=vt||!z(Xt)||W&&!this.bitrateTestDelay||Xt<l)){const _i=this.forcedAutoLevel;return Xe!==T&&(_i===-1||_i!==T)&&(ot.length&&this.trace(`Skipped level(s) ${ot.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${y[ot[0]].codecs}" ${y[ot[0]].videoRange}; not compatible with "${re}" ${_e}`),this.info(`switch candidate:${f}->${Xe} adjustedbw(${Math.round(Ft)})-bitrate=${Math.round(Ft-Ct)} ttfb:${vt.toFixed(1)} avgDuration:${Ge.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${Xt.toFixed(1)} firstSelection:${ne} codecSet:${ut.codecSet} videoRange:${ut.videoRange} hls.loadLevel:${T}`)),ne&&(this.firstSelection=Xe),Xe}}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 tt={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 zt(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;for(let s=0;s<a.length;++s){const r=a[s];if(ii(e,t,r))return r}return null}function ct(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)&&It(t,i,s)===0||rt(s,a,Math.min(n,i))))return s;const r=tt.search(e,It.bind(null,t,i));return r&&(r!==a||!s)?r:s}function rt(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 It(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 ii(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function Yt(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let i=a.fragments;const{fragmentHint:n}=a;n&&(i=i.concat(n));let s;return tt.search(i,r=>r.cc<e?1:r.cc>e?-1:(s=r,r.end<=t?1:r.start>t?-1:0)),s||null}return null}function pt(a){switch(a.details){case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_TIMEOUT:case N.LEVEL_LOAD_TIMEOUT:case N.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function wt(a,e){const t=pt(e);return a.default[`${t?"timeout":"error"}Retry`]}function si(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Ht(a){return x(x({},a),{errorRetry:null,timeoutRetry:null})}function kt(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(ci(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function ci(a){return a===0&&navigator.onLine===!1||!!a&&(a<400||a>499)}var yt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},jt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Gi 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 N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case N.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=oi();return}case N.FRAG_GAP:case N.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=yt.SendAlternateToPenaltyBox;return}case N.LEVEL_EMPTY_ERROR:case N.LEVEL_PARSING_ERROR:{var r,o;const l=t.parent===Y.MAIN?t.level:n.loadLevel;t.details===N.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(o=r.levelDetails)!=null&&o.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.SUBTITLE_LOAD_ERROR:case N.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const l=n.loadLevelObj;if(l&&(s.type===ie.AUDIO_TRACK&&l.hasAudioGroup(s.groupId)||s.type===ie.SUBTITLE_TRACK&&l.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=yt.SendAlternateToPenaltyBox,t.errorAction.flags=jt.MoveAllAlternatesMatchingHost;return}}return;case N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.loadLevelObj,h=l==null?void 0:l.attrs["HDCP-LEVEL"];h?t.errorAction={action:yt.SendAlternateToPenaltyBox,flags:jt.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}:this.keySystemError(t)}return;case N.BUFFER_ADD_CODEC_ERROR:case N.REMUX_ALLOC_ERROR:case N.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case N.INTERNAL_EXCEPTION:case N.BUFFER_APPENDING_ERROR:case N.BUFFER_FULL_ERROR:case N.LEVEL_SWITCH_ERROR:case N.BUFFER_STALLED_ERROR:case N.BUFFER_SEEK_OVER_HOLE:case N.BUFFER_NUDGE_ON_STALL:t.errorAction=oi();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=wt(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(kt(n,s,pt(e),e.response))return{action:yt.RetryRequest,flags:jt.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=wt(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((h,f)=>h+f.fragmentError,0);if(n&&(e.details!==N.FRAG_GAP&&n.fragmentError++,kt(o,c,pt(e),e.response)))return{action:yt.RetryRequest,flags:jt.None,retryConfig:o,retryCount:c};const l=this.getLevelSwitchAction(e,i);return o&&(l.retryConfig=o,l.retryCount=c),l}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var s,r;const l=e.details;n.loadError++,l===N.BUFFER_APPEND_ERROR&&n.fragmentError++;let h=-1;const{levels:f,loadLevel:d,minAutoLevel:E,maxAutoLevel:y}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const A=(s=e.frag)==null?void 0:s.type,O=(A===Y.AUDIO&&l===N.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===N.BUFFER_ADD_CODEC_ERROR||l===N.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:_e})=>n.audioCodec!==_e),W=e.sourceBufferName==="video"&&(l===N.BUFFER_ADD_CODEC_ERROR||l===N.BUFFER_APPEND_ERROR)&&f.some(({codecSet:_e,audioCodec:le})=>n.codecSet!==_e&&n.audioCodec===le),{type:ne,groupId:re}=(r=e.context)!=null?r:{};for(let _e=f.length;_e--;){const le=(_e+d)%f.length;if(le!==d&&le>=E&&le<=y&&f[le].loadError===0){var o,c;const fe=f[le];if(l===N.FRAG_GAP&&A===Y.MAIN&&e.frag){const me=f[le].details;if(me){const ue=ct(e.frag,me.fragments,e.frag.start);if(ue!=null&&ue.gap)continue}}else{if(ne===ie.AUDIO_TRACK&&fe.hasAudioGroup(re)||ne===ie.SUBTITLE_TRACK&&fe.hasSubtitleGroup(re))continue;if(A===Y.AUDIO&&(o=n.audioGroups)!=null&&o.some(me=>fe.hasAudioGroup(me))||A===Y.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(me=>fe.hasSubtitleGroup(me))||O&&n.audioCodec===fe.audioCodec||!O&&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:yt.SendAlternateToPenaltyBox,flags:jt.None,nextAutoLevel:h}}return{action:yt.SendAlternateToPenaltyBox,flags:jt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case yt.DoNothing:break;case yt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==N.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 yt.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 jt.None:this.switchLevel(e,r);break;case jt.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=xi[xi.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===N.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=Oi(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function oi(a){const e={action:yt.DoNothing,flags:jt.None};return a&&(e.resolved=!0),e}var ei={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Mi{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 l=c.range[e];if(l){if(l.time.length===0){this.removeFragment(c.body);return}l.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=Ni(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 l=t[o],h=r||c.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,h,l)}),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),Ii(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=Ki(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=Ni(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,l=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(l>=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 E=Math.max(r,n.start(h)),y=Math.min(o,n.end(h));y>E&&(s.partial=!0,s.time.push({startPTS:E,endPTS:y}))}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(l=>{const h=c[l];h&&Ii(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||Ii(t))}getState(e){const t=Ni(e),i=this.fragments[t];return i?i.buffered?Ii(i)?ei.PARTIAL:ei.OK:ei.APPENDING:ei.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=Ni(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 l=this.activePartLists[o];l||(this.activePartLists[o]=l=[]),l.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=Ni(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=Ni(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=Ki(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 Ii(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 Ni(a){return`${a.type}_${a.level}_${a.sn}`}function Ki(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Ei={cbc:0,ctr:1};class Xi{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 Ei.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Ei.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 Fi(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class rn{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,l=c[0],h=c[1],f=c[2],d=c[3],E=new Uint32Array(256);let y=0,A=0,T=0;for(T=0;T<256;T++)T<128?E[T]=T<<1:E[T]=T<<1^283;for(T=0;T<256;T++){let O=A^A<<1^A<<2^A<<3^A<<4;O=O>>>8^O&255^99,e[y]=O,t[O]=y;const Q=E[y],W=E[Q],ne=E[W];let re=E[O]*257^O*16843008;n[y]=re<<24|re>>>8,s[y]=re<<16|re>>>16,r[y]=re<<8|re>>>24,o[y]=re,re=ne*16843009^W*65537^Q*257^y*16843008,l[O]=re<<24|re>>>8,h[O]=re<<16|re>>>16,f[O]=re<<8|re>>>24,d[O]=re,y?(y=Q^E[E[E[ne^Q]]],A^=E[E[A]]):y=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 l=this.keySchedule=new Uint32Array(r),h=this.invKeySchedule=new Uint32Array(r),f=this.sBox,d=this.rcon,E=this.invSubMix,y=E[0],A=E[1],T=E[2],O=E[3];let Q,W;for(o=0;o<r;o++){if(o<s){Q=l[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]),l[o]=Q=(l[o-s]^W)>>>0}for(c=0;c<r;c++)o=r-c,c&3?W=l[o]:W=l[o-4],c<4||o<=4?h[c]=W:h[c]=y[f[W>>>24]]^A[f[W>>>16&255]]^T[f[W>>>8&255]]^O[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],l=o[1],h=o[2],f=o[3],d=this.uint8ArrayToUint32Array_(i);let E=d[0],y=d[1],A=d[2],T=d[3];const O=new Int32Array(e),Q=new Int32Array(O.length);let W,ne,re,_e,le,fe,me,ue,Ce,Qe,vt,ot,lt,Xe;const ut=this.networkToHostOrderSwap;for(;t<O.length;){for(Ce=ut(O[t]),Qe=ut(O[t+1]),vt=ut(O[t+2]),ot=ut(O[t+3]),le=Ce^s[0],fe=ot^s[1],me=vt^s[2],ue=Qe^s[3],lt=4,Xe=1;Xe<n;Xe++)W=c[le>>>24]^l[fe>>16&255]^h[me>>8&255]^f[ue&255]^s[lt],ne=c[fe>>>24]^l[me>>16&255]^h[ue>>8&255]^f[le&255]^s[lt+1],re=c[me>>>24]^l[ue>>16&255]^h[le>>8&255]^f[fe&255]^s[lt+2],_e=c[ue>>>24]^l[le>>16&255]^h[fe>>8&255]^f[me&255]^s[lt+3],le=W,fe=ne,me=re,ue=_e,lt=lt+4;W=r[le>>>24]<<24^r[fe>>16&255]<<16^r[me>>8&255]<<8^r[ue&255]^s[lt],ne=r[fe>>>24]<<24^r[me>>16&255]<<16^r[ue>>8&255]<<8^r[le&255]^s[lt+1],re=r[me>>>24]<<24^r[ue>>16&255]<<16^r[le>>8&255]<<8^r[fe&255]^s[lt+2],_e=r[ue>>>24]<<24^r[le>>16&255]<<16^r[fe>>8&255]<<8^r[me&255]^s[lt+3],Q[t]=ut(W^E),Q[t+1]=ut(_e^y),Q[t+2]=ut(re^A),Q[t+3]=ut(ne^T),E=Ce,y=Qe,A=vt,T=ot,t=t+4}return Q.buffer}}class gi{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=qi(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function qi(a){switch(a){case Ei.cbc:return"AES-CBC";case Ei.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const An=16;class mn{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?Fi(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!==Ei.cbc||t.byteLength!==16)return X.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=ft(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(i=s);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new rn),l.expandKey(t);const h=r;return this.currentResult=l.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 gi(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Xi(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%An;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 an=Math.pow(2,17);class wn{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 Bi({type:ee.NETWORK_ERROR,details:N.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(y=>y[0]==="GAP")){c(Ji(e));return}else e.gap=!1;const l=this.loader=s?new s(n):new r(n),h=Yi(e);e.loader=l;const f=Ht(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:an};e.stats=l.stats;const E={onSuccess:(y,A,T,O)=>{this.resetLoader(e,l);let Q=y.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:O})},onError:(y,A,T,O)=>{this.resetLoader(e,l),c(new Bi({type:ee.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:x({url:i,data:void 0},y),error:new Error(`HTTP Error ${y.code} ${y.text}`),networkDetails:T,stats:O}))},onAbort:(y,A,T)=>{this.resetLoader(e,l),c(new Bi({type:ee.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:T,stats:y}))},onTimeout:(y,A,T)=>{this.resetLoader(e,l),c(new Bi({type:ee.NETWORK_ERROR,details:N.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:T,stats:y}))}};t&&(E.onProgress=(y,A,T,O)=>t({frag:e,part:null,payload:T,networkDetails:O})),l.load(h,d,E)})}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(Ji(e,t));return}const l=this.loader=s?new s(n):new r(n),h=Yi(e,t);e.loader=l;const f=Ht(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:an};t.stats=l.stats,l.load(h,d,{onSuccess:(E,y,A,T)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const O={frag:e,part:t,payload:E.data,networkDetails:T};i(O),o(O)},onError:(E,y,A,T)=>{this.resetLoader(e,l),c(new Bi({type:ee.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:x({url:h.url,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:A,stats:T}))},onAbort:(E,y,A)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),c(new Bi({type:ee.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:A,stats:E}))},onTimeout:(E,y,A)=>{this.resetLoader(e,l),c(new Bi({type:ee.NETWORK_ERROR,details:N.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:A,stats:E}))}})})}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),l=Math.min(Math.round(i.loaded/s),c),f=(c-l)*Math.round(i.loaded/l);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 Yi(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"&&Pn((r=a.decryptdata)==null?void 0:r.method)){const l=s-n;l%16&&(c=s+(16-l%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=c}return i}function Ji(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:ee.MEDIA_ERROR,details:N.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new Bi(i)}function Pn(a){return a==="AES-128"||a==="AES-256"}class Bi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class on 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 Pi{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=ji(),this.buffering={audio:ji(),video:ji(),audiovideo:ji()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function ji(){return{start:0,executeStart:0,executeEnd:0,end:0}}const ln={length:0,start:()=>0,end:()=>0};class mt{static isBuffered(e,t){if(e){const i=mt.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=mt.getBuffered(e);return mt.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=mt.bufferedRanges(e);if(n.length)return mt.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,l=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,l=d,r=l-t;else if(t+i<f){o=f;break}}return{len:r,start:c||0,end:l||0,nextStart:o,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||ln}catch(t){return X.log("failed to get media.buffered",t),ln}}}const Qi=/\{\$([a-zA-Z0-9-_]+)\}/g;function nn(a){return Qi.test(a)}function _n(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Qi,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 In(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 Hn(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 jn=/^(\d+)x(\d+)$/,Fn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ai{constructor(e,t){typeof e=="string"&&(e=ai.parseAttrList(e,t)),v(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=jn.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={},s='"';for(Fn.lastIndex=0;(i=Fn.exec(e))!==null;){const r=i[1].trim();let o=i[2];const c=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let l=!1;if(c)o=o.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":l=!0}if(t&&(c||l))o=_n(t,o);else if(!l&&!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 ts="com.apple.hls.interstitial";function as(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function zn(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class pn{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=v(new ai({}),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===ts}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 os=10;class ls{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?z(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||os}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function vn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Bn(a){switch(a){case"AES-128":case"AES-256":return Ei.cbc;case"AES-256-CTR":return Ei.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function On(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Rn(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function en(a){const e=Rn(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Sn(a){const e=function(i,n,s){const r=i[n];i[n]=i[s],i[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function Zn(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const s=n[0]==="base64",r=n[1];s?(i.splice(-1,1),t=On(r)):t=en(r)}}return t}const Vi=typeof self!="undefined"?self:void 0;var Et={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},li={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function un(a){switch(a){case li.FAIRPLAY:return Et.FAIRPLAY;case li.PLAYREADY:return Et.PLAYREADY;case li.WIDEVINE:return Et.WIDEVINE;case li.CLEARKEY:return Et.CLEARKEY}}var Ln={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Yn(a){if(a===Ln.WIDEVINE)return Et.WIDEVINE;if(a===Ln.PLAYREADY)return Et.PLAYREADY;if(a===Ln.CENC||a===Ln.CLEARKEY)return Et.CLEARKEY}function Qn(a){switch(a){case Et.FAIRPLAY:return li.FAIRPLAY;case Et.PLAYREADY:return li.PLAYREADY;case Et.WIDEVINE:return li.WIDEVINE;case Et.CLEARKEY:return li.CLEARKEY}}function Xn(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[Et.FAIRPLAY,Et.WIDEVINE,Et.PLAYREADY,Et.CLEARKEY].filter(n=>!!e[n]):[];return!i[Et.WIDEVINE]&&t&&i.push(Et.WIDEVINE),i}const is=function(a){return Vi!=null&&(a=Vi.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function at(a,e,t,i){let n;switch(a){case Et.FAIRPLAY:n=["cenc","sinf"];break;case Et.WIDEVINE:case Et.PLAYREADY:n=["cenc"];break;case Et.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return At(n,e,t,i)}function At(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 pi(a){var e;return a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function Ti(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=On(o).subarray(0,16);return Sn(c),c}}return null}let mi={};class Un{static clearKeyUriToKeyIdMap(){mi={}}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&&!vn(e)}isSupported(){if(this.method){if(vn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case li.FAIRPLAY:case li.WIDEVINE:case li.PLAYREADY:case li.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(vn(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=ps(e);return new Un(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=Zn(this.uri);if(t)switch(this.keyFormat){case li.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case li.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Le(i,null,t),this.keyId=Ti(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=mi[this.uri];if(!i){const n=Object.keys(mi).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),mi[this.uri]=i}this.keyId=i}return this}}function ps(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const Dn=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,us=/#EXT-X-MEDIA:(.*)/g,Br=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ls=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Ur=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class $n{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 F.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Br.test(e)}static parseMasterPlaylist(e,t){const i=nn(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];Dn.lastIndex=0;let r;for(;(r=Dn.exec(e))!=null;)if(r[1]){var o;const l=new ai(r[1],n),h=_n(n,r[2]),f={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:$n.resolve(h,t)},d=l.decimalResolution("RESOLUTION");d&&(f.width=d.width,f.height=d.height),Ds(l.CODECS,f);const E=l["SUPPLEMENTAL-CODECS"];E&&(f.supplemental={},Ds(E,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),n.levels.push(f)}else if(r[3]){const l=r[3],h=r[4];switch(l){case"SESSION-DATA":{const f=new ai(h,n),d=f["DATA-ID"];d&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[d]=f);break}case"SESSION-KEY":{const f=bs(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 ai(h,n);In(n,f,t)}break}case"CONTENT-STEERING":{const f=new ai(h,n);n.contentSteering={uri:$n.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=rr(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(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:r.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(us.lastIndex=0;(n=us.exec(e))!==null;){const l=new ai(n[1],i),h=l.TYPE;if(h){const f=o[h],d=s[h]||[];s[h]=d;const E=l.LANGUAGE,y=l["ASSOC-LANGUAGE"],A=l.CHANNELS,T=l.CHARACTERISTICS,O=l["INSTREAM-ID"],Q={attrs:l,bitrate:0,id:c++,groupId:l["GROUP-ID"]||"",name:l.NAME||E||"",type:h,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:E,url:l.URI?$n.resolve(l.URI,t):""};if(y&&(Q.assocLang=y),A&&(Q.channels=A),T&&(Q.characteristics=T),O&&(Q.instreamId=O),f!=null&&f.length){const W=$n.findGroup(f,Q.groupId)||f[0];ns(Q,W,"audioCodec"),ns(Q,W,"textCodec")}d.push(Q)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},l=new ls(t),h=l.fragments,f=[];let d=null,E=0,y=0,A=0,T=0,O=0,Q=null,W=new de(n,c),ne,re,_e,le=-1,fe=!1,me=null,ue;if(Ls.lastIndex=0,l.m3u8=e,l.hasVariableRefs=nn(e),((o=Ls.exec(e))==null?void 0:o[0])!=="#EXTM3U")return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;(ne=Ls.exec(e))!==null;){fe&&(fe=!1,W=new de(n,c),W.playlistOffset=A,W.start=A,W.sn=E,W.cc=T,O&&(W.bitrate=O),W.level=i,d&&(W.initSegment=d,d.rawProgramDateTime&&(W.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),me&&(W.setByteRange(me),me=null)));const ot=ne[1];if(ot){W.duration=parseFloat(ot);const lt=(" "+ne[2]).slice(1);W.title=lt||null,W.tagList.push(lt?["INF",ot,lt]:["INF",ot])}else if(ne[3]){if(z(W.duration)){W.playlistOffset=A,W.start=A,_e&&Vs(W,_e,l),W.sn=E,W.level=i,W.cc=T,h.push(W);const lt=(" "+ne[3]).slice(1);W.relurl=_n(l,lt),Cs(W,Q,f),Q=W,A+=W.duration,E++,y=0,fe=!0}}else{if(ne=ne[0].match(Ur),!ne){X.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re<ne.length&&ne[re]===void 0;re++);const lt=(" "+ne[re]).slice(1),Xe=(" "+ne[re+1]).slice(1),ut=ne[re+2]?(" "+ne[re+2]).slice(1):null;switch(lt){case"BYTERANGE":Q?W.setByteRange(Xe,Q):W.setByteRange(Xe);break;case"PROGRAM-DATE-TIME":W.rawProgramDateTime=Xe,W.tagList.push(["PROGRAM-DATE-TIME",Xe]),le===-1&&(le=h.length);break;case"PLAYLIST-TYPE":l.type&&qn(l,lt,ne),l.type=Xe.toUpperCase();break;case"MEDIA-SEQUENCE":l.startSN!==0?qn(l,lt,ne):h.length>0&&Ws(l,lt,ne),E=l.startSN=parseInt(Xe);break;case"SKIP":{l.skippedSegments&&qn(l,lt,ne);const ht=new ai(Xe,l),Oe=ht.decimalInteger("SKIPPED-SEGMENTS");if(z(Oe)){l.skippedSegments+=Oe;for(let Ft=Oe;Ft--;)h.push(null);E+=Oe}const Ge=ht.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ge&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(Ge.split(" ")));break}case"TARGETDURATION":l.targetduration!==0&&qn(l,lt,ne),l.targetduration=Math.max(parseInt(Xe),1);break;case"VERSION":l.version!==null&&qn(l,lt,ne),l.version=parseInt(Xe);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||qn(l,lt,ne),l.live=!1;break;case"#":(Xe||ut)&&W.tagList.push(ut?[Xe,ut]:[Xe]);break;case"DISCONTINUITY":T++,W.tagList.push(["DIS"]);break;case"GAP":W.gap=!0,W.tagList.push([lt]);break;case"BITRATE":W.tagList.push([lt,Xe]),O=parseInt(Xe)*1e3,z(O)?W.bitrate=O:O=0;break;case"DATERANGE":{const ht=new ai(Xe,l),Oe=new pn(ht,l.dateRanges[ht.ID],l.dateRangeTagCount);l.dateRangeTagCount++,Oe.isValid||l.skippedSegments?l.dateRanges[Oe.id]=Oe:X.warn(`Ignoring invalid DATERANGE tag: "${Xe}"`),W.tagList.push(["EXT-X-DATERANGE",Xe]);break}case"DEFINE":{{const ht=new ai(Xe,l);"IMPORT"in ht?Hn(l,ht,r):In(l,ht,t)}break}case"DISCONTINUITY-SEQUENCE":l.startCC!==0?qn(l,lt,ne):h.length>0&&Ws(l,lt,ne),l.startCC=T=parseInt(Xe);break;case"KEY":{const ht=bs(Xe,t,l);if(ht.isSupported()){if(ht.method==="NONE"){_e=void 0;break}_e||(_e={}),_e[ht.keyFormat]&&(_e=v({},_e)),_e[ht.keyFormat]=ht}else X.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${Xe}"`);break}case"START":l.startTimeOffset=rr(Xe);break;case"MAP":{const ht=new ai(Xe,l);if(W.duration){const Oe=new de(n,c);or(Oe,ht,i,_e),d=Oe,W.initSegment=d,d.rawProgramDateTime&&!W.rawProgramDateTime&&(W.rawProgramDateTime=d.rawProgramDateTime)}else{const Oe=W.byteRangeEndOffset;if(Oe){const Ge=W.byteRangeStartOffset;me=`${Oe-Ge}@${Ge}`}else me=null;or(W,ht,i,_e),d=W,fe=!0}d.cc=T;break}case"SERVER-CONTROL":{ue&&qn(l,lt,ne),ue=new ai(Xe),l.canBlockReload=ue.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=ue.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&ue.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=ue.optionalFloat("PART-HOLD-BACK",0),l.holdBack=ue.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{l.partTarget&&qn(l,lt,ne);const ht=new ai(Xe);l.partTarget=ht.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ht=l.partList;ht||(ht=l.partList=[]);const Oe=y>0?ht[ht.length-1]:void 0,Ge=y++,Ft=new ai(Xe,l),Ct=new Te(Ft,W,c,Ge,Oe);ht.push(Ct),W.duration+=Ct.duration;break}case"PRELOAD-HINT":{const ht=new ai(Xe,l);l.preloadHint=ht;break}case"RENDITION-REPORT":{const ht=new ai(Xe,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(ht);break}default:X.warn(`line parsed but not handled: ${ne}`);break}}}Q&&!Q.relurl?(h.pop(),A-=Q.duration,l.partList&&(l.fragmentHint=Q)):l.partList&&(Cs(W,Q,f),W.cc=T,l.fragmentHint=W,_e&&Vs(W,_e,l)),l.targetduration||(l.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Ce=h.length,Qe=h[0],vt=h[Ce-1];if(A+=l.skippedSegments*l.targetduration,A>0&&Ce&&vt){l.averagetargetduration=A/Ce;const ot=vt.sn;l.endSN=ot!=="initSegment"?ot:0,l.live||(vt.endList=!0),Qe&&l.startCC===void 0&&(l.startCC=Qe.cc),le>0&&(ar(h,le),Qe&&f.unshift(Qe))}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(A+=l.fragmentHint.duration),l.totalduration=A,f.length&&l.dateRangeTagCount&&Qe&&nr(f,l),l.endCC=T,l}}function nr(a,e){const t=a.length;if(!t)return;const i=a[t-1],n=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let r=s.length;r--;){const o=e.dateRanges[s[r]],c=o.startDate.getTime();o.tagAnchor=i.ref;for(let l=t;l--;){const h=sr(e,c,a,l,n);if(h!==-1){o.tagAnchor=e.fragments[h].ref;break}}}}function sr(a,e,t,i,n){const s=t[i];if(s){const o=s.programDateTime;if(e>=o||i===0){var r;const c=(((r=t[i+1])==null?void 0:r.start)||n)-s.start;if(e<=o+c*1e3){const l=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 E=d;E>l;E--){const y=h[E].programDateTime;if(e>=y&&e<y+h[E].duration*1e3)return E}}return l}}}return-1}function bs(a,e,t){var i,n;const s=new ai(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,c=s.hexadecimalInteger("IV"),l=s.KEYFORMATVERSIONS,h=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!c&&X.error(`Invalid IV: ${s.IV}`);const f=o?$n.resolve(o,e):"",d=(l||"1").split("/").map(Number).filter(Number.isFinite);return new Un(r,f,h,d,c)}function rr(a){const t=new ai(a).decimalFloatingPoint("TIME-OFFSET");return z(t)?t:null}function Ds(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>et(s,i));n.length&&(e[`${i}Codec`]=n.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>n.indexOf(s)===-1))}),e.unknownCodecs=t}function ns(a,e,t){const i=e[t];i&&(a[t]=i)}function ar(a,e){let t=a[e];for(let i=e;i--;){const n=a[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function Cs(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function or(a,e,t,i){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",i&&(a.levelkeys=i),a.initSegment=null}function Vs(a,e,t){a.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(a)}function qn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Ws(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 lr(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 l=e.startPTS,h=e.endPTS;if(z(l)){const T=Math.abs(l-t);z(e.deltaPTS)?e.deltaPTS=Math.max(T,e.deltaPTS):e.deltaPTS=T,o=Math.max(t,l),t=Math.min(t,l),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 E;const y=d-a.startSN,A=a.fragments;for(A[y]=e,E=y;E>0;E--)Hs(A[E],A[E-1]);for(E=y;E<A.length-1;E++)Hs(A[E],A[E+1]);return a.fragmentHint&&Hs(A[A.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,f}function $r(a,e){if(a===e)return;let t=null;const i=a.fragments;for(let l=i.length-1;l>=0;l--){const h=i[l].initSegment;if(h){t=h;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let n;xs(a,e,(l,h,f,d)=>{if((!e.startCC||e.skippedSegments)&&h.cc!==l.cc){const E=l.cc-h.cc;for(let y=f;y<d.length;y++)d[y].cc+=E;e.endCC=d[d.length-1].cc}z(l.startPTS)&&z(l.endPTS)&&(h.setStart(h.startPTS=l.startPTS),h.startDTS=l.startDTS,h.maxStartPTS=l.maxStartPTS,h.endPTS=l.endPTS,h.endDTS=l.endDTS,h.minEndPTS=l.minEndPTS,h.setDuration(l.endPTS-l.startPTS),h.duration&&(n=h),e.PTSKnown=e.alignedSliding=!0),l.hasStreams&&(h.elementaryStreams=l.elementaryStreams),h.loader=l.loader,l.hasStats&&(h.stats=l.stats),l.initSegment&&(h.initSegment=l.initSegment,t=l.initSegment)});const s=e.fragments,r=e.fragmentHint?s.concat(e.fragmentHint):s;if(t&&r.forEach(l=>{var h;l&&(!l.initSegment||l.initSegment.relurl===((h=t)==null?void 0:h.relurl))&&(l.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=s.some(l=>!l),e.deltaUpdateFailed){X.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)s.shift();e.startSN=s[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=Gr(a.dateRanges,e));const l=a.fragments.filter(h=>h.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let h=1;h<r.length;h++)r[h].programDateTime===null&&Cs(r[h],r[h-1],l);nr(l,e)}e.endCC=s[s.length-1].cc}if(!e.startCC){var o;const l=zs(a,e.startSN-1);e.startCC=(o=l==null?void 0:l.cc)!=null?o:s[0].cc}ur(a.partList,e.partList,(l,h)=>{h.elementaryStreams=l.elementaryStreams,h.stats=l.stats}),n?lr(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):cr(a,e),s.length&&(e.totalduration=e.edge-s[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const l=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=l),e.driftEndTime=c,e.driftEnd=l}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function Gr(a,e){const{dateRanges:t,recentlyRemovedDateranges:i}=e,n=v({},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],l=new pn(t[o].attr,c);l.isValid?(n[o]=l,c||(l.tagOrder+=r)):X.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Qt(t[o].attr)}"`)}),n}function ur(a,e,t){if(a&&e){let i=0;for(let n=0,s=a.length;n<=s;n++){const r=a[n],o=e[n+i];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):i--}}}function xs(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 l=n;l<=s;l++){const h=c[r+l];let f=o[l];if(i&&!f&&h&&(f=e.fragments[l]=h),h&&f){if(t(h,f,l,o),h.url&&h.url!==f.url){e.playlistParsingError=ks(`media sequence mismatch ${f.sn}:`,a,e,h,f);return}else if(h.cc!==f.cc){e.playlistParsingError=ks(`discontinuity sequence mismatch (${h.cc}!=${f.cc})`,a,e,h,f);return}}}}function ks(a,e,t,i,n){return new Error(`${a} ${n.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function cr(a,e,t=!0){const i=e.startSN+e.skippedSegments-a.startSN,n=a.fragments,s=i>=0;let r=0;if(s&&i<n.length)r=n[i].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)r=a.fragmentStart;else return;js(e,r)}function js(a,e){if(e){const t=a.fragments;for(let i=a.skippedSegments;i<t.length;i++)t[i].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function hr(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const i=a.fragments;if(i.length&&t*4>e){const s=i[i.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function zs(a,e,t){if(!a)return null;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function Ss(a,e,t){return a?fr(a.partList,e,t):null}function fr(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 dr(a){a.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function Ts(a,e){for(let i=0,n=a.length;i<n;i++){var t;if(((t=a[i])==null?void 0:t.cc)===e)return a[i]}return null}function pr(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function gr(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function mr(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)gr(t[i],a);e.fragmentHint&&gr(e.fragmentHint,a),e.alignedSliding=!0}function Kr(a,e){a&&(_r(e,a),!e.alignedSliding&&a&&Ps(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&cr(a,e,!1))}function _r(a,e){if(!pr(e,a))return;const t=Math.min(e.endCC,a.endCC),i=Ts(e.fragments,t),n=Ts(a.fragments,t);if(!i||!n)return;X.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;mr(s,a)}function Ps(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,i=e.fragments;if(!t.length||!i.length)return;let n,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(n=Ts(i,r),s=Ts(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=Ts(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,c=s.programDateTime;if(!o||!c)return;const l=(c-o)/1e3-(s.start-n.start);mr(l,a)}const Wi={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}},pe={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 Ai extends on{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=pe.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:l,state:h}=this,f=c?c.currentTime:0,d=mt.bufferInfo(l||c,f,r.maxBufferHole);if(this.log(`media seeking to ${z(f)?f.toFixed(3):f}, state: ${h}`),this.state===pe.ENDED)this.resetLoadingState();else if(o){const E=r.maxFragLookUpTolerance,y=o.start-E,A=o.start+o.duration+E;if(!d.len||A<d.start||y>d.end){const T=f>A;(f<y||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 E=this.lastCurrentTime;if(f>E&&(this.lastCurrentTime=f),!this.loadingParts){const y=Math.max(d.end,f),A=this.shouldLoadParts(this.getLevelDetails(),y);A&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${y.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 wn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new mn(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===pe.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=pe.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=mt.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>n&&r<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const h=c[c.length-1];return mt.isBuffered(this.media,h.start+h.duration/2)}const l=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(l)}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===pe.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=pe.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===pe.FRAG_LOADING||!this.fragCurrent&&r===pe.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=pe.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===pe.STOPPED||this.state===pe.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)===ei.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)===ei.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&&vn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,Bn(o.method)).catch(l=>{throw n.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:N.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:s}),l}).then(l=>{const h=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:s,payload:l,stats:{tstart:c,tdecrypt:h}}),i.payload=l,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===pe.STOPPED||this.state===pe.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!==pe.STOPPED&&(this.state=pe.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?Wi.toString(mt.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=pe.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=pe.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 Pi(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=pe.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===pe.KEY_LOADING&&(this.state=pe.IDLE),f}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):e.encrypted||(o=this.keyLoader.loadClear(e,r.encryptedFragments),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(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 E=f[d];e=this.fragCurrent=E.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${E.index} (${d}/${f.length-1}) of ${this.fragInfo(e,!1,E)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=E.start+E.duration,this.state=pe.FRAG_LOADING;let y;return o?y=o.then(A=>!A||this.fragContextChanged(A.frag)?null:this.doFragPartsLoad(e,E,t,n)).catch(A=>this.handleFragLoadError(A)):y=this.doFragPartsLoad(e,E,t,n).catch(A=>this.handleFragLoadError(A)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:E,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):y}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=pe.FRAG_LOADING;const l=this.config.progressive;let h;return l&&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,l?n:void 0),o]).then(([f])=>(!l&&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=[],l=(o=i.details)==null?void 0:o.partList,h=f=>{this.fragmentLoader.loadPart(e,f,n).then(d=>{c[f.index]=d;const E=d.part;this.hls.trigger(p.FRAG_LOADED,d);const y=Ss(i.details,e.sn,f.index+1)||fr(l,e.sn,f.index+1);if(y)h(y);else return s({frag:e,part:E,partsLoaded:c})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===N.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:N.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==pe.PARSING){!this.fragCurrent&&this.state!==pe.STOPPED&&this.state!==pe.ERROR&&(this.state=pe.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(),l=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);l!==this.loadingParts&&(this.log(`LL-Part loading ${l?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=l),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,l=r>-1?Ss(c,s,r):null,h=l?l.fragment:zs(c,s,i);return h?(i&&i!==h&&(h.stats=i.stats),{frag:h,part:l,level:o}):null}bufferFragmentData(e,t,i,n,s){var r;if(!e||this.state!==pe.PARSING)return;const{data1:o,data2:c}=e;let l=o;if(o&&c&&(l=ft(o,c)),!((r=l)!=null&&r.length))return;const h={type:e.type,frag:t,part:i,chunkMeta:n,parent:t.type,data:l};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(!mt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=mt.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=mt.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 mt.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 l;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const d=this.hls.startPosition,E=this.hls.liveSyncPosition,y=c?(d!==-1&&d>=r?d:E)||c.start:e;this.log(`Setting startPosition to ${y} to match start frag at live edge. mainStart: ${d} liveSyncPosition: ${E} frag.start: ${(l=c)==null?void 0:l.start}`),this.startPosition=this.nextLoadPosition=y}}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===ei.OK||i===ei.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(yn(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(yn(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 l=e[o];if(r=r&&!l.independent,n>-1&&i<l.start)break;const h=l.loaded;h?n=-1:(s||l.independent||r)&&l.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){const t=e.fragments,i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=zt(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=Yt(e,i.cc,i.end),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:l}=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 E;const A=e<this.lastCurrentTime||e>t-l||(E=this.media)!=null&&E.paused||!this.startFragRequested?0:l;d=ct(s,r,e,A)}else d=r[r.length-1];if(d){const y=d.sn-i.startSN,A=this.fragmentTracker.getState(d);if((A===ei.OK||A===ei.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 O=r[y+1];d.sn<o&&this.fragmentTracker.getState(O)!==ei.OK?d=O: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){Kr(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!==pe.FRAG_LOADING_WAITING_RETRY)&&(this.state=pe.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const y=this.getCurrentContext(t.chunkMeta);y&&(t.frag=y.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===N.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const r=t.errorAction,{action:o,flags:c,retryCount:l=0,retryConfig:h}=r||{},f=!!r&&!!h,d=f&&o===yt.RetryRequest,E=f&&!r.resolved&&c===jt.MoveAllAlternatesMatchingHost;if(!d&&E&&V(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),r.resolved=!0;else if((d||E)&&l<h.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const y=si(h,l);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${l+1}/${h.maxNumRetry} in ${y}ms`),r.resolved=!0,this.retryDate=self.performance.now()+y,this.state=pe.FRAG_LOADING_WAITING_RETRY}else if(h&&r)if(this.resetFragmentErrors(e),l<h.maxNumRetry)!s&&o!==yt.RemoveAlternatePermanently&&(r.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${l})`);return}else o===yt.SendAlternateToPenaltyBox?this.state=pe.WAITING_LEVEL:this.state=pe.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===pe.PARSING||this.state===pe.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!==pe.STOPPED&&(this.state=pe.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=mt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===pe.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==pe.STOPPED&&(this.state=pe.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,l)=>{const h=e.elementaryStreams[l];if(h){const f=h.endPTS-h.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${f})`),c||!1;const d=n?0:lr(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:l,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:N.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=pe.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 yn(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class En{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=Os(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Os(a,e){const t=new Uint8Array(e);let i=0;for(let n=0;n<a.length;n++){const s=a[n];t.set(s,i),i+=s.length}return t}var As={exports:{}},vr;function yr(){return vr||(vr=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(c,l,h){this.fn=c,this.context=l,this.once=h||!1}function s(c,l,h,f,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var E=new n(h,f||c,d),y=t?t+l:l;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],E]:c._events[y].push(E):(c._events[y]=E,c._eventsCount++),c}function r(c,l){--c._eventsCount===0?c._events=new i:delete c._events[l]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],h,f;if(this._eventsCount===0)return l;for(f in h=this._events)e.call(h,f)&&l.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(h)):l},o.prototype.listeners=function(l){var h=t?t+l:l,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,E=f.length,y=new Array(E);d<E;d++)y[d]=f[d].fn;return y},o.prototype.listenerCount=function(l){var h=t?t+l:l,f=this._events[h];return f?f.fn?1:f.length:0},o.prototype.emit=function(l,h,f,d,E,y){var A=t?t+l:l;if(!this._events[A])return!1;var T=this._events[A],O=arguments.length,Q,W;if(T.fn){switch(T.once&&this.removeListener(l,T.fn,void 0,!0),O){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,E),!0;case 6:return T.fn.call(T.context,h,f,d,E,y),!0}for(W=1,Q=new Array(O-1);W<O;W++)Q[W-1]=arguments[W];T.fn.apply(T.context,Q)}else{var ne=T.length,re;for(W=0;W<ne;W++)switch(T[W].once&&this.removeListener(l,T[W].fn,void 0,!0),O){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(re=1,Q=new Array(O-1);re<O;re++)Q[re-1]=arguments[re];T[W].fn.apply(T[W].context,Q)}}return!0},o.prototype.on=function(l,h,f){return s(this,l,h,f,!1)},o.prototype.once=function(l,h,f){return s(this,l,h,f,!0)},o.prototype.removeListener=function(l,h,f,d){var E=t?t+l:l;if(!this._events[E])return this;if(!h)return r(this,E),this;var y=this._events[E];if(y.fn)y.fn===h&&(!d||y.once)&&(!f||y.context===f)&&r(this,E);else{for(var A=0,T=[],O=y.length;A<O;A++)(y[A].fn!==h||d&&!y[A].once||f&&y[A].context!==f)&&T.push(y[A]);T.length?this._events[E]=T.length===1?T[0]:T:r(this,E)}return this},o.prototype.removeAllListeners=function(l){var h;return l?(h=t?t+l:l,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}(As)),As.exports}var Er=yr(),cs=w(Er);const hs="1.6.5",gs={};function qo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Jo(){const a=gs[hs];if(a)return a.clientCount++,a;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),n={worker:new self.Worker(t),objectURL:t,clientCount:1};return gs[hs]=n,n}function el(a){const e=gs[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 gs[a]=n,n}function tl(a){const e=gs[a||hs];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete gs[a||hs],n&&self.URL.revokeObjectURL(n),i.terminate()}}function Aa(a,e){return e+10<=a.length&&a[e]===51&&a[e+1]===68&&a[e+2]===73&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function Vr(a,e){return e+10<=a.length&&a[e]===73&&a[e+1]===68&&a[e+2]===51&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function br(a,e){let t=0;return t=(a[e]&127)<<21,t|=(a[e+1]&127)<<14,t|=(a[e+2]&127)<<7,t|=a[e+3]&127,t}function Zs(a,e){const t=e;let i=0;for(;Vr(a,e);){i+=10;const n=br(a,e+6);i+=n,Aa(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function 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 E=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:ee.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!0,error:E,reason:E.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,l="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:${l}, channels:${c}, rate:${h} (ADTS object type:${o} sampling index:${r})`),{config:d,samplerate:h,channelCount:c,codec:l,parsedCodec:l,manifestCodec:i}}function wa(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ia(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 xr(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(xr(a,e)){const t=Ia(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||xr(a,n)}return!1}function Ra(a,e,t,i,n){if(!a.samplerate){const s=il(e,t,i,n);if(!s)return;v(a,s)}}function La(a){return 1024*9e4/a}function al(a,e){const t=Ia(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,E=d+f,y=Math.max(0,t+E-e.length);y?(c=new Uint8Array(E-d),c.set(e.subarray(t+d,e.length),0)):c=e.subarray(t+d,t+E);const A={unit:c,pts:r};return y||a.samples.push(A),{sample:A,length:E,missing:y}}const l=e.length-t;return c=new Uint8Array(l),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:r},length:l,missing:-1}}function ol(a,e){return Vr(a,e)&&br(a,e+6)+10<=a.length-e}function ll(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 ul(a,e,t,Uint8Array)}function ul(a,e,t,i){const n=cl(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=hl(a)?a.byteOffset:0,o=(r+a.byteLength)/s,c=(r+e)/s,l=Math.floor(Math.max(0,Math.min(c,o))),h=Math.floor(Math.min(l+Math.max(t,0),o));return new i(n,l,h-l)}function cl(a){return a instanceof ArrayBuffer?a:a.buffer}function hl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function fl(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=a.data.subarray(1).indexOf(0);if(i===-1)return;const n=it(Hr(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=it(Hr(a.data,3+i,r));let c;return n==="-->"?c=it(Hr(a.data,4+i+r)):c=ll(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function dl(a){if(a.size<2)return;const e=it(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function pl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=it(a.data.subarray(t),!0);t+=i.length+1;const n=it(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=it(a.data.subarray(1));return{key:a.type,info:"",data:e}}function gl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=it(a.data.subarray(t),!0);t+=i.length+1;const n=it(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=it(a.data);return{key:a.type,info:"",data:e}}function ml(a){return a.type==="PRIV"?dl(a):a.type[0]==="W"?gl(a):a.type==="APIC"?fl(a):pl(a)}function _l(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=br(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const Sr=10,vl=10;function Ca(a){let e=0;const t=[];for(;Vr(a,e);){const i=br(a,e+6);a[e+5]>>6&1&&(e+=Sr),e+=Sr;const n=e+i;for(;e+vl<n;){const s=_l(a.subarray(e)),r=ml(s);r&&t.push(r),e+=s.size+Sr}Aa(a,e)&&(e+=Sr)}return t}function ka(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function yl(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=Ca(a);for(let t=0;t<e.length;t++){const i=e[t];if(ka(i))return yl(i)}}let Mn=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function ss(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class zr{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=ft(this.cachedData,e),this.cachedData=null);let i=Zs(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,c=i?jr(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&z(c))&&(this.basePTS=El(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Mn.audioId3,duration:Number.POSITIVE_INFINITY});n<l;){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=l}else ol(e,n)?(i=Zs(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Mn.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,s=n):n++;if(n===l&&s!==l){const h=e.slice(s);this.cachedData?this.cachedData=ft(this.cachedData,h):this.cachedData=h}}return{audioTrack:r,videoTrack:ss(),id3Track:o,textTrack:ss()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:ss(),id3Track:this._id3Track,textTrack:ss()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const El=(a,e,t)=>{if(z(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Tr=null;const bl=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],xl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Sl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Tl=[0,1,1,4];function Pa(a,e,t,i,n){if(t+24>e.length)return;const s=Oa(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=i+n*r,c={unit:e.subarray(t,t+s.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=s.channelCount,a.samplerate=s.sampleRate,a.samples.push(c),{sample:c,length:s.frameLength,missing:0}}}function Oa(a,e){const t=a[e+1]>>3&3,i=a[e+1]>>1&3,n=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-i:i===3?3:4,l=bl[c*14+n-1]*1e3,f=xl[(t===3?0:t===2?1:2)*3+s],d=o===3?1:2,E=Sl[t][i],y=Tl[i],A=E*8*y,T=Math.floor(E*l/f+r)*y;if(Tr===null){const W=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Tr=W?parseInt(W[1]):0}return!!Tr&&Tr<=87&&i===2&&l>=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 Ma(a,e){return e+1<a.length&&Zr(a,e)}function Al(a,e){return Zr(a,e)&&4<=a.length-e}function Na(a,e){if(e+1<a.length&&Zr(a,e)){const i=Oa(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||Ma(a,s)}return!1}class wl extends zr{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Zs(e,0);let n=(i==null?void 0:i.length)||0;if(Na(e,n))return!1;for(let s=e.length;n<s;n++)if(rl(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return sl(e,t)}appendFrame(e,t,i){Ra(e,this.observer,t,i,e.manifestCodec);const n=Da(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const Fa=(a,e)=>{let t=0,i=5;e+=i;const n=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;i>0;){r[0]=a[e];const o=Math.min(i,8),c=8-o;s[0]=4278190080>>>24+c<<c,n[0]=(r[0]&s[0])>>c,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class Il extends zr{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=Ba(e,t,i,this.basePTS,this.frameIndex);if(n!==-1)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}static probe(e){if(!e)return!1;const t=Zs(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&jr(t)!==void 0&&Fa(e,i)<16}}function Ba(a,e,t,i,n){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],c=e[t+4]&63,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 E=(e[t+6]<<8|e[t+7])>>12-d&1,A=[2,1,2,3,3,4,4,5][f]+E,T=e[t+5]>>3,O=e[t+5]&7,Q=new Uint8Array([s<<6|T<<1|O>>2,(O&3)<<6|f<<3|E<<2|c>>4,c<<4&224]),W=1536/o*9e4,ne=i+n*W,re=e.subarray(t,t+h);return a.config=Q,a.channelCount=A,a.samplerate=o,a.samples.push({unit:re,pts:ne}),h}class Rl extends zr{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Zs(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&jr(t)!==void 0&&Fa(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(Na(e,i))return X.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Al(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Pa(e,t,i,this.basePTS,this.frameIndex)}}const Ll=/\/emsg[-/]ID3/i;class Dl{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const s=this.videoTrack=ss("video",1),r=this.audioTrack=ss("audio",1),o=this.txtTrack=ss("text",1);if(this.id3Track=ss("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=Ve(e);if(c.video){const{id:l,timescale:h,codec:f,supplemental:d}=c.video;s.id=l,s.timescale=o.timescale=h,s.codec=f,s.supplemental=d}if(c.audio){const{id:l,timescale:h,codec:f}=c.audio;r.id=l,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 Re(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ft(this.remainderData,e));const o=Pt(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=Ot(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=Ot(e,t),{videoTrack:t,audioTrack:ss(),id3Track:n,textTrack:ss()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=se(e.samples,["emsg"]);n&&n.forEach(s=>{const r=St(s);if(Ll.test(r.schemeIdUri)){const o=Ua(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const l=r.payload;i.samples.push({data:l,len:l.byteLength,dts:o,pts:o,type:Mn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Ua(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Mn.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function Ua(a,e){return z(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Cl{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new mn(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Ei.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=Jt(s.data),o=this.getAvcEncryptedData(r);this.decryptBuffer(o.buffer).then(c=>{s.data=this.getAvcDecryptedUnit(r,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)})}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const s=e[t].units;for(;!(i>=s.length);i++){const r=s[i];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,i,n,r),!this.decrypter.isSync()))return}}}}class $a{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const s=i.units;n=s[s.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const s=i[n-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,l,h,f,d=-1,E=0;for(s===-1&&(d=0,E=this.getNALuType(t,0),s=0,c=1);c<n;){if(l=t[c++],!s){s=l?0:1;continue}if(s===1){s=l?0:2;continue}if(!l)s=3;else if(l===1){if(h=c-s-1,d>=0){const y={data:t.subarray(d,h),type:E};o.push(y)}else{const y=this.getLastNalUnit(e.samples);y&&(r&&c<=4-r&&y.state&&(y.data=y.data.subarray(0,y.data.byteLength-r)),h>0&&(y.data=ft(y.data,t.subarray(0,h)),y.state=0))}c<n?(f=this.getNALuType(t,c),d=c,E=f,s=0):s=-1}else s=0}if(d>=0&&s>=0){const y={data:t.subarray(d,n),type:E,state:s};o.push(y)}if(o.length===0){const y=this.getLastNalUnit(e.samples);y&&(y.data=ft(y.data,t))}return e.naluState=s,o}}class Ys{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");n.set(e.subarray(i,i+s)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&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 Ga extends $a{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(l=>{var h,f;switch(l.type){case 1:{let A=!1;o=!0;const T=l.data;if(c&&T.length>4){const O=this.readSliceType(T);(O===2||O===4||O===7||O===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,qt(l.data,1,i.pts,t.samples);break}case 7:{var E,y;o=!0,c=!0;const A=l.data,T=this.readSPS(A);if(!e.sps||e.width!==T.width||e.height!==T.height||((E=e.pixelRatio)==null?void 0:E[0])!==T.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==T.pixelRatio[1]){e.width=T.width,e.height=T.height,e.pixelRatio=T.pixelRatio,e.sps=[A];const O=A.subarray(1,4);let Q="avc1.";for(let W=0;W<3;W++){let ne=O[W].toString(16);ne.length<2&&(ne="0"+ne),Q+=ne}e.codec=Q}break}case 8:o=!0,e.pps=[l.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(l)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Ys(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,s;for(let r=0;r<e;r++)n!==0&&(s=t.readEG(),n=(i+s+256)%256),i=n===0?i:n}readSPS(e){const t=new Ys(e);let i=0,n=0,s=0,r=0,o,c,l;const h=t.readUByte.bind(t),f=t.readBits.bind(t),d=t.readUEG.bind(t),E=t.readBoolean.bind(t),y=t.skipBits.bind(t),A=t.skipEG.bind(t),T=t.skipUEG.bind(t),O=this.skipScalingList.bind(this);h();const Q=h();if(f(5),y(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&&y(1),T(),T(),y(1),E())for(c=fe!==3?8:12,l=0;l<c;l++)E()&&(l<6?O(16,t):O(64,t))}T();const W=d();if(W===0)d();else if(W===1)for(y(1),A(),A(),o=d(),l=0;l<o;l++)A();T(),y(1);const ne=d(),re=d(),_e=f(1);_e===0&&y(1),y(1),E()&&(i=d(),n=d(),s=d(),r=d());let le=[1,1];if(E()&&E())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((ne+1)*16-i*2-n*2),height:(2-_e)*(re+1)*16-(_e?2:4)*(s+r),pixelRatio:le}}}class Ka extends $a{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(l=>{var h,f;switch(l.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,qt(l.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=v(e.params,this.readVPS(l.data)),this.initVPS=l.data),e.vps=[l.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],l.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const E=this.readSPS(l.data);e.width=E.width,e.height=E.height,e.pixelRatio=E.pixelRatio,e.codec=E.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const y in E.params)e.params[y]=E.params[y]}this.pushParameterSet(e.sps,l.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 E=this.readPPS(l.data);for(const y in E)e.params[y]=E[y]}this.pushParameterSet(e.pps,l.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(l)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Ys(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new Ys(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),s=t.readBoolean(),r=t.readBits(5),o=t.readUByte(),c=t.readUByte(),l=t.readUByte(),h=t.readUByte(),f=t.readUByte(),d=t.readUByte(),E=t.readUByte(),y=t.readUByte(),A=t.readUByte(),T=t.readUByte(),O=t.readUByte(),Q=[],W=[];for(let hi=0;hi<i;hi++)Q.push(t.readBoolean()),W.push(t.readBoolean());if(i>0)for(let hi=i;hi<8;hi++)t.readBits(2);for(let hi=0;hi<i;hi++)Q[hi]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),W[hi]&&t.readUByte();t.readUEG();const ne=t.readUEG();ne==3&&t.skipBits(1);const re=t.readUEG(),_e=t.readUEG(),le=t.readBoolean();let fe=0,me=0,ue=0,Ce=0;le&&(fe+=t.readUEG(),me+=t.readUEG(),ue+=t.readUEG(),Ce+=t.readUEG());const Qe=t.readUEG(),vt=t.readUEG(),ot=t.readUEG(),lt=t.readBoolean();for(let hi=lt?0:i;hi<=i;hi++)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 bn=0;bn<4;bn++)for(let Wn=0;Wn<(bn===3?2:6);Wn++)if(!t.readBoolean())t.readUEG();else{const es=Math.min(64,1<<4+(bn<<1));bn>1&&t.readEG();for(let Ks=0;Ks<es;Ks++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const ht=t.readUEG();let Oe=0;for(let hi=0;hi<ht;hi++){let bn=!1;if(hi!==0&&(bn=t.readBoolean()),bn){hi===ht&&t.readUEG(),t.readBoolean(),t.readUEG();let Wn=0;for(let Is=0;Is<=Oe;Is++){const es=t.readBoolean();let Ks=!1;es||(Ks=t.readBoolean()),(es||Ks)&&Wn++}Oe=Wn}else{const Wn=t.readUEG(),Is=t.readUEG();Oe=Wn+Is;for(let es=0;es<Wn;es++)t.readUEG(),t.readBoolean();for(let es=0;es<Is;es++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const hi=t.readUEG();for(let bn=0;bn<hi;bn++){for(let Wn=0;Wn<ot+4;Wn++)t.readBits(1);t.readBits(1)}}let Ft=0,Ct=1,Xt=1,ui=!0,_i=1,Ri=0;t.readBoolean(),t.readBoolean();let Tn=!1;if(t.readBoolean()){if(t.readBoolean()){const Rs=t.readUByte(),Ho=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Fr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Rs>0&&Rs<16?(Ct=Ho[Rs-1],Xt=Fr[Rs-1]):Rs===255&&(Ct=t.readBits(16),Xt=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(),Tn=t.readBoolean(),Tn&&(fe+=t.readUEG(),me+=t.readUEG(),ue+=t.readUEG(),Ce+=t.readUEG()),t.readBoolean()&&(_i=t.readBits(32),Ri=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Fr=t.readBoolean(),jo=t.readBoolean();let tr=!1;(Fr||jo)&&(tr=t.readBoolean(),tr&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),tr&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let zo=0;zo<=i;zo++){ui=t.readBoolean();const th=ui||t.readBoolean();let Zo=!1;th?t.readEG():Zo=t.readBoolean();const Yo=Zo?1:t.readUEG()+1;if(Fr)for(let ir=0;ir<Yo;ir++)t.readUEG(),t.readUEG(),tr&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(jo)for(let ir=0;ir<Yo;ir++)t.readUEG(),t.readUEG(),tr&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Ft=t.readUEG())}let Es=re,Wo=_e;if(le||Tn){let hi=1,bn=1;ne===1?hi=bn=2:ne==2&&(hi=2),Es=re-hi*me-hi*fe,Wo=_e-bn*Ce-bn*ue}const Jc=n?["A","B","C"][n]:"",eh=o<<24|c<<16|l<<8|h;let Sa=0;for(let hi=0;hi<32;hi++)Sa=(Sa|(eh>>hi&1)<<31-hi)>>>0;let Ta=Sa.toString(16);return r===1&&Ta==="2"&&(Ta="6"),{codecString:`hvc1.${Jc}${r}.${Ta}.${s?"H":"L"}${O}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,c,l,h],general_constraint_indicator_flags:[f,d,E,y,A,T],general_level_idc:O,bit_depth:Qe+8,bit_depth_luma_minus8:Qe,bit_depth_chroma_minus8:vt,min_spatial_segmentation_idc:Ft,chroma_format_idc:ne,frame_rate:{fixed:ui,fps:Ri/_i}},width:Es,height:Wo,pixelRatio:[Ct,Xt]}}readPPS(e){const t=new Ys(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),s=t.readBoolean();let r=1;return s&&n?r=0:s?r=3:n&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const cn=188;class ms{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=ms.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(cn*5,t-cn)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=cn)if(e[c]===71&&(t-c===cn||e[c+cn]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+cn*99,e.length-cn)+1)),s||(s=Yr(e,c)===0),s&&o>1&&(r===0&&o>2||c+cn>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=ms.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=ms.createTrack("audio",n),this._id3Track=ms.createTrack("id3"),this._txtTrack=ms.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,l=this._txtTrack;let h=r.pid,f=r.pesData,d=o.pid,E=c.pid,y=o.pesData,A=c.pesData,T=null,O=this.pmtParsed,Q=this._pmtId,W=e.length;if(this.remainderData&&(e=ft(this.remainderData,e),W=e.length,this.remainderData=null),W<cn&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:l};const ne=Math.max(0,ms.syncOffset(e));W-=(W-ne)%cn,W<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,W,e.buffer.byteLength-W));let re=0;for(let le=ne;le<W;le+=cn)if(e[le]===71){const fe=!!(e[le+1]&64),me=Yr(e,le),ue=(e[le+3]&48)>>4;let Ce;if(ue>1){if(Ce=le+5+e[le+4],Ce===le+cn)continue}else Ce=le+4;switch(me){case h:if(fe){if(f&&(s=Ms(f,this.logger))){if(this.videoParser===null)switch(r.segmentCodec){case"avc":this.videoParser=new Ga;break;case"hevc":this.videoParser=new Ka;break}this.videoParser!==null&&this.videoParser.parsePES(r,l,s,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray(Ce,le+cn)),f.size+=le+cn-Ce);break;case d:if(fe){if(y&&(s=Ms(y,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}y={data:[],size:0}}y&&(y.data.push(e.subarray(Ce,le+cn)),y.size+=le+cn-Ce);break;case E:fe&&(A&&(s=Ms(A,this.logger))&&this.parseID3PES(c,s),A={data:[],size:0}),A&&(A.data.push(e.subarray(Ce,le+cn)),A.size+=le+cn-Ce);break;case 0:fe&&(Ce+=e[Ce]+1),Q=this._pmtId=kl(e,Ce);break;case Q:{fe&&(Ce+=e[Ce]+1);const Qe=Pl(e,Ce,this.typeSupported,i,this.observer,this.logger);h=Qe.videoPid,h>0&&(r.pid=h,r.segmentCodec=Qe.segmentVideoCodec),d=Qe.audioPid,d>0&&(o.pid=d,o.segmentCodec=Qe.segmentAudioCodec),E=Qe.id3Pid,E>0&&(c.pid=E),T!==null&&!O&&(this.logger.warn(`MPEG-TS PMT found at ${le} after unknown PID '${T}'. Backtracking to sync byte @${ne} to parse all TS packets.`),T=null,le=ne-188),O=this.pmtParsed=!0;break}case 17:case 8191:break;default:T=me;break}}else re++;re>0&&Qr(this.observer,new Error(`Found ${re} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=y,c.pesData=A;const _e={audioTrack:o,videoTrack:r,id3Track:c,textTrack:l};return n&&this.extractRemainingSamples(_e),_e}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 l;if(r&&(l=Ms(r,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new Ga;break;case"hevc":this.videoParser=new Ka;break}this.videoParser!==null&&(this.videoParser.parsePES(i,s,l,!0),i.pesData=null)}else i.pesData=r;if(o&&(l=Ms(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);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&&(l=Ms(c,this.logger))?(this.parseID3PES(n,l),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Cl(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=ft(n.sample.unit,s);else{const E=d-f;n.sample.unit.set(s.subarray(0,f),E),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!xr(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}Ra(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 l=0,h;for(;r<o;)if(h=Da(e,s,r,c,l),r+=h.length,h.missing){this.aacOverFlow=h;break}else for(l++;r<o-1&&!xr(s,r);r++);}parseMPEGPES(e,t){const i=t.data,n=i.length;let s=0,r=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<n;)if(Ma(i,r)){const c=Pa(e,i,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(n===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=i.length;let r=0,o=0,c;for(;o<s&&(c=Ba(e,i,o,n,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=v({},t,{type:this._videoTrack?Mn.emsg:Mn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Yr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function kl(a,e){return(a[e+10]&31)<<8|a[e+11]}function Pl(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,l=(a[e+10]&15)<<8|a[e+11];for(e+=12+l;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,E=f;for(;E>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,E-=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:N.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 Ms(a,e){let t=0,i,n,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=ft(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 E=0,y=c.length;E<y;E++){i=c[E];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 Ol{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const _s=Math.pow(2,32)-1;class 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/(_s+1)),n=Math.floor(t%(_s+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/(_s+1)),n=Math.floor(t%(_s+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return 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,l=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,l>>8&255,l&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/(_s+1)),o=Math.floor(i%(_s+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/(_s+1)),r=Math.floor(t%(_s+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,l,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],l=c.duration,h=c.size,f=c.flags,d=c.cts,r.set([l>>>24&255,l>>>16&255,l>>>8&255,l&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 ft(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 y=0;y<i.length;y+=1){r+=3;for(let A=0;A<i[y].length;A+=1)r+=2+i[y][A].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let y=0;y<i.length;y+=1){o.set(new Uint8Array([32+y|(y===c?128:0),0,i[y].length]),r),r+=3;for(let A=0;A<i[y].length;A+=1)o.set(new Uint8Array([i[y][A].length>>8,i[y][A].length&255]),r),r+=2,o.set(i[y][A],r),r+=i[y][A].length}const l=he.box(he.types.hvcC,o),h=e.width,f=e.height,d=e.pixelRatio[0],E=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]),l,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,E>>24,E>>16&255,E>>8&255,E&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 Va=9e4;function qr(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function Ml(a,e,t=1,i=!1){return qr(a,e,1/t,i)}function Qs(a,e=!1){return qr(a,1e3,1/Va,e)}function Nl(a,e=1){return qr(a,Va,1/e)}const Fl=10*1e3,Bl=1024,Ul=1152,$l=1536;let Ns=null,Jr=null;function Wa(a,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class Ar{constructor(e,t,i,n){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.ISGenerated=!1,Ns===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ns=r?parseInt(r[1]):0}if(Jr===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Jr=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=Gn(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 l,h,f,d,E,y,A=s,T=s;const O=e.pid>-1,Q=t.pid>-1,W=t.samples.length,ne=e.samples.length>0,re=o&&W>0||W>1;if((!O||ne)&&(!Q||re)||this.ISGenerated||o){if(this.ISGenerated){var le,fe,me,ue;const ot=this.videoTrackConfig;(ot&&(t.width!==ot.width||t.height!==ot.height||((le=t.pixelRatio)==null?void 0:le[0])!==((fe=ot.pixelRatio)==null?void 0:fe[0])||((me=t.pixelRatio)==null?void 0:me[1])!==((ue=ot.pixelRatio)==null?void 0:ue[1]))||!ot&&re||this.nextAudioPts===null&&ne)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const Ce=this.isVideoContiguous;let Qe=-1,vt;if(re&&(Qe=Gl(t.samples),!Ce&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,Qe>0){this.logger.warn(`[mp4-remuxer]: Dropped ${Qe} out of ${W} video samples due to a missing keyframe`);const ot=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Qe),t.dropped+=Qe,T+=(t.samples[0].pts-ot)/t.inputTimeScale,vt=T}else Qe===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${W} video samples`),y=!1);if(this.ISGenerated){if(ne&&re){const ot=this.getVideoStartPts(t.samples),Xe=(Gn(e.samples[0].pts,ot)-ot)/t.inputTimeScale;A+=Math.max(0,Xe),T+=Math.max(0,-Xe)}if(ne){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||re||c===Y.AUDIO?T:void 0),re){const ot=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)),l=this.remuxVideo(t,T,Ce,ot)}}else re&&(l=this.remuxVideo(t,T,Ce,0));l&&(l.firstKeyFrame=Qe,l.independent=Qe!==-1,l.firstKeyFramePTS=vt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(E=Ha(i,s,this._initPTS,this._initDTS)),n.samples.length&&(d=ja(n,s,this._initPTS))),{audio:h,video:l,initSegment:f,independent:y,text:d,id3:E}}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,c={},l=this._initPTS;let h=!l||n,f="audio/mp4",d,E,y,A;if(h&&(d=E=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&&(A=e.id,y=e.inputTimeScale,!l||y!==l.timescale?d=E=s[0].pts-Math.round(y*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(A=t.id,y=t.inputTimeScale,!l||y!==l.timescale){const T=this.getVideoStartPts(r),O=Math.round(y*i);E=Math.min(E,Gn(r[0].dts,T)-O),d=Math.min(d,T-O)}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:y},this._initDTS={baseTime:E,timescale:y}):d=y=void 0,{tracks:c,initPTS:d,timescale:y,trackId:A}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,l=this._initPTS;let h=this.nextAvcDts,f=8,d=this.videoSampleDuration,E,y,A=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,O=!1;if(!i||h===null){const Oe=t*s,Ge=r[0].pts-Gn(r[0].dts,r[0].pts);Ns&&h!==null&&Math.abs(Oe-Ge-h)<15e3?i=!0:h=Oe-Ge}const Q=l.baseTime*s/l.timescale;for(let Oe=0;Oe<c;Oe++){const Ge=r[Oe];Ge.pts=Gn(Ge.pts-Q,h),Ge.dts=Gn(Ge.dts-Q,h),Ge.dts<r[Oe>0?Oe-1:Oe].dts&&(O=!0)}O&&r.sort(function(Oe,Ge){const Ft=Oe.dts-Ge.dts,Ct=Oe.pts-Ge.pts;return Ft||Ct}),E=r[0].dts,y=r[r.length-1].dts;const W=y-E,ne=W?Math.round(W/(c-1)):d||e.inputTimeScale/30;if(i){const Oe=E-h,Ge=Oe>ne,Ft=Oe<-1;if((Ge||Ft)&&(Ge?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Qs(Oe,!0)} ms (${Oe}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Qs(-Oe,!0)} ms (${Oe}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ft||h>=r[0].pts||Ns)){E=h;const Ct=r[0].pts-Oe;if(Ge)r[0].dts=E,r[0].pts=Ct;else{let Xt=!0;for(let ui=0;ui<r.length&&!(r[ui].dts>Ct&&Xt);ui++){const _i=r[ui].pts;if(r[ui].dts-=Oe,r[ui].pts-=Oe,ui<r.length-1){const Ri=r[ui+1].pts,Tn=r[ui].pts,kn=Ri<=Tn,Es=Ri<=_i;Xt=kn==Es}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${Qs(Ct,!0)}/${Qs(E,!0)}, delta: ${Qs(Oe,!0)} ms`)}}E=Math.max(0,E);let re=0,_e=0,le=E;for(let Oe=0;Oe<c;Oe++){const Ge=r[Oe],Ft=Ge.units,Ct=Ft.length;let Xt=0;for(let ui=0;ui<Ct;ui++)Xt+=Ft[ui].data.length;_e+=Xt,re+=Ct,Ge.length=Xt,Ge.dts<le?(Ge.dts=le,le+=ne/4|0||1):le=Ge.dts,A=Math.min(Ge.pts,A),T=Math.max(Ge.pts,T)}y=r[c-1].dts;const fe=_e+4*re+8;let me;try{me=new Uint8Array(fe)}catch(Oe){this.observer.emit(p.ERROR,p.ERROR,{type:ee.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:Oe,bytes:fe,reason:`fail allocating video mdat ${fe}`});return}const ue=new DataView(me.buffer);ue.setUint32(0,fe),me.set(he.types.mdat,4);let Ce=!1,Qe=Number.POSITIVE_INFINITY,vt=Number.POSITIVE_INFINITY,ot=Number.NEGATIVE_INFINITY,lt=Number.NEGATIVE_INFINITY;for(let Oe=0;Oe<c;Oe++){const Ge=r[Oe],Ft=Ge.units;let Ct=0;for(let _i=0,Ri=Ft.length;_i<Ri;_i++){const Tn=Ft[_i],kn=Tn.data,Es=Tn.data.byteLength;ue.setUint32(f,Es),f+=4,me.set(kn,f),f+=Es,Ct+=4+Es}let Xt;if(Oe<c-1)d=r[Oe+1].dts-Ge.dts,Xt=r[Oe+1].pts-Ge.pts;else{const _i=this.config,Ri=Oe>0?Ge.dts-r[Oe-1].dts:ne;if(Xt=Oe>0?Ge.pts-r[Oe-1].pts:ne,_i.stretchShortVideoTrack&&this.nextAudioPts!==null){const Tn=Math.floor(_i.maxBufferHole*s),kn=(n?A+n*s:this.nextAudioPts)-Ge.pts;kn>Tn?(d=kn-Ri,d<0?d=Ri:Ce=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${kn/90} ms to the next segment; using duration ${d/90} ms for the last video frame.`)):d=Ri}else d=Ri}const ui=Math.round(Ge.pts-Ge.dts);Qe=Math.min(Qe,d),ot=Math.max(ot,d),vt=Math.min(vt,Xt),lt=Math.max(lt,Xt),o.push(Wa(Ge.key,d,Ct,ui))}if(o.length){if(Ns){if(Ns<70){const Oe=o[0].flags;Oe.dependsOn=2,Oe.isNonSync=0}}else if(Jr&&lt-vt<ot-Qe&&ne/ot<.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=E;for(let Ge=0,Ft=o.length;Ge<Ft;Ge++){const Ct=Oe+o[Ge].duration,Xt=Oe+o[Ge].cts;if(Ge<Ft-1){const ui=Ct+o[Ge+1].cts;o[Ge].duration=ui-Xt}else o[Ge].duration=Ge?o[Ge-1].duration:ne;o[Ge].cts=0,Oe=Ct}}}d=Ce||!d?ne:d,this.nextAvcDts=h=y+d,this.videoSampleDuration=d,this.isVideoContiguous=!0;const ht={data1:he.moof(e.sequenceNumber++,E,v(e,{samples:o})),data2:me,startPTS:A/s,endPTS:(T+d)/s,startDTS:E/s,endDTS:h/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,ht}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Ul;case"ac3":return $l;default:return Bl}}remuxAudio(e,t,i,n,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,c=r/o,l=this.getSamplesPerFrame(e),h=l*c,f=this._initPTS,d=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,E=[],y=s!==void 0;let A=e.samples,T=d?0:8,O=this.nextAudioPts||-1;const Q=t*r,W=f.baseTime*r/f.timescale;if(this.isAudioContiguous=i=i||A.length&&O>0&&(n&&Math.abs(Q-O)<9e3||Math.abs(Gn(A[0].pts-W,Q)-O)<20*h),A.forEach(function(Xe){Xe.pts=Gn(Xe.pts-W,Q)}),!i||O<0){if(A=A.filter(Xe=>Xe.pts>=0),!A.length)return;s===0?O=0:n&&!y?O=Math.max(0,Q):O=A[0].pts}if(e.segmentCodec==="aac"){const Xe=this.config.maxAudioFramesDrift;for(let ut=0,ht=O;ut<A.length;ut++){const Oe=A[ut],Ge=Oe.pts,Ft=Ge-ht,Ct=Math.abs(1e3*Ft/r);if(Ft<=-Xe*h&&y)ut===0&&(this.logger.warn(`Audio frame @ ${(Ge/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Ft/r)} ms.`),this.nextAudioPts=O=ht=Ge);else if(Ft>=Xe*h&&Ct<Fl&&y){let Xt=Math.round(Ft/h);ht=Ge-Xt*h,ht<0&&(Xt--,ht+=h),ut===0&&(this.nextAudioPts=O=ht),this.logger.warn(`[mp4-remuxer]: Injecting ${Xt} audio frame @ ${(ht/r).toFixed(3)}s due to ${Math.round(1e3*Ft/r)} ms gap.`);for(let ui=0;ui<Xt;ui++){const _i=Math.max(ht,0);let Ri=Ol.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Ri||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ri=Oe.unit.subarray()),A.splice(ut,0,{unit:Ri,pts:_i}),ht+=h,ut++}}Oe.pts=ht,ht+=h}}let ne=null,re=null,_e,le=0,fe=A.length;for(;fe--;)le+=A[fe].unit.byteLength;for(let Xe=0,ut=A.length;Xe<ut;Xe++){const ht=A[Xe],Oe=ht.unit;let Ge=ht.pts;if(re!==null){const Ct=E[Xe-1];Ct.duration=Math.round((Ge-re)/c)}else if(i&&e.segmentCodec==="aac"&&(Ge=O),ne=Ge,le>0){le+=T;try{_e=new Uint8Array(le)}catch(Ct){this.observer.emit(p.ERROR,p.ERROR,{type:ee.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:Ct,bytes:le,reason:`fail allocating audio mdat ${le}`});return}d||(new DataView(_e.buffer).setUint32(0,le),_e.set(he.types.mdat,4))}else return;_e.set(Oe,T);const Ft=Oe.byteLength;T+=Ft,E.push(Wa(!0,l,Ft,0)),re=Ge}const me=E.length;if(!me)return;const ue=E[E.length-1];this.nextAudioPts=O=re+c*ue.duration;const Ce=d?new Uint8Array(0):he.moof(e.sequenceNumber++,ne/c,v({},e,{samples:E}));e.samples=[];const Qe=ne/r,vt=O/r,lt={data1:Ce,data2:_e,startPTS:Qe,endPTS:vt,startDTS:Qe,endDTS:vt,type:"audio",hasAudio:!0,hasVideo:!1,nb:me};return this.isAudioContiguous=!0,lt}}function Gn(a,e){let t;if(e===null)return a;for(e<a?t=-8589934592:t=8589934592;Math.abs(a-e)>4294967296;)a+=t;return a}function Gl(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function Ha(a,e,t,i){const n=a.samples.length;if(!n)return;const s=a.inputTimeScale;for(let o=0;o<n;o++){const c=a.samples[o];c.pts=Gn(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=Gn(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function ja(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=Gn(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 Kl{constructor(e,t,i,n){this.logger=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1,this.logger=n}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment($e(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,this.logger)),n.video&&(i=za(n.video,g.VIDEO,this.logger));const s={};n.audio&&n.video?s.audiovideo={container:"video/mp4",codec:t+","+i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:n.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?s.video={container:"video/mp4",codec:i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,i,n,s,r){var o,c;let{initPTS:l,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 E={initPTS:void 0,timescale:void 0,trackId:void 0};let y=this.initData;if((o=y)!=null&&o.length||(this.generateInitSegment(d),y=this.initData),!((c=y)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(E.tracks=this.initTracks,this.emitInitSegment=!1);const A=We(d,y,this.logger),T=y.audio?A[y.audio.id]:null,O=y.video?A[y.video.id]:null,Q=wr(O,1/0),W=wr(T,1/0),ne=wr(O,0,!0),re=wr(T,0,!0);let _e,le=s,fe=0;if(T&&(!O||!l&&W<Q||l&&l.trackId===y.audio.id)?(E.trackId=y.audio.id,_e=T,fe=re-W):O&&(E.trackId=y.video.id,_e=O,fe=ne-Q),_e){const Xe=_e.timescale;le=_e.start/Xe,E.timescale=Xe,l||(E.initPTS=_e.start-s*Xe,this.initPTS=l={baseTime:E.initPTS,timescale:Xe,trackId:E.trackId})}(r||!l)&&(Vl(l,le,s,fe)||E.timescale!==l.timescale)&&(E.initPTS=le-s,l&&l.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${l.baseTime/l.timescale} to ${E.initPTS}`),this.initPTS=l={baseTime:E.initPTS,timescale:1});const me=e?le-l.baseTime/l.timescale:h;_t(y,d,l.baseTime/l.timescale);const ue=me+fe;fe>0?this.lastEndTime=ue:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Ce=!!y.audio,Qe=!!y.video;let vt="";Ce&&(vt+="audio"),Qe&&(vt+="video");const ot={data1:d,startPTS:me,startDTS:me,endPTS:ue,endDTS:ue,type:vt,hasAudio:Ce,hasVideo:Qe,nb:1,dropped:0};f.audio=Ce&&!Qe?ot:void 0,f.video=Qe?ot:void 0;const lt=O==null?void 0:O.sampleCount;if(lt){const Xe=O.keyFrameIndex,ut=Xe!==-1;ot.nb=lt,ot.dropped=Xe===0||this.isVideoContiguous?0:ut?Xe:lt,ot.independent=ut,ot.firstKeyFrame=Xe,ut&&O.keyFrameStart&&(ot.firstKeyFramePTS=O.keyFrameStart-l.baseTime/l.timescale),this.isVideoContiguous||(f.independent=ut),this.isVideoContiguous||(this.isVideoContiguous=ut),ot.dropped&&this.logger.warn(`fmp4 does not start with IDR: firstIDR ${Xe}/${lt} dropped: ${ot.dropped} pts: ${ot.firstKeyFramePTS||"NA"}`)}return f.initSegment=E,f.id3=Ha(i,s,l,l),n.samples.length&&(f.text=ja(n,s,l)),f}}function wr(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function Vl(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>n}function za(a,e,t){const i=a==null?void 0:a.codec;return i&&i.length>4?i:e===g.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?dt(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let fs;try{fs=self.performance.now.bind(self.performance)}catch(a){fs=Date.now}const Ir=[{demux:Dl,remux:Kl},{demux:ms,remux:Ar},{demux:wl,remux:Ar},{demux:Rl,remux:Ar}];Ir.splice(2,0,{demux:Il,remux:Ar});class Za{constructor(e,t,i,n,s,r){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const s=i.transmuxing;s.executeStart=fs();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:l,discontinuity:h,trackSwitch:f,accurateTimeOffset:d,timeOffset:E,initSegmentChange:y}=n||o,{audioCodec:A,videoCodec:T,defaultInitPts:O,duration:Q,initSegmentData:W}=c,ne=Wl(r,t);if(ne&&vn(ne.method)){const fe=this.getDecrypter(),me=Bn(ne.method);if(fe.isSync()){let ue=fe.softwareDecrypt(r,ne.key.buffer,ne.iv.buffer,me);if(i.part>-1){const Qe=fe.flush();ue=Qe&&Qe.buffer}if(!ue)return s.executeEnd=fs(),ea(i);r=new Uint8Array(ue)}else return this.asyncResult=!0,this.decryptionPromise=fe.webCryptoDecrypt(r,ne.key.buffer,ne.iv.buffer,me).then(ue=>{const Ce=this.push(ue,null,i);return this.decryptionPromise=null,Ce}),this.decryptionPromise}const re=this.needsProbing(h,f);if(re){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:N.FRAG_PARSING_ERROR,fatal:!1,error:fe,reason:fe.message}),s.executeEnd=fs(),ea(i)}(h||f||y||re)&&this.resetInitSegment(W,A,T,Q,t),(h||y||re)&&this.resetInitialTimestamp(O),l||this.resetContiguity();const _e=this.transmux(r,ne,E,d,i);this.asyncResult=Xs(_e);const le=this.currentTransmuxState;return le.contiguous=!0,le.discontinuity=!1,le.trackSwitch=!1,s.executeEnd=fs(),_e}flush(e){const t=e.transmuxing;t.executeStart=fs();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:l}=this;if(!c||!l){t.executeEnd=fs();const f=[ea(e)];return this.asyncResult?Promise.resolve(f):f}const h=c.flush(o);return Xs(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:l}=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,l,c,!0,this.id);e.push({remuxResult:h,chunkMeta:i}),i.transmuxing.executeEnd=fs()}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=Ir.length;f<d;f++){var r;if((r=Ir[f].demux)!=null&&r.probe(e,this.logger)){s=Ir[f];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,l=s.remux,h=s.demux;(!c||!(c instanceof l))&&(this.remuxer=new l(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 mn(this.config)),e}}function Wl(a,e){let t=null;return a.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ea=a=>({remuxResult:{},chunkMeta:a});function Xs(a){return"then"in a&&a.then instanceof Function}class Hl{constructor(e,t,i,n,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=s||null}}class jl{constructor(e,t,i,n,s,r){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=s,this.initSegmentChange=r}}let Ya=0;class Qa{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Ya++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const l=c.data,h=this.hls;if(!(!h||!(l!=null&&l.event)||l.instanceNo!==this.instanceNo))switch(l.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(l.data);break}case"flush":{this.onFlush(l.data);break}case"workerLog":{h.logger[l.data.logType]&&h.logger[l.data.logType](l.data.message);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.part=this.part,l.data.id=this.id,h.trigger(l.event,l.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const l=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:N.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:l})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const r=(c,l)=>{l=l||{},l.frag=this.frag||void 0,c===p.ERROR&&(l=l,l.parent=this.id,l.part=this.part,this.error=l.error),this.hls.trigger(c,l)};this.observer=new cs,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=tn(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:Qt(s)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new Za(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new Za(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Ya++;const t=this.hls.config,i=tn(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Qt(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,l,h){var f,d;l.transmuxing.start=self.performance.now();const{instanceNo:E,transmuxer:y}=this,A=r?r.start:s.start,T=s.decryptdata,O=this.frag,Q=!(O&&s.cc===O.cc),W=!(O&&l.level===O.level),ne=O?l.sn-O.sn:-1,re=this.part?l.part-this.part.index:-1,_e=ne===0&&l.id>1&&l.id===(O==null?void 0:O.stats.chunkCount),le=!W&&(ne===1||ne===0&&(re===1||_e&&re<=0)),fe=self.performance.now();(W||ne||s.stats.parsing.start===0)&&(s.stats.parsing.start=fe),r&&(re||!le)&&(r.stats.parsing.start=fe);const me=!(O&&((f=s.initSegment)==null?void 0:f.url)===((d=O.initSegment)==null?void 0:d.url)),ue=new jl(Q,le,c,W,A,me);if(!le||Q||me){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===Y.MAIN?"level":"track"}: ${l.level} id: ${l.id}
discontinuity: ${Q}
trackSwitch: ${W}
contiguous: ${le}
accurateTimeOffset: ${c}
timeOffset: ${A}
initSegmentChange: ${me}`);const Ce=new Hl(i,n,t,o,h);this.configureTransmuxer(Ce)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:E,cmd:"demux",data:e,decryptdata:T,chunkMeta:l,state:ue},e instanceof ArrayBuffer?[e]:[]);else if(y){const Ce=y.push(e,T,l,ue);Xs(Ce)?Ce.then(Qe=>{this.handleTransmuxComplete(Qe)}).catch(Qe=>{this.transmuxerError(Qe,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(Ce)}}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);Xs(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:N.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 Xa=100;class zl extends Ai{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===pe.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==r)&&this.syncWithAnchor(t,c==null?void 0:c.frag)}else!this.hls.hasEnoughToStart&&o&&o.cc!==r?(o.abortRequests(),this.syncWithAnchor(t,o)):this.state===pe.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&(n==null?void 0:n.cc)===t.cc)return;const s=(n||e).cc,r=this.getLevelDetails(),o=this.getLoadPosition(),c=Yt(r,s,o);c&&(this.log(`Waiting fragment cc (${t==null?void 0:t.cc}) cancelled because video is at cc ${e.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===pe.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=pe.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Xa),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=pe.IDLE):this.state=pe.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case pe.IDLE:this.doTickIdle();break;case pe.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=pe.WAITING_INIT_PTS}break}case pe.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=pe.IDLE}break}case pe.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=pe.FRAG_LOADING;const c=s.flush().buffer,l={frag:i,part:n,payload:c,networkDetails:null};this._handleFragmentLoadProgress(l),r&&super._handleFragmentLoadComplete(l)}else o&&o.cc!==t.frag.cc&&this.syncWithAnchor(o,t.frag)}else this.state=pe.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:s}=this,r=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(i!=null&&i[s]))return;const o=i[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=pe.WAITING_TRACK,this.startFragRequested=!1;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,g.AUDIO,Y.AUDIO));const h=this.getFwdBufferInfo(l,Y.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=pe.ENDED;return}const f=h.len,d=t.maxBufferLength,E=c.fragments,y=E[0].start,A=this.getLoadPosition(),T=this.flushing?A:h.end;if(this.switchingTrack&&n){const W=A;c.PTSKnown&&W<y&&(h.end>y||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=y+.05)}if(f>=d&&!this.switchingTrack&&T<E[E.length-1].start)return;let O=this.getNextFragment(T,c);if(O&&this.isLoopLoading(O,T)&&(O=this.getNextFragmentLoopLoading(O,c,h,Y.MAIN,d)),!O){this.bufferFlushed=!0;return}let Q=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&Q&&V(O)&&!O.endList&&(!c.live||!this.loadingParts&&T<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(Q)===ei.OK&&(this.mainFragLoading=Q=null),Q&&V(Q))){if(O.start>Q.end){const ne=this.fragmentTracker.getFragAtPos(T,Y.MAIN);ne&&ne.end>Q.end&&(Q=ne,this.mainFragLoading={frag:ne,targetBufferTime:null})}if(O.start>Q.end)return}this.loadFragment(O,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 Zi(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!==pe.STOPPED&&(this.setInterval(Xa),this.state=pe.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 l=this.mainDetails;if(!l||s.endCC>l.endCC||l.expired){this.cachedTrackLoadedData=t,this.state!==pe.STOPPED&&(this.state=pe.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||(_r(s,l),s.alignedSliding||Ps(s,l),f=s.fragmentStart)}h.details=s,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(l,f),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===pe.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=pe.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 l=c[o];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const h=l.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const f=r.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new Qa(this.hls,Y.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const E=this.initPTS[i.cc],y=(t=i.initSegment)==null?void 0:t.data;if(E!==void 0){const T=n?n.index:-1,O=T!==-1,Q=new Pi(i.level,i.sn,i.stats.chunkCount,s.byteLength,T,O);d.push(s,y,f,"",i,n,h.totalduration,!1,Q,E)}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 En,complete:!1};A.push(new Uint8Array(s)),this.state!==pe.STOPPED&&(this.state=pe.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===pe.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=pe.ERROR;return}switch(t.details){case N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.AUDIO,t);break;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===pe.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ie.AUDIO_TRACK&&(this.state=pe.IDLE);break;case N.BUFFER_ADD_CODEC_ERROR:case N.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case N.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case N.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===pe.ENDED&&(this.state=pe.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:l,level:h}=o,{details:f}=h,{audio:d,text:E,id3:y,initSegment:A}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=pe.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:O,startDTS:Q,endDTS:W}=d;l&&(l.elementaryStreams[g.AUDIO]={startPTS:T,endPTS:O,startDTS:Q,endDTS:W}),c.setElementaryStreamInfo(g.AUDIO,T,O,Q,W),this.bufferFragmentData(d,c,l,r)}if(y!=null&&(t=y.samples)!=null&&t.length){const T=v({id:i,frag:c,details:f},y);n.trigger(p.FRAG_PARSING_METADATA,T)}if(E){const T=v({id:i,frag:c,details:f},E);n.trigger(p.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,i,n){if(this.state!==pe.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===ei.NOT_LOADED||n===ei.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=pe.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&Ps(t.details,r)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;ge({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,we)||(st(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(l){this.warn(`Could not construct new URL for Rendition Report: ${l}`),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 l=i&&dn(i);return new zi(o,c>=0?c:void 0,l)}}}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){$r(i,n);const Q=n.playlistParsingError;if(Q){this.warn(Q);const W=this.hls;if(!W.config.ignorePlaylistParsingErrors){var l;const{networkDetails:ne}=t;W.trigger(p.ERROR,{type:ee.NETWORK_ERROR,details:N.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:Q,reason:Q.message,level:t.level||void 0,parent:(l=n.fragments[0])==null?void 0:l.type,networkDetails:ne,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,E=(n.edge-d)*1e3,y=hr(n,E);if(n.requestScheduled+y<r?n.requestScheduled=r:n.requestScheduled+=y,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let A,T,O;if(n.canBlockReload&&n.endSN&&n.advanced){const Q=this.hls.config.lowLatencyMode,W=n.lastPartSn,ne=n.endSN,re=n.lastPartIndex,_e=re!==-1,le=W===ne;_e?le?(T=ne+1,O=Q?0:re):(T=W,O=Q?re+1:n.maxPartIndex):T=ne+1;const fe=n.age,me=fe+n.ageHeader;let ue=Math.min(me-n.partTarget,n.targetduration*1.5);if(ue>0){if(me>n.targetduration*3)this.log(`Playlist last advanced ${fe.toFixed(2)}s ago. Omitting segment and part directives.`),T=void 0,O=void 0;else if(i!=null&&i.tuneInGoal&&me-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 Ce=Math.floor(ue/n.targetduration);if(T+=Ce,O!==void 0){const Qe=Math.round(ue%n.targetduration/n.partTarget);O+=Qe}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${fe.toFixed(2)}s goal: ${ue} skip sn ${Ce} to part ${O}`)}n.tuneInGoal=ue}if(A=this.getDeliveryDirectives(n,t.deliveryDirectives,T,O),Q||!le){n.requestScheduled=r,this.loadingPlaylist(h,A);return}}else(n.canBlockReload||n.canSkipUntil)&&(A=this.getDeliveryDirectives(n,t.deliveryDirectives,T,O));A&&T!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(y-o*2,y/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=dn(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=Si.No),new zi(i,n,s)}checkRetry(e){const t=e.details,i=pt(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===yt.RetryRequest||!n.resolved&&s===yt.SendAlternateToPenaltyBox);if(c){var l;if(r>=o.maxNumRetry)return!1;if(i&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=si(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 qa(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!qs(a[t].attrs,e[t].attrs))return!1;return!0}function qs(a,e,t){const i=a["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(n=>a[n]!==e[n])}function ia(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class Zl 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,E)=>{d.id=E});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const d=Z(c,o,we);if(d>-1)s=o[d];else{const E=Z(c,this.tracks);s=this.tracks[E]}}let l=this.findTrackId(s);l===-1&&s&&(l=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(l!==-1&&f===-1)this.setAudioTrack(l);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:N.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&&ge(e,n,we))return n;const s=Z(e,this.tracksInGroup,we);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=ke(e,t.levels,i,r,we);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=Z(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||ge(e,n,we)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let l=0;l<t.length;l++){const h=t[l];if(ge({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},h,we))return l}for(let l=0;l<t.length;l++){const h=t[l];if(qs(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const h=t[l];if(qs(e.attrs,h.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&st(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 Yl{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];n.push(e),n.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(s){var i;if(n.onError(s),this.queues===null||this.tracks===null)return;const r=(i=this.tracks[e])==null?void 0:i.buffer;r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],n=i==null?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const Ja=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,eo="HlsJsTrackRemovedError";class Ql extends Error{constructor(e){super(e),this.name=eo}}class Xl 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=Ie(ve(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?v(i,n.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(i[r]=v({},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=ve(this.appendSource);if(this.transferData=this.overrides=void 0,i&&n){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),s)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&r instanceof c,to(i),ql(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: ${Qt(i,(c,l)=>c==="initSegment"?void 0:l)};
transfer tracks: ${Qt(n,(c,l)=>c==="initSegment"?void 0:l)}}`),!xe(n,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,l=this.details,h=Math.max(c,(l==null?void 0:l.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 l=c,h=n[l];if(h){const f=h.buffer;if(f){const d=this.fragmentTracker,E=h.id;if(d.hasFragments(E)||d.hasParts(E)){const T=mt.getBuffered(f);d.detectEvictedFragments(l,T,E,null,!0)}const y=na(l),A=[l,f];this.sourceBuffers[y]=A,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(l),this.trackSourceBuffer(l,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 l=c.length;l--;)o&&c[l].abort(),s.removeSourceBuffer(c[l]);o&&s.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(n.removeAttribute("src"),this.appendSource&&to(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(p.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[na(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Yl(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,l,h;const f=t[o],{id:d,codec:E,levelCodec:y,container:A,metadata:T,supplemental:O}=f;let Q=i[o];const W=(c=this.transferData)==null||(l=c.tracks)==null?void 0:l[o],ne=W!=null&&W.buffer?W:Q,re=(ne==null?void 0:ne.pendingCodec)||(ne==null?void 0:ne.codec),_e=ne==null?void 0:ne.levelCodec;Q||(Q=i[o]={buffer:void 0,listeners:[],codec:E,supplemental:O,container:A,levelCodec:y,metadata:T,id:d});const le=Kt(re,_e),fe=le==null?void 0:le.replace(Ja,"$1");let me=Kt(E,y);const ue=(h=me)==null?void 0:h.replace(Ja,"$1");me&&le&&fe!==ue&&(o.slice(0,5)==="audio"&&(me=dt(me,this.appendSource)),this.log(`switching codec ${re} to ${me}`),me!==(Q.pendingCodec||Q.codec)&&(Q.pendingCodec=me),Q.container=A,this.appendChangeType(o,A,me))}),(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&&mt.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:l}=t,h=l.buffering[s],f=o.sn,d=self.performance.now();h.start=d;const E=o.stats.buffering,y=c?c.stats.buffering:null;E.start===0&&(E.start=d),y&&y.start===0&&(y.start=d);const A=i.audio;let T=!1;s==="audio"&&(A==null?void 0:A.container)==="audio/mpeg"&&(T=!this.lastMpegAudioChunk||l.id===1||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);const O=this.tracks.video,Q=O==null?void 0:O.buffer;if(Q&&f!=="initSegment"){const re=c||o,_e=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend){const fe=re.start+re.duration*.05,me=Q.buffered,ue=this.currentOp("video");!me.length&&!ue?this.blockAudio(re):!ue&&!mt.isBuffered(Q,fe)&&this.lastVideoAppendEnd<fe&&this.blockAudio(re)}else if(s==="video"){const le=re.end;if(_e){const fe=_e.frag.start;(le>fe||le<this.lastVideoAppendEnd||mt.isBuffered(Q,fe))&&this.unblockAudio()}this.lastVideoAppendEnd=le}}const W=(c||o).start,ne={label:`append-${s}`,execute:()=>{if(h.executeStart=self.performance.now(),T){const re=this.tracks[s];if(re){const _e=re.buffer;if(_e){const le=W-_e.timestampOffset;Math.abs(le)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${W} (delta: ${le}) sn: ${f})`),_e.timestampOffset=W)}}}this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const re=self.performance.now();h.executeEnd=h.end=re,E.first===0&&(E.first=re),y&&y.first===0&&(y.first=re);const _e={};this.sourceBuffers.forEach(([le,fe])=>{le&&(_e[le]=mt.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:l,parent:o.type,timeRanges:_e})},onError:re=>{var _e;const le={type:ee.MEDIA_ERROR,parent:o.type,details:N.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:l,error:re,err:re,fatal:!1},fe=(_e=this.media)==null?void 0:_e.error;if(re.code===DOMException.QUOTA_EXCEEDED_ERR)le.details=N.BUFFER_FULL_ERROR;else if(re.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!fe)le.errorAction=oi(!0);else if(re.name===eo&&this.sourceBufferCount===0)le.errorAction=oi(!0);else{const me=++this.appendErrors[s];this.warn(`Failed ${me}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${fe||"no media error"})`),(me>=this.hls.config.appendErrorMaxRetry||fe)&&(le.fatal=!0)}this.hls.trigger(p.ERROR,le)}};this.append(ne,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 l=n?n.stats:i.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:i,part:n,stats:l,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===N.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),l=Math.floor(s/r)*r-c;this.flushBackBuffer(s,r,l)}if(z(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),l=Math.max(c,r),h=Math.floor(s/r)*r+l;this.flushFrontBuffer(s,r,h)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const o=mt.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=mt.getBuffered(s),o=r.length;if(o<2)return;const c=r.start(o-1),l=r.end(o-1);if(i>c||e>=c&&e<=l)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 l=Math.max(0,t.fragmentStart),h=Math.max(l,n);return{duration:1/0,start:l,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}) ${Qt(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:N.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),l=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${l})${this.currentOp(r)?" Queued":""} ${Qt(o)}`);try{const h=i.addSourceBuffer(l),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:N.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,sourceBufferName:r,mimeType:l,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")&&gt(i,"video")&&(n=Gt(n,i));const s=Kt(n,e.levelCodec);return s?t.slice(0,5)==="audio"?dt(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:N.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,l=z(s.duration)?s.duration:1/0,h=Math.max(0,t),f=Math.min(i,c,l);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 Ql(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(r=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const s=n.buffer;if(!s)return;const r=i.bind(this,e);n.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function to(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function ql(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 Cn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Jl={HLS:"h"},Js={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},eu={[Js.OBJECT]:["br","d","ot","tb"],[Js.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Js.SESSION]:["cid","pr","sf","sid","st","v"],[Js.STATUS]:["bs","rtp"]};class Fs{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Fs?i:new Fs(i))),this.value=e,this.params=t}}const tu="Dict";function iu(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 nu(a,e,t,i){return new Error(`failed to ${a} "${iu(e)}" as ${t}`,{cause:i})}function rs(a,e,t){return nu("serialize",a,e,t)}class io{constructor(e){this.description=e}}const no="Bare Item",su="Boolean";function ru(a){if(typeof a!="boolean")throw rs(a,su);return a?"?1":"?0"}function au(a){return btoa(String.fromCharCode(...a))}const ou="Byte Sequence";function lu(a){if(ArrayBuffer.isView(a)===!1)throw rs(a,ou);return`:${au(a)}:`}const uu="Integer";function cu(a){return a<-999999999999999||999999999999999<a}function so(a){if(cu(a))throw rs(a,uu);return a.toString()}function hu(a){return`@${so(a.getTime()/1e3)}`}function ro(a,e){if(a<0)return-ro(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const n=Math.floor(a*t);return(n%2===0?n:n+1)/t}else return Math.round(a*t)/t}const fu="Decimal";function du(a){const e=ro(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw rs(a,fu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const pu="String",gu=/[\x00-\x1f\x7f]+/;function mu(a){if(gu.test(a))throw rs(a,pu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function _u(a){return a.description||a.toString().slice(7,-1)}const vu="Token";function ao(a){const e=_u(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw rs(e,vu);return e}function ra(a){switch(typeof a){case"number":if(!z(a))throw rs(a,no);return Number.isInteger(a)?so(a):du(a);case"string":return mu(a);case"symbol":return ao(a);case"boolean":return ru(a);case"object":if(a instanceof Date)return hu(a);if(a instanceof Uint8Array)return lu(a);if(a instanceof io)return ao(a);default:throw rs(a,no)}}const yu="Key";function aa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw rs(a,yu);return a}function oa(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${aa(e)}`:`;${aa(e)}=${ra(t)}`).join("")}function oo(a){return a instanceof Fs?`${ra(a.value)}${oa(a.params)}`:ra(a)}function Eu(a){return`(${a.value.map(oo).join(" ")})${oa(a.params)}`}function bu(a,e={whitespace:!0}){if(typeof a!="object")throw rs(a,tu);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof Fs||(s=new Fs(s));let r=aa(n);return s.value===!0?r+=oa(s.params):(r+="=",Array.isArray(s.value)?r+=Eu(s):r+=oo(s)),r}).join(`,${i}`)}function xu(a,e){return bu(a,e)}function Su(a){return a==="ot"||a==="sf"||a==="st"}function Tu(a){return typeof a=="number"?z(a):a!=null&&a!==""&&a!==!1}function Au(a,e){const t=new URL(a),i=new URL(e);if(t.origin!==i.origin)return a;const n=t.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")}const Rr=a=>Math.round(a),wu=(a,e)=>(e!=null&&e.baseUrl&&(a=Au(a,e.baseUrl)),encodeURIComponent(a)),Lr=a=>Rr(a/100)*100,Iu={br:Rr,d:Rr,bl:Lr,dl:Lr,mtp:Lr,nor:wu,rtp:Lr,tb:Rr};function Ru(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=v({},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||Tu(o)&&(Su(r)&&typeof o=="string"&&(o=new io(o)),t[r]=o))}),t}function lo(a,e={}){return a?xu(Ru(a,e),v({whitespace:!1},e)):""}function Lu(a,e={}){const t={};if(!a)return t;const i=Object.entries(a),n=Object.entries(eu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((r,o)=>{var c,l;const[h,f]=o,d=((c=n.find(E=>E[1].includes(h)))===null||c===void 0?void 0:c[0])||Js.REQUEST;return(l=r[d])!==null&&l!==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 Du(a,e,t){return v(a,Lu(e,t))}const Cu="CMCD";function ku(a,e={}){if(!a)return"";const t=lo(a,e);return`${Cu}=${encodeURIComponent(t)}`}const uo=/CMCD=[^&#]+/;function Pu(a,e,t){const i=ku(e,t);if(!i)return a;if(uo.test(a))return a.replace(uo,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Ou{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:Cn.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=n=>{try{const{frag:s,part:r}=n,o=this.hls.levels[s.level],c=this.getObjectType(s),l={d:(r||s).duration*1e3,ot:c};(c===Cn.VIDEO||c===Cn.AUDIO||c==Cn.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(c)/1e3,l.bl=this.getBufferLength(c));const h=r?this.getNextPart(r):this.getNextFrag(s);h!=null&&h.url&&h.url!==s.url&&(l.nor=h.url),this.apply(n,l)}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:Jl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){v(t,this.createData());const i=t.ot===Cn.INIT||t.ot===Cn.VIDEO||t.ot===Cn.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((r,o)=>(n.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Du(e.headers,t,s)):e.url=Pu(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 l=r[c];if(l.index===n&&l.fragment.sn===o)return r[c+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Cn.TIMED_TEXT;if(e.sn==="initSegment")return Cn.INIT;if(t==="audio")return Cn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Cn.VIDEO:Cn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Cn.AUDIO)i=n.audioTracks;else{const s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;i=n.levels.slice(0,r)}return i.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Cn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:mt.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 Mu=3e5;class Nu 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)===yt.SendAlternateToPenaltyBox&&i.flags===jt.MoveAllAlternatesMatchingHost){const n=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:l}=t.context;o&&n?r=this.getPathwayForGroupId(o,l,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: ${Qt(s)} penalized: ${Qt(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]>Mu&&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,dr(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[o];c&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${l.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 l=this.getLevelsForPathway(o).map(h=>{const f=new ai(h.attrs);f["PATHWAY-ID"]=r;const d=f.AUDIO&&`${f.AUDIO}_clone_${r}`,E=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;d&&(i[f.AUDIO]=d,f.AUDIO=d),E&&(n[f.SUBTITLES]=E,f.SUBTITLES=E);const y=ho(h.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),A=new Zi({attrs:f,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:y,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(...l),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},l={onSuccess:(h,f,d,E)=>{this.log(`Loaded steering manifest: "${n}"`);const y=h.data;if((y==null?void 0:y.VERSION)!==1){this.log(`Steering VERSION ${y.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=y.TTL;const{"RELOAD-URI":A,"PATHWAY-CLONES":T,"PATHWAY-PRIORITY":O}=y;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:y,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,Q),O&&this.updatePathwayPriority(O)},onError:(h,f,d,E)=>{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 y=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&&(y=parseFloat(T)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,y)},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,l)}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=v({},r);return o.details=void 0,o.attrs=new ai(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(l=>{l&&c.searchParams.set(l,s[l])}),c.href}function Nn(a,e,t){Kn(a,e,t),a.addEventListener(e,t)}function Kn(a,e,t){a.removeEventListener(e,t)}class Bs 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.mediaKeys=null,this.setMediaKeysQueue=Bs.CDMCleanupPromise?[Bs.CDMCleanupPromise]:[],this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,s=`"${t.type}" event: init data type: "${i}"`;if(this.debug(s),n!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=Xn(this.config));const o=r.map(Qn).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=un(r);let c,l;if(i==="sinf"){if(o!==Et.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const y=nt(new Uint8Array(n));try{const A=On(JSON.parse(y).sinf),T=bt(A);if(!T)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(T.subarray(8,24)),l=Et.FAIRPLAY}catch(A){this.warn(`${s} Failed to parse sinf: ${A}`);return}}else{if(o!==Et.WIDEVINE&&o!==Et.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const y=Be(n),A=y.filter(O=>!!O.systemId&&Yn(O.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){y.length===0||y.some(O=>!O.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${y.map(O=>Yn(O.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(l=Yn(T.systemId),T.version===0&&T.data)if(l===Et.WIDEVINE){const O=T.data.length-22;c=new Uint8Array(T.data.subarray(O,O+16))}else l===Et.PLAYREADY&&(c=Ti(T.data))}if(!l||!c)return;const h=U.hexDump(c),{keyIdToKeySessionPromise:f,mediaKeySessions:d}=this;let E=f[h];for(let y=0;y<d.length;y++){const A=d[y],T=A.decryptdata;if(!T.keyId)continue;const O=U.hexDump(T.keyId);if(h===O||T.uri.replace(/-/g,"").indexOf(h)!==-1){if(E=f[O],T.pssh)break;delete f[O],T.pssh=new Uint8Array(n),T.keyId=c,E=f[h]=E.then(()=>this.generateRequestWithPreferredKeySession(A,i,n,"encrypted-event-key-match")),E.catch(Q=>this.handleError(Q));break}}if(!E){if(l!==o){this.log(`Ignoring "${t.type}" event with ${l} init data for selected key-system ${o}`);return}E=f[h]=this.getKeySystemSelectionPromise([l]).then(({keySystem:y,mediaKeys:A})=>{var T;this.throwIfDestroyed();const O=new Un("ISO-23001-7",h,(T=Qn(y))!=null?T:"");return O.pssh=new Uint8Array(n),O.keyId=c,this.attemptSetMediaKeys(y,A).then(()=>{this.throwIfDestroyed();const Q=this.createMediaKeySessionContext({decryptdata:O,keySystem:y,mediaKeys:A});return this.generateRequestWithPreferredKeySession(Q,i,n,"encrypted-event-no-match")})}),E.catch(y=>this.handleError(y))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(p.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(p.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===Et.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=l=>{const h=l.shift();this.getMediaKeysPromise(h,n,s).then(f=>r({keySystem:h,mediaKeys:f})).catch(f=>{l.length?c(l):f instanceof Vn?o(f):o(new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return is===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){const n=at(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: ${Qt(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 l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=c.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),o.hasMediaKeys=!0,l.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)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Qn(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const s=Qn(n);s?t(s):i(new Error(`Unable to find format for key-system "${n}"`))}).catch(i))}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Xn(this.config),i=e.map(un).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(i)}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);let s=this.keyIdToKeySessionPromise[i];return s||(s=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(o,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:o,mediaKeys:c,decryptdata:t}))))),(this.keyIdToKeySessionPromise[i]=s.then(o=>{const c="cenc",l=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(o,c,l,"playlist-key")})).catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Vn?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=un(e.keyFormat),s=n?[n]:Xn(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Xn(this.config)),e.length===0)throw new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Qt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>i.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var s,r;const o=(s=this.config.drmSystems)==null||(r=s[e.keySystem])==null?void 0:r.generateRequest;if(o)try{const y=o.call(this.hls,t,i,e);if(!y)throw new Error("Invalid response from configured generateRequest filter");t=y.initDataType,i=y.initData?y.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(y){var c;if(this.warn(y.message),(c=this.hls)!=null&&c.config.debug)throw y}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const h=new cs,f=e._onmessage=y=>{const A=e.mediaKeysSession;if(!A){h.emit("error",new Error("invalid state"));return}const{messageType:T,message:O}=y;this.log(`"${T}" message event for session "${A.sessionId}" message size: ${O.byteLength}`),T==="license-request"||T==="license-renewal"?this.renewLicense(e,O).catch(Q=>{h.eventNames().length?h.emit("error",Q):this.handleError(Q)}):T==="license-release"?e.keySystem===Et.FAIRPLAY&&(this.updateKeySession(e,Rn("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${T}"`)},d=e._onkeystatuseschange=y=>{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 ${l}`),this.renewKeySession(e))};Nn(e.mediaKeysSession,"message",f),Nn(e.mediaKeysSession,"keystatuseschange",d);const E=new Promise((y,A)=>{h.on("error",A),h.on("keyStatus",T=>{T.startsWith("usable")?y():T==="output-restricted"?A(new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):T==="internal-error"?A(new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.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 y;this.log(`Request generated for key-session "${(y=e.mediaKeysSession)==null?void 0:y.sessionId}" keyId: ${l}`)}).catch(y=>{throw new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_SESSION,error:y,fatal:!1},`Error generating key-session request: ${y}`)}).then(()=>E).catch(y=>{throw h.removeAllListeners(),this.removeSession(e),y}).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},l=t.certLoadPolicy.default,h={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,E,y,A)=>{r(d.data)},onError:(d,E,y,A)=>{o(new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:x({url:c.url,data:void 0},d)},`"${e}" certificate request failed (${s}). Status: ${d.code} (${d.text})`))},onTimeout:(d,E,y)=>{o(new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(d,E,y)=>{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 Vn({type:ee.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.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 E=(r=h.querySelector("name"))==null?void 0:r.textContent,y=(o=h.querySelector("value"))==null?void 0:o.textContent;E&&y&&e.setRequestHeader(E,y)}}const c=n.querySelector("Challenge"),l=c==null?void 0:c.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return Rn(atob(l))}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 l=this.config.licenseResponseCallback;if(l)try{c=l.call(this.hls,o,r,e)}catch(h){this.error(h)}n(c)}else{const c=i.errorRetry,l=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||o.status>=400&&o.status<500)s(new Vn({type:ee.KEY_SYSTEM_ERROR,details:N.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=l-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:l})=>{e.keySystem==Et.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(c,l)),c.send(l)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Nn(i,"encrypted",this.onMediaEncrypted),Nn(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Kn(e,"encrypted",this.onMediaEncrypted),Kn(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Un.clearKeyUriToKeyIdMap();const n=i.length;Bs.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(s=>{var r;this.log(`Could not clear media keys: ${s}`),(r=this.hls)==null||r.trigger(p.ERROR,{type:ee.OTHER_ERROR,details:N.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).catch(s=>{var r;this.log(`Could not close sessions and clear media keys: ${s}`),(r=this.hls)==null||r.trigger(p.ERROR,{type:ee.OTHER_ERROR,details:N.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,s)=>(n.indexOf(s.keyFormat)===-1&&n.push(s.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{drmSystemOptions:s}=this.config;return(pi(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:N.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:N.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}}}Bs.CDMCleanupPromise=void 0;class Vn extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class Fu{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,l=this.hls;if(l.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),c>0&&r>l.config.fpsDroppedMonitoringThreshold*o){let h=l.currentLevel;l.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=h)&&(h=h-1,l.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:l.currentLevel}),l.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 Us(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let i=a.cues.length;i--;)e&&a.cues[i].removeEventListener("enter",e),a.removeCue(a.cues[i]);t==="disabled"&&(a.mode=t)}function la(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=Uu(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 Bu(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 Uu(a,e,t){const i=[],n=Bu(a,e);if(n>-1)for(let s=n,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Dr(a){const e=[];for(let t=0;t<a.length;t++){const i=a[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(a[t])}return e}class $u extends ta{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Dr(this.media.textTracks);for(let s=0;s<i.length;s++)if(i[s].mode==="hidden")t=i[s];else if(i[s].mode==="showing"){t=i[s];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;Dr(i.textTracks).forEach(r=>{Us(r)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(r=>(n==null?void 0:n.indexOf(r))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(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=Z(o,r);if(h>-1)s=r[h];else{const f=Z(o,this.tracks);s=this.tracks[f]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const l={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,l),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||ge(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(qs(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(qs(e.attrs,s.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(ia(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===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&&ge(e,i))return i;const n=Z(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=Z(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Dr(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>ia(i,s))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==n&&(s.mode="disabled")}),n){const s=this.subtitleDisplay?"showing":"hidden";n.mode!==s&&(n.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!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:l,url:h}=n;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:l,url:h});const f=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(f)}}function Gu(){try{return crypto.randomUUID()}catch(a){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?s:s&3|8).toString(16)})}}}function er(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const $s=.025;let Cr=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Ku(a,e,t){return`${a.identifier}-${t+1}-${er(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){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return ua(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=ua(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=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)<$s))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Cr.Range:Cr.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return Wu(this)}}function ua(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<$s)?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 ca(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function Wu(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function Gs(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Hu{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls.trigger(p.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=n;let r=n.uri;try{r=go(r,t.primarySessionId).href}catch(c){}s.loadSource(r);const o=()=>{this.hasDetails=!0};s.once(p.LEVEL_LOADED,o),s.once(p.AUDIO_TRACK_LOADED,o),s.once(p.SUBTITLE_TRACK_LOADED,o),s.on(p.MEDIA_ATTACHING,(c,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(p.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,s.trigger(p.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return((e=this.interstitial)==null?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,n=mt.bufferInfo(e,i,0);return this.getAssetTime(n.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=mt.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const e=this.hls;if(this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){this.hls.on(e,t)}once(e,t,i){this.hls.once(e,t)}off(e,t,i){this.hls.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Gs(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.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(l=>!o.includes(l.identifier)):[];r.length&&r.sort((l,h)=>{const f=l.cue.pre,d=l.cue.post,E=h.cue.pre,y=h.cue.post;if(f&&!E)return-1;if(E&&!f||d&&!y)return 1;if(y&&!d)return-1;if(!f&&!E&&!d&&!y){const A=l.startTime,T=h.startTime;if(A!==T)return A-T}return l.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=r,c.forEach(l=>{this.removeEvent(l)}),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 l=this.eventMap[o];l?l.setDateRange(c):(l=new Vu(c,t),this.eventMap[o]=l,i===!1&&(l.appendInPlace=i)),n.push(l)}}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,l=0;if(e.forEach((h,f)=>{const d=h.cue.pre,E=h.cue.post,y=e[f-1]||null,A=h.appendInPlace,T=E?s:h.startOffset,O=h.duration,Q=h.timelineOccupancy===Cr.Range?O:0,W=h.resumptionOffset,ne=(y==null?void 0:y.startTime)===T,re=T+h.cumulativeDuration;let _e=A?re+O:T+W;if(d||!E&&T<=0){const fe=l;l+=Q,h.timelineStart=re;const me=r;r+=O,i.push({event:h,start:re,end:_e,playout:{start:me,end:r},integrated:{start:fe,end:l}})}else if(T<=s){if(!ne){const ue=T-c;if(ue>mo){const Ce=c,Qe=l;l+=ue;const vt=r;r+=ue;const ot={previousEvent:e[f-1]||null,nextEvent:h,start:Ce,end:Ce+ue,playout:{start:vt,end:r},integrated:{start:Qe,end:l}};i.push(ot)}else ue>0&&y&&(y.cumulativeDuration+=ue,i[i.length-1].end=T)}E&&(_e=re),h.timelineStart=re;const fe=l;l+=Q;const me=r;r+=O,i.push({event:h,start:re,end:_e,playout:{start:me,end:r},integrated:{start:fe,end:l}})}else return;const le=h.resumeTime;E||le>s?c=s:c=le}),c<s){var o;const h=c,f=l,d=s-c;l+=d;const E=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:E,end:r},integrated:{start:f,end:l}})}this.setDurations(s,r,l)}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 l=o.cue.pre,h=o.cue.post,f=l?0:h?n:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!h&&o.snapOptions.in&&(o.resumeAnchor=ct(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 E=z(o.resumeOffset)?o.resumeOffset:o.duration;s+=E})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>$s?(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 l=ct(null,o.fragments,i);if(!l)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(l.start-i)<$s+h||Math.abs(l.end-i)<$s+h?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${r} fragment bounds (${l.start}-${l.end} sn: ${l.sn} cc: ${l.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 l=r.error?0:r.duration||0;i+=l}),n&&!s?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function vs(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class zu{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=go(i,this.hls.sessionId,e.baseUrl)}catch(d){const E=this.assignAssetListError(e,N.ASSET_LIST_LOAD_ERROR,d,i);this.hls.trigger(p.ERROR,E);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},l=s.interstitialAssetListLoadPolicy.default,h={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,E,y,A)=>{const T=d.data,O=T==null?void 0:T.ASSETS;if(!Array.isArray(O)){const Q=this.assignAssetListError(e,N.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),y.url,E,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,E,y,A)=>{const T=this.assignAssetListError(e,N.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${E.url})`),E.url,A,y);this.hls.trigger(p.ERROR,T)},onTimeout:(d,E,y)=>{const A=this.assignAssetListError(e,N.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${E.url})`),E.url,d,y);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 _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 E=this.findItemIndex(o);if(d>E){const y=this.schedule.findJumpRestrictedIndex(E+1,d);if(y>E){this.setSchedulePosition(y);return}}}this.setSchedulePosition(d);return}const l=this.playingAsset;if(!l){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=l.timelineStart,f=l.duration||0;(r&&i<h||i>=h+f)&&this.setScheduleToAssetAtTime(i,l)},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||[],l=s.durations,h=i.map(y=>y.identifier),f=!!(o.length||h.length);(f||n)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(y=>vs(y))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`),this.playerQueue.forEach(y=>{if(y.interstitial.appendInPlace){const A=y.assetItem.timelineStart,T=y.timelineOffset-A;if(T)try{y.timelineOffset=A}catch(O){Math.abs(T)>$s&&this.warn(`${O} ("${y.assetId}" ${y.timelineOffset}->${A})`)}}});let d=null;if(r){const y=this.updateItem(r,this.timelinePos);this.itemsMatch(r,y)&&(this.playingItem=y,this.waitingItem=this.endedItem=null,d=()=>this.trimInPlace(y,r))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const E=this.bufferingItem;if(E){const y=this.updateItem(E,this.bufferedPos);this.itemsMatch(E,y)?(this.bufferingItem=y,d||(d=()=>this.trimInPlace(y,E))):E.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(E.event,null))}if(i.forEach(y=>{y.assetList.forEach(A=>{this.clearAssetPlayer(A.identifier,null)})}),f||n){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:l,removedIds:h}),this.isInterstitial(r)&&h.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}d&&d(),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){Kn(e,"play",this.onPlay),Kn(e,"pause",this.onPause),Kn(e,"seeking",this.onSeeking),Kn(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Nn(i,"seeking",this.onSeeking),Nn(i,"timeupdate",this.onTimeupdate),Nn(i,"play",this.onPlay),Nn(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const s=this.findItemIndex(i);this.setSchedulePosition(s)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=f=>f&&e.getAssetPlayer(f.identifier),n=(f,d,E,y,A)=>{if(f){let T=f[d].start;const O=f.event;if(O){if(d==="playout"||O.timelineOccupancy!==Cr.Point){const Q=i(E);(Q==null?void 0:Q.interstitial)===O&&(T+=Q.assetItem.startOffset+Q[A])}}else{const Q=y==="bufferedPos"?r():e[y];T+=Q-f.start}return T}return 0},s=(f,d)=>{if(f!==0&&d!=="primary"&&e.schedule.length){var E;const y=e.schedule.findItemIndexAtTime(f),A=(E=e.schedule.items)==null?void 0:E[y];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 E,y;const A=e.effectivePlayingItem;if(A!=null&&(E=A.event)!=null&&E.restrictions.skip)return;e.log(`seek to ${f} "${d}"`);const T=e.effectivePlayingItem,O=e.schedule.findItemIndexAtTime(f,d),Q=(y=e.schedule.items)==null?void 0:y[O],W=e.getBufferingPlayer(),ne=W==null?void 0:W.interstitial,re=ne==null?void 0:ne.appendInPlace,_e=T&&e.itemsMatch(T,Q);if(T&&(re||_e)){const fe=i(e.playingAsset),me=(fe==null?void 0:fe.media)||e.primaryMedia;if(me){const ue=d==="primary"?me.currentTime:n(T,d,e.playingAsset,"timelinePos","currentTime"),Ce=f-ue,Qe=(re?ue:me.currentTime)+Ce;if(Qe>=0&&(!fe||re||Qe<=fe.duration)){me.currentTime=Qe;return}}}if(Q){let fe=f;if(d!=="primary"){const ue=Q[d].start,Ce=f-ue;fe=Q.start+Ce}const me=!e.isInterstitial(Q);if((!e.isInterstitial(T)||T.event.appendInPlace)&&(me||Q.event.appendInPlace)){const ue=e.media||(re?W==null?void 0:W.media:null);ue&&(ue.currentTime=fe)}else if(T){const ue=e.findItemIndex(T);if(O>ue){const Qe=e.schedule.findJumpRestrictedIndex(ue+1,O);if(Qe>ue){e.setSchedulePosition(Qe);return}}let Ce=0;if(me)e.timelinePos=fe,e.checkBuffer();else{var le;const Qe=Q==null||(le=Q.event)==null?void 0:le.assetList;if(Qe){const vt=f-(Q[d]||Q).start;for(let ot=Qe.length;ot--;){const lt=Qe[ot];if(lt.duration&&vt>=lt.startOffset&&vt<lt.startOffset+lt.duration){Ce=ot;break}}}}e.setSchedulePosition(O,Ce)}}},l=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const d=t();return e.isInterstitial(d)?d:null},h={get currentTime(){const f=l(),d=e.effectivePlayingItem;return d&&d===f?n(d,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-d.playout.start:0},set currentTime(f){const d=l(),E=e.effectivePlayingItem;E&&E===d&&c(f+E.playout.start,"playout")},get duration(){const f=l();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const d=(f=l())==null?void 0:f.event.assetList;return d?d.map(E=>e.getAssetPlayer(E.identifier)):[]},get playingIndex(){var f;const d=(f=l())==null?void 0:f.event;return d&&e.effectivePlayingAsset?d.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return l()}};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 l()?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 E=e.findItemIndex(f);if(d.appendInPlace){const y=f.playout.start+f.event.duration;c(y+.001,"playout")}else e.advanceAfterAssetEnded(d,E,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} ${Qt(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,l=(i=this.detachedData)==null?void 0:i.mediaSource;let h;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),h="Primary";else if(l){const E=this.getBufferingPlayer();E?(s=E.transferMedia(),h=`${E}`):h="detached MediaSource"}else h="detached media";if(!s){if(l)s=this.detachedData,this.log(`using detachedData: MediaSource ${Qt(s)}`);else if(!this.detachedData||r.media===t){const E=this.playerQueue;E.length>1&&E.forEach(y=>{if(o&&y.interstitial.appendInPlace!==c){const A=y.interstitial;this.clearInterstitial(y.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 E=o&&e.assetId===this.schedule.assetIdAtEnd;d.overrides={duration:this.schedule.duration,endOfStream:!o||E,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=ca(e,i);if(!e.isAssetPastPlayoutLimit(n))this.setSchedulePosition(t,n);else{const s=this.schedule.items;if(s){const r=t+1,o=s.length;if(r>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.timelinePos=c,this.checkBuffer()),this.setSchedulePosition(r)}}}setScheduleToAssetAtTime(e,t){const i=this.schedule,n=t.parentIdentifier,s=i.getEvent(n);if(s){const r=i.findEventIndex(n),o=i.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,r,o-1)}}setSchedulePosition(e,t){const i=this.schedule.items;if(!i||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const n=e>=0?i[e]:null,s=this.playingItem,r=this.playingLastItem;if(this.isInterstitial(s)){var o;const l=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=l.assetList)==null?void 0:o[t].identifier))){var c;const E=l.findAssetIndex(h);this.log(`INTERSTITIAL_ASSET_ENDED ${E+1}/${l.assetList.length} ${Gs(h)}`),this.endedAsset=h,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:h,assetListIndex:E,event:l,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 ${l} ${vs(s)}`),l.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:l,schedule:i.slice(0),scheduleIndex:e}),l.cue.once)){this.updateSchedule();const E=this.schedule.items;if(n&&E){const y=this.schedule.findItemIndex(n);this.advanceSchedule(y,E,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(l=>{const h=l.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 l=r.event;if(i===void 0){i=this.schedule.findAssetIndex(l,this.timelinePos);const E=ca(l,i-1);if(l.isAssetPastPlayoutLimit(E)){this.advanceAfterAssetEnded(l,e,i);return}i=E}const h=this.waitingItem;this.assetsBuffered(r,o)||this.setBufferingItem(r);let f=this.preloadAssets(l,i);if(this.eventItemsMatch(r,h||n)||(this.waitingItem=r,this.log(`INTERSTITIAL_STARTED ${vs(r)} ${l.appendInPlace?"append in place":""}`),this.hls.trigger(p.INTERSTITIAL_STARTED,{event:l,schedule:t.slice(0),scheduleIndex:e})),!l.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${l}`);return}if(l.assetListLoader&&(l.assetListLoader.destroy(),l.assetListLoader=void 0),!o){this.log(`Waiting for attachMedia to start Interstitial ${l}`);return}this.waitingItem=this.endedItem=null,this.playingItem=r;const d=l.assetList[i];if(!d){const E=t[e+1],y=this.media;E&&y&&!this.isInterstitial(E)&&y.currentTime<E.start&&(y.currentTime=this.timelinePos=E.start),this.advanceAfterAssetEnded(l,e,i||0);return}if(f||(f=this.getAssetPlayer(d.identifier)),f===null||f.destroyed){const E=l.assetList.length;this.warn(`asset ${i+1}/${E} player destroyed ${l}`),f=this.createAssetPlayer(l,d,i)}if(!this.eventItemsMatch(r,this.bufferingItem)&&l.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 ${vs(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let r=this.timelinePos;(r<e.start||r>=e.end)&&(r=this.getPrimaryResumption(e,t),this.timelinePos=r),this.attachPrimary(r,e)}if(!i)return;const s=this.schedule.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${vs(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(i<n.fragmentStart||i>n.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:mt.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=Nt(t);this.playerQueue.forEach(n=>n.hls.setAudioOption(t)||n.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=Nt(t);this.playerQueue.forEach(n=>n.hls.setSubtitleOption(t)||t.id!==-1&&n.hls.setSubtitleOption(i))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let n=0;n<t.length;n++){const s=t[n];if(s.cue.post){var i;const r=this.schedule.findEventIndex(s.identifier),o=(i=this.schedule.items)==null?void 0:i[r];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){const i=this.schedule.items;if(e&&i){const n=this.findItemIndex(e,t);return i[n]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,r)=>{e.event.isAssetPastPlayoutLimit(r)&&this.clearAssetPlayer(s.identifier,null)});const i=e.end+.25,n=mt.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.attachPrimary(i,null),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e?this.schedule.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const i=mt.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 l,h;const f=this.findItemIndex(s),d=Math.min(f+1,t.length-1),E=t[d];if((c===-1&&s&&e>=s.end||(l=E.event)!=null&&l.appendInPlace&&e+.01>=E.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(E);else{const y=this.primaryDetails;this.primaryLive&&y&&e>y.edge-y.targetduration&&E.start<y.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(E)&&this.preloadAssets(E.event,0)}}else i&&r&&!this.itemsMatch(r,s)&&(c===o?this.bufferedToItem(r):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(n=>{const s=this.getAssetPlayer(n.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:n,events:s}=i;if(!n||!s)return t;const r=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=o?o.remaining:t?t.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${vs(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),this.playbackDisabled||(r?e.event.assetList.forEach(l=>{const h=this.getAssetPlayer(l.identifier);h&&h.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(l=>l.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 l,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&&(l=Math.round(d*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${l?` live-start: ${h} start-offset: ${l}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const f=this.assetListLoader.loadAssetList(e,l);f&&(e.assetListLoader=f)}else if(!r&&n){for(let c=t;c<n;c++){const l=e.assetList[c],h=this.getAssetPlayerQueueIndex(l.identifier);(h===-1||this.playerQueue[h].destroyed)&&!l.error&&this.createAssetPlayer(e,l,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){const n=this.hls,s=n.userConfig;let r=s.videoPreference;const o=n.loadLevelObj||n.levels[n.currentLevel];(r||o)&&(r=v({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=n.audioTracks[n.audioTrack],l=n.subtitleTracks[n.subtitleTrack];let h=0;if(this.primaryLive||e.appendInPlace){const W=this.timelinePos-t.timelineStart;if(W>1){const ne=t.duration;ne&&W<ne&&(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:l||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(d.timelineOffset=t.timelineStart));const E=d.cmcd;E!=null&&E.sessionId&&E.contentId&&(d.cmcd=v({},E,{contentId:er(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const y=new Hu(this.HlsPlayerClass,d,e,t);this.playerQueue.push(y),e.assetList[i]=t;const A=W=>{if(W.live){const _e=new Error(`Interstitials MUST be VOD assets ${e}`),le={fatal:!0,type:ee.OTHER_ERROR,details:N.INTERSTITIAL_ASSET_ITEM_ERROR,error:_e};this.handleAssetItemError(le,e,this.schedule.findEventIndex(e.identifier),i,_e.message);return}const ne=W.edge-W.fragmentStart,re=t.duration;(re===null||ne>re)&&(this.log(`Interstitial asset "${f}" duration change ${re} > ${ne}`),t.duration=ne,this.updateSchedule())};y.on(p.LEVEL_UPDATED,(W,{details:ne})=>A(ne)),y.on(p.LEVEL_PTS_UPDATED,(W,{details:ne})=>A(ne));const T=(W,ne)=>{const re=this.getAssetPlayer(f);if(re&&ne.tracks){re.off(p.BUFFER_CODECS,T),re.tracks=ne.tracks;const _e=this.primaryMedia;this.bufferingAsset===re.assetItem&&_e&&!re.media&&this.bufferAssetPlayer(re,_e)}};y.on(p.BUFFER_CODECS,T);const O=()=>{var W;const ne=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${ne}`),!ne)return;const re=this.schedule.findEventIndex(e.identifier),_e=(W=this.schedule.items)==null?void 0:W[re];if(this.isInterstitial(_e)){const fe=e.findAssetIndex(t),me=ca(e,fe);if(!e.isAssetPastPlayoutLimit(me))this.bufferedToItem(_e,me);else{var le;const ue=(le=this.schedule.items)==null?void 0:le[re+1];ue&&this.bufferedToItem(ue)}}};y.on(p.BUFFERED_TO_END,O);const Q=W=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const re=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,re,W)};return y.once(p.MEDIA_ENDED,Q(i)),y.once(p.PLAYOUT_LIMIT_REACHED,Q(1/0)),y.on(p.ERROR,(W,ne)=>{const re=this.getAssetPlayer(f);if(ne.details===N.BUFFER_STALLED_ERROR){if(re!=null&&re.media){const _e=re.currentTime,le=re.duration-_e;_e&&e.appendInPlace&&le/re.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${re.media.currentTime}`),O()):(this.warn(`Stalled at ${_e} of ${_e+le} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(ne,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${ne.error} ${e}`)}),y.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const ne=new Error(`Asset player destroyed unexpectedly ${f}`),re={fatal:!0,type:ee.OTHER_ERROR,details:N.INTERSTITIAL_ASSET_ITEM_ERROR,error:ne};this.handleAssetItemError(re,e,this.schedule.findEventIndex(e.identifier),i,ne.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Gs(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:y}),y}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){this.log(`clear asset player "${e}" toSegment: ${t&&vs(t)}`);const n=this.playerQueue[i];this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,s){const{interstitial:r,assetItem:o,assetId:c}=e,l=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}/${l} ${Gs(o)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,n;const{interstitial:s,assetItem:r}=e,o=this.schedule.findEventIndex(s.identifier),c=(i=this.schedule.items)==null?void 0:i[o];if(!c)return;this.setBufferingItem(c),this.bufferingAsset=r;const l=this.getBufferingPlayer();if(l===e)return;const h=s.appendInPlace;if(h&&(l==null?void 0:l.interstitial.appendInPlace)===!1)return;const f=(l==null?void 0:l.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(h&&r!==this.playingAsset){if(!e.tracks)return;if(f&&!xe(f,e.tracks)){const d=new Error(`Asset ${Gs(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),E={fatal:!0,type:ee.OTHER_ERROR,details:N.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},y=s.findAssetIndex(r);this.handleAssetItemError(E,s,o,y,d.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,n,s){if(e.details===N.BUFFER_STALLED_ERROR)return;const r=t.assetList[n];this.warn(`INTERSTITIAL_ASSET_ERROR ${r&&Gs(r)} ${e.error}`);const o=r==null?void 0:r.identifier,c=this.getAssetPlayerQueueIndex(o),l=this.playerQueue[c]||null,h=this.schedule.items,f=v({},e,{fatal:!1,errorAction:oi(!0),asset:r,assetListIndex:n,event:t,schedule:h,scheduleIndex:i,player:l});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const d=this.playingAsset,E=new Error(s);if(r&&(this.clearAssetPlayer(o,null),r.error=E),!t.assetList.some(y=>!y.error))t.error=E;else if(t.appendInPlace){for(let y=n;y<t.assetList.length;y++)this.resetAssetPlayer(t.assetList[y].identifier);this.updateSchedule()}t.error?this.primaryFallback(t):d&&d.identifier===o&&this.advanceAfterAssetEnded(t,i,n)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(this.updateSchedule(),i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${i?vs(i):"<none>"} error: ${e.error}`);let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const s=this.updateItem(i,n);this.itemsMatch(i,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));const r=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(r)}else this.checkStart()}onAssetListLoaded(e,t){var i;const n=t.event,s=n.identifier,r=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(s))return;const o=n.timelineStart,c=n.duration;let l=0;r.forEach((y,A)=>{const T=parseFloat(y.DURATION);this.createAsset(n,A,l,o+l,T,y.URI),l+=T}),n.duration=l,this.log(`Loaded asset-list with duration: ${l} (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 E;const y=this.schedule.findEventIndex(s),A=(E=this.schedule.items)==null?void 0:E[y];if(A){if(!this.playingItem&&this.timelinePos>A.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==y){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(A)}this.setSchedulePosition(y)}else if((d==null?void 0:d.identifier)===s&&d.appendInPlace){const y=n.assetList[0],A=this.getAssetPlayer(y.identifier),T=this.primaryMedia;y&&A&&T&&this.bufferAssetPlayer(A,T)}}onError(e,t){switch(t.details){case N.ASSET_LIST_PARSING_ERROR:case N.ASSET_LIST_LOAD_ERROR:case N.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case N.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const vo=500;class Yu extends Ai{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=pe.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=pe.IDLE,!n)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=i.start;for(let l=0;l<s.length;l++)if(o>=s[l].start&&o<=s[l].end){r=s[l];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===N.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==pe.STOPPED&&(this.state=pe.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&qa(this.levels,t)){this.levels=t.map(i=>new Zi(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new Zi(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!==pe.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 l=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?(Ps(r,f),l=r.fragmentStart):d&&(l=d.start,js(r,l));else{var h;l=this.alignPlaylists(r,c.details,(h=this.levelLastLoaded)==null?void 0:h.details),l===0&&d&&(l=d.start,js(r,l))}}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===pe.IDLE&&(ct(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&&vn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,Bn(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:N.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=pe.IDLE})}}doTick(){if(!this.media){this.state=pe.IDLE;return}if(this.state===pe.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=mt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:c}=r,l=i.details,h=this.hls.maxBufferLength+l.levelTargetDuration;if(c>h)return;const f=l.fragments,d=f.length,E=l.edge;let y=null;const A=this.fragPrevious;if(o<E){const Q=n.maxFragLookUpTolerance,W=o>E-Q?0:Q;y=ct(A,f,Math.max(f[0].start,o),W),!y&&A&&A.start<f[0].start&&(y=f[0])}else y=f[d-1];if(y=this.filterReplacedPrimary(y,i.details),!y)return;const T=y.sn-l.startSN,O=f[T-1];if(O&&O.cc===y.cc&&this.fragmentTracker.getState(O)===ei.NOT_LOADED&&(y=O),this.fragmentTracker.getState(y)===ei.NOT_LOADED){const Q=this.mapToInitFragWhenRequired(y);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),Jn=15,ds=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 ws=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Eo{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class 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<ds;t++)this.chars.push(new sc);this.logger=e}equals(e){for(let t=0;t<ds;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<ds;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<ds;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>ds&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=ds)}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>=ds){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<ds;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<ds;i++){const n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class ha{constructor(e){this.rows=[],this.currRow=Jn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Jn;t++)this.rows.push(new rc(e));this.logger=e}reset(){for(let e=0;e<Jn;e++)this.rows[e].clear();this.currRow=Jn-1}equals(e){let t=!0;for(let i=0;i<Jn;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Jn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Jn;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+Qt(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Jn;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const o=r.rows[s].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(r.rows[s+l])}}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 = "+Qt(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let s=0;s<Jn;s++){const r=this.rows[s].getTextString();r&&(n=s+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
`)),i}getTextAndFormat(){return this.rows}}class bo{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new ha(i),this.nonDisplayedMemory=new ha(i),this.lastOutputScreen=new ha(i),this.currRollUpRow=this.displayedMemory.rows[Jn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Jn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+Qt(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,()=>"["+ws([t[i],t[i+1]])+"] -> ("+ws([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(ac(n,s,c)){kr(null,null,c),this.logger.log(3,()=>"Repeated command ("+ws([n,s])+") is dropped");continue}kr(n,s,this.cmdHistory),r=this.parseCmd(n,s),r||(r=this.parseMidrow(n,s)),r||(r=this.parsePAC(n,s)),r||(r=this.parseBackgroundAttributes(n,s))}else kr(null,null,c);if(!r&&(o=this.parseChars(n,s),o)){const 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 "+ws([n,s])+" orig: "+ws([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))return!1;const s=e===20||e===21||e===23?1:2,r=this.channels[s];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=s,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+ws([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(n||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?i=r===1?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 = "+ws(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=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()}kr(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function kr(a,e,t){t.a=a,t.b=e}function ac(a,e,t){return t.a===a&&t.b===e}function oc(){return{a:null,b:null}}var fa=function(){if(Vi!=null&&Vi.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 l=c.toLowerCase();return~o.indexOf(l)?l:!1}function i(o){return t(a,o)}function n(o){return t(e,o)}function s(o,...c){let l=1;for(;l<arguments.length;l++){const h=arguments[l];for(const f in h)o[f]=h[f]}return o}function r(o,c,l){const h=this,f={enumerable:!0};h.hasBeenReset=!1;let d="",E=!1,y=o,A=c,T=l,O=null,Q="",W=!0,ne="auto",re="start",_e=50,le="middle",fe=50,me="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 E},set:function(ue){E=!!ue}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return y},set:function(ue){if(typeof ue!="number")throw new TypeError("Start time must be set to a number.");y=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 O},set:function(ue){O=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return Q},set:function(ue){const Ce=i(ue);if(Ce===!1)throw new SyntaxError("An invalid or illegal string was specified.");Q=Ce,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 ne},set:function(ue){if(typeof ue!="number"&&ue!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");ne=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return re},set:function(ue){const Ce=n(ue);if(!Ce)throw new SyntaxError("An invalid or illegal string was specified.");re=Ce,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return _e},set:function(ue){if(ue<0||ue>100)throw new Error("Position must be between 0 and 100.");_e=ue,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return le},set:function(ue){const Ce=n(ue);if(!Ce)throw new SyntaxError("An invalid or illegal string was specified.");le=Ce,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 me},set:function(ue){const Ce=n(ue);if(!Ce)throw new SyntaxError("An invalid or illegal string was specified.");me=Ce,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,""),Pr=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 l=new uc;To(o,function(d,E){let y;switch(d){case"region":for(let A=t.length-1;A>=0;A--)if(t[A].id===E){l.set(d,t[A].region);break}break;case"vertical":l.alt(d,E,["rl","lr"]);break;case"line":y=E.split(","),l.integer(d,y[0]),l.percent(d,y[0])&&l.set("snapToLines",!1),l.alt(d,y[0],["auto"]),y.length===2&&l.alt("lineAlign",y[1],["start",Pr,"end"]);break;case"position":y=E.split(","),l.percent(d,y[0]),y.length===2&&l.alt("positionAlign",y[1],["start",Pr,"end","line-left","line-right","auto"]);break;case"size":l.percent(d,E);break;case"align":l.alt(d,E,["start",Pr,"end","left","right"]);break}},/:/,/\s/),c.region=l.get("region",null),c.vertical=l.get("vertical","");let h=l.get("line","auto");h==="auto"&&da.line===-1&&(h=-1),c.line=h,c.lineAlign=l.get("lineAlign","start"),c.snapToLines=l.get("snapToLines",!0),c.size=l.get("size",100),c.align=l.get("align",Pr);let f=l.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 er(a.toString())+er(e.toString())+er(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=it(new Uint8Array(a)).trim().replace(fc,`
`).split(`
`),l=[],h=e?Nl(e.baseTime,e.timescale):0;let f="00:00.000",d=0,E=0,y,A=!0;o.oncue=function(T){const O=t[i];let Q=t.ccOffset;const W=(d-h)/9e4;if(O!=null&&O.new&&(E!==void 0?Q=t.ccOffset=O.start:pc(t,i,W)),W){if(!e){y=new Error("Missing initPTS for VTT MPEGTS");return}Q=W-t.presentationOffset}const ne=T.endTime-T.startTime,re=Gn((T.startTime+Q-E)*9e4,n*9e4)/9e4;T.startTime=Math.max(re,0),T.endTime=Math.max(re+ne,0);const _e=T.text.trim();T.text=decodeURIComponent(encodeURIComponent(_e)),T.id||(T.id=ga(T.startTime,T.endTime,_e)),T.endTime>0&&l.push(T)},o.onparsingerror=function(T){y=T},o.onflush=function(){if(y){r(y);return}s(l)},c.forEach(T=>{if(A)if(pa(T,"X-TIMESTAMP-MAP=")){A=!1,T.slice(16).split(",").forEach(O=>{pa(O,"LOCAL:")?f=O.slice(6):pa(O,"MPEGTS:")&&(d=parseInt(O.slice(7)))});try{E=dc(f)/1e3}catch(O){y=O}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+)?$/,Io=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,mc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ro(a,e,t,i){const n=se(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>it(o)),r=Ml(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")),l=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 E=ya(f.getAttribute("begin"),r),y=ya(f.getAttribute("dur"),r);let A=ya(f.getAttribute("end"),r);if(E===null)throw Co(f);if(A===null){if(y===null)throw Co(f);A=E+y}const T=new fa(E-e,A-e,d);T.id=ga(T.startTime,T.endTime,T.text);const O=l[f.getAttribute("region")],Q=c[f.getAttribute("style")],W=vc(O,Q,c),{textAlign:ne}=W;if(ne){const re=mc[ne];re&&(T.lineAlign=re),T.align=ne}return v(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 l=va(e,i,c)||va(a,i,c)||va(n,i,c);return l&&(o[c]=l),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):Io.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=Io.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class Or{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class 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 Or(this,"textTrack1"),t=new Or(this,"textTrack2"),i=new Or(this,"textTrack3"),n=new Or(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],l=xc(c[0],c[1],t,i);if(l>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),r=!0,l/(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,Us(i[e]),fo(i[e],n);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,i[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,n={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach(s=>{Us(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Oo(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Us(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===ma);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(qa(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Dr(r.textTracks):null;if(this.tracks.forEach((c,l)=>{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)Us(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(l=>l!==null).map(l=>l.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:l}=t.frag,h=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;s&&r&&(l!==o+1||l===o&&h!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=c,this.lastSn=l,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;Ro(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,l=(t=i.initSegment)!=null&&t.data?ft(i.initSegment.data,new Uint8Array(n)).buffer:n;gc(l,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||Ro(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,l;const h=self.VTTCue||self.TextTrackCue;for(let d=0;d<i.rows.length;d++)if(s=i.rows[d],o=!0,c=0,l="",!s.isEmpty()){var f;for(let A=0;A<s.chars.length;A++)Sc.test(s.chars[A].uchar)&&o?c++:(l+=s.chars[A].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const E=Ao(l.trim()),y=ga(e,t,E);a!=null&&(f=a.cues)!=null&&f.getCueById(y)||(r=new h(e,t,E),r.id=y,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,E)=>d.line==="auto"||E.line==="auto"?0:d.line>8&&E.line>8?E.line-d.line:d.line-E.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=Ic(e,this.controller.signal),r=e.responseType==="arraybuffer",o=r?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=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:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(Xs(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var d;this.response=this.loader=f;const E=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},l-(E-n.loading.start)),!f.ok){const{status:A,statusText:T}=f;throw new Cc(T||"fetch, bad network response",A,f)}n.loading.first=E,n.total=Lc(f.headers)||n.total;const y=(d=this.callbacks)==null?void 0:d.onProgress;return y&&z(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,y):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var d,E;const y=this.response;if(!y)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:y.url,data:f,code:y.status},O=(d=this.callbacks)==null?void 0:d.onProgress;O&&!z(t.highWaterMark)&&O(n,e,f,y),(E=this.callbacks)==null||E.onSuccess(T,n,e,y)}).catch(f=>{var d;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const E=f&&f.code||0,y=f?f.message:null;(d=this.callbacks)==null||d.onError({code:E,text:y},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 En,o=e.body.getReader(),c=()=>o.read().then(l=>{if(l.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const h=l.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 Ic(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(v({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function Rc(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=Rc(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 l=t.status,h=t.responseType==="text"?t.responseText:null;if(l>=200&&l<300){const y=h!=null?h:t.response;if(y!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=t.responseType==="arraybuffer"?y.byteLength:y.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,y,t);const O={url:t.responseURL,data:y,code:l};(o=this.callbacks)==null||o.onSuccess(O,i,e,t);return}}const f=s.loadPolicy.errorRetry,d=i.retry,E={url:e.url,data:void 0,code:l};if(kt(f,d,!1,E))this.retry(f);else{var c;X.error(`${l} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:l,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(kt(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=si(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,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:No,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ae,bufferController:Xl,capLevelController:sa,errorController:Gi,fpsController:Fu,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:is,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default: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:$u,timelineController:bc,audioStreamController:zl,audioTrackController:Zl,emeController:Bs,cmcdController:Ou,contentSteeringController:Nu,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,l=[];s.forEach(h=>{const f=`${r}Loading${h}`,d=e[f];if(d!==void 0&&c){l.push(f);const E=i[o].default;switch(e[o]={default:E},h){case"TimeOut":E.maxLoadTimeMs=d,E.maxTimeToFirstByteMs=d;break;case"MaxRetry":E.errorRetry.maxNumRetry=d,E.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":E.errorRetry.retryDelayMs=d,E.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":E.errorRetry.maxRetryDelayMs=d,E.timeoutRetry.maxRetryDelayMs=d;break}}}),l.length&&t.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${Qt(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 Mr=2,Bc=.1,Uc=.05,$c=100;class Gc extends on{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval($c),this.mediaSource=t.mediaSource;const i=this.media=t.media;Nn(i,"playing",this.onMediaPlaying),Nn(i,"waiting",this.onMediaWaiting),Nn(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Kn(i,"playing",this.onMediaPlaying),Kn(i,"waiting",this.onMediaWaiting),Kn(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const s=(i=this.hls)==null?void 0:i.config;if(!s)return;const r=this.media;if(!r)return;const{seeking:o}=r,c=this.seeking&&!o,l=!this.seeking&&o,h=r.paused&&!o||r.ended||r.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!h&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(l||c){c&&this.stallResolved(e);return}if(h){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(!mt.getBuffered(r).length){this.nudgeRetry=0;return}const f=mt.bufferInfo(r,e,0),d=f.nextStart||0,E=this.fragmentTracker;if(o&&E&&this.hls){const _e=Fo(this.hls.inFlightFragments,e),le=f.len>Mr,fe=!d||_e||d-e>Mr&&!E.getPartialFragment(e);if(le||fe)return;this.moved=!1}const y=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&E){if(!(f.len>0)&&!d)return;const le=Math.max(d,f.start||0)-e,me=!!(y!=null&&y.live)?y.targetduration*2:Mr,ue=E.getPartialFragment(e);if(le>0&&(le<=me||ue)){r.paused||this._trySkipBufferHole(ue);return}}const A=s.detectStallWithCurrentTimeMs,T=self.performance.now(),O=this.waiting;let Q=this.stalled;if(Q===null)if(O>0&&T-O<A)Q=this.stalled=O;else{this.stalled=T;return}const W=T-Q;if(!o&&(W>=A||O)&&this.hls){var ne;if(((ne=this.mediaSource)==null?void 0:ne.readyState)==="ended"&&!(y!=null&&y.live)&&Math.abs(e-((y==null?void 0:y.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const re=mt.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(re,W,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const s=mt.bufferedInfo(mt.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=mt.timeRangesToArray(n),o=mt.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=mt.bufferedInfo(r,e,0).bufferedIndex,l=r[o].end,h=r[o+1].start;if((c===-1||c>o)&&h-l<1&&e-l<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${l} -> ${h} buffered index: ${c}`);this.warn(f.message),this.media.currentTime+=1e-6;const d=this.fragmentTracker.getPartialFragment(e)||void 0,E=mt.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:N.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:d,buffer:E.len,bufferInfo:E})}}}}}_tryFixBufferStall(e,t,i){var n,s;const{fragmentTracker:r,media:o}=this,c=(n=this.hls)==null?void 0:n.config;if(!o||!r||!c)return;const l=(s=this.hls)==null?void 0:s.latestLevelDetails,h=r.getPartialFragment(i);if((h||l!=null&&l.live&&i<l.fragmentStart)&&(this._trySkipBufferHole(h)||!this.media))return;const f=e.buffered,d=this.adjacentTraversal(e,i);(f&&f.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-i<c.maxBufferHole||d))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,n=e.nextStart;if(i&&n){const s=i.getFragAtPos(t,Y.MAIN),r=i.getFragAtPos(n,Y.MAIN);if(s&&r)return r.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:s}=this;if(!n&&s!==null&&i&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Qt(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:N.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=mt.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 y=!1;if(r===0){const A=i.getAppendedFrag(0,Y.MAIN);A&&c<A.end&&(y=!0)}if(!y){const A=e||i.getAppendedFrag(r,Y.MAIN);if(A){var l;if(!((l=this.hls.loadLevelObj)!=null&&l.details)||Fo(this.hls.inFlightFragments,c))return 0;let O=!1,Q=A.end;for(;Q<c;){const W=i.getPartialFragment(Q);if(W)Q+=W.duration;else{O=!0;break}}if(O)return 0}}}const E=Math.max(c+Uc,r+Bc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${E}`),this.moved=!0,n.currentTime=E,!(e!=null&&e.gap)){const y=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${E}`);this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:N.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return E}}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:N.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:N.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 pe.IDLE:case pe.STOPPED:case pe.ENDED:case pe.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,Qt(n?x({type:n},i):i))}return s}const Nr=(()=>{const a=ba();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function 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&&Us(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return fo(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:n}}}=this;if(!i&&!n)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=ba();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Mn.emsg&&!i||!n)continue;const l=Ca(s[o].data);if(l){const h=s[o].pts;let f=h+s[o].duration;f>Nr&&(f=Nr),f-h<=0&&(f=h+Kc);for(let E=0;E<l.length;E++){const y=l[E];if(!ka(y)){this.updateId3CueEnds(h,c);const A=Uo(r,h,f,y,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===Nr&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let l;n==="audio"?l=h=>h.type===Mn.audioId3&&c:n==="video"?l=h=>h.type===Mn.emsg&&o:l=h=>h.type===Mn.audioId3&&c||h.type===Mn.emsg&&o,la(s,t,i,l)}}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],E=r[d].cues;delete r[d],Object.keys(E).forEach(y=>{try{const A=E[y];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 l=ba();for(let h=0;h<s.length;h++){const f=s[h],d=n[f],E=d.startTime,y=r[f],A=(y==null?void 0:y.cues)||{};let T=(y==null?void 0:y.durationKnown)||!1,O=Nr;const{duration:Q,endDate:W}=d;if(W&&Q!==null)O=E+Q,T=!0;else if(d.endOnNext&&!T){const re=s.reduce((_e,le)=>{if(le!==d.id){const fe=n[le];if(fe.class===d.class&&fe.startDate>d.startDate&&(!_e||d.startDate<_e.startDate))return fe}return _e},null);re&&(O=re.startTime,T=!0)}const ne=Object.keys(d.attr);for(let re=0;re<ne.length;re++){const _e=ne[re];if(!as(_e))continue;const le=A[_e];if(le)T&&!y.durationKnown?le.endTime=O:Math.abs(le.startTime-E)>.01&&(le.startTime=E,le.endTime=O);else if(l){let fe=d.attr[_e];zn(_e)&&(fe=Vc(fe));const ue=Uo(l,E,O,{key:_e,data:fe},Mn.dateRange);ue&&(ue.id=f,this.id3Track.addCue(ue),A[_e]=ue,this.hls.config.interstitialsController&&(_e==="X-ASSET-LIST"||_e==="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,l=Math.min(this.maxLatency,o+i.targetduration);if(c<l&&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,E=Math.min(f,Math.max(1,d));this.changeMediaPlaybackRate(t,E)}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 l=o&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||l===0)&&(l=s!==void 0?s:r*n);const h=n;return l+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===N.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,l=!1;t.levels.forEach(h=>{const f=h.attrs;let{audioCodec:d,videoCodec:E}=h;d&&(h.audioCodec=d=dt(d,i)||void 0),E&&(E=h.videoCodec=wi(E));const{width:y,height:A,unknownCodecs:T}=h;let O=T?T.length:0;if(T)for(let ue=O;ue--;){const Ce=T[ue];this.isAudioSupported(Ce)?(h.audioCodec=d=d?`${d},${Ce}`:Ce,O--,Ye.audio[d.substring(0,4)]=2):this.isVideoSupported(Ce)&&(h.videoCodec=E=E?`${E},${Ce}`:Ce,O--,Ye.video[E.substring(0,4)]=2)}if(o||(o=!!(y&&A)),c||(c=!!E),l||(l=!!d),O||d&&!this.isAudioSupported(d)||E&&!this.isVideoSupported(E)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:Q,"FRAME-RATE":W,"HDCP-LEVEL":ne,"PATHWAY-ID":re,RESOLUTION:_e,"VIDEO-RANGE":le}=f,me=`${`${re||"."}-`}${h.bitrate}-${_e}-${W}-${Q}-${le}-${ne}`;if(s[me])if(s[me].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const ue=r[me]+=1;h.attrs["PATHWAY-ID"]=new Array(ue+1).join(".");const Ce=this.createLevel(h);s[me]=Ce,n.push(Ce)}else s[me].addGroupId("audio",f.AUDIO),s[me].addGroupId("text",f.SUBTITLES);else{const ue=this.createLevel(h);s[me]=ue,r[me]=1,n.push(ue)}}),this.filterAndSortMediaOptions(n,t,o,c,l)}createLevel(e){const t=new Zi(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=fi(n,[])}return t}isAudioSupported(e){return gt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return gt(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:O,width:Q,height:W})=>(!!T||!!(Q&&W))&&fn(O))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let T="no level with compatible codecs found in manifest",O=T;t.levels.length&&(O=`one or more CODECS in variant not supported: ${Qt(t.levels.map(W=>W.attrs.CODECS).filter((W,ne,re)=>re.indexOf(W)===ne))}`,this.warn(O),T+=` (${O})`);const Q=new Error(T);this.hls.trigger(p.ERROR,{type:ee.MEDIA_ERROR,details:N.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:Q,reason:O})}});return}t.audioTracks&&(r=t.audioTracks.filter(T=>!T.audioCodec||this.isAudioSupported(T.audioCodec)),$o(r)),t.subtitles&&(o=t.subtitles,$o(o));const l=c.slice(0);c.sort((T,O)=>{if(T.attrs["HDCP-LEVEL"]!==O.attrs["HDCP-LEVEL"])return(T.attrs["HDCP-LEVEL"]||"")>(O.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&T.height!==O.height)return T.height-O.height;if(T.frameRate!==O.frameRate)return T.frameRate-O.frameRate;if(T.videoRange!==O.videoRange)return Di.indexOf(T.videoRange)-Di.indexOf(O.videoRange);if(T.videoCodec!==O.videoCodec){const Q=ze(T.videoCodec),W=ze(O.videoCodec);if(Q!==W)return W-Q}if(T.uri===O.uri&&T.codecSet!==O.codecSet){const Q=De(T.codecSet),W=De(O.codecSet);if(Q!==W)return W-Q}return T.averageBitrate!==O.averageBitrate?T.averageBitrate-O.averageBitrate:0});let h=l[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==l.length)){for(let T=0;T<l.length;T++)if(l[T].pathwayId===c[0].pathwayId){h=l[T];break}}this._levels=c;for(let T=0;T<c.length;T++)if(c[T]===h){var f;this._firstLevel=T;const O=h.bitrate,Q=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${O}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const W=Math.min(O,this.hls.config.abrEwmaDefaultEstimateMax);W>Q&&Q===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=W)}break}const d=s&&!n,E=this.hls.config,y=!!(E.audioStreamController&&E.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:y&&!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:N.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 l=r.details;if(!l||l.live){const h=this.switchParams(r.uri,n==null?void 0:n.details,l);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));dr(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(!ve())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=ve();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(Je(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(Je(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 Ai{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=pe.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=pe.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case pe.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=pe.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=pe.IDLE;break}break}case pe.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=pe.IDLE}}break}this.state===pe.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=pe.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 l=r.details;if(!l||this.state===pe.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=pe.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 E=this.getNextFragment(d,l);if(this.couldBacktrack&&!this.fragPrevious&&E&&V(E)&&this.fragmentTracker.getState(E)!==ei.OK){var y;const T=((y=this.backtrackFragment)!=null?y:E).sn-l.startSN,O=l.fragments[T-1];O&&E.cc===O.cc&&(E=O,this.fragmentTracker.removeFragment(O))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(E&&this.isLoopLoading(E,d)){if(!E.gap){const T=this.audioOnly&&!this.altAudio?g.AUDIO:g.VIDEO,O=(T===g.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;O&&this.afterBufferFlushed(O,T,Y.MAIN)}E=this.getNextFragmentLoopLoading(E,l,o,Y.MAIN,f)}E&&(E.initSegment&&!E.initSegment.data&&!this.bitrateTest&&(E=E.initSegment),this.loadFragment(E,r,d))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===ei.NOT_LOADED||n===ei.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],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*c.maxBitrate/(1e3*l)+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,l=o.duration,h=Math.max(r.end,c+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(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 pe.KEY_LOADING:case pe.FRAG_LOADING:case pe.FRAG_LOADING_WAITING_RETRY:case pe.PARSING:case pe.PARSED:this.state=pe.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;Nn(i,"playing",this.onMediaPlaying),Nn(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Kn(i,"playing",this.onMediaPlaying),Kn(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!==pe.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=pe.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 l=t.levelInfo,h=this.fragCurrent;h&&(this.state===pe.FRAG_LOADING||this.state===pe.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let f=0;if(o.live||(i=l.details)!=null&&i.live){var d;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,l.details,(d=this.levelLastLoaded)==null?void 0:d.details)}if(l.details=o,this.levelLastLoaded=l,s||this.setStartPosition(o,f),this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:r}),this.state===pe.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=pe.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 h=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&i.readyState<4||s<o-h)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var l;const f=mt.bufferInfo(i,n,0);if(!(f!=null&&(l=f.buffered)!=null&&l.length)){i.currentTime=n;return}if(f.start<=s){i.currentTime=n;return}const{nextStart:E}=mt.bufferedInfo(f.buffered,s,0);E&&(i.currentTime=E)}else i.currentTime=n}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=r[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=o.videoCodec,h=c.PTSKnown||!c.live,f=(t=i.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),E=this.transmuxer=this.transmuxer||new Qa(this.hls,Y.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),y=n?n.index:-1,A=y!==-1,T=new Pi(i.level,i.sn,i.stats.chunkCount,s.byteLength,y,A),O=this.initPTS[i.cc];E.push(s,f,d,l,i,n,c.totalduration,h,T,O)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(st(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=st(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 l=i[o];l&&(this.videoBuffer=l.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===pe.PARSED&&(this.state=pe.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&&mt.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=pe.ERROR;return}switch(t.details){case N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.MAIN,t);break;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===pe.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ie.LEVEL&&(this.state=pe.IDLE);break;case N.BUFFER_ADD_CODEC_ERROR:case N.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case N.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=pe.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=mt.getBuffered(e),o=r.length?r.start(0):0,c=o-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<l||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=pe.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:l,level:h}=o,{video:f,text:d,id3:E,initSegment:y}=s,{details:A}=h,T=this.altAudio?void 0:s.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=pe.PARSING,y){if(y!=null&&y.tracks){const W=c.initSegment||c;this._bufferInitSegment(h,y.tracks,W,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:i,tracks:y.tracks})}const O=y.initPTS,Q=y.timescale;z(O)&&(this.initPTS[c.cc]={baseTime:O,timescale:Q},n.trigger(p.INIT_PTS_FOUND,{frag:c,id:i,initPTS:O,timescale:Q}))}if(f&&A){T&&f.type==="audiovideo"&&this.logMuxedErr(c);const O=A.fragments[c.sn-1-A.startSN],Q=c.sn===A.startSN,W=!O||c.cc>O.cc;if(s.independent!==!1){const{startPTS:ne,endPTS:re,startDTS:_e,endDTS:le}=f;if(l)l.elementaryStreams[f.type]={startPTS:ne,endPTS:re,startDTS:_e,endDTS:le};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!W&&(this.couldBacktrack=!0),f.dropped&&f.independent){const fe=this.getMainFwdBufferInfo(),me=(fe?fe.end:this.getLoadPosition())+this.config.maxBufferHole,ue=f.firstKeyFramePTS?f.firstKeyFramePTS:ne;if(!Q&&me<ue-this.config.maxBufferHole&&!W){this.backtrack(c);return}else W&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,re,c.start,le,!0)}else Q&&ne-(A.appliedTimelineOffset||0)>Mr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,ne,re,_e,le),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,l,r,Q||W)}else if(Q||W)c.gap=!0;else{this.backtrack(c);return}}if(T){const{startPTS:O,endPTS:Q,startDTS:W,endDTS:ne}=T;l&&(l.elementaryStreams[g.AUDIO]={startPTS:O,endPTS:Q,startDTS:W,endDTS:ne}),c.setElementaryStreamInfo(g.AUDIO,O,Q,W,ne),this.bufferFragmentData(T,c,l,r)}if(A&&E!=null&&(t=E.samples)!=null&&t.length){const O={id:i,frag:c,details:A,samples:E.samples};n.trigger(p.FRAG_PARSING_METADATA,O)}if(A&&d){const O={id:i,frag:c,details:A,samples:d.samples};n.trigger(p.FRAG_PARSING_USERDATA,O)}}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!==pe.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 l=Kt(s.codec,e.audioCodec);l==="mp4a"&&(l="mp4a.40.5");const h=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const f=s.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&h.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&h.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),s.levelCodec=l,s.id=Y.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=Y.MAIN;const l=r.codec;if((l==null?void 0:l.length)===4)switch(l){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||""}/${l}]${r.codec!==l?" 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(l=>{const f=t[l].initSegment;f!=null&&f.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:l,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=pe.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(mt.isBuffered(e,i)?t=this.getAppendedFrag(i):mt.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?ct(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=N.KEY_LOAD_ERROR,i,n,s){return new Bi({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&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length){const{sn:i,cc:n}=e;for(let s=0;s<t.length;s++){const r=t[s];if(n<=r.cc&&(i==="initSegment"||r.sn==="initSegment"||i<r.sn))return this.emeController.selectKeySystemFormat(r).then(o=>{if(r.setKeyFormat(o),this.emeController&&this.config.requireKeySystemAccessOnStart){const c=un(o);if(c)return this.emeController.getKeySystemAccess([c])}})}}else if(this.config.requireKeySystemAccessOnStart){const i=Xn(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const l=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,N.KEY_LOAD_ERROR,l))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,N.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(l=>(s.key=l.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,N.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},l=i.keyLoadPolicy.default,h={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,E,y,A)=>{const{frag:T,keyInfo:O,url:Q}=y;if(!T.decryptdata||O!==this.keyUriToKeyInfo[Q])return o(this.createKeyLoadError(T,N.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),A));O.decryptdata.key=T.decryptdata.key=new Uint8Array(d.data),T.keyLoader=null,O.loader=null,r({frag:T,keyInfo:O})},onError:(d,E,y,A)=>{this.resetLoader(E),o(this.createKeyLoadError(t,N.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),y,x({url:c.url,data:void 0},d)))},onTimeout:(d,E,y)=>{this.resetLoader(E),o(this.createKeyLoadError(t,N.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),y))},onAbort:(d,E,y)=>{this.resetLoader(E),o(this.createKeyLoadError(t,N.INTERNAL_ABORTED,new Error("key loading aborted"),y))}};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 l=this.hls.logger,h=n.context;if(h&&h.levelOrTrack===e.levelOrTrack&&(h.url===e.url||h.deliveryDirectives&&!e.deliveryDirectives)){h.url===e.url?l.log(`[playlist-loader]: ignore ${e.url} ongoing request`):l.log(`[playlist-loader]: ignore ${e.url} in favor of ${h.url}`);return}l.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let s;if(e.type===ie.MANIFEST?s=i.manifestLoadPolicy.default:s=v({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),z((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===ie.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===ie.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===ie.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const h=l.partTarget,f=l.targetduration;if(h&&f){const d=Math.max(h*3,f*.8)*1e3;s=v({},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:(l,h,f,d)=>{const E=this.getInternalLoader(f);this.resetInternalLoader(f.type);const y=l.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,f,new Error("no EXTM3U delimiter"),d||null,h);return}h.parsing.start=performance.now(),$n.isMediaPlaylist(y)||f.type!==ie.MANIFEST?this.handleTrackOrLevelPlaylist(l,h,f,d||null,E):this.handleMasterPlaylist(l,h,f,d)},onError:(l,h,f,d)=>{this.handleNetworkError(h,f,!1,l,d)},onTimeout:(l,h,f)=>{this.handleNetworkError(h,f,!0,void 0,l)}};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=$n.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:l,levels:h,sessionData:f,sessionKeys:d,startTimeOffset:E,variableList:y}=c;this.variableList=y;const{AUDIO:A=[],SUBTITLES:T,"CLOSED-CAPTIONS":O}=$n.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 ai({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:h,audioTracks:A,subtitles:T,captions:O,contentSteering:l,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:d,startTimeOffset:E,variableList:y})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:c,type:l}=i,h=xa(e,i),f=z(c)?c:z(o)?o:0,d=Vo(i),E=$n.parseLevelPlaylist(e.data,h,f,d,0,this.variableList);if(l===ie.MANIFEST){const y={attrs:new ai({}),bitrate:0,details:E,name:"",url:h};E.requestScheduled=t.loading.start+hr(E,0),r.trigger(p.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:h,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=E,this.handlePlaylistLoaded(E,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:ee.NETWORK_ERROR,details:N.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=N.UNKNOWN,l=!1;const h=this.getInternalLoader(e);switch(e.type){case ie.MANIFEST:c=i?N.MANIFEST_LOAD_TIMEOUT:N.MANIFEST_LOAD_ERROR,l=!0;break;case ie.LEVEL:c=i?N.LEVEL_LOAD_TIMEOUT:N.LEVEL_LOAD_ERROR,l=!1;break;case ie.AUDIO_TRACK:c=i?N.AUDIO_TRACK_LOAD_TIMEOUT:N.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case ie.SUBTITLE_TRACK:c=i?N.SUBTITLE_TRACK_LOAD_TIMEOUT:N.SUBTITLE_LOAD_ERROR,l=!1;break}h&&this.resetInternalLoader(e.type);const f={type:ee.NETWORK_ERROR,details:c,fatal:l,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:l,id:h,groupId:f,deliveryDirectives:d}=n,E=xa(t,n),y=Vo(n),A=typeof n.level=="number"&&y===Y.MAIN?l:void 0;if(!e.fragments.length){const O=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:ee.NETWORK_ERROR,details:N.LEVEL_EMPTY_ERROR,fatal:!1,url:E,error:O,reason:O.message,response:t,context:n,level:A,parent:y,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:N.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:T,reason:T.message,response:t,context:n,level:A,parent:y,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 ys{static get version(){return hs}static isMSESupported(){return Ko()}static isSupported(){return zc()}static getMediaSource(){return ve()}static get Events(){return p}static get MetadataSchema(){return Mn}static get ErrorTypes(){return ee}static get ErrorDetails(){return N}static get DefaultConfig(){return ys.defaultConfig?ys.defaultConfig:Oc}static set DefaultConfig(e){ys.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new cs,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=te(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=Nc(ys.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Fc(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=i,l=new o(this),h=this.abrController=new n(this),f=new Mi(this),d=i.interstitialsController,E=d?this.interstitialsController=new d(this,ys):null,y=this.bufferController=new s(this,f),A=this.capLevelController=new r(this),T=new c(this),O=new qc(this),Q=i.contentSteeringController,W=Q?new Q(this):null,ne=this.levelController=new jc(this,W),re=new Wc(this),_e=new Xc(this.config),le=this.streamController=new Qc(this,f,_e),fe=this.gapController=new Gc(this,f);A.setStreamController(le),T.setStreamController(le);const me=[O,ne,le];E&&me.splice(1,0,E),W&&me.splice(1,0,W),this.networkControllers=me;const ue=[h,y,fe,A,T,re,f];this.audioTrackController=this.createController(i.audioTrackController,me);const Ce=i.audioStreamController;Ce&&me.push(this.audioStreamController=new Ce(this,f,_e)),this.subtitleTrackController=this.createController(i.subtitleTrackController,me);const Qe=i.subtitleStreamController;Qe&&me.push(this.subtititleStreamController=new Qe(this,f,_e)),this.createController(i.timelineController,ue),_e.emeController=this.emeController=this.createController(i.emeController,ue),this.cmcdController=this.createController(i.cmcdController,ue),this.latencyController=this.createController(Hc,ue),this.coreComponents=ue,me.push(l);const vt=l.onErrorOut;typeof vt=="function"&&this.on(p.ERROR,vt,l),this.on(p.MANIFEST_LOADED,O.onManifestLoaded,O)}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:N.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:N.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=F.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=Gu()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){sn(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=xn(t);return Li(e,i,navigator.mediaCapabilities)}}ys.defaultConfig=void 0}}]);
}());